[论文解读] Trex: Learning Execution Semantics from Micro-Traces for Binary Similarity
Trex 通过在 under-constrained micro-traces 上进行 pretraining with masked LM 和 a hierarchical Transformer 来学习执行语义,然后 finetunes 以在跨 architectures、optimizations、和 obfuscations 的函数上匹配语义相似性,并实现更高的准确性和速度。
Detecting semantically similar functions -- a crucial analysis capability with broad real-world security usages including vulnerability detection, malware lineage, and forensics -- requires understanding function behaviors and intentions. This task is challenging as semantically similar functions can be implemented differently, run on different architectures, and compiled with diverse compiler optimizations or obfuscations. Most existing approaches match functions based on syntactic features without understanding the functions' execution semantics. We present Trex, a transfer-learning-based framework, to automate learning execution semantics explicitly from functions' micro-traces and transfer the learned knowledge to match semantically similar functions. Our key insight is that these traces can be used to teach an ML model the execution semantics of different sequences of instructions. We thus train the model to learn execution semantics from the functions' micro-traces, without any manual labeling effort. We then develop a novel neural architecture to learn execution semantics from micro-traces, and we finetune the pretrained model to match semantically similar functions. We evaluate Trex on 1,472,066 function binaries from 13 popular software projects. These functions are from different architectures and compiled with various optimizations and obfuscations. Trex outperforms the state-of-the-art systems by 7.8%, 7.2%, and 14.3% in cross-architecture, optimization, and obfuscation function matching, respectively. Ablation studies show that the pretraining significantly boosts the function matching performance, underscoring the importance of learning execution semantics.
研究动机与目标
- 为安全任务(如漏洞检测、恶意软件追踪和取证)建立语义函数相似性。
- 通过从 micro-traces 学习执行语义来应对跨架构和跨优化的挑战。
- 开发一个可捕捉指令级执行效果的预训练模型,并将其迁移到函数相似性任务。
提出的方法
- 在来自 under-constrained 动态执行的 micro-traces 上,使用一个 masked language modeling objective 对 a hierarchical Transformer 进行预训练。
- 用五个输入序列表示 micro-traces,这些序列捕捉代码标记、动态值、指令位置、操作数位置和体系结构,其中对 8-byte 值使用 value-encoding bi-LSTM。
- 训练模型以预测被屏蔽的代码标记和 8-byte 动态值,以学习近似的执行语义。
- 通过在预训练模型之上堆叠一个小型 MLP 来生成函数嵌入,并优化基于余弦相似度的目标函数进行微调。
- 在推理阶段,计算函数嵌入并通过余弦相似度测量语义相似性,而无需实时执行。
实验结果
研究问题
- RQ1是否可以使用 under-constrained micro-traces 学习近似执行语义,并将其迁移到跨架构、跨优化和跨混淆的函数匹配?
- RQ2使用 micro-traces 的预训练是否能超越基于静态代码的方法,提升语义函数相似性?
- RQ3层次化 Transformer 是否能高效建模跨架构的长执行轨迹,从而实现可扩展的二进制相似性搜索?
主要发现
- Trex 在跨架构函数匹配中比最先进系统高出 7.8%,在跨优化匹配中高出 7.2%,在跨混淆匹配中高出 14.3%。
- Trex 在函数匹配方面的运行速度比此前的神经架构快最多 8×。
- 在消融研究中,使用 micro-trace masked LM 任务进行预训练将匹配准确性提升 15.7%。
- 评估覆盖来自 13 个项目的 1,472,066 个函数,横跨 x86、x64、ARM 和 MIPS,包含四个优化和五个混淆。
- 对 180 个真实固件镜像的案例研究揭示了 Trex 发现的 16 个未披露 CVE。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。