DNS exfiltration case study
A Tomcat web service was vulnerable to Expression Language injection, allowing remote code execution. The attacker could execute arbitrary OS commands and exfiltrate their output via DNS requests.
insinuator.net
Published on insinuator.net
Lately, we came across a remote code execution in a Tomcat web service by utilizing Expression Language. The vulnerable POST body field expected a number.
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
What the attacker needed
Network access to the vulnerable endpoint; attacker-controlled DNS server
How it was found
- Send a POST request with an EL expression in a field that expects a number.
- Observe the error message revealing EL execution and Java usage.
- Use the implicit `param` object to pass command arguments and execute commands via `Runtime.exec`.
- Use `waitFor()` to confirm command execution and check exit status.
- Exfiltrate command output by encoding it in DNS queries to an attacker-controlled domain.
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 web application took user input and evaluated it as a Java Expression Language (EL) expression, which is like a mini programming language. Because the input was not properly sanitised, an attacker could run system commands on the server. The output of those commands was then sent out through DNS queries to a server controlled by the attacker.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.