TL;DR
CupidCall is a novel framework that uses Graph Neural Networks (GNNs) to resolve indirect call targets in stripped binary code with unprecedented accuracy. By augmenting traditional control flow graphs with data-code cross-references and training on high-quality, compiler-derived datasets, it achieves a 95.2% F1 score, significantly outperforming previous state-of-the-art machine learning models.
What Problem Does This Paper Address?
In binary analysis—essential for security auditing and reverse engineering when source code is missing—researchers struggle with indirect calls (icalls). Unlike a direct call (e.g., call 0x401000), an indirect call uses a register or memory location (e.g., call rax). Because the value of rax isn't known until the program actually runs, static analysis tools often see an incomplete "map" of the program, known as the Inter-procedural Control Flow Graph (CFG).
Existing solutions fall into two camps:
- Traditional Static/Dynamic Analysis: These are often either too "conservative" (guessing too many possible targets, leading to false positives) or too "narrow" (only finding targets exercised by specific test cases).
- Previous ML Approaches: These often treat assembly code like natural language (a linear sequence of words). This ignores the complex, non-linear relationships in binaries and often discards vital information—like memory addresses—to avoid "out-of-vocabulary" errors.
Methods
CupidCall introduces a "relational" approach to binary representation. Its architecture consists of three main pillars:
- Augmented CFGs (ACFGs): Instead of just looking at code blocks, CupidCall incorporates data nodes and cross-reference (xRef) edges. It tracks how code refers to data (c2d), how data refers to other data (d2d), and how data points back to code (d2c). This preserves the "semantic bridge" that usually breaks when binaries are stripped.
- Relational Graph Convolutional Networks (RGCN): Since the graph now has different types of nodes (code vs. data) and edges (control flow vs. xRef), the authors use an RGCN. This allows the model to learn different "weights" for different types of relationships.
- Advanced Positional Encoding: To help the GNN understand the global structure of the program, they use Laplacian Positional Encoding. This gives each node a unique coordinate based on its structural position in the graph, helping the model differentiate between similar-looking code blocks in different parts of the binary.
- High-Fidelity Training: They modified a compiler-level tool called TyPro and a custom linker script to generate "ground truth" labels. This ensures the model learns from actual, verified callsite-callee pairs rather than noisy guesses.
Datasets
The authors curated what they claim is the largest verified icall dataset to date:
- Sources: Real-world projects from GitHub and the Arch User Repository (AUR).
- Scale: 2,680 stripped binaries compiled for x86_64 with various optimization levels (O0–O3).
- Statistics: The dataset includes 350,000 functions, 36,000 indirect calls, and 704,000 verified callsite-callee pairs.
- Open Source: The authors have released their prototype, pre-trained model, and datasets on Zenodo.
Key Insights and Ideas
- Data is the Key: The most significant "aha moment" is that indirect calls are almost always governed by the data section (e.g., function pointers in a table). By treating the data section as first-class nodes in the graph, the model can "see" the connection between a
call rdxinstruction and the memory address where the target function pointer lives. - The "Natural Language" Fallacy: The paper argues forcefully against treating assembly as a linear sequence. Binaries are inherently graphs; forcing them into a 1D sequence (like a sentence) loses the structural context that defines program behavior.
- Reverse Edges Matter: By enabling "reverse edges" in the graph, the model can learn from backward execution traces, allowing it to understand the provenance of a pointer, not just where it's going.
Key Results
- Superior Accuracy: CupidCall achieved an F1 score of 95.2%, significantly higher than the previous leader, Callee (89.9%).
- Precision in Security: In a case study involving the Firefox codebase, CupidCall reduced the "precision gap" (the difference between binary-level guesses and source-level truth) by over 80% compared to previous models.
- Optimization Resilience: The model remained robust across different compiler optimization levels (O0 to O3), which usually mangle code structure enough to break simpler analysis tools.
Limitations and Future Work
- Indirect Jumps: The current model focuses specifically on indirect calls. It does not yet handle indirect jumps (commonly used in switch-case statements), which are a different but related challenge.
- Ground Truth Dependency: While CupidCall is modular, its current training data relies on TyPro. Any inherent limitations or biases in TyPro's type propagation are inherited by the model.
- Heterogeneous Graph PE: The authors note that there is no standardized method for positional encoding in heterogeneous graphs. They currently convert the graph to a homogeneous one to calculate the encoding, which they suggest is an area for future mathematical refinement.
Summary updated