javascript函数劫持
javascript劫持其实就是将相关函数改成自己的
如这样
1 <html> 2 <head> 3 </head> 4 <body> 5 <script> 6 var _eval=eval; 7 eval=function(x) 8 { 9 if(typeof(x)=='undefined') 10 { 11 return; 12 } 13 alert(x); 14 _eval(x); 15 }; 16 eval('alert(1)'); 17 </script> 18 </body> 19 </html>
他会先弹出alert(1);
在弹出1;
下面这段代码在余弦大大那本书上firebug貌似报错啊
1 <html> 2 <head> 3 </head> 4 <body> 5 <script> 6 var _write=document.write.bind(document); 7 document.write=function(x) 8 { 9 if(typeof(x)=='undefined') 10 { 11 return; 12 } 13 _write(x); 14 }; 15 document.write("<script>alert(1)<\/script>"); 16 </script> 17 </body> 18 </html>
document.write("<script>alert(1)</script>")
需要在/前面添加转意符号\

浙公网安备 33010602011771号