Enhancing Binary Security Analysis Through Pre-Trained Semantic and Structural Feature Matching
Source abstract
Abstract
Binary code similarity detection serves as a critical front-line defense mechanism in cybersecurity, playing an indispensable role in identifying known vulnerabilities, detecting emergent malware families, and preventing intellectual property theft via code plagiarism. However, existing methods based on Control Flow Graphs (CFGs) often suffer from two major limitations: the inadequate capture of deep semantic information within CFG nodes, and the neglect of structural relationships across different functions. To address these issues, we propose Breg, a novel framework that synergistically integrates pre-trained semantic features with cross-graph structural features. Breg employs a BERT model pre-trained on a large-scale binary corpus to capture nuanced semantic relationships, and introduces a Cross-Graph Neural Network (CGNN) to explicitly model topological correlations between two CFGs, thereby generating highly discriminative embeddings. Extensive experimental validation demonstrates that Breg achieves leading F1-scores of 0.8682 and 0.8970 on Dataset3. In real-world vulnerability search tasks on Dataset4, Breg achieves an MRR@10 of 0.9333 in the challenging MIPS32-to-x64 search task, a clear improvement over the 0.8533 scored by the strongest baseline. This underscores its superior effectiveness and robustness across diverse compilation environments and architectures. To the best of our knowledge, this is the first work to integrate a pre-trained language model with cross-graph structural learning for binary code similarity detection, offering enhanced effectiveness, generalization, and practical applicability in real-world security scenarios.
Source: crossref · Quality: baseline
Research context
OpenAlex topics: Advanced Malware Detection Techniques · Software Engineering Research · Adversarial Robustness in Machine Learning
SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.
Affiliations
School of Computer Science and Technology, Harbin Institute of Technology (Shenzhen), Shenzhen 518055, China
The Third Research Institute of Ministry of Public Security, Shanghai 201204, China
Funding
Ministry of Science and Technology of the People’s Republic of China
References (40)
Show source-provided references
1. Jang, J., Agrawal, A., and Brumley, D. (2012, January 20–23). ReDeBug: Finding unpatched code clones in entire os distributions. Proceedings of the 2012 IEEE Symposium on Security and Privacy, San Francisco, CA, USA.10.1109/SP.2012.13 ↗
2. Cui, A., Costello, M., and Stolfo, S. (2025, October 23). When Firmware Modifications Attack: A Case Study of Embedded Exploitation. Available online: https://www.ndss-symposium.org/ndss2013/ndss-2013-programme/when-firmware-modifications-attack-case-study-embedded-exploitation/.
3. Brosch, T., and Morgenstern, M. (2025, October 23). Runtime Packers: The Hidden Problem. Available online: https://www.av-test.org/fileadmin/pdf/publications/blackhat_2006_avtest_presentation_runtime_packers-the_hidden_problem.pdf.
4. Marcelli, A., Graziano, M., Ugarte-Pedrero, X., Fratantonio, Y., Mansouri, M., and Balzarotti, D. (2022, January 10–12). How machine learning is solving the binary function similarity problem. Proceedings of the 31st USENIX Security Symposium (USENIX Security 22), Boston, MA, USA.
5. Xu, X., Liu, C., Feng, Q., Yin, H., Song, L., and Song, D. (November, January 30). Neural network-based graph embedding for cross-platform binary code similarity detection. Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security, Dallas, TX, USA.10.1145/3133956.3134018 ↗
6. Feng, Q., Zhou, R., Xu, C., Cheng, Y., Testa, B., and Yin, H. (2016, January 24–28). Scalable graph-based bug search for firmware images. Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, Vienna, Austria.10.1145/2976749.2978370 ↗
7. Song, L. (2025, October 23). Structure2vec: Deep Learning for Security Analytics over Graphs. Available online: https://www.usenix.org/conference/scainet18/presentation/song.
8. Devlin, J., Chang, M.W., Lee, K., and Toutanova, K. (2018). Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv.
9. Graph neural networks: A review of methods and applications10.1016/j.aiopen.2021.01.001 ↗
10. Pre-trained models for natural language processing: A survey10.1007/s11431-020-1647-3 ↗
11. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A.N., Kaiser, Ł., and Polosukhin, I. (2017, January 4–9). Attention is all you need. Proceedings of the Advances in Neural Information Processing Systems, Long Beach, CA, USA.
12. Guo, W., Mu, D., Xing, X., Du, M., and Song, D. (2019, January 14–16). DEEPVSA: Facilitating value-set analysis with deep learning for postmortem program analysis. Proceedings of the USENIX Security Symposium, Santa Clara, CA, USA.
13. Raff, E., Barker, J., Sylvester, J., Brandon, R., Catanzaro, B., and Nicholas, C.K. (2018, January 2–7). Malware detection by eating a whole exe. Proceedings of the Workshops at the Thirty-Second AAAI Conference on Artificial Intelligence, New Orleans, LA, USA.
14. Liu, B., Huo, W., Zhang, C., Li, W., Li, F., Piao, A., and Zou, W. (2018, January 3–7). αdiff: Cross-version binary code similarity detection with dnn. Proceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering, Montpellier, France.10.1145/3238147.3238199 ↗
15. Jiang, L., Misherghi, G., Su, Z., and Glondu, S. (2007, January 20–26). DECKARD: Scalable and Accurate Tree-Based Detection of Code Clones. Proceedings of the 29th International Conference on Software Engineering (ICSE’07), Minneapolis, MN, USA.10.1109/ICSE.2007.30 ↗
16. Yang, S., Cheng, L., Zeng, Y., Lang, Z., Zhu, H., and Shi, Z. (2021, January 21–24). Asteria: Deep learning-based AST-encoding for cross-platform binary code similarity detection. Proceedings of the 2021 51st Annual IEEE/IFIP International Conference on Dependable Systems and Networks (DSN), Taipei, Taiwan.10.1109/DSN48987.2021.00036 ↗
17. A survey of machine learning for big code and naturalness10.1145/3212695 ↗
18. On the naturalness of software10.1145/2902362 ↗
19. Kingma, D.P., and Ba, J. (2017). Adam: A Method for Stochastic Optimization. arXiv.
20. Li, Y., Gu, C., Dullien, T., Vinyals, O., and Kohli, P. (2019, January 9–15). Graph matching networks for learning the similarity of graph structured objects. Proceedings of the International Conference on Machine Learning, PMLR, Long Beach, CA, USA.
21. Li, X., Qu, Y., and Yin, H. (2021, January 15–19). Palmtree: Learning an assembly language model for instruction embedding. Proceedings of the 2021 ACM SIGSAC Conference on Computer and Communications Security, Virtual Event.10.1145/3460120.3484587 ↗
22. Visualizing data using t-SNE
23. Luo, L., Ming, J., Wu, D., Liu, P., and Zhu, S. (2014, January 16–21). Semantics-based obfuscation-resilient binary code similarity comparison with applications to software plagiarism detection. Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering, Hong Kong, China.10.1145/2635868.2635900 ↗
24. Zuo, F., Li, X., Young, P., Luo, L., Zeng, Q., and Zhang, Z. (2019, January 24–27). Neural Machine Translation Inspired Binary Code Similarity Comparison beyond Function Pairs. Proceedings of the 2019 Network and Distributed System Security Symposium. Internet Society, San Diego, CA, USA.10.14722/ndss.2019.23492 ↗
25. Xu, C., Zhou, W., Ge, T., Wei, F., and Zhou, M. (2020). BERT-of-Theseus: Compressing BERT by Progressive Module Replacing. arXiv.10.18653/v1/2020.emnlp-main.633 ↗
26. Wang, W., Wei, F., Dong, L., Bao, H., Yang, N., and Zhou, M. (2020). MiniLM: Deep Self-Attention Distillation for Task-Agnostic Compression of Pre-Trained Transformers. arXiv.10.18653/v1/2021.findings-acl.188 ↗
27. Multilevel graph matching networks for deep graph similarity learning10.1109/TNNLS.2021.3102234 ↗
28. Zhang, Z., Bu, J., Ester, M., Li, Z., Yao, C., Yu, Z., and Wang, C. (2021, January 14–18). H2mn: Graph similarity learning with hierarchical hypergraph matching networks. Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, Singapore.10.1145/3447548.3467328 ↗
29. Dullien, T. (2025, October 23). Searching Statically-Linked Vulnerable Library Functions in Executable Code, 18 December 2018. Available online: https://googleprojectzero.blogspot.com/2018/12/searching-statically-linked-vulnerable.html.
30. Pagani, F., Dell’Amico, M., and Balzarotti, D. (2018, January 19–21). Beyond precision and recall: Understanding uses (and misuses) of similarity hashes in binary analysis. Proceedings of the Eighth ACM Conference on Data and Application Security and Privacy, Tempe, AZ, USA.10.1145/3176258.3176306 ↗
31. Vuldetector: Detecting vulnerabilities using weighted feature graph comparison10.1109/TIFS.2020.3047756 ↗
32. Melekhov, I., Kannala, J., and Rahtu, E. (2016, January 4–8). Siamese network features for image matching. Proceedings of the 2016 23rd International Conference on Pattern Recognition (ICPR), Cancun, Mexico.10.1109/ICPR.2016.7899663 ↗
33. VDSimilar: Vulnerability detection based on code similarity of vulnerabilities and patches10.1016/j.cose.2021.102417 ↗
34. Ding, S.H.H., Fung, B.C.M., and Charland, P. (2019, January 19–23). Asm2Vec: Boosting Static Representation Robustness for Binary Clone Search against Code Obfuscation and Compiler Optimization. Proceedings of the 2019 IEEE Symposium on Security and Privacy (SP), San Francisco, CA, USA.10.1109/SP.2019.00003 ↗
35. Lee, Y., Kwon, H., Choi, S.H., Lim, S.H., Baek, S.H., and Park, K.W. (2019). Instruction2vec: Efficient Preprocessor of Assembly Code to Detect Software Weakness with CNN. Appl. Sci., 9.10.3390/app9194086 ↗
36. Mikolov, T., Chen, K., Corrado, G., and Dean, J. (2013). Efficient estimation of word representations in vector space. arXiv.
37. Function representations for binary similarity10.1109/TDSC.2021.3051852 ↗
38. Yu, Z., Cao, R., Tang, Q., Nie, S., Huang, J., and Wu, S. (2020, January 7–12). Order matters: Semantic-aware neural networks for binary code similarity detection. Proceedings of the AAAI Conference on Artificial Intelligence, New York, NY, USA.10.1609/aaai.v34i01.5466 ↗
39. Ahn, S., Ahn, S., Koo, H., and Paek, Y. (2022, January 5–9). Practical binary code similarity detection with bert-based transferable similarity learning. Proceedings of the 38th Annual Computer Security Applications Conference, Austin, TX, USA.10.1145/3564625.3567975 ↗
40. Pei, K., Xuan, Z., Yang, J., Jana, S., and Ray, B. (2020). Trex: Learning execution semantics from micro-traces for binary similarity. arXiv.