I once saw JavaScript code which was only written as multiple brackets ()
. Does anybody remember this kind of code? There was also an online converter to convert "normal" JS into this style of code. I want to show it while a presentation as an example of state of the art XSS. Or what are other really surprising XSS examples?
2 Answers
Found it
- http://sla.ckers.org/forum/read.php?24,33349
- http://security.bleurgh.net/javascript-without-letters-or-numbers
- http://sla.ckers.org/forum/read.php?24,28687
Converter to convert normal JS into brackets only JS:
-
2wow I didn't even think that was possible! time to modify my code filters! (and the next time somebody asks for an obfuscated program on codegolf.stackexchange.com I'll use this :) Commented Oct 20, 2011 at 1:24
-
3Wow. I'll confess, when I read your question, I thought, "Man, this guy really doesn't know what the hell he's talking about." (I've been writing JavaScript for years.) Now, seeing this? Head asplode. Commented Dec 15, 2011 at 15:13
This is an interesting find!
To those who are only just now finding out...
It is now obvious how you can create strings out of braces, and you could do things like window[gibberish](gibberish)
to eval something. What may not be clear is that you can do this without the word window
. All you need is a variable name (like $
or _
)
Run this prep code
$=~[];$={___:++$,$$$$:(![]+"")[$],__$:++$,$_$_:(![]+"")[$],_$_:++$,$_$$:({}+"")[$],$$_$:($[$]+"")[$],_$$:++$,$$$_:(!""+"")[$],$__:++$,$_$:++$,$$__:({}+"")[$],$$_:++$,$$$:++$,$___:++$,$__$:++$};$.$_=($.$_=$+"")[$.$_$]+($._$=$.$_[$.__$])+($.$$=($.$+"")[$.__$])+((!$)+"")[$._$$]+($.__=$.$_[$.$$_])+($.$=(!""+"")[$.__$])+($._=(!""+"")[$._$_])+$.$_[$.$_$]+$.__+$._$+$.$;$.$$=$.$+(!""+"")[$._$$]+$.__+$._+$.$+$.$$;$.$=($.___)[$.$_][$.$_]
You will have a function.
Run this to call alert(0)
on that function
$.$($.$($.$$+"\""+$.$_$_+(![]+"")[$._$_]+$.$$$_+"\\"+$.__$+$.$$_+$._$_+$.__+"("+$.___+")"+"\"")())();
<script>
tags, addonclick/onhover
-type methods to html tags, or useeval
on user provided input in your js, etc.). Then this just is obsfuscation.