Lab: OS command injection, simple case


Lab Scenario: Our objective is to explore and exploit an OS command injection vulnerability in a web application's stock level check feature. By intercepting and modifying a request, we aim to execute arbitrary commands and observe the response, highlighting the risks associated with such vulnerabilities. Let's embark on this journey using Burp Suite:
Intercepting the Request:
Use Burp Suite to intercept and modify a request that checks the stock level.
Identify the parameter susceptible to OS command injection, in this case, the
storeID
parameter.
Modifying the Parameter:
Modify the
storeID
parameter by injecting the value1|whoami
. This payload is designed to execute thewhoami
command, revealing the name of the current user.Observe that the modified request looks like this:
storeID=1|whoami
Observing the Response:
Forward the modified request and observe the response from the server.
Note that the response contains the name of the current user, demonstrating the successful execution of the injected OS command.
Conclusion: This simple lab exercise provides hands-on experience in exploiting an OS command injection vulnerability. By following this step-by-step guide, users can gain insights into the potential risks associated with command injection and the importance of securing web applications against such exploits. Stay informed, keep learning, and continue exploring the dynamic field of cybersecurity to contribute to a more secure online environment.
Reference:
https://portswigger.net/web-security/os-command-injection/lab-simple
Subscribe to my newsletter
Read articles from Ohekpeje Joel Odey directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Ohekpeje Joel Odey
Ohekpeje Joel Odey
Cybersecurity professional sharing insights on securing ecosystems, exploring cloud tech, and simplifying concepts for pros, enthusiasts, and beginners alike.