Skip to content

Commit bda2237

Browse files
Added another example for SpringExporterUnsafeDeserialization.ql
1 parent 82cb4a8 commit bda2237

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

java/ql/src/experimental/Security/CWE/CWE-502/SpringExporterUnsafeDeserialization.qhelp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<overview>
55
<p>
66
The Spring Framework provides an abstract base class <code>RemoteInvocationSerializingExporter</code>
7-
for defining remote service exporters.
7+
for creating remote service exporters.
88
A Spring exporter, which is based on this class, deserializes incoming data using <code>ObjectInputStream</code>.
99
Deserializing untrusted data is easily exploitable and in many cases allows an attacker
1010
to execute arbitrary code.
@@ -24,7 +24,8 @@ using unsafe <code>ObjectInputStream</code>. If a remote attacker can reach such
2424
it results in remote code execution in the worst case.
2525
</p>
2626
<p>
27-
CVE-2016-1000027 has been assigned to this issue in the Spring Framework. It is regarded as a design limitation, and can be mitigated but not fixed outright.
27+
CVE-2016-1000027 has been assigned to this issue in the Spring Framework.
28+
It is regarded as a design limitation, and can be mitigated but not fixed outright.
2829
</p>
2930
</overview>
3031

@@ -35,16 +36,20 @@ and any other exporter that is based on <code>RemoteInvocationSerializingExporte
3536
Instead, use other message formats for API endpoints (for example, JSON),
3637
but make sure that the underlying deserialization mechanism is properly configured
3738
so that deserialization attacks are not possible. If the vulnerable exporters can not be replaced,
38-
consider using global deserialization filters introduced by JEP 290.
39-
In general, avoid using Java's built-in deserialization methods on untrusted data.
39+
consider using global deserialization filters introduced in JEP 290.
4040
</p>
4141
</recommendation>
4242

4343
<example>
4444
<p>
45-
The following example defines a vulnerable HTTP endpoint:
45+
The following example shows how a vulnerable HTTP endpoint can be defined
46+
using <code>HttpInvokerServiceExporter</code> and Spring annotations:
4647
</p>
4748
<sample src="UnsafeHttpInvokerEndpoint.java" />
49+
<p>
50+
The next examples shows how the same vulnerable endpoint can be defined in a Spring XML config:
51+
</p>
52+
<sample src="UnsafeHttpInvokerEndpoint.xml" />
4853
</example>
4954

5055
<references>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<bean name="/account" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter">
2+
<property name="service" ref="accountService"/>
3+
<property name="serviceInterface" value="AccountService"/>
4+
</bean>

0 commit comments

Comments
 (0)