bWAPP----HTML OS Command Injection - Blind


OS Command Injection - Blind

先上代碼,他判斷了win還是linux然后進行了ping但是結果並沒有返回。

 1 <div id="main">
 2 
 3     <h1>OS Command Injection - Blind</h1>
 4 
 5     <form action="<?php echo($_SERVER["SCRIPT_NAME"]);?>" method="POST">
 6 
 7         <p>
 8 
 9         <label for="target">Enter your IP address:</label>
10         <input type="text" id="target" name="target" value="">
11 
12         <button type="submit" name="form" value="submit">PING</button>
13 
14         </p>
15 
16     </form>
17     <?php
18 
19     if(isset($_POST["target"]))
20     {
21 
22         $target = $_POST["target"];
23 
24         if($target == "")
25         {
26 
27             echo "<font color=\"red\">Please enter your IP address...</font>";
28 
29         }
30 
31         else
32         {
33 
34             echo "Did you captured our GOLDEN packet?";
35 
36             if(PHP_OS == "Windows" or PHP_OS == "WINNT" or PHP_OS == "WIN32")
37             {
38 
39                 // Debugging
40                 // echo "Windows!";
41 
42                 // Increasing the PING count will slow down your web scanner!
43                 shell_exec("ping -n 1 " . commandi($target));
44 
45             }
46 
47             else
48             {
49 
50                 // Debugging
51                 // echo "Not Windows!";
52 
53                 // Increasing the PING count will slow down your web scanner!
54                 shell_exec("ping -c 1 " . commandi($target));
55 
56             }
57 
58         }
59 
60     }
61 
62     ?>
63 
64 </div>

看反應時間,沒有任何ping,只是返回一個信息,服務器的執行速度最快

 當服務器正常ping一次后,反應是17

 

當有命令注入時,多執行了一個命令,所以反應的時間會長,是25

 

如果是錯誤命令,服務器不執行,時間會在兩者之間。

 

根據時間的長短就能判斷服務器是否執行了注入的命令

防御代碼與 上一個命令注入相同。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM