-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathDeserializedDelegate.qhelp
More file actions
35 lines (26 loc) · 954 Bytes
/
DeserializedDelegate.qhelp
File metadata and controls
35 lines (26 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>Deserializing a delegate object may result in remote code execution, when an
attacker can control the serialized data.</p>
</overview>
<recommendation>
<p>Avoid deserializing delegate objects, if possible, or make sure that the serialized
data cannot be controlled by an attacker.</p>
</recommendation>
<example>
<p>In this example, a file stream is deserialized to a <code>Func<int></code>
object, using a <code>BinaryFormatter</code>. The file stream is a parameter of a public
method, so depending on the calls to <code>InvokeSerialized</code>, this may or may not
pose a security problem.</p>
<sample src="DeserializedDelegateBad.cs" />
</example>
<references>
<li>
Microsoft:
<a href="https://docs.microsoft.com/en-us/dotnet/api/system.runtime.serialization.formatters.binary.binaryformatter">BinaryFormatter Class</a>.
</li>
</references>
</qhelp>