Home > Security Bulletins > S2-012 |

Apache Struts 2 Documentation
S2-012
Edit Page Browse Space Add Page Add News

## Summary

Showcase app vulnerability allows remote command execution

Who should read this | All Struts 2 developers
Impact of vulnerability | Remote command execution
Maximum security rating | Moderately Critical
Recommendation | Developers should immediately upgrade to Struts 2.3.14.1
Affected Software | Struts Showcase App 2.0.0 - Struts Showcase App 2.3.13
Reporter | Xgc Kxlzx, Alibaba Security Team
CVE Identifier | CVE-2013-1965
Original Description | Reported directly to security@a.o

## Problem

OGNL provides, among other features, extensive expression evaluation capabilities.
A request that included a specially crafted request parameter could be used to inject arbitrary OGNL code into a property, afterward used as request parameter of a redirect address, which will cause a further evaluation.

OGNL evaluation was already addressed in S2-003 and S2-005 and S2-009, but, since it involved just the parameter's name, it turned out that the resulting fixes based on whitelisting acceptable parameter names and denying evaluation of the expression contained in parameter names, closed the vulnerability only partially.

The second evaluation happens when redirect result reads it from the stack and uses the previously injected code as redirect parameter.
This lets malicious users put arbitrary OGNL statements into any unsanitized String variable exposed by an action and have it evaluated as an OGNL expression to enable method execution and execute arbitrary methods, bypassing Struts and OGNL library protections.

## Proof of concept

1. Run struts2-showcase
2. Open url: http://localhost:8080/struts2-showcase/skill/edit.action?skillName=SPRING-DEV
3. write skill name to %{expr} for example:
4. submit the form

The issue, in order to work, need a redirect result defined as the following:

### JUnit Version

## Solution

The OGNLUtil class was changed to deny eval expressions by default.

Icon

It is strongly recommended to upgrade to Struts 2.3.14.1, which contains the corrected OGNL and XWork library.