1
+ <!DOCTYPE qhelp PUBLIC "-//Semmle//qhelp//EN" "qhelp.dtd">
2
+ <qhelp >
3
+
4
+ <overview >
5
+ <p >
6
+ Spring Framework provides an abstract base class <code >RemoteInvocationSerializingExporter</code >
7
+ for defining remote service exporters.
8
+ A Spring exporter, which is based on this class, deserializes incoming data using <code >ObjectInputStream</code >.
9
+ Deserializing untrusted data is easily exploitable and in many cases allows an attacker
10
+ to execute arbitrary code.
11
+ </p >
12
+ <p >
13
+ Spring Framework also provides two classes that extend <code >RemoteInvocationSerializingExporter</code >:
14
+ <li >
15
+ <code >HttpInvokerServiceExporter</code >
16
+ </li >
17
+ <li >
18
+ <code >SimpleHttpInvokerServiceExporter</code >
19
+ </li >
20
+ </p >
21
+ <p >
22
+ These classes export specified beans as HTTP endpoints that deserialize data from an HTTP request
23
+ using unsafe <code >ObjectInputStream</code >. If a remote attacker can reach such endpoints,
24
+ it results in remote code execution.
25
+ </p >
26
+ </overview >
27
+
28
+ <recommendation >
29
+ <p >
30
+ Avoid using <code >HttpInvokerServiceExporter</code >, <code >SimpleHttpInvokerServiceExporter</code >
31
+ and other exporters that are based on <code >RemoteInvocationSerializingExporter</code >.
32
+ Instead, use other message formats for API endpoints (for example, JSON),
33
+ but make sure that the underlying deserialization mechanism is properly configured
34
+ so that deserialization attacks are not possible. If the vulnerable exporters can not be replaced,
35
+ consider using global deserialization filters introduced by JEP 290.
36
+ In general, avoid deserialization of untrusted data.
37
+ </p >
38
+ </recommendation >
39
+
40
+ <example >
41
+ <p >
42
+ The following example defines a vulnerable HTTP endpoint:
43
+ </p >
44
+ <sample src =" UnsafeHttpInvokerEndpoint.java" />
45
+ </example >
46
+
47
+ <references >
48
+ <li >
49
+ OWASP:
50
+ <a href =" https://www.owasp.org/index.php/Deserialization_of_untrusted_data" >Deserialization of untrusted data</a >.
51
+ </li >
52
+ <li >
53
+ National Vulnerability Database:
54
+ <a href =" https://nvd.nist.gov/vuln/detail/CVE-2016-1000027" >CVE-2016-1000027</a >
55
+ </li >
56
+ <li >
57
+ Tenable Research Advisory:
58
+ <a href =" https://www.tenable.com/security/research/tra-2016-20" >[R2] Pivotal Spring Framework HttpInvokerServiceExporter readRemoteInvocation Method Untrusted Java Deserialization</a >
59
+ </li >
60
+ <li >
61
+ Spring Framework bug tracker:
62
+ <a href =" https://github.com/spring-projects/spring-framework/issues/24434" >Sonatype vulnerability CVE-2016-1000027 in Spring-web project</a >
63
+ </li >
64
+ <li >
65
+ OpenJDK:
66
+ <a href =" https://openjdk.java.net/jeps/290" >JEP 290: Filter Incoming Serialization Data</a >
67
+ </li >
68
+ </references >
69
+ </qhelp >
0 commit comments