Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Summary

Excerpt

Cross-Site Scripting Vulnerability in Debug Mode and in exposed JSP filesSpecial top object can be used to access Struts' internals


Who should read this

All Struts 2 developers and users

Impact of vulnerability

Affects of a cross-site scripting vulnerability when debug mode is switched on or JSPs are exposed in production environment.

Manipulation of Struts' internals, altering of user session

Maximum security rating

Low

Important

Recommendation

Turn off debug mode in production environment, apply tips from Security guideline to secure JSPs

Update regex used to excluded vulnerable incoming parameters. An upgrade to Struts 2.3.24.

20

1 is recommended.

Affected Software

Struts 2.0.0 - Struts Struts 2.3.

16.3

Reporter

Takayoshi Isayama, Mitsui Bussan Secure Directions, Inc. (vulnerability with JSPs)

24

Reporter

rskvp93 at gmail dot com from Viettel Information Security Center

anonymous (vulnerability with devMode)

CVE Identifier

CVE-2015-

5169

5209

Problem

When the Struts2 debug mode is turned on, under certain conditions an arbitrary script may be executed in the 'Problem Report' screen. Also if JSP files are exposed to be accessed directly it's possible to execute an arbitrary script.

Solution

It is generally not advisable to have debug mode switched on outside of the development environment. Debug mode should always be turned off in production setup. Also never expose JSPs files directly and hide them inside WEB-INF folder or define dedicated security constraints to block access to raw JSP files. Please also read our Security guide - it contains useful informations how to secure your application.

ValueStack defines special top object which represents root of execution context. It can be used to manipulate Struts' internals or can be used to affect container's settings

Solution

Applying better regex which includes pattern to exclude request parameters trying to use top object. We Struts >= 2.3.20 is not vulnerable to this attack. We recommend upgrading to Struts 2.3.24.20 or higher1.

Backward compatibility

No If an application is using parameter named top to access action's properties, it won't be set on the action. In other case no backward compatibility problems are expected.

Workaround

...

Applying the below patterns will solve the problem as well:

Code Block
"(^|\\%\\{)((#?)(top(\\.|\\['|\\[\")|\\[\\d\\]\\.)?)(dojo|struts|session|request|response|application|servlet(Request|Response|Context)|parameters|context|_memberAccess)(\\.|\\[).*",
"^(action|method):.*"