TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Improving our homemade JavaScript obfuscator

58 pointsby avastelover 5 years ago

8 comments

OskarSover 5 years ago
Ugh. This whole blog post is giving me the heebie-jeebies. Replacing all static accesses with dynamic ones, and with endless function calls everywhere has to destroy performance. You&#x27;re intentionally making it hard for the JIT compiler to do its work.<p>And for what? Obfuscating your code so that people don&#x27;t steal it or whatever? This kind of obfuscation can be easily and programmatically reversed engineered if someone really wants to, so... why do it? Just to screw with people trying to look at the source code of a web page?<p>People complain about JavaScript minifiers and WebAssembly that they&#x27;re making the web less open and hackable, but at least those things have a point to them. There&#x27;s a performance upside! This is just &quot;naah, lets make the web slower, more closed and less hackable, for... you know... reasons.&quot;
评论 #20916846 未加载
评论 #20916903 未加载
heavenlyblueover 5 years ago
If I were to be making a JavaScript obfuscator, I would simply start by rewriting the AST so that Exceptions would become the driver behind the code. That way, it would make it really hard to reverse the code without executing it.<p>Also sprinkle some parts of the code that check how much time it takes to execute it and then takes a different code path if it was interrupted.<p>What is done here is child&#x27;s play, the author is clearly not familiar with old-school assembly obfuscation - this code is one script away from being de-obfuscated.
评论 #20917707 未加载
评论 #20917380 未加载
评论 #20932455 未加载
userbinatorover 5 years ago
In my (extremely limited) experience with reversing JS, I&#x27;m pretty sure I&#x27;ve already seen these obfuscation techniques before, and common deobfuscators of the time had no problem reversing the transformation. It doesn&#x27;t stop anyone except the most easily discouraged.<p>(The JS that&#x27;s used to detect adblockers and&#x2F;or coerce you into viewing ads is often obfuscated. Those of you who have played around with this stuff may recognise this keyword: DtsBlkVFQx.)
garganzolover 5 years ago
The proposed scheme trashes the performance while providing a primitive protection that is statically observable (e.g. distinguishable) and thus easily reversible.<p>Looks insane, in a bad way.
basdpover 5 years ago
I would like to see the performance differences between the original and obfuscated. Most of the compiler optimizations are being made impossible by removing static access. Plus, a reverse-obfuscator is trivial for all those static-to-dynamic and base64 encoding.
评论 #20916318 未加载
cosmojgover 5 years ago
Code obfuscation is idiotic and pointless no matter what form it takes, but this example is particularly egregious. This accomplishes little more than degrading performance across the board for the <i>very real</i> end user (bye bye JIT optimizations) while requiring some <i>purely hypothetical</i> reverse engineer to write one additional script before (<i>gasp</i>) reading the code.<p>I&#x27;m genuinely curious how much time and money was wasted on this imbecilic venture.
评论 #20918810 未加载
bestestover 5 years ago
Aren&#x27;t JS obfuscators futile? The code will still end up in the JS VM, and you can&#x27;t really obfuscate the actual AST.
评论 #20918769 未加载
评论 #20916375 未加载
motohagiographyover 5 years ago
When I reviewed different obfuscator products, it was based on the idea it was only a &quot;speedbump,&quot; for our threat actors, and imposed the cost of someone having both the motive and means to reverse it.<p>If you would prefer that a summer student at an enterprise customer doesn&#x27;t replace your product with an in-house work-alike, it&#x27;s useful. Similar if it&#x27;s cheaper to buy your product than spending several hours reversing it.<p>If your business model relies on the integrity of a secret (key, derivation component, method, etc), it probably has a single, catastrophic failure mode and obfuscation isn&#x27;t your solution.