Blind OS command injection with output redirection
Last updated
Was this helpful?
Last updated
Was this helpful?
Navigating to the Submit Feedback page, you will notice four input fields:
Name
Subject
Message
The goal is to determine if one of these fields is vulnerable to command injection and whether the output can be redirected to the writable directory /var/www/images/
.
Using Burp Suite, intercept the feedback submission request. Below is an example of a normal intercepted request:
The request contains the user input as parameters, making it a good candidate for injection.
Modify the Email parameter to include the following payload:
This payload runs the command whoami
and saves it
||
is used to append and execute additional commands.
whoami
retrieves the current user running the application.
>/var/www/images/whoami.txt
redirects the output of the command to a file in the writable directory.
Submit the request with the modified payload.
To retrieve the saved command output:
Note that the application serves images from /var/www/images/
via a parameter filename=
in the URL.
Navigate to any image URL in your browser
modify the parameter to filename=whoami.txt
Visiting the URL, the browser displays the output of the whoami
command, confirming that the injection was successful. For example: