Re:JSNice: Statistical renaming, type inference, and deobfus...
by dsp1234 on Tuesday November 15, 2016 @12:14PM
(#12959987)
Just as a general thought, not specific to this product:
This is decrypted and eval'd at runtime
Most(all?) string-based obfuscators can be bypassed by simply replacing eval with a logging eval implementation.
var oldEval = eval; eval = function(str){console.log(str);oldEval(str)};
A similar patch to the Function constructor can bypass the other easy dynamic code generation code path.If at some point, a string needs to be evaluated as code, then it's possible to intercept that code and output it.
Re:JSNice: Statistical renaming, type inference, and deobfus...
by slig on Tuesday November 15, 2016 @06:06PM
(#12963142)
That didn't work on JScrambler. The function that does the decryption checks to see if the `eval` has been tampered. (IIRC it checks for a `prototype` property). And you can't modify the body of this function otherwise the decryption fails.
Re:JSNice: Statistical renaming, type inference, and deobfus...
by visarga on Tuesday November 15, 2016 @01:02PM
(#12960430)
So, all you need is to break a longer eval into multiple smaller ones, shuffle them and thus make it a chore to connect the evals back.
Re:JSNice: Statistical renaming, type inference, and deobfus...
by r0ckcg on Wednesday November 16, 2016 @12:46PM
(#12969403)
tried it, does not work I'm afraid...
Re:JSNice: Statistical renaming, type inference, and deobfus...
by k__ on Tuesday November 15, 2016 @07:46AM
(#12957529)
Ah, but they're SaaS, right?
So no webpack plugin, I guess :)
Re:JSNice: Statistical renaming, type inference, and deobfus...
by slig on Tuesday November 15, 2016 @07:50AM
(#12957542)
They're SaaS and I believe they do have a webpack plugin (I used their grunt plugin). The plugin will send your code to their servers and wait for it to come back.
Re:JSNice: Statistical renaming, type inference, and deobfus...
by lomnakkus on Tuesday November 15, 2016 @03:14PM
(#12961752)
Not sure what exactly they're promising wrt. the quality of obfuscation, but if it actually works "well enough" you'd imagine they should be happy for you to run an obfuscated version of their code[1] rather than shipping your JS to their servers. Hmm... :)
[1] I'm assuming it's written in JS. It might not, of course.
They do nice stuff, like hiding some of your strings, other literals and random predicates inside an encrypted string. This is decrypted and eval'd at runtime using the text of the decrypt function as a parameter i.e, you can't beautify it otherwise it stop working. The random predicates are merged within your code for instance: it appends a `&& somePredicateThatReturnsTrue(someOtherRandomValue)` to ifs conditions. It makes it really hard to figure out what is happening.