WASM

Change to a readable format

wasm2wat file.wasm -o file.wat

Or Ghidra with extension

https://github.com/nneonneo/ghidra-wasm-plugin

Dump it with wasm-objdump

wasm-objdump -x file.wasm

Load it on node.js or a browser

const fs = require('fs');
const wasmBuffer = fs.readFileSync('./file.wasm');

WebAssembly.instantiate(wasmBuffer).then(wasmModule => {
  console.log(wasmModule.instance.exports);
});

WASM?

BLUF: .wasm files are often used in web apps to hide logic, improve performance, or implement crypto/math.

Reverse engineer the logic, find hidden vulnerabilities, or bypass security controls.


What to do?

1. Understand what the .wasm is doing

2. Break it or bypass it

🧠 3. Map the attack surface


Workflow for Bug Bounty with .wasm

Step 1: Decompile to readable format

wasm2wat file.wasm -o file.wat

Or use:

🔎 Step 2: Inspect it

Look for:

Step 3: Rebuild and Patch

Modify logic in the .wat, then rebuild:

wat2wasm file.wat -o patched.wasm

Then serve it back in your browser using:

Step 4: Abuse the logic

fetch('file.wasm')
  .then(r => r.arrayBuffer())
  .then(buf => WebAssembly.instantiate(buf, { env: {} }))
  .then(mod => {
    console.log(mod.instance.exports);
    // try mod.instance.exports.checkPin(1234)
  });
;; original
if (condition) then
  call $fail

;; patch: remove fail call or flip the logic

Real-World Bug Bounty Wins

Example Description
Bypassing PIN validation .wasm checks PIN locally — patch to always return true.
Extracting API secrets A secret or key hardcoded in .wasm used for HMAC/auth.
Reversing challenge-response .wasm does challenge math to verify token — now you mimic it.
Breaking license checks .wasm validates a license — you flip the check.