Blind command injection
A script that checked SPF records passed the user-supplied domain into a shell command without sanitising it, so an attacker could append their own commands. Although the command output was not returned in the response, the attacker could make the server send the output of an executed command to a server they controlled, confirming remote command execution.
Published on bergee.it
Hi dear readers. This story is about how to find command injection, which leads to RCE getting “Thank you” in return :).
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 script concatenated the user-supplied domain parameter directly into a shell command without validation or escaping.
Impact
An attacker could run arbitrary commands on the server, leading to remote command execution, though the report notes the program was a VDP that only returned a thank-you email.
What the attacker needed
Access to the SPF-checking endpoint; attacker-controlled server reachable from target
How it was found
- Find a page that checks SPF records for a domain supplied in a request parameter.
- Send a request with the domain parameter and append a shell command separator and a simple command to test for injection.
- Observe that the response only shows PHP errors and no command output.
- Send a request that appends a command which makes the server connect to an attacker-controlled host and includes the output of an executed command as a parameter value.
- Check the attacker-controlled server and see the command output arrive, confirming blind command execution.
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.
The website had a feature that looked up email-sending rules for a domain you typed in. Behind the scenes it ran a system command using your text, and it did not clean that text first. By adding extra shell instructions, the author made the server run their own command and send the result to a server they controlled, even though the website itself showed no output.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.