4 ms·
> So I went back to the debugger and placed some breakpoints around where the WebAssembly module is loaded, realizing that its only purpose is to deobfuscate th
by xg15 7y ago
> So I went back to the debugger and placed some breakpoints around where the WebAssembly module is loaded, realizing that its only purpose is to deobfuscate the JavaScript that eventually makes it into that "SOURCE" pseudo-file I saw earlier. [...]
> So… the WebAssembly is essentially generating JavaScript on-the-fly. Of course, all renditions of the code do the same thing, but the variable names are changing. [...]
> So it seems the WebAssembly module is doing some sort of tampering checking, [...]
I remember various discussions when WASM was specced about the danger of WASM blobs being used for code obfuscation.
The fears were dismissed with the argument that WASM is easy to decompile and that there is a textual representation to preserve "view source" functionality.
And yet, as soon as WASM is practically usable, we get this - an application that uses WASM solely because it is hard to inspect in the browser.
- clktmr 7y agoJavascript can be obfuscated too. What is the difference?
- xg15 7y agoWell, someone went to the trouble of writing a Rust binary just to hide the game code, when they could have used standard JS obfuscation instead. This suggests to me that WASM has some properties that make reverse-engeneering harder than obfuscated JS could do alone. This would give some validity to the fears of WASM becoming the "new Flash" that were voiced when it was still in development.
- ReverseCold 7y ago> new Flash ... but Flash was easy to reverse too, just download the .swf file and use one of many tools to reverse engineer it. It's probably why there are so many "hacked" flash games available if you search for them.
- Arbalest 7y agoI never really found any of those tools. Granted I could have looked harder. Perhaps I was looking in the open source world too much and they usually came as binaries?
- tetris11 7y agohttps://github.com/AndreyMiloserdov/jpexs-flash-decompiler https://github.com/AndreyMiloserdov/jpexs-flash-decompiler
- deleted 7y ago[deleted]
- castwide 7y agoTo be fair, they probably have more practical reasons for using Rust than simply to obfuscate the code.
- paulddraper 7y agoYeah, it would seem that JS can be sufficiently obfuscated already.
- trilliumbaker 7y agoJavaScript has it covered pretty well. http://www.jsfuck.com/ http://www.jsfuck.com/
- kvakil 7y agojsfuck is hardly obfuscation: remove the first 828 bytes (for "eval(") and the last 3 bytes (for ")()"), and then execute the remaining string, and that gives you the original source code.
- afiori 7y agoYou would need to be able to dynamically find that 828, I think it is entirely trivial to have a jsfuck2 that produces a non deterministic "eval(" structure of arbitrary length.
- throwGuardian 7y agoWhy should someone be forced to make their IP "open" just because someone else on the internet feels entitled to read and potentially copy/modify/... their code?
- xg15 7y agoBecause the code is being executed on my machine, with my data, using my online identity. Until now, the general understanding for the web platform was that code that runs on a user's machine is also inspectable by that user. A large number of browser functions are developed with that understanding in mind. You can argue that this practice should be changed, but that would be a rather fundamental change to the way the web works and the advantages and disadvantages should be discussed. As a practical point: I don't condone cheating in multiplayer games, but the exact same obfuscation techniques that a game might use for legitimate reasons are also available to malware. If you make a general rule that programs should be hands-off to everyone except the devs (and browsers should change their tools accordingly), the same benefits will be given to malware.
- throwGuardian 7y ago> Because the code is being executed on my machine, with my data, using my online identity. You chose to execute someone else's code by visiting their website. The mere act of voluntarily executing someone else's code doesn't entitle you to it's source. Feel free to not visit the site, and looking at the top Alexa sites, your insistence of code audit-ability would leave you with very few viable, high quality choices. > general understanding for the web platform was that code.... Untrue. It just so happened that the early web was a collection of static documents, and js was a hack to add some trivial functionality. Only recently has the web turned into a full fledged app development platform. > fundamental change to the way the web works .... Again, this is an anachronistic view of the web. We're well past a collection of static documents > the same benefits will be given to malware ... Goes without saying that technology can and will be used for good and bad. While one can legislate to discourage the bad, simply demanding code to be open sourced, as an argument for deterrence is unture, inaccurate and hampers innovation. In summary: No one is entitled to someone else's web app code.