Remote command execution in Struts <= 2.2.3 (ExceptionDelegator) When an exception occurs while applying parameter values to properties, the value is evaluated as an OGNL expression. For example, this occurs when setting a string value to an integer property. Since the values are not filtered an attacker can abuse the power of the OGNL language to execute arbitrary Java code leading to remote command execution. This issue has been reported (https://issues.apache.org/jira/browse/WW-3668) and was fixed in Struts 2.2.3.1. However the ability to execute arbitrary Java code has been overlooked.
其实就是 S2-007。
S2-008-02
官方描述
1 2
Remote command execution in Struts <= 2.3.1 (CookieInterceptor) The character whitelist for parameter names isnot applied to the CookieInterceptor. When Struts is configured to handle cookie names, an attacker can execute arbitrary system commands with static methodaccessto Java functions. Therefore the flag allowStaticMethodAccess can be settotruewithin the request.
protectedvoidpopulateCookieValueIntoStack(String cookieName, String cookieValue, Map<String, String> cookiesMap, ValueStack stack) { if (cookiesValueSet.isEmpty() || cookiesValueSet.contains("*")) { // If the interceptor is configured to accept any cookie value // OR // no cookiesValue is defined, so as long as the cookie name match // we'll inject it into Struts' action ... cookiesMap.put(cookieName, cookieValue); stack.setValue(cookieName, cookieValue); } else { // if cookiesValues is specified, the cookie's value must match before we // inject them into Struts' action if (cookiesValueSet.contains(cookieValue)) { ... cookiesMap.put(cookieName, cookieValue); stack.setValue(cookieName, cookieValue); } } }
if (acceptedPattern.matcher(name).matches()) { ... }
S2-008-03
官方描述
1 2
Arbitrary File Overwrite in Struts <= 2.3.1 (ParameterInterceptor) While accessing the flag allowStaticMethodAccess within parameters is prohibited since Struts 2.2.3.1 an attacker can still accesspublic constructors withonly one parameter oftype String tocreatenew Java objects andaccess their setters withonly one parameter oftype String. This can be abused in example tocreateand overwrite arbitrary files. To inject forbidden characters into a filename an uninitialized string property can be used.
听说是 S2-009 的前身,那就之后再研究。
S2-008-04
官方描述
1 2
Remote command execution in Struts <= 2.3.17 (DebuggingInterceptor) While not being a security vulnerability itself, please note that applications running in developer modeand using the DebuggingInterceptor are prone to remote command execution as well. While applications should never run in developer mode during production, developers should be aware that doing so not onlyhas performance issues (as documented) but also a critical security impact.
elseif (COMMAND_MODE.equals(type)) { ValueStackstack= (ValueStack) ctx.getSession().get(SESSION_KEY); if (stack == null) { //allows it to be embedded on another page stack = (ValueStack) ctx.get(ActionContext.VALUE_STACK); ctx.getSession().put(SESSION_KEY, stack); } Stringcmd= getParameter(EXPRESSION_PARAM);
if (isClassExcluded(target.getClass(), member.getDeclaringClass())) { if (LOG.isWarnEnabled()) { LOG.warn("Target class [#0] or declaring class of member type [#1] are excluded!", target, member); } returnfalse; }