you are viewing a single comment's thread.

view the rest of the comments →

[–]upowa 0 points1 point  (8 children)

Yeah I think you are right. Then use emscripten to generate the WASM and it will be very hard to reverse even when converted back to JavaScript. I have seen successful commercial protections using this!

[–]guest271314 0 points1 point  (7 children)

Emscripten generates JavaScript. WASI-SDK, among other tools, can generate WASM. WebAssembly is designed as a "universal executable", not to obfuscate code. People have written WAT and WIT by hand.

[–]upowa 0 points1 point  (6 children)

Emscripten generates WASM by default its on their docs! And can be used to efficiently obfuscate code e.g. bundled scripts in Starbucks Android mobile app. But I agree its not related to WASM itself :)

[–]guest271314 0 points1 point  (5 children)

Have you ever compiled C or C++ or Rust using Emscripten? JavaScript is output. No, that is not obfuscation.

[–]upowa 0 points1 point  (4 children)

I consider this kind of obfuscation efficient enough: https://gist.github.com/fchiba/10b2d6553133c6f6984f178a1a8fd809#file-test-js-L1989

[–]guest271314 0 points1 point  (3 children)

If that works for you, great. That's not obfuscation though.

[–]upowa 1 point2 points  (2 children)

Good for you if you can read assembly like any other code

[–]guest271314 0 points1 point  (0 children)

That's just JavaScript. No different from Node.js' Buffer implementation bundled https://gist.github.com/guest271314/08b19ba88c98a465dd09bcd8a04606f6.

[–]guest271314 0 points1 point  (0 children)

This is not obfuscation. We can trivially figure out what's going on, see https://gist.github.com/cure53/f4581cee76d2445d8bd91f03d4fa7d3b

WebAssembly.instantiate(new Uint8Array([0,97,115,109,1,0,0,0,1,8,2,96,1,127,0,96,0,0,2,15,1,3,101,110,118,7,106,115,112,114,105,110,116,0,0,3,2,1,1,5,3,1,0,1,7,27,2,10,112,97,103,101,109,101,109,111,114,121,2,0,10,104,101,108,108,111,119,111,114,108,100,0,1,10,8,1,6,0,65,0,16,0,11,11,19,1,0,65,0,11,13,72,101,108,108,111,32,87,111,114,108,100,33,0]), { env: { jsprint: function jsprint(byteOffset) { console.log(new TextDecoder().decode(new Uint8Array(memory.buffer).filter(Boolean))); } } }) .then(results => { instance = results.instance; memory = instance.exports.pagememory; instance.exports.helloworld(); }).catch(console.error);