从程序执行推断插入式二进制分析器
Inferring Drop-in Binary Parsers from Program Executions
摘要:
我们提出BIEBER(字节-IdEntical二进制解析器),第一个系统建模和重新生成一个完整的工作解析器从仪表程序执行。为了实现这一点,Bieber利用了规律性(例如,头字段和类似数组的数据结构),其通常在文件格式中找到。关键的泛化步骤派生出跨步循环,它解析输入文件数据,并用输入文件头字节上的表达式重写具体的循环边界。这些步骤使BIEBER能够泛化特定输入文件的解析,以获得对任意大小的输入文件进行操作的解析器。BIEBER还增量地和有效地推断决策树,该决策树读取文件头字节以将不同类型的输入文件路由到适当类型的推断解析器。推断的解析器和决策树用IR表示;单独的后端(在我们的原型中是C和Perl)可以将IR翻译成与原始程序相同的语言(为了更安全的插入式替换),或者自动移植到不同的语言。一个实证评估表明,BIEBER可以成功地重新生成解析器的六个文件格式(波形音频[1654个文件]、MT 76 x 0.BIN固件容器[5个文件]、OS/2 1.x位图图像[9个文件]、Windows 3.x位图[9971个文件]、Windows 95/NT 4位图[133个文件]和Windows 98/2000位图[859个文件]),正确解析100%(当使用标准保持交叉验证时,>= 99.98%)的相应语料库。重新生成的解析器包含自动插入的安全检查,可以消除常见的错误类别,如内存错误。我们发现BIEBER可以帮助逆向工程文件格式,因为它自动识别与文件格式的关键语义相关的决策树的谓词。我们还讨论了BIEBER如何帮助我们检测和修复stb_image中的两个新错误,以及独立地重新发现和修复一个已知错误。
英文摘要:
We present BIEBER (Byte-IdEntical Binary parsER), the first system to model and regenerate a full working parser from instrumented program executions. To achieve this, BIEBER exploits the regularity (e.g., header fields and array-like data structures) that is commonly found in file formats. Key generalization steps derive strided loops that parse input file data and rewrite concrete loop bounds with expressions over input file header bytes. These steps enable BIEBER to generalize parses of specific input files to obtain parsers that operate over input files of arbitrary size. BIEBER also incrementally and efficiently infers a decision tree that reads file header bytes to route input files of different types to inferred parsers of the appropriate type. The inferred parsers and decision tree are expressed in an IR; separate backends (C and Perl in our prototype) can translate the IR into the same language as the original program (for a safer drop-in replacement), or automatically port to a different language. An empirical evaluation shows that BIEBER can successfully regenerate parsers for six file formats (waveform audio [1654 files], MT76x0 .BIN firmware containers [5 files], OS/2 1.x bitmap images [9 files], Windows 3.x bitmaps [9971 files], Windows 95/NT4 bitmaps [133 files], and Windows 98/2000 bitmaps [859 files]), correctly parsing 100% (>= 99.98% when using standard held-out cross-validation) of the corresponding corpora. The regenerated parsers contain automatically inserted safety checks that eliminate common classes of errors such as memory errors. We find that BIEBER can help reverse-engineer file formats, because it automatically identifies predicates for the decision tree that relate to key semantics of the file format. We also discuss how BIEBER helped us detect and fix two new bugs in stb_image as well as independently rediscover and fix a known bug.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。