Created
December 30, 2011 01:47
-
-
Save codeimpossible/1537211 to your computer and use it in GitHub Desktop.
get reference to window with obfuscated javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$=((([])[(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]]));$()["eval"]("alert(1)") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this takes advantage of a bug in javascripts implementation of Array.prototype.sort. When you assign the sort function to a global variable and call it with no arguments it will return
this
, which when called normally on an array would return the current array, but when it's called on the globally scoped variable it returns thewindow
object.