Arbitrary Code Execution Affecting org.apache.struts:struts2-core package, versions [2.3.7, 2.3.32) [2.5.0, 2.5.10.1)
Threat Intelligence
Do your applications use this vulnerable package?
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applications- Snyk ID SNYK-JAVA-ORGAPACHESTRUTS-30207
- published 21 Mar 2017
- disclosed 5 Mar 2017
- credit Nike Zheng
How to fix?
Upgrade org.apache.struts:struts2-core
to version 2.3.32, 2.5.10.1 or higher.
Overview
org.apache.struts:struts2-core
is an elegant, extensible framework for building enterprise-ready Java web applications.
Affected versions of the package are vulnerable to Arbitrary Command Execution while uploading files with the Jakarta Multipart parser. This particular vulnerability can be exploited by an attacker by sending a crafted request to upload a file to the vulnerable server that uses a Jakarta-based plugin to process the upload request.
The attacker can then send malicious code in the Content-Type
, Content-Disposition
or Content-Length
HTTP headers, which will then be executed by the vulnerable server. A proof of concept that demonstrates the attack scenario is publicly available and the vulnerability is being actively exploited in the wild.
Although maintainers of the open source project immediately patched the vulnerability, Struts servers that have yet to install the update remain under attack by hackers who exploit it to inject commands of their choice.
This attack can be achieved without authentication. To make matters worse, web applications don't necessarily need to successfully upload a malicious file to exploit this vulnerability, as just the presence of the vulnerable Struts library within an application is enough to exploit the vulnerability.
References
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-5638
- https://exploit-db.com/exploits/41614
- https://www.exploit-db.com/exploits/41570/
- https://github.com/rapid7/metasploit-framework/pull/8072/commits/fc0f63e77471baa40057effaaa8be0f205adc6b7
- https://github.com/rapid7/metasploit-framework/issues/8064
- https://github.com/rapid7/metasploit-framework/pull/8072
- https://web.archive.org/web/20200917011847/https://github.com/tengzhangchao/Struts2_045-Poc
- https://cwiki.apache.org/confluence/display/WW/S2-045
- http://blog.talosintelligence.com/2017/03/apache-0-day-exploited.html