Command Injection PoC
A job listing site's filename parameter was vulnerable to command injection, allowing an attacker to execute arbitrary commands on the server. The attacker demonstrated this by causing time delays, receiving ICMP pings, and exfiltrating the /etc/passwd file.
{{media:0}}
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application passed the filename parameter directly into a shell command without sanitisation, enabling command injection.
Impact
An attacker could execute arbitrary commands on the server, potentially reading sensitive files and further compromising the system.
What the attacker needed
Access to the filename parameter
How it was found
- Test the filename parameter with a sleep command and observe a delay.
- Confirm with a longer sleep command and see a longer delay.
- Use ping to send ICMP packets to a controlled server and verify receipt with tcpdump.
- Use ngrok to receive HTTP requests from the vulnerable server via curl.
- Exfiltrate /etc/passwd by sending it to the ngrok address with curl -F.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Command injection is when a program passes user input to a system shell without proper filtering, so an attacker can run their own commands. Here, the filename field was used in a shell command, letting the attacker run commands like sleep or curl on the server.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.