Skip to content Skip to sidebar Skip to footer

Obfuscated Javascript In An Exploit Kit Using Array's Constructor

I noticed some obfuscated Javascript in an Exploit Kit > a = []['constructor'] Array() { [native code] } > b = a['constructor'] Function() { [native code] } > b('console.l

Solution 1:

[].constructor.constructor("console.log('a');")()

a

SO.. what is this?

[].constructor.constructor

Function() { [native code] }

Ahha... so it is just a way to invoke the Function constructor, which takes a string to eval... then the final parens invoke it.

Function("console.log('a')")()  // Works withorwithout `new`

a

Solution 2:

You can enter [].constructor.constructor into any JS console and find out for yourself.

[].constructor
  -> Array() { [native code] }
[].constructor.constructor
  -> Function() { [native code] }
[].constructor.constructor("console.log('a');")()
 -> a

Post a Comment for "Obfuscated Javascript In An Exploit Kit Using Array's Constructor"