NodeJS - Command Injection 4 (CMD-4)
Last updated
Last updated
Now that the app is running let's go hacking!
The command injecion is an attack in which the goal is execution of arbitrary commands on the host operating system via a vulnerable application. Command injection attacks are possible when an application passes unsafe user supplied data (forms, cookies, HTTP headers etc.) to a system shell. In the first step, the attacker needs to inspect the functioning of the web app in order to find possible injection points.
When we start the application we can see that there is a box where we can write an IP address in order to execute a ping against it.
First, we are going to try the functionality and execute the ping against the loopback address. We can also see the resulted output:
For this lab we are going to try to make the website show us the result of a malicious command executed by the system unintentionally. We start by trying methods like:
It seems that it may not be possible to execute OS commands taking advantage of the ping functionality. However, we suspect that maybe the website is filtering some of these special characters usually used for command execution so we try some new:
We finally could execute a command (whoami)!!
Now we try with another simple example:
Goal achieved and filter bypassed!