[英]Obfuscated Javascript in an exploit kit using Array's constructor
I noticed some obfuscated Javascript in an Exploit Kit 我在漏洞利用工具包中发现了一些混淆的Javascript
> a = []["constructor"]
Array() { [native code] }
> b = a["constructor"]
Function() { [native code] }
> b("console.log('a');")
anonymous() {
console.log('a');
}
> b("console.log('a');")()
a
or in other words 或者换句话说
> [].constructor.constructor("console.log('a');")()
a
Can someone explain what's happening here? 有人可以解释这里发生了什么吗? What's the constructor of a constructor of an Array? 什么是数组的构造函数?
[].constructor.constructor("console.log('a');")()
a 一种
SO.. what is this? SO ..这是什么?
[].constructor.constructor
Function() { [native code] } Function(){[本地代码]}
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
构造Function
一种方法,该Function
需要将一个字符串赋值给eval ...然后最后的parens会调用它。
Function("console.log('a')")() // Works with or without `new`
a 一种
You can enter [].constructor.constructor
into any JS console and find out for yourself. 您可以在任何JS控制台中输入[].constructor.constructor
并[].constructor.constructor
查找。
[].constructor
-> Array() { [native code] }
[].constructor.constructor
-> Function() { [native code] }
[].constructor.constructor("console.log('a');")()
-> a
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.