author | Rich Burridge <rich.burridge@oracle.com> |
Wed, 07 Jan 2015 06:54:22 -0800 | |
branch | s11-update |
changeset 3590 | 1b75635bc6a3 |
parent 2969 | f8d4fd8116f7 |
permissions | -rw-r--r-- |
2969
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
1 |
Fix for CVE-2012-1833 |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
2 |
VMware SpringSource Grails before 1.3.8, and 2.x before 2.0.2, |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
3 |
does not properly restrict data binding, which might allow remote |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
4 |
attackers to bypass intended access restrictions and modify arbitrary |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
5 |
object properties via a crafted request parameter to an application. |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
6 |
|
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
7 |
See also |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
8 |
http://support.springsource.com/security/cve-2012-1833 |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
9 |
http://jira.grails.org/browse/GRAILS-8971 |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
10 |
http://jira.grails.org/browse/GRAILS-9027 |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
11 |
|
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
12 |
--- grails-1.0.3/src/groovy/org/codehaus/groovy/grails/plugins/web/ControllersGrailsPlugin.groovy 2008-06-06 10:25:10.000000000 +0000 |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
13 |
+++ grails-1.0.3/src/groovy/org/codehaus/groovy/grails/plugins/web/ControllersGrailsPlugin.groovy 2014-02-12 14:00:13.482080338 +0000 |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
14 |
@@ -473,13 +473,18 @@ |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
15 |
} |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
16 |
} |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
17 |
|
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
18 |
+ def newCommandObject = false; |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
19 |
if (!commandObject) { |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
20 |
commandObject = paramType.newInstance() |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
21 |
- ctx.autowireCapableBeanFactory.autowireBeanProperties(commandObject,AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false) |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
22 |
+ newCommandObject = true; |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
23 |
commandObjects << commandObject |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
24 |
} |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
25 |
def params = RCH.currentRequestAttributes().params |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
26 |
bind.invoke(commandObject, "bindData", [commandObject, params] as Object[]) |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
27 |
+ if (newCommandObject) { |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
28 |
+ ctx.autowireCapableBeanFactory?.autowireBeanProperties( |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
29 |
+ commandObject, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false) |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
30 |
+ } |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
31 |
def errors = commandObject.errors ?: new BindException(commandObject, paramType.name) |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
32 |
def constrainedProperties = commandObject.constraints?.values() |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
33 |
constrainedProperties.each {constrainedProperty -> |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
34 |
--- grails-1.0.3/src/web/org/codehaus/groovy/grails/web/binding/GrailsDataBinder.java 2008-06-06 10:25:10.000000000 +0000 |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
35 |
+++ grails-1.0.3/src/web/org/codehaus/groovy/grails/web/binding/GrailsDataBinder.java 2014-02-12 16:20:58.887401444 +0000 |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
36 |
@@ -102,6 +102,7 @@ |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
37 |
} |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
38 |
setDisallowedFields(disallowed); |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
39 |
setAllowedFields(ALL_OTHER_FIELDS_ALLOWED_BY_DEFAULT); |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
40 |
+ setIgnoreInvalidFields(true); |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
41 |
} |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
42 |
|
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
43 |
/** |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
44 |
--- grails-1.0.3/src/web/org/codehaus/groovy/grails/web/metaclass/DataBindingDynamicConstructor.java 2008-06-06 10:25:10.000000000 +0000 |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
45 |
+++ grails-1.0.3/src/web/org/codehaus/groovy/grails/web/metaclass/DataBindingDynamicConstructor.java 2014-02-12 16:22:04.259197011 +0000 |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
46 |
@@ -25,6 +25,7 @@ |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
47 |
import org.codehaus.groovy.grails.exceptions.GrailsDomainException; |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
48 |
import org.codehaus.groovy.grails.web.binding.DataBindingUtils; |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
49 |
import org.springframework.context.ApplicationContext; |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
50 |
+import org.springframework.beans.factory.config.AutowireCapableBeanFactory; |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
51 |
|
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
52 |
import javax.servlet.http.HttpServletRequest; |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
53 |
import java.util.Iterator; |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
54 |
@@ -63,18 +64,13 @@ |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
55 |
public Object invoke(Class clazz, Object[] args) { |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
56 |
Object map = args.length > 0 ? args[0] : null; |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
57 |
Object instance; |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
58 |
- if(applicationContext!=null && applicationContext.containsBean(clazz.getName())) { |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
59 |
- instance = applicationContext.getBean(clazz.getName()); |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
60 |
- } |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
61 |
- else { |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
62 |
|
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
63 |
- try { |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
64 |
- instance = clazz.newInstance(); |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
65 |
- } catch (InstantiationException e1) { |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
66 |
- throw new GrailsDomainException("Error instantiated class [" + clazz + "]: " + e1.getMessage(),e1); |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
67 |
- } catch (IllegalAccessException e1) { |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
68 |
- throw new GrailsDomainException("Illegal access instantiated class [" + clazz + "]: " + e1.getMessage(),e1); |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
69 |
- } |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
70 |
+ try { |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
71 |
+ instance = clazz.newInstance(); |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
72 |
+ } catch (InstantiationException e1) { |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
73 |
+ throw new GrailsDomainException("Error instantiated class [" + clazz + "]: " + e1.getMessage(),e1); |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
74 |
+ } catch (IllegalAccessException e1) { |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
75 |
+ throw new GrailsDomainException("Illegal access instantiated class [" + clazz + "]: " + e1.getMessage(),e1); |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
76 |
} |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
77 |
|
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
78 |
|
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
79 |
@@ -113,6 +109,11 @@ |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
80 |
} |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
81 |
} |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
82 |
|
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
83 |
+ if (applicationContext != null) { |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
84 |
+ applicationContext.getAutowireCapableBeanFactory().autowireBeanProperties( |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
85 |
+ instance, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false); |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
86 |
+ } |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
87 |
+ |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
88 |
return instance; |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
89 |
} |
f8d4fd8116f7
17673376 problem in UTILITY/GRAILS
Rich Burridge <rich.burridge@oracle.com>
parents:
diff
changeset
|
90 |