Return-Path: X-Original-To: apmail-struts-issues-archive@minotaur.apache.org Delivered-To: apmail-struts-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3D997101F8 for ; Wed, 24 Jul 2013 04:01:01 +0000 (UTC) Received: (qmail 71225 invoked by uid 500); 24 Jul 2013 04:01:01 -0000 Delivered-To: apmail-struts-issues-archive@struts.apache.org Received: (qmail 71203 invoked by uid 500); 24 Jul 2013 04:01:00 -0000 Mailing-List: contact issues-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list issues@struts.apache.org Received: (qmail 71033 invoked by uid 99); 24 Jul 2013 04:00:56 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jul 2013 04:00:56 +0000 Date: Wed, 24 Jul 2013 04:00:56 +0000 (UTC) From: "bruce liu (JIRA)" To: issues@struts.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (WW-4146) cache attack at OgnlUtil.expressions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/WW-4146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13717946#comment-13717946 ] bruce liu commented on WW-4146: ------------------------------- I think, maybe the point is what parameter should put into cache . in class com.opensymphony.xwork2.interceptor.ParametersInterceptor, method "protected void setParameters(final Object action, ValueStack stack, final Map parameters)", there is a loop like below : [code] for (Map.Entry entry : acceptableParameters.entrySet()) { String name = entry.getKey(); Object value = entry.getValue(); try { newStack.setParameter(name, value); } catch (RuntimeException e) { // some code do log here, i ignore it . } } [/code] when call "newStack.setParameter(name, value);" , it will call to OnglUtil.compile() which will cache all parameter name . here is my opinion: we should loop by properties in action , not parameteres input by user . properties in action class is fix, we can find out at request first time come to the action and cache it for later request . WDYT? > cache attack at OgnlUtil.expressions > ------------------------------------- > > Key: WW-4146 > URL: https://issues.apache.org/jira/browse/WW-4146 > Project: Struts 2 > Issue Type: Bug > Components: Expression Language > Affects Versions: 2.3.15.1 > Reporter: bruce liu > Fix For: 2.3.17 > > > in class com.opensymphony.xwork2.ognl.OgnlUtil, code : > {code:java} > tree = expressions.get(expression); > if (tree == null) { > tree = Ognl.parseExpression(expression); > expressions.putIfAbsent(expression, tree); > } > {code} > every parameter in the request cached in field expressions which is an instances of ConcurrentMap, use parameterName as key. so i construct huge different parameters that has different name (like "abc[123], abc[124]" ), they all cached in expressions, this cause outofmemory error, and let map acted like a list . -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira