Abstract
With the privatization deployment of DNNs on edge devices, the security of on-device DNNs has raised significant concern. To quantify the model leakage risk of on-device DNNs automatically, we propose NNReverse, the first learning-based method which can reverse DNNs from AI programs without domain knowledge. NNReverse trains a representation model to represent the semantics of binary code for DNN layers. By searching the most similar function in our database, NNReverse infers the layer type of a given function’s binary code. To represent assembly instructions semantics precisely, NNReverse proposes a more fine-grained embedding model to represent the textual and structural-semantic of assembly functions.
Introduction: The Vulnerability of On-Device AI
As Deep Neural Networks (DNNs) migrate from the cloud to edge devices—such as smartphones, IoT hardware, and autonomous vehicles—developers increasingly rely on compilation to protect proprietary models. By transforming high-level code (e.g., PyTorch or TensorFlow) into stand-alone binary executables, the industry has long assumed that machine code acts as a "black box" that is incomprehensible to unauthorized parties.
However, this assumption creates a massive security blind spot. If an attacker can reverse-engineer these binaries, they can steal intellectual property, extract sensitive training data memorized by the model, or launch highly effective white-box adversarial attacks. The primary challenge in reversing these models lies in the complexity of modern DNNs and the architectural diversity of target hardware, ranging from Intel and ARM processors to specialized Android environments.
Methodology: The NNReverse Framework
NNReverse treats reverse-engineering as a search-and-match problem, leveraging the fact that while DNN architectures are complex, they are constructed from a finite set of standard "kernel operators" (e.g., Convolution, Pooling, ReLU).
1. Fine-Grained Semantic Representation
Standard Natural Language Processing (NLP) tools often fail on assembly code because they ignore the underlying structure of the program. NNReverse overcomes this with a dual-embedding approach that captures both textual and structural semantics.
- Sequential Embedding: The model breaks down assembly instructions into opcodes and operands. To handle random memory addresses (the "Out-of-Vocabulary" problem), it employs a "blur strategy" where values exceeding a specific threshold are generalized.
- Structure Embedding: The model analyzes the Control Flow Graph (CFG) of a function. By using sub-graph analysis, it captures how code blocks are connected, which is essential for identifying the complex loops characteristic of operators like 2D convolutions.
2. The Two-Phase Attack Pipeline
NNReverse operates in two distinct stages to bridge the gap between binary code and high-level model architectures.
- Offline Phase: Researchers build a comprehensive kernel database by compiling known DNNs across various platforms and optimization levels. This creates a "dictionary" mapping binary code vectors to specific layer types.
- Online Phase: When presented with a "victim" program, NNReverse decompiles it, converts its functions into vectors using the trained representation model, and searches the database for the closest match. It then iteratively reconstructs the computational graph to produce a functional high-level model.
Datasets and Evaluation
The study utilized models from TorchVision and HuggingFace, covering both computer vision (e.g., VGG, ResNet) and natural language processing (e.g., BERT). The authors have open-sourced a dataset of over 80,000 assembly functions compiled for four major platforms: ARM, Aarch64, Android, and Intel. This represents the first major dataset specifically designed for automated DNN reverse-engineering research.
Key Results and Insights
- Semantics Over Syntax: NNReverse achieves cross-platform portability by focusing on underlying logic rather than syntax. Even when Intel and ARM assembly look different, the semantic representation of a Convolutional layer remains consistent.
- The Power of Feature Fusion: Ablation studies demonstrated that structural information alone is insufficient. However, when fused with textual embeddings, the accuracy of layer identification increases significantly, often by 10-20%.
- Zero-Loss Reconstruction: NNReverse performs a "steal attack" rather than a mere functionality mimicry. By recovering the actual architecture and parameters, the researchers successfully reconstructed complex models like ResNet-50 and MobileNet-V2 with 0.00 accuracy loss compared to the original.
- High Precision: The framework achieved F1 scores as high as 0.88 in identifying kernel operators across different platforms, significantly outperforming traditional binary analysis baselines like Asm2Vec.
Conclusion and Future Work
NNReverse demonstrates that automated, learning-based reverse engineering of DNNs is a viable and potent threat. While the current framework is highly effective, its success depends on the presence of similar kernel operators in its offline database. Future research must address potential countermeasures, such as advanced code obfuscation and the development of "defense-in-depth" strategies for deep learning compilers to protect AI intellectual property on the edge.
Summary updated