DVWA Series 8 medium-level Command Execution Vulnerability
Set DVWA Security to medium, and click "View Source" in Command Execution to View the webpage Source code.
Here, the variable $ target used to receive the IP address entered by the user is filtered. The filtering method is to define a blacklist.
$ Substitutions = array ('&' => '', ';' => '',);
This line of statements defines an array and assigns it to the variable $ substitutions. The array contains two keys: & and;, and their corresponding values are NULL.
$ Target = str_replace (array_keys ($ substitutions), $ substitutions, $ target );
This line of statements replaces the characters in the $ target variable with the str_replace function by replacing array_keys ($ substitutions) with $ substitutions, that is, replace & and; both are replaced with null values.
Anyone who knows a little about network security knows that the blacklist is unreliable, because there are inevitable omissions in the blacklist, which provides an opportunity for hackers to bypass. As defined here, the blacklist only includes the & and; symbols. Through the analysis of the previous blog, we know that there are too many methods to bypass, for example, "|", "|", and ">. Therefore, the medium-level command execution vulnerability is actually very simple.