右键查看源码
<!--//1st$query = $_SERVER['QUERY_STRING'];if( substr_count($query, '_') !== 0 || substr_count($query, '%5f') != 0 ){die('Y0u are So cutE!');}if($_GET['b_u_p_t'] !== '23333' && preg_match('/^23333$/', $_GET['b_u_p_t'])){echo "you are going to the next ~";}!-->
进行了两次判断,首先是get的参数中不能带有_,其次是参数的值不能是23333,并且要以23333开始和结束。
第一个使用b.u.p.t绕过,第二个使用%0a换行符绕过。
进入secrettw.php,继续查看源码,发现一串jsfuck
运行后提示
使用post方式带上参数Merak提交,获得源码
<?phperror_reporting(0);include 'takeip.php';ini_set('open_basedir','.');include 'flag.php';if(isset($_POST['Merak'])){highlight_file(__FILE__);die();}function change($v){$v = base64_decode($v);$re = '';for($i=0;$i<strlen($v);$i++){$re .= chr ( ord ($v[$i]) + $i*2 );}return $re;}echo 'Local access only!'."<br/>";$ip = getIp();if($ip!='127.0.0.1')echo "Sorry,you don't have permission! Your ip is :".$ip;if($ip === '127.0.0.1' && file_get_contents($_GET['2333']) === 'todat is a happy day' ){echo "Your REQUEST is:".change($_GET['file']);echo file_get_contents(change($_GET['file'])); }?>
源码中提示Local access only!使用X-Forwarded-For,但是发现没有效果,换成Client-Ip后,成功绕过。
第二处验证file_get_contents($_GET['2333'])使用为协议绕过
最后传递file参数,使其读取flag.php即可,但是因为在file_get_contents之前被change函数处理过了,所以需要先处理一下:
$exp='flag.php';$re='';for($i=0;$i<strlen($exp);$i++){$re .= chr ( ord ($exp[$i]) - $i*2 );}$re=base64_encode($re);echo($re);
将编码后的exp传入file,提交得到flag。
