Introduction
Binary Code Similarity Detection (BCSD) is a fundamental technique in cybersecurity, used for vulnerability discovery, malware analysis, and software provenance. Recently, the field has shifted toward deep learning-based models such as SAFE, Asm2Vec, and jTrans, which have demonstrated superior performance over traditional graph-matching methods. However, these models inherit the adversarial vulnerabilities common to deep neural networks.
FuncFooler is a novel black-box framework designed to exploit these vulnerabilities. Unlike previous white-box attacks that require internal knowledge of a model's parameters, FuncFooler operates blindly, inserting "poison" instructions into malicious code while strictly maintaining original functionality and control flow structure.
Methodology
FuncFooler generates adversarial binaries through a multi-stage pipeline that ensures the inserted instructions are both effective at fooling the model and harmless to the program's execution.
1. Identifying Vulnerable Candidates (Dominate Nodes)
To ensure adversarial instructions are consistently processed by the model's sampling logic, FuncFooler targets "Dominate Nodes." These are basic blocks in the Control Flow Graph (CFG) that must be executed to reach the function's exit. By focusing on these central nodes, the attack becomes significantly more efficient than random instruction insertion, as the model cannot easily "skip" the adversarial content during feature extraction.
2. Instruction Selection
The attack selects instructions from "inverse functions"—benign code that the target model identifies as highly dissimilar to the malware. This strategy is designed to maximize the "push" away from the correct malicious classification in the model's embedding space, effectively camouflaging the malware as benign software.
3. Semantic Side-Effect Correction
To preserve program functionality and prevent crashes, FuncFooler implements three key protection strategies:
- Register Protection: Utilizing
push/poppairs to save and restore register states before and after adversarial instructions. - EFLAGS Protection: Using
pushfd/popfdto preserve CPU status flags. - Memory Redirection: Redirecting memory-accessing instructions to "Bumper Zones"—safe, pre-allocated heap areas—to prevent segmentation faults that would otherwise occur from random memory access.
Evaluation and Results
The researchers evaluated FuncFooler against three state-of-the-art (SOTA) models—SAFE (RNN-based), Asm2Vec (representation learning), and jTrans (Transformer-based)—using the industry-standard SPEC CPU 2006 and SPEC CPU 2017 benchmarks.
Key Findings
- Devastating Success Rate: FuncFooler reduced detection accuracy from nearly 100% to below 5% across all tested models. For instance, SAFE's accuracy on SPEC CPU 2017 dropped to a mere 2.43%.
- Minimal Perturbation: This success was achieved by modifying or adding less than 13% of the original instructions, maintaining the overall profile of the binary.
- Negligible Overhead: The resulting adversarial binaries exhibited a runtime performance overhead of less than 1%, making the attack highly practical for real-world malware deployment.
- Transferability: Adversarial examples generated for one model were often successful against others, suggesting that different BCSD models learn similar, flawed features of binary code.
Conclusion
FuncFooler demonstrates a significant vulnerability in current learning-based BCSD methods. While adversarial training offers some defense by including these examples in the training set, the results suggest a need for more robust models that can better capture the true semantics of binary code rather than relying on surface-level patterns. Future work includes extending these techniques to other architectures like ARM and MIPS and refining the toolchain to handle more complex code structures containing inline assembly.
Summary updated