SemDiff:通过差异比对关键语义图进行二进制相似性检测
SemDiff: Binary Similarity Detection by Diffing Key-Semantics Graphs
AI总结:
针对二进制相似性检测在编译优化和混淆下效果不佳的问题,提出SemDiff,通过提取关键指令构建关键语义图并利用拓扑排序与局部敏感哈希量化相似度,显著提升了跨优化、编译器和混淆的检测性能。
摘要:
二进制相似性检测是一项关键技术,已应用于许多源代码不可用的真实场景中,例如错误搜索、恶意软件分析和代码抄袭检测。在部署了不同编译优化、编译器、源代码版本或混淆的情况下,现有工作在检测相似二进制文件时效果不佳。我们观察到,尽管这些情况会显著修改二进制文件的语法和结构,但并未改变其关键代码行为。基于这一关键观察,我们从二进制文件中提取一组关键指令以捕捉其关键代码行为。通过检测两个二进制文件的关键指令之间的相似性,我们能够很好地解决现有工作效果不佳的局限。具体而言,我们将每条提取的关键指令转换为自定义的关键表达式,并基于二进制文件的控制流生成关键语义图。关键语义图中的每个节点表示一条关键指令,节点属性为关键表达式。为了量化两个给定关键语义图之间的相似性,我们首先通过拓扑排序将每个图序列化为关键表达式序列。然后,我们对关键表达式进行分词并拼接以生成令牌列表。我们计算所有令牌列表的局部敏感哈希值,并量化它们的相似度。我们的评估结果表明,总体而言,在检测由不同优化级别、编译器和混淆生成的二进制文件的相似性时,SemDiff 优于最先进的工具。SemDiff 在库版本搜索和发现固件中相似漏洞方面也很有效。
英文摘要:
Binary similarity detection is a critical technique that has been applied in many real-world scenarios where source code is not available, e.g., bug search, malware analysis, and code plagiarism detection. Existing works are ineffective in detecting similar binaries in cases where different compiling optimizations, compilers, source code versions, or obfuscation are deployed. We observe that all the cases do not change a binary's key code behaviors although they significantly modify its syntax and structure. With this key observation, we extract a set of key instructions from a binary to capture its key code behaviors. By detecting the similarity between two binaries' key instructions, we can address well the ineffectiveness limitation of existing works. Specifically, we translate each extracted key instruction into a self-defined key expression, generating a key-semantics graph based on the binary's control flow. Each node in the key-semantics graph denotes a key instruction, and the node attribute is the key expression. To quantify the similarity between two given key-semantics graphs, we first serialize each graph into a sequence of key expressions by topological sort. Then, we tokenize and concatenate key expressions to generate token lists. We calculate the locality-sensitive hash value for all token lists and quantify their similarity. %We implement a prototype, called SemDiff, consisting of two modules: graph generation and graph diffing. The first module generates a pair of key-semantics graphs and the second module diffs the graphs. Our evaluation results show that overall, SemDiff outperforms state-of-the-art tools when detecting the similarity of binaries generated from different optimization levels, compilers, and obfuscations. SemDiff is also effective for library version search and finding similar vulnerabilities in firmware.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。