在数据交换中实现更高的安全性:为上下文无关文法定义具有上下文相关编码器的解解析器
Towards More Security in Data Exchange: Defining Unparsers with Context-Sensitive Encoders for Context-Free Grammars
摘要:
为了在分布式系统中交换复杂的数据结构,在通信方之间交换用上下文无关语言编写的文档。正确地解析这些文档与正确地解析它们同样重要,因为在解析过程中的错误会导致注入漏洞,如跨站脚本(XSS)和SQL注入。注入攻击并不局限于网络世界。每个使用输入以上下文无关语言生成文档的程序都可能容易受到此类攻击。即使对于广泛使用的语言,如HTML和JavaScript,也很少有方法通过上下文敏感编码来防止注入攻击,并且这些方法与语言相关。因此,本文的目的是从上下文无关文法中推导出上下文相关编码器,为所有上下文无关语言提供正确的恶意输入数据解析。所提出的解决方案将编码器定义集成到上下文无关文法中,并提供用于在(非)解析期间使用的上下文敏感编码器和解码器的生成器。这种解解析过程产生的文档中,输入数据既不影响文档的结构,也不改变它们的预期语义。通过在语言定义期间定义编码,使用该语言的开发人员可以获得一个干净的接口,用于编写和读取用该语言编写的文档,而无需关心与安全相关的编码。
英文摘要:
To exchange complex data structures in distributed systems, documents written in context-free languages are exchanged among communicating parties. Unparsing these documents correctly is as important as parsing them correctly because errors during unparsing result in injection vulnerabilities such as cross-site scripting (XSS) and SQL injection. Injection attacks are not limited to the web world. Every program that uses input to produce documents in a context-free language may be vulnerable to this class of attack. Even for widely used languages such as HTML and JavaScript, there are few approaches that prevent injection attacks by context-sensitive encoding, and those approaches are tied to the language. Therefore, the aim of this paper is to derive context-sensitive encoder from context-free grammars to provide correct unparsing of maliciously crafted input data for all context-free languages. The presented solution integrates encoder definition into context-free grammars and provides a generator for context-sensitive encoders and decoders that are used during (un)parsing. This unparsing process results in documents where the input data does neither influence the structure of the document nor change their intended semantics. By defining encoding during language definition, developers who use the language are provided with a clean interface for writing and reading documents written in that language, without the need to care about security-relevant encoding.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。