BinGo: Identifying Security Patches in Binary Code with Graph Representation Learning

Xu He, Shu Wang, Pengbin Feng, Xinda Wang, Shiyu Sun, Qi Li, Kun SunAsiaCCS 2023

Abstract

Software vendors frequently release "silent patches"—security fixes that are not publicly disclosed or assigned CVE identifiers. This lack of transparency leaves users vulnerable to N-day attacks. BinGo is a novel deep-learning system designed to identify these security patches directly within binary code. By integrating BERT-based instruction embeddings with Code Property Graphs (CPGs) and a Siamese network architecture, BinGo effectively distinguishes security fixes from routine updates, achieving over 80% accuracy across various compilers and optimization levels.

Introduction

Timely patching is the primary defense against software vulnerabilities. However, analyzing patches in binary form is significantly more challenging than source code analysis. The compilation process—involving different compilers (e.g., GCC vs. Clang) and optimization levels (e.g., -O2 vs. -Os)—drastically alters code structure and instructions. Existing source-based tools fail when source code is unavailable, a common scenario for commercial software. BinGo addresses this by focusing on the semantic and structural properties of binary code to identify security-critical changes.

The BinGo Pipeline

BinGo operates through a four-phase end-to-end pipeline designed to isolate and analyze patch-related changes in binary files.

The four phases of the BinGo pipeline: Preprocessing, Graph Extraction, Embedding, and Graph Learning.
  1. Patch Data Pre-processing: The system identifies "patch-related" basic blocks by comparing pre-patch and post-patch binaries. It utilizes a modified version of DeepBinDiff to filter out noise and focus on the specific functions and blocks that have been modified.
  2. Graph Extraction: BinGo constructs a Code Property Graph (CPG) to capture the program's logic. This unified structure merges Control Flow, Control Dependency, and Data Dependency relationships. To maintain efficiency, "graph slicing" is used to retain only the context relevant to the patch.
  3. Embedding Generation: To understand the semantics of basic blocks, BinGo employs a BERT-based language model. Pre-trained on assembly instructions, this model captures deep logical meanings that simple statistical features often miss.
  4. Graph Representation Learning: The system uses a Siamese Network consisting of two identical graph convolutional networks (GCNs) that share weights. This architecture allows the model to learn the specific relationship and difference between the pre-patch and post-patch versions.

Code Property Graph (CPG) Construction

A core innovation of BinGo is its use of the Code Property Graph. While most binary diffing tools rely solely on the Control Flow Graph (CFG), BinGo integrates multiple dependency types to capture subtle side effects of security patches.

BinGo constructs a CPG by merging the Control Flow Graph (CFG), Data Dependence Graph (DDG), and Control Dependence Graph (CDG).

By combining the CFG with the Data Dependence Graph (DDG) and the Control Dependence Graph (CDG), BinGo creates a comprehensive representation of how data and control move through the patched region. This multi-faceted view is critical for identifying security fixes, which often involve subtle changes to data validation or error handling that a standard CFG might overlook.

Key Results and Insights

BinGo was evaluated on a large-scale dataset of 2,900 patches from the Linux Kernel, compiled across multiple configurations. Key findings include:

  • High Accuracy: BinGo achieved a peak accuracy of 80.77% and an F1-score of 0.759, outperforming source-based models like PatchRNN.
  • Robustness: The system remained stable across different compilers and optimization levels, though it performed slightly better on Clang-compiled code due to its more explicit dependency structures.
  • Reduced False Negatives: BinGo significantly lowered the False Negative Rate (FNR) to 29.15%, roughly half that of existing baseline models.

Conclusion

BinGo demonstrates that graph representation learning, combined with deep semantic embeddings, can effectively identify security patches in binary code. By focusing on the underlying logic rather than syntax, it overcomes the challenges posed by compilation noise. Future work will focus on "tangled patches"—where multiple fixes are combined in a single commit—and expanding the analysis to include callee semantics.

Summary updated

BibTeX
@inproceedings{he2023bingo,
  author = {Xu He and Shu Wang and Pengbin Feng and Xinda Wang and Shiyu Sun and Qi Li and Kun Sun},
  title = {{BinGo: Identifying Security Patches in Binary Code with Graph Representation Learning}},
  booktitle = {AsiaCCS},
  year = {2023},
}
Figure