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.
翻译:检测语义相似的功能 -- 一个关键的分析能力, 具有广泛的真实世界安全用法, 包括脆弱性检测、 恶意软件线和法医学等关键的分析能力, 需要理解功能行为和意图。 任务具有挑战性, 因为语义相似的功能可以不同地执行, 在不同的结构中运行, 并且以不同的编译器优化或模糊的语义进行编译。 大多数现有方法在不理解功能执行语义的情况下, 与基于合成特征的函数匹配。 我们然后从功能的微轨迹中引入一个转移学习基础框架, 到自动学习执行的语义, 从微轨迹中明确从功能中学习, 并传输学到的知识, 以匹配语义相似的功能。 我们的关键洞察力是, 这些痕迹可以用来教一个 ML 模式, 执行不同顺序指令的语义结构。 因此我们训练模型从函数的微轨迹中学习执行语义, 无需任何手动标签努力。 我们随后开发一个新的神经结构架构, 从微轨迹中学习执行语义学的语义学, 从微轨迹学中精度学, 我们对预学模型进行匹配的模型与精度函数匹配, 匹配功能的功能比 。 我们分别评估 重读取 。