Anti-AIClone

Log date · Tue

Can NotDec decompile WebAssembly, and is Wasm secret?

Wasm is not a secrecy boundary. We compare two modules with and without names and examine the scope of the NotDec paper.

Can Wasm keep logic secret?

Treat WebAssembly delivered to clients as inspectable code, not a secrecy boundary. Our two hand-built modules execute the same pricing calculation. The version with a name section is 65 bytes; the one without it is 46 bytes. Their export, code bytes and results for two inputs are identical. Removing names removes one clue, but leaves the calculation itself.

Our comparison
QuestionFinding
How many name sections?One in named; zero in minimal.
Results?120 for input 0 and 154 for input 2 in both.
What changed in code?The function body bytes are identical.

The NotDec paper’s v1 reached arXiv at 08:01 UTC on 2026-08-04, with a note that it was published at ICSE'26. [1] It studies how to recover more readable C and data structures from Wasm, beyond simply reading names.

Experiment: one computation, two metadata variants

NotDec is not available in our toolchain. We used Node.js 20.19.5’s WebAssembly engine to run a hand-encoded minimal binary and its JavaScript API to inspect exports and name sections. This illustrates the difference between metadata and code; it is neither a NotDec test nor a replication of the paper. The sample compares one integer function and two inputs, not decompilation quality on real optimized modules.

Text representation of the sample; we generated the hand-encoded binary.
(module (func (export "quote") (param i32) (result i32)
  local.get 0 i32.const 17 i32.mul i32.const 120 i32.add))

The named variant appends a custom name section labeling function index 0 as pricing; the minimal variant omits it. The specification describes the name section as printable names for definitions and says custom sections do not affect Wasm semantics. [4] The export name quote is part of the interface and remains in both variants.

Output from our run; code includes the local declaration and instructions.
minimal: bytes=46 name_sections=0
minimal: exports=quote quote(0)=120 quote(2)=154
minimal: code=00200041116c41f8006a0b
named: bytes=65 name_sections=1
named: exports=quote quote(0)=120 quote(2)=154
named: code=00200041116c41f8006a0b

The results confirm identical behavior for these two inputs, and identical function bodies show that removing the name did not alter this calculation. Hex bytes are not readable C and this sample does not demonstrate structure recovery. They do show that the binary representation still carries instructions needed for execution; the specification defines Wasm as a low-level instruction set with binary and text forms. [3]

What the paper measured

The paper describes lifting bytecode into an SSA intermediate representation, applying inter-procedural Retypd type recovery with pointer-versus-number differentiation, and using Memory SSA and structured control-flow analysis to emit C. [1] Type recovery infers data structures from their uses; it does not mean retrieving the original source, variable names or comments.

The authors report 100% recompilation success across all 5,241 Juliet samples and all Howard dataset programs, versus 45.95% for Ghidra; for struct member accesses in real-world programs they report 85.33% recovered versus 9.24%. These are the paper’s results, not our measurements. Recompilation and member-access recovery answer different questions; neither figure alone establishes readability or correctness for every output.

The paper also notes scalability challenges for the full inter-procedural version on large binaries. Its intra-procedural NotDec_F variant used less than half of Ghidra’s memory and up to 97% less time on unoptimized binaries. The project repository also warns that its C backend can fail on complex statements. [1][2] When assessing your own modules, retain failed cases and tool settings as well as successful output.

Recommendations by risk

These are engineering recommendations, not protection gains measured by our experiment. First distinguish public computation, diagnostic metadata and authority that belongs on a server.

Recommendations
QuestionFinding
Public client computationKeep necessary exports and record a readability baseline for release builds.
Names or debug informationInspect release artifacts; retain what diagnosis needs and store symbols securely.
Shared privileged credentialsKeep them on a controlled server and rotate exposed values.
Authorization or pricing decisionsValidate consequential decisions server-side and account for offline limits.

A server boundary also needs authentication, authorization and abuse controls; moving a function alone does not supply them. For offline features, define which decisions a client may make and how expiry or revocation is handled when service returns. Wasm’s sandbox restricts a module’s access to host capabilities, a separate issue from hiding code distributed to the user. [3]

Check your own module

Use the same JavaScript API on a release module you are authorized to inspect; replace the path below. This counts exports and name sections, but does not enumerate other debug information such as DWARF or prove that sensitive logic is absent.

Replace the path with your own release module.
node -e "const fs=require('fs'); const m=new WebAssembly.Module(fs.readFileSync(process.argv[1])); console.log(WebAssembly.Module.exports(m)); console.log('name sections:', WebAssembly.Module.customSections(m,'name').length)" path/to/your.wasm

Record the module’s origin, build version, compiler options, exports and debug information. Compare successive release artifacts rather than treating a debug build as representative. Spot-check important logic with tools your team accepts, preserving versions, commands, results and failures. Finally review the authority design: even when names are hard to read, a client receives and executes the computation.

Your checklist

  • Inventory shipped Wasm modules and their purposes.
  • Record exports, name sections and debug information in release builds.
  • Move shared privileged credentials server-side and rotate exposed values.
  • Validate consequential authorization and pricing decisions server-side.
  • Recheck your own artifacts after toolchain upgrades and retain results.

Primary sources

All sources and reproduction status ↗