3DGen:AI辅助生成可证明正确的二进制格式解析器
3DGen: AI-Assisted Generation of Provably Correct Binary Format Parsers
AI总结:
3DGen框架利用AI智能体将RFC等非正式输入转换为3D格式规范,并通过符号化测试生成与反复精化产出可证明正确的高效C解析代码,在20个互联网标准格式上验证了其可行性。
摘要:
对攻击者控制的输入进行不当解析是软件安全漏洞的主要来源,尤其是当程序员将RFC中的非正式格式描述转写为低级、内存不安全语言中的高效解析逻辑时。一些研究者已提出用于数据格式的形式化规范语言,并可从这些规范中提取高效代码。然而,将非正式需求提炼为形式化规范具有挑战性,且尽管形式化语言有诸多益处,新的形式化语言仍难以被人们学习和使用。在本文中,我们提出了3DGen框架,该框架利用AI智能体将混合的非正式输入(包括自然语言文档,即RFC,以及示例输入)转换为一种名为3D的语言所描述的格式规范。为帮助人类理解并信任所生成的规范,3DGen使用符号化方法同时合成可针对外部预言机进行验证的测试输入。符号化测试生成还有助于区分多个看似合理的解决方案。通过反复精化的过程,3DGen生成一个符合测试套件的3D规范,并由此产生安全、高效、可证明正确的C语言解析代码。我们在20个互联网标准格式上对3DGen进行了评估,展示了AI智能体在非平凡规模上生成形式化验证的C代码的潜力。一个关键的使能因素是使用领域特定语言将AI输出限制在自动符号化分析可处理的类别内。
英文摘要:
Improper parsing of attacker-controlled input is a leading source of software security vulnerabilities, especially when programmers transcribe informal format descriptions in RFCs into efficient parsing logic in low-level, memory unsafe languages. Several researchers have proposed formal specification languages for data formats from which efficient code can be extracted. However, distilling informal requirements into formal specifications is challenging and, despite their benefits, new, formal languages are hard for people to learn and use. In this work, we present 3DGen, a framework that makes use of AI agents to transform mixed informal input, including natural language documents (i.e., RFCs) and example inputs into format specifications in a language called 3D. To support humans in understanding and trusting the generated specifications, 3DGen uses symbolic methods to also synthesize test inputs that can be validated against an external oracle. Symbolic test generation also helps in distinguishing multiple plausible solutions. Through a process of repeated refinement, 3DGen produces a 3D specification that conforms to a test suite, and which yields safe, efficient, provably correct, parsing code in C. We have evaluated 3DGen on 20 Internet standard formats, demonstrating the potential for AI-agents to produce formally verified C code at a non-trivial scale. A key enabler is the use of a domain-specific language to limit AI outputs to a class for which automated, symbolic analysis is tractable.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。