[论文解读] XDA: Accurate, Robust Disassembly with Transfer Learning
XDA 是一种基于迁移学习的逆向工程框架,利用掩码语言建模学习机器代码中的上下文字节依赖关系,实现高精度和高鲁棒性的逆向工程。其在函数边界恢复任务上达到 99.0% 的 F1 分数,在指令恢复任务上达到 99.7%,优于以往最先进方法的同时保持了高效率。
Accurate and robust disassembly of stripped binaries is challenging. The root of the difficulty is that high-level structures, such as instruction and function boundaries, are absent in stripped binaries and must be recovered based on incomplete information. Current disassembly approaches rely on heuristics or simple pattern matching to approximate the recovery, but these methods are often inaccurate and brittle, especially across different compiler optimizations. We present XDA, a transfer-learning-based disassembly framework that learns different contextual dependencies present in machine code and transfers this knowledge for accurate and robust disassembly. We design a self-supervised learning task motivated by masked Language Modeling to learn interactions among byte sequences in binaries. The outputs from this task are byte embeddings that encode sophisticated contextual dependencies between input binaries' byte tokens, which can then be finetuned for downstream disassembly tasks. We evaluate XDA's performance on two disassembly tasks, recovering function boundaries and assembly instructions, on a collection of 3,121 binaries taken from SPEC CPU2017, SPEC CPU2006, and the BAP corpus. The binaries are compiled by GCC, ICC, and MSVC on x86/x64 Windows and Linux platforms over 4 optimization levels. XDA achieves 99.0% and 99.7% F1 score at recovering function boundaries and instructions, respectively, surpassing the previous state-of-the-art on both tasks. It also maintains speed on par with the fastest ML-based approach and is up to 38x faster than hand-written disassemblers like IDA Pro. We release the code of XDA at https://github.com/CUMLSec/XDA.
研究动机与目标
- 解决在缺少高级结构(如函数边界和指令)的剥离二进制文件中实现高精度和高鲁棒性逆向工程的挑战。
- 克服基于启发式规则的逆向引擎的局限性,这些方法脆弱且常不准确,尤其是在编译器优化下表现更差。
- 通过在大规模字节序列上使用自监督学习进行预训练,提升基于机器学习的逆向工程在泛化能力和鲁棒性方面的表现。
- 开发一种框架,在多种编译器(GCC、ICC、MSVC)、架构(x86/x64)、平台(Linux/Windows)和优化级别下均保持高性能。
提出的方法
- 在 3,121 个剥离二进制文件上,使用掩码语言建模(MLM)目标预训练基于 Transformer 的模型,以学习上下文字节依赖关系。
- 使用特定任务的前馈网络层微调预训练模型,用于下游逆向工程任务:函数边界检测与指令恢复。
- 利用自监督预训练阶段学习低级代码语义,无需标签,从而实现向下游任务的迁移。
- 利用注意力机制捕捉字节之间的长距离依赖关系,隐式学习函数首尾序列模式和控制流结构。
- 设计数据流水线,确保训练集与测试集之间的重叠率低于 3%,以验证泛化能力。
- 使用真实世界二进制文件在多种编译器和优化级别下评估性能,以 F1 分数作为评价指标。
实验结果
研究问题
- RQ1像掩码语言建模这样的自监督预训练目标,能否有效学习机器代码中低级代码语义,以支持逆向工程?
- RQ2在多样化二进制文件上进行预训练后,迁移学习是否能提升在不同编译器和优化级别下的逆向工程准确性和鲁棒性?
- RQ3在非重叠测试数据上评估时,基于机器学习的逆向引擎是否比基于启发式规则的工具具有更好的泛化能力?
- RQ4XDA 在准确率、速度和鲁棒性方面与最先进方法相比表现如何?
- RQ5学习到的字节嵌入是否能在无显式监督的情况下捕捉有意义的结构模式(如函数首尾序列)?
主要发现
- XDA 在函数边界恢复任务上达到 99.0% 的 F1 分数,比之前最先进方法高出 17.2% 的准确率。
- XDA 在指令恢复任务上达到 99.7% 的 F1 分数,展现出在复杂二进制文件上极高的精确率和召回率。
- 该模型在多种编译器(GCC、ICC、MSVC)、平台(Linux、Windows)和优化级别下均保持高性能,表现出强大的鲁棒性。
- XDA 的速度最高可达 IDA Pro 的 38 倍,同时与最快基于机器学习的逆向引擎速度相当。
- 注意力可视化结果表明,XDA 能够从字节级上下文中隐式学习到函数首尾序列等结构模式。
- 模型泛化能力良好,表现为 ByteWeight 的 F1 分数在非重叠数据上从 97% 降至 65%,而 XDA 仍保持高性能。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。