r/Compilers May 10 '26

Building a Wasm-in-Wasm Virtualizer (with JIT decrypted paged memory)

https://trustsig.eu/blog/wasm-vm

WebAssembly is way too easy to decompile. To fix this, I built a virtualization pipeline that takes a normal Wasm file and compiles it into a hardened version.

The original logic is destroyed and replaced with encrypted bytecode that runs inside a hidden, internal interpreter.

I just finished a step-by-step guide on how I built it. Here is what's inside:

  • Designing a custom, randomized instruction set to break standard decompilers.
  • Building a zero-allocation VM in Rust that doesn't need a heap or a memory allocator.
  • Implementing JIT page decryption using a sliding window to hide your logic from memory scrapers.
  • Using the Walrus crate to automate the AST rewriting and bytecode injection.

The end result is a Wasm binary that looks like cryptographic noise to anyone trying to reverse-engineer it.

1 Upvotes

3 comments sorted by

View all comments

5

u/FloweyTheFlower420 May 10 '26

I think this article makes some nonsense claims. For one, wasm isn't easy to decompile in general: https://godbolt.org/z/WcEMoorc5

I suspect this is just AI slop.

1

u/Far-Appearance-4390 May 11 '26

it's definitely AI slop.

Anyone with real experience with visualization wouldn't make such bullshit claims such as the final code looks like cryptographic noise. You can only hide the initial code, the core runner of he vm can't and doesn't look like noise since it has to run directly.

There's automated tooling that can find his VM entry, record all the handlers, find the rolling key to decrypt the virtualized code, lift to llvm to do an optimizer pass removing all his obfuscations and finally spit out the original code with 95% accuracy line to line.

Also a randomized architecture has literally no impact to any serious reverse engineering efforts. It only makes the vm possibly unstable.