基于代码嵌入的二进制代码相似性分析方法
网络安全与数据治理 2023年3期
熊敏,薛吟兴,徐云
(1.中国科学技术大学计算机科学与技术学院,安徽合肥230026; 2.安徽省高性能计算重点实验室,安徽合肥230026)
摘要: 代码嵌入利用神经网络模型将二进制函数的代码表示转化为向量,在漏洞搜索等应用中展现了优势。现有的方法将函数表示为汇编指令序列、控制流图的拓扑结构或若干路径,都没有克服不同编译环境导致控制流图结构变化的干扰。为此,设计了基于基本块树(Basic Block Tree, BBT)的代码表示以及构建了对应的代码嵌入模型BBTree。首先,二进制函数被表示为一系列BBT,每个BBT被处理为指令序列;其次,BBTree利用LSTM和BiGRU将基于BBT的代码表示转化为向量;最后,通过计算向量间的距离去高效衡量对应函数的相似性。在代码搜索中,BBTree的平均准确率比主流工具提升了24.8%;在漏洞搜索中,BBTree的平均召回率比主流工具提升了26.1%。
中图分类号:TP311.5
文献标识码:A
DOI:10.19358/j.issn.2097-1788.2023.03.010
引用格式:熊敏,薛吟兴,徐云.基于代码嵌入的二进制代码相似性分析方法[J].网络安全与数据治理,2023,42(3):58-67.
文献标识码:A
DOI:10.19358/j.issn.2097-1788.2023.03.010
引用格式:熊敏,薛吟兴,徐云.基于代码嵌入的二进制代码相似性分析方法[J].网络安全与数据治理,2023,42(3):58-67.
A binary code similarity analysis method based on code embedding
Xiong Min1,2,Xue Yinxing1,Xu Yun 1,2
(1. School of Computer Science and Technology, University of Science and Technology of China, Hefei 230026, China; 2. Key Laboratory of High Performance Computing of Anhui Province, Hefei 230026, China)
Abstract: Code embedding utilizes neural network models to convert binary code into a vector, showing advantages in applications such as vulnerability searching. Existing methods represent functions as assembly instruction sequences, topology structures of control flow graphs, or several paths.However, none of them can overcome the interference produced by the structural changes in control flow graphs caused by different compilation environments.To this end, this paper designs a basic block tree (BBT)-based code representation and builds a corresponding code embedding model named BBTree.Firstly, the binary function is represented as a series of BBTs, and each BBT is processed into an instruction sequence Secondly, BBTree utilizes LSTM and Bi.GRU to convert the BBT.based code representation into a numerical vector Last, the distance between vectors is calculated to efficiently measure the similarity of corresponding functions. In code search, BBTree’s average accuracy rate is 24.8% higher than mainstream tools; in vulnerability search, BBTree’s average recall rate is 26.1% higher than mainstream tools.
Key words :
0 引言
由于商业程序、遗留程序和恶意代码的源码不公开, 因此,对这些程序进行二进制代码相似性分析具有很多安全应用,比如抄袭检测、恶意软件检测、漏洞搜索等。相似性分析旨在根据已有的二进制代码(如已揭露的漏洞等)在代码库中搜索出语义相似的二进制代码,从而探测出潜在的漏洞,维护程序的安全。二进制代码嵌入作为一种新兴的相似性分析技术,利用神经网络模型将二进制函数的代码表示转化为数值向量,不仅学习了二进制代码的语义,还可以通过计算向量间的距离去定量分析对应函数的相似性。
本文详细内容请下载:https://www.chinaaet.com/resource/share/2000005257
作者信息:
熊敏1,2,薛吟兴1,徐云1,2
(1.中国科学技术大学计算机科学与技术学院,安徽合肥230026;2.安徽省高性能计算重点实验室,安徽合肥230026)

此内容为AET网站原创,未经授权禁止转载。
