Table of Contents
Fetching ...

Multi-modal Learning for WebAssembly Reverse Engineering

Hanxian Huang, Jishen Zhao

TL;DR

WasmRev introduces the first multi-modal pre-trained language model for WebAssembly reverse engineering by jointly learning from source code, documentation, and WebAssembly code. Through three tailored self-supervised pre-training tasks, it produces a generic NL-PL-Wasm representation that transfers to diverse tasks with minimal labeled data. When fine-tuned on Function Purpose Identification, Type Recovery, and WebAssembly Summarization, WasmRev achieves state-of-the-art performance and demonstrates strong data efficiency and transferability. The approach offers a practical, scalable pathway to higher-level semantic understanding of Wasm, enabling more effective reverse engineering and code inspection workflows.

Abstract

The increasing adoption of WebAssembly (Wasm) for performance-critical and security-sensitive tasks drives the demand for WebAssembly program comprehension and reverse engineering. Recent studies have introduced machine learning (ML)-based WebAssembly reverse engineering tools. Yet, the generalization of task-specific ML solutions remains challenging, because their effectiveness hinges on the availability of an ample supply of high-quality task-specific labeled data. Moreover, previous works overlook the high-level semantics present in source code and its documentation. Acknowledging the abundance of available source code with documentation, which can be compiled into WebAssembly, we propose to learn representations of them concurrently and harness their mutual relationships for effective WebAssembly reverse engineering. In this paper, we present WasmRev, the first multi-modal pre-trained language model for WebAssembly reverse engineering. WasmRev is pre-trained using self-supervised learning on a large-scale multi-modal corpus encompassing source code, code documentation and the compiled WebAssembly, without requiring labeled data. WasmRev incorporates three tailored multi-modal pre-training tasks to capture various characteristics of WebAssembly and cross-modal relationships. WasmRev is only trained once to produce general-purpose representations that can broadly support WebAssembly reverse engineering tasks through few-shot fine-tuning with much less labeled data, improving data efficiency. We fine-tune WasmRev onto three important reverse engineering tasks: type recovery, function purpose identification and WebAssembly summarization. Our results show that WasmRev pre-trained on the corpus of multi-modal samples establishes a robust foundation for these tasks, achieving high task accuracy and outperforming the state-of-the-art ML methods for WebAssembly reverse engineering.

Multi-modal Learning for WebAssembly Reverse Engineering

TL;DR

WasmRev introduces the first multi-modal pre-trained language model for WebAssembly reverse engineering by jointly learning from source code, documentation, and WebAssembly code. Through three tailored self-supervised pre-training tasks, it produces a generic NL-PL-Wasm representation that transfers to diverse tasks with minimal labeled data. When fine-tuned on Function Purpose Identification, Type Recovery, and WebAssembly Summarization, WasmRev achieves state-of-the-art performance and demonstrates strong data efficiency and transferability. The approach offers a practical, scalable pathway to higher-level semantic understanding of Wasm, enabling more effective reverse engineering and code inspection workflows.

Abstract

The increasing adoption of WebAssembly (Wasm) for performance-critical and security-sensitive tasks drives the demand for WebAssembly program comprehension and reverse engineering. Recent studies have introduced machine learning (ML)-based WebAssembly reverse engineering tools. Yet, the generalization of task-specific ML solutions remains challenging, because their effectiveness hinges on the availability of an ample supply of high-quality task-specific labeled data. Moreover, previous works overlook the high-level semantics present in source code and its documentation. Acknowledging the abundance of available source code with documentation, which can be compiled into WebAssembly, we propose to learn representations of them concurrently and harness their mutual relationships for effective WebAssembly reverse engineering. In this paper, we present WasmRev, the first multi-modal pre-trained language model for WebAssembly reverse engineering. WasmRev is pre-trained using self-supervised learning on a large-scale multi-modal corpus encompassing source code, code documentation and the compiled WebAssembly, without requiring labeled data. WasmRev incorporates three tailored multi-modal pre-training tasks to capture various characteristics of WebAssembly and cross-modal relationships. WasmRev is only trained once to produce general-purpose representations that can broadly support WebAssembly reverse engineering tasks through few-shot fine-tuning with much less labeled data, improving data efficiency. We fine-tune WasmRev onto three important reverse engineering tasks: type recovery, function purpose identification and WebAssembly summarization. Our results show that WasmRev pre-trained on the corpus of multi-modal samples establishes a robust foundation for these tasks, achieving high task accuracy and outperforming the state-of-the-art ML methods for WebAssembly reverse engineering.
Paper Structure (33 sections, 6 equations, 11 figures, 2 tables)

This paper contains 33 sections, 6 equations, 11 figures, 2 tables.

Figures (11)

  • Figure 1: The relationship of engineering and reverse engineering among source code, code documentation, and WebAssembly code.
  • Figure 2: WasmRev overview.
  • Figure 3: Motivating example. (a) A function's source code. (b) The compiled WebAssembly in text format. (c) The C source code converted from WebAssembly. (d) The decompiled C-like syntax from WebAssembly. (e) The reverse engineering task results of WasmRev.
  • Figure 4: An illustration of WasmRev pre-training. The model architecture consists of 8 bidirectional Transformer layers. The model takes the concatenation of (documentation, source code, WebAssembly code) as input, and is pre-trained on M3LM, SSI and RII tasks.
  • Figure 5: A multi-modal masked language model example
  • ...and 6 more figures