Arbitrary Command execution in Privacy Disclaimer page of a very popular organization
The organisation's website had Apache Struts development mode enabled, which exposes an OGNL debug console. An attacker could use the debug=command parameter with a crafted expression to execute arbitrary commands on the server.
pankajupadhyay.in
Published on pankajupadhyay.in
One fine evening, while exploring an organization’s ‘Security and Privacy’ page, I don’t remember how I came across a java stack trace. The last paragraph, after the stack trace caught my attention.
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 was deployed with struts.devMode set to true, leaving the OGNL debug console accessible.
Impact
An attacker could execute arbitrary commands on the server, potentially leading to full compromise.
What the attacker needed
Struts dev mode enabled; No authentication required
The fix
The issue was fixed by disabling development mode in production, for example by setting struts.devMode to false in struts.xml.
How it was found
- Find a Java stack trace on the Security and Privacy page.
- Notice the message that development mode is enabled.
- Research Struts dev mode and OGNL injection.
- Use the debug=command parameter with an expression parameter to execute commands.
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.
Apache Struts is a framework for building Java web applications. Development mode is a debugging feature that, when left on in production, lets anyone run Java expressions on the server. Because those expressions can call system commands, an attacker can take control of 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.