Skip to content

Commit 4c1c12d

Browse files
coadaflorinJLLeitschuh
authored andcommitted
suggestions in list format
1 parent 1d7881e commit 4c1c12d

File tree

1 file changed

+37
-49
lines changed

1 file changed

+37
-49
lines changed

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

Lines changed: 37 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -37,55 +37,43 @@ protection measures.
3737
<p>
3838
Recommendations specific to particular frameworks supported by this query:
3939
</p>
40-
<table>
41-
<tbody>
42-
<tr>
43-
<th>Project</th>
44-
<th>Maven Coordinates</th>
45-
<th>Secure by Default</th>
46-
<th>Recommendation</th>
47-
</tr>
48-
<tr>
49-
<td>XMLDecoder</td>
50-
<td>Java Standard Library</td>
51-
<td>No</td>
52-
<td>Do not use with untrusted user input.</td>
53-
</tr>
54-
<tr>
55-
<td>ObjectInputStream</td>
56-
<td>Java Standard Library</td>
57-
<td>No</td>
58-
<td>Use a validating input stream, such as <code>org.apache.commons.io.serialization.ValidatingObjectInputStream</code>.</td>
59-
</tr>
60-
<tr>
61-
<td>FastJson</td>
62-
<td>com.alibaba:fastjson</td>
63-
<td>Partially</td>
64-
<td>Call <code>com.alibaba.fastjson.parser.ParserConfig#setSafeMode</code> with the argument <code>true</code> before deserializing untrusted data.</td>
65-
</tr>
66-
<tr>
67-
<td>SnakeYAML</td>
68-
<td>org.yaml:snakeyaml</td>
69-
<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>
70-
<td>Pass an instance of <code>org.yaml.snakeyaml.constructor.SafeConstructor</code> to <code>org.yaml.snakeyaml.Yaml</code>'s constructor before using it to deserialize untrusted data.</td>
71-
</tr>
72-
<tr>
73-
<td>FasterXML jackson-databind</td>
74-
<td>com.fasterxml.jackson.core:jackson-databind</td>
75-
<td>Yes</td>
76-
<td>
77-
Don't call <code>com.fasterxml.jackson.databind.ObjectMapper#enableDefaultTyping</code> and don't annotate any object fields with <code>@JsonTypeInfo(CLASS) or @JsonTypeInfo(MINIMAL_CLASS)</code> if untrusted data may be deserialized.
78-
Read <a href="https://cowtowncoder.medium.com/jackson-2-10-safe-default-typing-2d018f0ce2ba">this guide</a>.
79-
</td>
80-
</tr>
81-
<tr>
82-
<td>Kryo</td>
83-
<td>com.esotericsoftware:kryo and com.esotericsoftware:kryo5</td>
84-
<td>com.esotericsoftware:kryo >= 5.0.0 and com.esotericsoftware:kryo5 Yes</td>
85-
<td>Don't call <code>com.esotericsoftware.kryo(5).Kryo#setRegistrationRequired</code> with the argument <code>false</code> on any <code>Kryo</code> instance that may deserialize untrusted data.</td>
86-
</tr>
87-
</tbody>
88-
</table>
40+
<p><b>FastJson</b> - <code>com.alibaba:fastjson</code></p>
41+
<ul>
42+
<li><b>Secure by Default</b>: Partially</li>
43+
<li><b>Recommendation</b>: Call <code>com.alibaba.fastjson.parser.ParserConfig#setSafeMode</code> with the argument <code>true</code> before deserializing untrusted data.</li>
44+
</ul>
45+
<p></p>
46+
<p><b>FasterXML</b> - <code>com.fasterxml.jackson.core:jackson-databind</code></p>
47+
<ul>
48+
<li><b>Secure by Default</b>: Yes</li>
49+
<li><b>Recommendation</b>: 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.
50+
Read <a href="https://cowtowncoder.medium.com/jackson-2-10-safe-default-typing-2d018f0ce2ba">this guide</a>.</li>
51+
</ul>
52+
<p></p>
53+
<p><b>Kryo</b> - <code>com.esotericsoftware:kryo</code> and <code>com.esotericsoftware:kryo5</code></p>
54+
<ul>
55+
<li><b>Secure by Default</b>: Yes for <code>com.esotericsoftware:kryo5</code> and for <code>com.esotericsoftware:kryo</code> >= v5.0.0</li>
56+
<li><b>Recommendation</b>: Don't call <code>com.esotericsoftware.kryo(5).Kryo#setRegistrationRequired</code> with the argument <code>false</code> on any <code>Kryo</code> instance that may deserialize untrusted data.</li>
57+
</ul>
58+
<p></p>
59+
<p><b>ObjectInputStream</b> - <code>Java Standard Library</code></p>
60+
<ul>
61+
<li><b>Secure by Default</b>: No</li>
62+
<li><b>Recommendation</b>: Use a validating input stream, such as <code>org.apache.commons.io.serialization.ValidatingObjectInputStream</code>.</li>
63+
</ul>
64+
<p></p>
65+
<p><b>SnakeYAML</b> - <code>org.yaml:snakeyaml</code></p>
66+
<ul>
67+
<li><b>Secure by Default</b>: No</li>
68+
<li><b>Recommendation</b>: Pass an instance of <code>org.yaml.snakeyaml.constructor.SafeConstructor</code> to <code>org.yaml.snakeyaml.Yaml</code>'s constructor before using it to deserialize untrusted data.</li>
69+
</ul>
70+
<p></p>
71+
<p><b>XML Decoder</b> - <code>Standard Java Library</code></p>
72+
<ul>
73+
<li><b>Secure by Defauly</b>: No</li>
74+
<li><b>Recommendation</b>: Do not use with untrusted user input.</li>
75+
</ul>
76+
<p></p>
8977
</recommendation>
9078

9179
<example>

0 commit comments

Comments
 (0)