RCE via Apache Struts2 - Still out there.
The web application was running Apache Struts2 and was vulnerable to remote code execution via a crafted Content-Type header. An attacker could execute arbitrary commands on the server, and the author demonstrated root access.
Published on medium.com
Apache Struts2 was discovered years ago but still we can find instances of it around the internet.
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 used a vulnerable version of Apache Struts2 that evaluated OGNL expressions in the Content-Type header, leading to remote code execution.
Impact
An attacker could execute arbitrary commands on the server with root privileges, leading to full compromise.
What the attacker needed
Vulnerable Struts2 version; network access to the endpoint
The fix
The vulnerability was fixed by the vendor within a couple of days after reporting.
How it was found
- Identify that the web app runs Java using Wappalyzer.
- Search for endpoints ending with .action using Google dork.
- Send a crafted Content-Type header with an OGNL expression to test for vulnerability.
- Observe a new header with the result of the multiplication, confirming the vulnerability.
- Use a public exploit script to run commands and gain root access.
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 Struts2 is a framework for building Java web applications. A flaw in how it handled certain request headers allowed an attacker to inject code that the server would run, giving full control of the machine. The author found the vulnerable endpoints by searching for URLs ending in .action.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.