Wei Gao, Blog Author
Senior Security Research Engineer

CVE-2017-5638 Apache Struts2 Zero-day

March 9, 2017 by Wei Gao

Ixia's ATI team is investigating a 0-day Apache Struts2 vulnerability (CVE-2017-5638) initially reported by Cisco's TALOS team. Shortly after disclosure, in-the-wild exploits started hitting our honeypots. By combing through these hits, we were able to identify variations in the exploit for testing for our customers.


ATI Honeypot Captured Exploit Sample


The payload is a malicious Java code assigned to Content-Type in an HTTP request. The vulnerability is due to a bug in Jakarta's Multipart parser in Struts2. A successful exploit can lead to code execution. 

Vulnerability Analysis

Apache uses org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest to upload file.


In the exploit, #nike='multipart/form-data' will make the expression as true. Then function getMultiPartRequest() will be executed.  It will configure struts.multipart.parser attribute using org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest.



The struts.multipart.parser used by the fileUpload interceptor to handle HTTP POST requests, encoded using the MIME-type multipart/form-data, can be changed out. Currently there are two choices, jakarta and pell. The jakarta parser is a standard part of the Struts 2 framework and needs only its required libraries added to a project. The pell parser uses Jason Pell's multipart parser instead of the Commons-FileUpload library. The pell parser is a Struts 2 plugin, for more details see: pell multipart plugin. There was a third alternative, cos, but it was removed due to licensing incompatibilities.

Finally, Struts2 uses LocalizedTextUtil.findText in function buildErrorMessage to build the error message while the exploit takes advantage of LocalizedTextUtil.findText to execute OGNL commands.


Vulnerability Reproduce

Environment setup:

Tomcat 7, Struts 2.3.24

Struts-Blank web application is in vulnerable Struts 2.3.24 package and we use it to test the vulnerability.



The PoC is to try to inject an OGNL command into Content-type I HTTP GET request:


Running the PoC will create a text file in /tmp folder in the target:




If you are using Jakarta based file upload Multipart parser, upgrade to Apache Struts version 2.3.32 or


[1] https://cwiki.apache.org/confluence/display/WW/S2-045