Explainer-guided Targeted Adversarial Attacks against Binary Code Similarity Detection Models

Mingjie Chen, Tiancheng Zhu, Mingxue Zhang, Yiling He, Minghao Lin, Penghui Li, Kui RenarXiv 2025 · DOI

Introduction

Binary Code Similarity Detection (BCSD) is a cornerstone of modern security analysis, facilitating tasks such as vulnerability discovery in firmware and malware variant identification. While deep learning has significantly advanced BCSD capabilities, these models remain susceptible to adversarial attacks—subtle, semantic-preserving modifications to code that can deceive the model's predictions.

Current adversarial research in this domain faces two primary hurdles. First, existing attack methodologies are often inefficient, relying on brute-force searches or simple heuristics that fail to identify the most impactful code segments. Second, while untargeted attacks (making similar code appear different) are relatively straightforward, targeted attacks—forcing a specific malicious function to appear identical to a chosen benign target—are significantly more challenging. This paper introduces a novel optimization strategy that leverages model "explainers" to bridge these gaps, achieving higher success rates with drastically reduced computational overhead.

Methodology: Explainer-Guided Optimization

The central innovation of this work is the use of model-agnostic explainers, such as LIME and GNNExplainer, as "targeting systems" for adversarial perturbations. Rather than exhaustively testing every possible instruction modification, the proposed framework queries the model to identify which features are most influential in its current decision-making process.

Overview of the explainer-guided adversarial attack pipeline.

The attack follows an iterative refinement loop. Starting with a binary sample, the system extracts features and obtains a prediction from the BCSD model. An explainer then generates an "explanation" for the model's selection, pinpointing the most salient features. These insights guide the application of semantic-preserving perturbations—such as instruction reordering or dead branch insertion—to the original binary. This process repeats until the model is successfully misled into classifying the sample as the intended target.

Bridging the Semantic Gap

A significant challenge in this approach is that explainers typically highlight abstract features (like graph nodes or token weights), whereas attacks must modify concrete assembly instructions. The authors developed specific mapping strategies for the two dominant BCSD model paradigms:

  1. Sequence-based Models (e.g., jTrans, SAFE): The framework utilizes LIME to create a local linear model around the input. It then maps the resulting token-level weights back to specific assembly instructions, identifying which lines of code most strongly contribute to the similarity score.
  2. Graph-based Models (e.g., Gemini, GMN): For models operating on Control Flow Graphs (CFGs), GNNExplainer is used to identify critical nodes. The authors implemented an "instruction-type vocabulary mapping" to translate these graph-level importance scores into a prioritized list of instructions for modification.
Detailed mapping strategies for sequence-based and graph-based BCSD models.

Experimental Evaluation

The efficacy of the explainer-guided approach was tested against a robust dataset comprising eight real-world open-source projects (including binutils, openssl, and ffmpeg). To ensure robustness across different environments, each project was compiled using multiple compilers (gcc and clang) and optimization levels (O0 and O3).

Key Results

The proposed method demonstrated superior performance across several metrics:

  • Attack Success Rate (ASR): The explainer-guided attacks consistently outperformed baseline methods. For instance, when targeting the jTrans model, the proposed method achieved an ASR@1 (successfully making the target the top match) of 0.91, compared to 0.78 for the baseline.
  • Efficiency Gains: The most striking result was the reduction in computational cost. For the Gemini model, the explainer-guided strategy was 12.71x faster at selecting optimal instructions for perturbation than iterative brute-force methods.
  • Real-world Impact: In case studies involving recent OpenSSL vulnerabilities, the attack successfully masked vulnerable functions by increasing their similarity scores to benign targets from 0.869 to 0.917, effectively evading detection.

Discussion and Future Work

This research highlights a paradigm shift: explainability tools, traditionally used for model debugging and transparency, can be repurposed as powerful tools for adversaries. By focusing modifications on "salient" code snippets, attackers can bypass the noise of irrelevant code and find the path of least resistance through a model's decision boundary.

However, limitations remain. The current perturbation library relies on standard techniques like dead code insertion. Future work could integrate more sophisticated obfuscation methods to increase the potency of the attacks. Additionally, defenders might counter these attacks by intentionally reducing the precision of model explanations (e.g., through gradient obfuscation), making it harder for an adversary to gain actionable insights. Finally, ensuring that adversarial modifications do not create anomalies detectable by traditional static analysis tools remains an ongoing challenge for creating truly "stealthy" binary exploits.

Summary updated

BibTeX
@misc{chen2025explainer,
  author = {Mingjie Chen and Tiancheng Zhu and Mingxue Zhang and Yiling He and Minghao Lin and Penghui Li and Kui Ren},
  title = {{Explainer-guided Targeted Adversarial Attacks against Binary Code Similarity Detection Models}},
  year = {2025},
  eprint = {2506.05430},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.05430},
}
Figure