[Paper Review] XDA: Accurate, Robust Disassembly with Transfer Learning
XDA is a transfer learning-based disassembly framework that uses masked language modeling to learn contextual byte dependencies in machine code, enabling highly accurate and robust disassembly. It achieves 99.0% F1 score for function boundary recovery and 99.7% for instruction recovery, outperforming prior state-of-the-art methods while maintaining high speed.
Accurate and robust disassembly of stripped binaries is challenging. The root of the difficulty is that high-level structures, such as instruction and function boundaries, are absent in stripped binaries and must be recovered based on incomplete information. Current disassembly approaches rely on heuristics or simple pattern matching to approximate the recovery, but these methods are often inaccurate and brittle, especially across different compiler optimizations. We present XDA, a transfer-learning-based disassembly framework that learns different contextual dependencies present in machine code and transfers this knowledge for accurate and robust disassembly. We design a self-supervised learning task motivated by masked Language Modeling to learn interactions among byte sequences in binaries. The outputs from this task are byte embeddings that encode sophisticated contextual dependencies between input binaries' byte tokens, which can then be finetuned for downstream disassembly tasks. We evaluate XDA's performance on two disassembly tasks, recovering function boundaries and assembly instructions, on a collection of 3,121 binaries taken from SPEC CPU2017, SPEC CPU2006, and the BAP corpus. The binaries are compiled by GCC, ICC, and MSVC on x86/x64 Windows and Linux platforms over 4 optimization levels. XDA achieves 99.0% and 99.7% F1 score at recovering function boundaries and instructions, respectively, surpassing the previous state-of-the-art on both tasks. It also maintains speed on par with the fastest ML-based approach and is up to 38x faster than hand-written disassemblers like IDA Pro. We release the code of XDA at https://github.com/CUMLSec/XDA.
Motivation & Objective
- To address the challenge of accurate and robust disassembly of stripped binaries where high-level constructs like function boundaries and instructions are missing.
- To overcome the limitations of heuristic-based disassemblers, which are brittle and often inaccurate, especially under compiler optimizations.
- To improve generalization and robustness in machine learning-based disassembly by pretraining on large-scale byte sequences using self-supervised learning.
- To develop a framework that maintains high performance across diverse compilers (GCC, ICC, MSVC), architectures (x86/x64), platforms (Linux/Windows), and optimization levels.
Proposed method
- Pretrain a transformer-based model using a masked language modeling (MLM) objective on 3,121 stripped binaries to learn contextual byte dependencies.
- Fine-tune the pretrained model with task-specific feedforward layers for downstream disassembly tasks: function boundary detection and instruction recovery.
- Use a self-supervised pretraining stage to learn low-level code semantics without labels, enabling transfer to downstream tasks.
- Leverage attention mechanisms to capture long-range dependencies between bytes, implicitly learning prologue/epilogue patterns and control-flow structures.
- Design a data pipeline that ensures minimal overlap (<3%) between training and testing sets to validate generalization.
- Evaluate performance using F1 score on real-world binaries compiled with multiple compilers and optimization levels.
Experimental results
Research questions
- RQ1Can a self-supervised pretraining objective like masked language modeling effectively learn low-level code semantics in machine code for disassembly?
- RQ2Does transfer learning from pretraining on diverse binaries improve disassembly accuracy and robustness across compilers and optimization levels?
- RQ3Can an ML-based disassembler generalize better than heuristic-based tools when evaluated on non-overlapping test data?
- RQ4How does XDA’s performance compare to state-of-the-art methods in terms of accuracy, speed, and robustness?
- RQ5Can the learned byte embeddings capture meaningful structural patterns (e.g., function prologues/epilogues) without explicit supervision?
Key findings
- XDA achieves a 99.0% F1 score for function boundary recovery, surpassing the previous state-of-the-art by 17.2% in accuracy.
- XDA attains a 99.7% F1 score for instruction recovery, demonstrating exceptional precision and recall on complex binaries.
- The model maintains high performance across diverse compilers (GCC, ICC, MSVC), platforms (Linux, Windows), and optimization levels, showing strong robustness.
- XDA is up to 38× faster than IDA Pro, while matching the speed of the fastest ML-based disassemblers.
- Attention visualization confirms that XDA implicitly learns structural patterns like function prologues and epilogues from byte-level context.
- The model generalizes well, as evidenced by the F1 score of ByteWeight dropping from 97% to 65% on non-overlapping data, while XDA maintains high performance.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.