一句话:提出首个面向 WebAssembly 逆向工程的多模态预训练语言模型 WasmRev,融合源码、文档与 Wasm,实现免标注预训练与少样本微调。
WebAssembly 在性能敏感与安全敏感场景中的广泛采用,催生了对 Wasm 程序理解与逆向工程的需求。已有基于机器学习的逆向工具存在两点不足:一是依赖大量任务特定标注数据,泛化能力受限;二是仅使用从 WebAssembly 抽取的特征,忽略了对应源码与文档中的高层语义。作者注意到大量带文档的源码可被编译为 WebAssembly,因而提出同时学习源码、代码文档与编译所得 Wasm 的表示并利用其相互关联。为此他们设计了 WasmRev——首个面向 Wasm 逆向工程的多模态预训练语言模型:在大规模多模态语料上以自监督方式预训练,无需标注数据,并引入三个定制的多模态预训练任务以刻画 Wasm 特性与跨模态关系。WasmRev 只需训练一次即可产出通用表示,通过少样本微调支持多类逆向任务,提升数据效率。作者在类型恢复、函数用途识别与 Wasm 摘要三个任务上微调评估,结果显示其准确率高并优于当前最先进的机器学习方法。
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 trained models only with features extracted from WebAssembly, overlooking the high-level semantics present in the corresponding 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.