Re:JSFuck – Write any JavaScript with 6 Characters: []()!+
by nilliams on Friday September 13, 2013 @09:33AM
(#6380312)
Was it Billy Hoffman's 'JavaScript the Evil Parts'? http://blip.tv/jsconf/billy-hoffman-javascript-the-evil-part...
Re:JSFuck – Write any JavaScript with 6 Characters: []()!+
by IgorPartola on Friday September 13, 2013 @10:19AM
(#6380619)
Yes, that's the one.
Re:JSFuck – Write any JavaScript with 6 Characters: []()!+
by dzuc on Friday September 13, 2013 @11:37AM
(#6381151)
I recently did this exact thing for Ruby: https://github.com/dzucconi/negative
Re:JSFuck – Write any JavaScript with 6 Characters: []()!+
by Yoshi- on Saturday September 14, 2013 @05:32AM
(#6385130)
It is kinda irrelevant that the Same Origin Policy doesn't prevent requests since, you don't even need to use a javascript request, a simple image tag does the same
Re:JSFuck – Write any JavaScript with 6 Characters: []()!+
by frozenport on Friday September 13, 2013 @02:50PM
(#6382365)
I am worried about the file size.
Re:JSFuck – Write any JavaScript with 6 Characters: []()!+
by IgorPartola on Friday September 13, 2013 @03:20PM
(#6382533)
Don't worry about it? :)
Realistically, how big is your exploit? 30KB? So it'll be 30*7 = 210 KB (JS is actually 7 bit ASCII). That's plenty of code to do something malicious. Nothing is preventing you from minifying the code before converting it to this whitespace encoding.
I suppose you could make your encoding include other whitespace chars, like newlines, carriage returns, etc. Then you could use base 4 instead of base 2.
One of the great points in the talk was JS obfuscation. Now, there are many techniques for doing this, but I really like this one as it just looks cool. Since you can translate most functional JS into ASCII, you simply encode every character into a binary coding using spaces for 0 and tabs for 1. Then you write a very simple converter + put an eval() around it, and viola, you are running arbitrary code. To a casual observer it would look like you have delivered a mostly empty file, while in fact you are delivering perfectly valid JS. Not unbreakable, but certainly fun.