|
ParameterInterceptor vulnerability allows remote command execution |
Who should read this |
All Struts 2 developers |
|---|---|
Impact of vulnerability |
Remote command execution |
Maximum security rating |
Critical |
Recommendation |
Developers should immediately upgrade to Struts 2.3.1.2 or read the following solution instructions carefully for a configuration change to mitigate the vulnerability |
Affected Software |
Struts 2.0.0 - Struts 2.3.1.1 |
Reporter |
Meder Kydyraliev, Google Security Team |
CVE Identifier |
OGNL provides, among other features, extensive expression evaluation capabilities. The vulnerability allows a malicious user to bypass all the protections (regex pattern, deny method invocation) built into the ParametersInterceptor, thus being able to inject a malicious expression in any exposed string variable for further evaluation.
A similar behavior was already addressed in S2-003 and S2-005, but it turned out that the resulting fix based on whitelisting acceptable parameter names closed the vulnerability only partially.
According to the regex pattern present into the ParametersInterceptor top'foo'(0) is a valid expression, unfortunately expression like this are further evaluated, hence resolved, by the OGNL parser. Then, a malicious user could inject into the foo var one of the following reserved keyword, bypassing the beforementioned filter:
The regex pattern inside the ParameterInterceptor was changed to provide a more narrow space of acceptable parameter names.
Furthermore the new setParameter method provided by the value stack will allow no more eval expression inside the param names.
|
It is strongly recommended to upgrade to Struts 2.3.1.2, which contains the corrected OGNL and XWork library. |
In case an upgrade isn't possible in a particular environment, there is a configuration based mitigation workaround:
The following additional interceptor-ref configuration, suggested by John Wilander, should mitigate the problem when applied correctly:
<interceptor-ref name="params"> <param name="acceptParamNames">\w+((\.\w+)|(\[\d+\])|(\['\w+'\]))*</param> </interceptor-ref> |
|
Beware that the above pattern doesn't allow the type conversion support for collection and map (those parameter names should be attached to acceptParamNames variable). |