Skip to content

Commit 4e60f89

Browse files
committed
[Java] Document fixes for deserialization vulnerabilities by framework
Related #11603
1 parent f373b7f commit 4e60f89

File tree

1 file changed

+54
-1
lines changed

1 file changed

+54
-1
lines changed

java/ql/src/Security/CWE/CWE-502/UnsafeDeserialization.qhelp

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,59 @@ from the input stream removes the vulnerability.
5151

5252
</example>
5353

54+
<p>
55+
56+
Fixes by framework
57+
<table>
58+
<tbody>
59+
<tr>
60+
<th>Project</th>
61+
<th>Maven Cordinates</th>
62+
<th>Secure by Default</th>
63+
<th>Fix</th>
64+
</tr>
65+
<tr>
66+
<td>XMLDecoder</td>
67+
<td>Java Standard Library</td>
68+
<td>No</td>
69+
<td>Don't use XMLDecoder with untrusted user input. It is impossible to secure.</td>
70+
</tr>
71+
<tr>
72+
<td>ObjectInputStream</td>
73+
<td>Java Standard Library</td>
74+
<td>No</td>
75+
<td>Leverage a validating input stream like <code>org.apache.commons.io.serialization.ValidatingObjectInputStream</code></td>
76+
</tr>
77+
<tr>
78+
<td>FastJson</td>
79+
<td>com.alibaba:fastjson</td>
80+
<td>Partially</td>
81+
<td>Call <code>com.alibaba.fastjson.parser.ParserConfig#setSafeMode</code> with the argument <code>true</code></td>
82+
</tr>
83+
<tr>
84+
<td>SnakeYAML</td>
85+
<td>org.yaml:snakeyaml</td>
86+
<td><a href="https://bitbucket.org/snakeyaml/snakeyaml/wiki/CVE%20&amp;%20NIST.md">No</a>. <a href="https://bitbucket.org/snakeyaml/snakeyaml/issues/561/cve-2022-1471-vulnerability-in">Maintainer response</a>.</td>
87+
<td>Instantiate the <code>org.yaml.snakeyaml.Yaml</code> instance explicitly with an instance of <code>org.yaml.snakeyaml.constructor.SafeConstructor</code> as an argument.</td>
88+
</tr>
89+
<tr>
90+
<td>FasterXML jackson-databind</td>
91+
<td>com.fasterxml.jackson.core:jackson-databind</td>
92+
<td>Yes</td>
93+
<td>
94+
Don't call <code>com.fasterxml.jackson.databind.ObjectMapper#enableDefaultTyping</code> and don't annotate any object fields with <code>com.fasterxml.jackson.annotation.JsonTypeInfo</code> passing either the <code>CLASS</code> or <code>MINIMAL_CLASS</code> values to the annotation.
95+
Read <a href="https://cowtowncoder.medium.com/jackson-2-10-safe-default-typing-2d018f0ce2ba">this guide</a>.
96+
</td>
97+
</tr>
98+
<tr>
99+
<td>Kryo</td>
100+
<td>com.esotericsoftware:kryo and com.esotericsoftware:kryo5</td>
101+
<td>com.esotericsoftware:kryo versions including &amp; after 5.0.0 Yes; com.esotericsoftware:kryo5 Yes</td>
102+
<td>Don't call <code>com.esotericsoftware.kryo(5).Kryo#setRegistrationRequired</code> with the argument <code>false</code>.</td>
103+
</tr>
104+
</tbody>
105+
</table>
106+
54107
<references>
55108

56109
<li>
@@ -74,7 +127,7 @@ Alvaro Muñoz &amp; Christian Schneider, RSAConference 2016:
74127
</li>
75128
<li>
76129
SnakeYaml documentation on deserialization:
77-
<a href="https://bitbucket.org/asomov/snakeyaml/wiki/Documentation#markdown-header-loading-yaml">SnakeYaml deserialization</a>.
130+
<a href="https://bitbucket.org/snakeyaml/snakeyaml/wiki/Documentation#markdown-header-loading-yaml">SnakeYaml deserialization</a>.
78131
</li>
79132
<li>
80133
Hessian deserialization and related gadget chains:

0 commit comments

Comments
 (0)