使用 Array 的构造函数在漏洞攻击包中混淆 Javascript
Obfuscated Javascript in an exploit kit using Array's constructor
我注意到漏洞利用工具包中有一些混淆 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
或者换句话说
> [].constructor.constructor("console.log('a');")()
a
有人可以解释一下这里发生了什么吗? Array的构造函数的构造函数是什么?
[].constructor.constructor("console.log('a');")()
a
SO..这是什么?
[].constructor.constructor
Function() { [native code] }
啊哈...所以这只是调用 Function
构造函数的一种方法,它接受一个字符串来求值...然后最后的括号调用它。
Function("console.log('a')")() // Works with or without `new`
a
您可以在任何 JS 控制台输入 [].constructor.constructor
并自行查找。
[].constructor
-> Array() { [native code] }
[].constructor.constructor
-> Function() { [native code] }
[].constructor.constructor("console.log('a');")()
-> a
我注意到漏洞利用工具包中有一些混淆 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
或者换句话说
> [].constructor.constructor("console.log('a');")()
a
有人可以解释一下这里发生了什么吗? Array的构造函数的构造函数是什么?
[].constructor.constructor("console.log('a');")()
a
SO..这是什么?
[].constructor.constructor
Function() { [native code] }
啊哈...所以这只是调用 Function
构造函数的一种方法,它接受一个字符串来求值...然后最后的括号调用它。
Function("console.log('a')")() // Works with or without `new`
a
您可以在任何 JS 控制台输入 [].constructor.constructor
并自行查找。
[].constructor
-> Array() { [native code] }
[].constructor.constructor
-> Function() { [native code] }
[].constructor.constructor("console.log('a');")()
-> a