命令注入旁路滤波器

时间:2017-04-16 01:37:40

标签: php

我试图绕过整天这段代码,这段代码是来自DVWA高安全性,我试过字符,编码器等,但我没有得到一个很好的答案  有人知道可以绕过:

if( isset( $_POST[ 'submit' ] ) ) {

$target = $_REQUEST["ip"];

$target = stripslashes( $target );


// Split the IP into 4 octects
$octet = explode(".", $target);

// Check IF each octet is an integer
if ((is_numeric($octet[0])) && (is_numeric($octet[1])) && (is_numeric($octet[2])) && (is_numeric($octet[3])) && (sizeof($octet) == 4)  ) {

// If all 4 octets are int's put the IP back together.
$target = $octet[0].'.'.$octet[1].'.'.$octet[2].'.'.$octet[3];


    // Determine OS and execute the ping command.
    if (stristr(php_uname('s'), 'Windows NT')) { 

        $cmd = shell_exec( 'ping  ' . $target );
        echo '<pre>'.$cmd.'</pre>';

    } else { 

        $cmd = shell_exec( 'ping  -c 3 ' . $target );
        echo '<pre>'.$cmd.'</pre>';

    }

}

else {
    echo '<pre>ERROR: You have entered an invalid IP</pre>';
}
}

?>

1 个答案:

答案 0 :(得分:0)

这取决于您的DVWA的年龄。在2015年,标有&#34; High&#34;现在是&#34;不可能&#34;。

https://github.com/ethicalhack3r/DVWA/blob/87c987e2804a7fb11507a4c6b66dc49958572fe5/vulnerabilities/exec/source/impossible.php

根据你所写的内容,我没有任何方式可以绕过它。