在一个盗号的钓鱼网站上看到这么几行代码,执行后会将网页重定向:
var _$=["\x6c\x6f\x63\x61\x74\x69\x6f\x6e","\x68\x72\x65\x66","\x68\x74\x74\x70\x3a\x2f\x2f\x75\x73\x65\x72\x2e\x71\x7a\x6f\x6e\x65\x2e\x71\x71\x2e\x63\x6f\x6d\x2f\x34\x30\x33\x33\x38\x32\x30\x33\x31\x2f\x34"];
top[_$[0]][_$[1]]=_$[2];
变量转义的结果为
["location", "href", "http://user.qzone.qq.com/xxxxxxxx/4"]
为什么用一个top的多维数组可以将代码等价于
location.href = "http://user.qzone.qq.com/xxxxxxxx/4"
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
这里执行的是:window.top.location.href 赋值
window[top][location][href] 赋值 对象的属性可以用[]访问
@fighterleslie 正解