kTrans: Knowledge-Aware Transformer for Binary Code Embedding

Wenyu Zhu, Hao Wang, Yuchen Zhou, Jiaming Wang, Zihan Sha +2 more
8/24/2023
cs.SEcs.AIcs.CR

Official code: Learner0x5a/kTrans-release (30 stars, MIT, last commit 2023-12-17).

Abstract

Binary Code Embedding (BCE) has important applications in various reverse engineering tasks such as binary code similarity detection, type recovery, control-flow recovery and data-flow analysis. Recent studies have shown that the Transformer model can comprehend the semantics of binary code to support downstream tasks. However, existing models overlooked the prior knowledge of assembly language. In this paper, we propose a novel Transformer-based approach, namely kTrans, to generate knowledge-aware binary code embedding. By feeding explicit knowledge as additional inputs to the Transformer, and fusing implicit knowledge with a novel pre-training task, kTrans provides a new perspective to incorporating domain knowledge into a Transformer framework. We inspect the generated embeddings with outlier detection and visualization, and also apply kTrans to 3 downstream tasks: Binary Code Similarity Detection (BCSD), Function Type Recovery (FTR) and Indirect Call Recognition (ICR). Evaluation results show that kTrans can generate high-quality binary code embeddings, and outperforms state-of-the-art (SOTA) approaches on downstream tasks by 5.2%, 6.8%, and 12.6% respectively. kTrans is publicly available at: https://github.com/Learner0x5a/kTrans-release

View on arXivView PDF

Code Implementations(1)

MIT

Official code for kTrans: Knowledge-Aware Transformer for Binary Code Embedding

302PythonAug 24, 20232 years agoMIT
binaryembeddingknowledgereverse-engineeringtransformer

Similar Papers

Cite this paper

@article{zhu2023ktrans,
  title  = {kTrans: Knowledge-Aware Transformer for Binary Code Embedding},
  author = {Wenyu Zhu and Hao Wang and Yuchen Zhou and Jiaming Wang and Zihan Sha and Zeyu Gao and Chao Zhang},
  year   = {2023},
  eprint = {2308.12659},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2308.12659v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2308.12659.svg)](https://codeofpaper.com/paper/2308.12659)

Discussion