Abstract
CP-BCS is a novel multi-modal framework designed to generate natural language summaries for "stripped" binary functions—code that lacks metadata such as function names or debug information. By integrating assembly instructions, instruction-level bidirectional control flow graphs (BI-CFG), and AI-refined pseudo-code, the system provides a comprehensive semantic understanding of low-level code. Experimental results demonstrate that CP-BCS achieves significant performance gains, enabling reverse engineers to understand complex code nearly 10 times faster than reading raw assembly alone.
Introduction
In cybersecurity and software engineering, professionals frequently encounter "stripped" binaries. These compiled programs have had helpful metadata removed to protect intellectual property or evade detection. While disassemblers can revert machine code to assembly, the resulting low-level instructions are tedious to analyze. Existing research has focused on predicting function names, but these are often cryptic. CP-BCS addresses this gap by generating full, human-readable summaries that explain the underlying logic and purpose of a function, effectively translating low-level execution behavior into natural language.
Methodology: A Multi-Modal Approach
The CP-BCS framework utilizes a multi-modal encoder-decoder architecture to process binary functions through three distinct lenses:
- Assembly Instruction Encoder: This component treats opcodes and operands as separate tokens. It employs a Transformer-based encoder with relative position encoding to capture the immediate semantics of the instruction sequence.
- BI-CFG Encoder (Structural Lens): Unlike standard basic-block-level Control Flow Graphs, CP-BCS introduces a Bidirectional Instruction-level CFG. Every instruction serves as a node, and a Graph Attention Network (GAT) learns the logic flow in both forward and backward directions.
- Pseudo Code Encoder (Expert Lens): Decompilers generate C-like pseudo-code, but stripped binaries result in generic placeholders (e.g.,
sub_E6D18). CP-BCS uses a fine-tuned CodeT5 model to "refine" this output, recovering meaningful variable and function names based on context before encoding.
Finally, a summary decoder uses cross-attention to fuse these three information streams, generating a concise English description of the function's intent.
The Role of Pseudo-Code Refinement
A key innovation in CP-BCS is the use of CodeT5 to improve decompiler output. By pre-processing messy pseudo-code to recover likely identifiers, the model provides the summarizer with high-quality semantic hints that raw decompiler output lacks. This refinement process bridges the gap between the stripped binary and the original source intent.
Dataset and Experimental Results
To evaluate the framework, the researchers constructed a high-quality dataset comprising over 100,000 samples from 51 open-source projects. The dataset covers three architectures (X86, X64, and ARM) and three optimization levels (O1, O2, and O3), pairing stripped assembly with ground-truth summaries from source code comments.
- Quantitative Performance: CP-BCS achieved BLEU scores between 25 and 30, indicating that the generated summaries successfully capture the "gist" of the code logic.
- Human Impact: In a study with professional reverse engineers, CP-BCS summaries resulted in a 9.7x speedup in code comprehension compared to analyzing raw assembly. Notably, these summaries were often more helpful than having the original function name alone.
- Architecture and Optimization: The model performs best on ARM due to its regular RISC instruction set. Conversely, high optimization levels (O3) present a challenge, as aggressive compiler techniques like loop unrolling scatter logic across the binary.
Discussion and Limitations
While CP-BCS represents a significant advancement, several challenges remain. The current model does not account for code obfuscation—techniques intentionally used by malware authors to break decompilers. Additionally, the model employs vocabulary normalization for memory addresses and constants, which, while necessary for handling variety, may discard some useful context.
Conclusion
CP-BCS demonstrates that combining structural information from instruction-level graphs with refined high-level pseudo-code significantly enhances binary code summarization. By providing clear, natural language explanations, the framework offers a powerful tool for reverse engineers, drastically reducing the time required to analyze complex, stripped binaries.
Summary updated