← 返回列表

S2-052 Remote Code Execution attack when using the Struts REST plugin

聚合站 SecWiki新闻 入库 2026-11-17T22:45:42

DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.

Summary

Possible Remote Code Execution attack when using the Struts REST plugin with XStream handler to handle XML payloads
| Who should read this | All Struts 2 developers and users |
|---|---|
| Impact of vulnerability | A RCE attack is possible when using the Struts REST plugin with XStream handler to deserialise XML requests |
| Maximum security rating | Critical |
| Recommendation | Upgrade to Struts 2.5.13 or Struts 2.3.34 |
| Affected Software | Struts 2.1.6 - Struts 2.3.33, Struts 2.5 - Struts 2.5.12 |
| Reporter | Man Yue Mo \ (lgtm.com / Semmle). More information on the lgtm.com blog: https://lgtm.com/blog |
| CVE Identifier | CVE-2017-9805 |

Problem

The REST Plugin is using a XStreamHandler with an instance of XStream for deserialization without any type filtering and this can lead to Remote Code Execution when deserializing XML payloads.

Solution

Upgrade to Apache Struts version 2.5.13 or 2.3.34.

Backward compatibility

It is possible that some REST actions stop working because of applied default restrictions on available classes. In such case please investigate the new interfaces that was introduced to allow define class restrictions per action, those interfaces are:

Workaround

The best option is to remove the Struts REST plugin when not used. Alternatively you can only upgrade the plugin by dropping in all the required JARs (plugin plus all dependencies). Another options is to limit th plugin to server normal pages and JSONs only:

  1. Disable handling XML pages and requests to such pages \
  2. Override getContentType in XStreamHandler
public class MyXStreamHandler extends XStreamHandler { public String getContentType() {
 return "not-existing-content-type-@;/&%$#@";
 }
}
  1. Register the handler by overriding the one provided by the framework in your struts.xml
    \ \

[2人]赞了它

原文链接:https://cwiki.apache.org/confluence/display/WW/S2-052