DVWA - Command Injection (low, medium, high)

low

查看源碼

// Get input
$target = $_REQUEST[ 'ip' ];
// Determine OS and execute the ping command. 
if( stristr( php_uname( 's' ), 'Windows NT' ) ) { 
    // Windows 
    $cmd = shell_exec( 'ping  ' . $target ); 
} 
else { 
    // *nix 
    $cmd = shell_exec( 'ping  -c 4 ' . $target ); 
}

功能是ping我們提供的IP,一般可用
;
|
||
&
&&
來連接命令執行,low這個等級挑一個自己喜歡的就可以了。注入代碼如下

;ls

返回結果如下

help
index.php
source

medium

查看源碼,可發現PHP以黑名單的方式,過濾(刪除)&&和;兩個連接符,思路是選擇其他的連接符即可,比如|, ||, &。

high

查看源碼,可發現PHP以黑名單方式,過濾(刪除)&, ;, | , -, $, (, ), `和||,但是細心一點可以發現|後面有一個空格,所以還是可以用|來連接命令,即注入命令爲

|ls
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章