bWAPP----PHP Code Injection

PHP Code Injection

主要代码

 1 <div id="main">
 2 
 3     <h1>PHP Code Injection</h1>
 4 
 5     <p>This is just a test page, reflecting back your <a href="<?php echo($_SERVER["SCRIPT_NAME"]);?>?message=test">message</a>...</p>
 6     
 7 <?php
 8 
 9 if(isset($_REQUEST["message"]))                                                              //这里接受message参数
10 {
11 
12     // If the security level is not MEDIUM or HIGH
13     if($_COOKIE["security_level"] != "1" && $_COOKIE["security_level"] != "2")               //如果是low级别执行下列代码
14     {
15 
16 ?>
17     <p><i><?php @eval ("echo " . $_REQUEST["message"] . ";");?></i></p>                      //直接echo  message
18 
19 <?php
20 
21     }
22 
23     // If the security level is MEDIUM or HIGH
24     else                                                                                   //如果不是low级别,进行echo函数过滤
25     {
26 ?>
27     <p><i><?php echo htmlspecialchars($_REQUEST["message"], ENT_QUOTES, "UTF-8");;?></i></p>
28 
29 <?php
30 
31     }
32 
33 }
34 
35 ?>
36 </div>

本人水平比较低,想到的是phpinfo(),然后直接上刀,看YouTube上的老外,直接命令执行反弹一个NC

原文地址:https://www.cnblogs.com/hongren/p/7215322.html