Beyond the Edge of Function: Unraveling the Patterns of Type Recovery in Binary Code
Authors:
- Gangyang LiGLGangyang Li
- Xiuwei ShangXSXiuwei Shang
- Shaoyin ChengSCShaoyin Cheng
- Junqi ZhangJZJunqi Zhang
- Li HuLHLi Hu
- Xu ZhuXZXu Zhu
- Weiming ZhangWZWeiming Zhang
- Nenghai YuNYNenghai Yu
Preprint
Abstract
Type recovery is a crucial step in binary code analysis, holding significant importance for reverse engineering and various security applications. Existing works typically simply target type identifiers within binary code and achieve type recovery by analyzing variable characteristics within functions. However, we find that the types in real-world binary programs are more complex and often follow specific distribution patterns. In this paper, to gain a profound understanding of the variable type recovery problem in binary code, we first conduct a comprehensive empirical study. We utilize the TYDA dataset, which includes 163,643 binary programs across four architectures and four compiler optimization options, fully reflecting the complexity and diversity of real-world programs. We carefully study the unique patterns that characterize types and variables in binary code, and also investigate the impact of compiler optimizations on them, yielding many valuable insights. Based on our empirical findings, we propose ByteTR, a framework for recovering variable types in binary code. We decouple the target type set to address the issue of unbalanced type distribution and perform static program analysis to tackle the impact of compiler optimizations on variable storage. In light of the ubiquity of variable propagation across functions observed in our study, ByteTR conducts inter-procedural analysis to trace variable propagation and employs a gated graph neural network to capture long-range data flow dependencies for variable type recovery. We conduct extensive experiments to evaluate the performance of ByteTR. The results demonstrate that ByteTR leads state-of-the-art works in both effectiveness and efficiency. Moreover, in real CTF challenge case, the pseudo code optimized by ByteTR significantly improves readability, surpassing leading tools IDA and Ghidra.Keywords
All Related Versions
This publication has 16 references indexed in Scilit:
- Bin2Summary: Beyond Function Name Prediction in Stripped Binaries with Functionality-Specific Code EmbeddingsProceedings of the ACM on Software Engineering, 2024
- Enhancing Function Name Prediction using Votes-Based Name Tokenization and Multi-task LearningProceedings of the ACM on Software Engineering, 2024
- BinCola: Diversity-Sensitive Contrastive Learning for Binary Code Similarity DetectionIEEE Transactions on Software Engineering, 2024
- LibAM: An Area Matching Framework for Detecting Third-Party Libraries in BinariesACM Transactions on Software Engineering and Methodology, 2023
- Asteria-Pro: Enhancing Deep Learning-based Binary Code Similarity Detection by Incorporating Domain KnowledgeACM Transactions on Software Engineering and Methodology, 2023
- Towards Practical Binary Code Similarity Detection: Vulnerability Verification via Patch Semantic AnalysisACM Transactions on Software Engineering and Methodology, 2023
- BinVulDet: Detecting vulnerability in binary program via decompiled pseudo code and BiLSTM-attentionComputers & Security, 2022
- Lightweight, Obfuscation-Resilient Detection and Family Identification of Android MalwareACM Transactions on Software Engineering and Methodology, 2017
- Zipf's Law and Heaps' Law Can Predict the Size of Potential WordsProgress of Theoretical Physics Supplement, 2012
- Discovering power laws in computer programsInformation Processing & Management, 2009