2024 · Conference paper
WaDec: Decompiling WebAssembly Using Large Language Model
WaDec decompiles WebAssembly text (wat) into C by fine-tuning CodeLlama-7b with LoRA on loop-level wat–C snippet pairs. Functions are ordered by dependency and sliced so that each input holds at most one loop, with nested loops replaced by markers. Prompts add declarations of called functions, previously defined local variables and offset-to-string mappings; the outputs are then reassembled, with string constants restored and variables renamed. Training data come from 51,768 the-stack-dedup and 377 TheAlgorithms/C programs compiled with Emscripten. On 3,977 C files, the authors report 3.34% code inflation, 52.11% recompilability, 43.55% re-execution and 27.15% output consistency, compared with Wasm2c and Ghidra.
Scope and limitations
The reported rates are author results on C programs compiled to Wasm with Emscripten. About half of the outputs recompile, fewer than half re-execute and roughly a quarter reproduce the original output, so decompiled code is generally not semantically equivalent. The 3,977-file benchmark comes from the same two sources as the training programs. Optimized builds are not evaluated: the authors neither adapted the method to nor trained it on O1/O2 code. The model also handles data structures poorly, often flattening them into separate variables or arrays. Only C sources are studied; Wasm produced from other languages or toolchains is not evaluated. Baselines are Wasm2c and Ghidra's Wasm plugin, and LLM baselines were excluded because none could decompile Wasm functions without fine-tuning. Slicing means one function may be decompiled several times, at about 0.1 to 2 seconds per prompt.
Why it fits this collection
Adds LLM decompilation of WebAssembly with recompilation and re-execution checks, complementing the native-binary decompilation research in this section and the WebAssembly tools in the catalog.
Publication and review details
- Venue
- ASE 2024
- Status
- Conference paper
- Publication / posting date
- October 27, 2024
- Date source
- ACM-deposited Crossref metadata gives print and online publication on 2024-10-27. That is also the first day of the October 27–November 1 conference; the date comes from the publisher record, not from the conference schedule.
- First arXiv submission
- June 17, 2024
- arXiv
- 2406.11346
- Reviewed arXiv version
- v3
- DOI
- 10.1145/3691620.3695020
ACM's Crossref deposit gives the three-author order, pages 481–492 and publication on 2024-10-27. The reviewed arXiv v3 (2024-09-11, comment “This paper was accepted by ASE 2024”) carries the ACM reference format and DOI; v1 dates from 2024-06-17. The paper's footnote names github.com/XinyuShe/WaDec as the replication artifact, while its reference list and the README's clone command still point to an anonymous review mirror. The reviewed 2024-07-24 snapshot contains dataset-construction notebooks, an evaluation JSON file and inference and metric scripts, but no license file or declaration, so no open license is inferred. The README lists only Python 3.x and Git as prerequisites. It points to the wadecc/FGW2C dataset (110,096 examples, no license declared) and the wadecc/Wat2c model, a LoRA adapter whose configuration names codellama/CodeLlama-7b-hf as its base, so the base model's own license also applies. No dataset, model or code was downloaded or run.
Sources reviewed
Source review only; experiments were not rerun for this collection. Cite the original authors using the linked paper or BibTeX.
Primary sources
- https://dl.acm.org/doi/10.1145/3691620.3695020
- https://api.crossref.org/works/10.1145/3691620.3695020
- https://arxiv.org/abs/2406.11346
- https://arxiv.org/pdf/2406.11346v3
- README.md GitHub · XinyuShe/WaDec · Revision e244f71
- Scripts/infering.py GitHub · XinyuShe/WaDec · Revision e244f71
- https://huggingface.co/datasets/wadecc/FGW2C/blob/572a8501594303a369df1b0152812a5e9e0f16ed/README.md
- https://huggingface.co/wadecc/Wat2c/blob/e7e740ea819fedbc7da19b7a22f82b4b2c049a90/adapter_config.json