Debian Codegraph @

deps/libneon/doc/security.xml

raw
1 <sect1 id="security">
2
3 <title>HTTP Client Security</title>
4
5 <para>&neon; is intended to be secure against a specific threat
6 model: use of a malicious HTTP server. Under this threat model, a
7 range of attacks are possible against a client when the user (or
8 application) can be tricked into accessing an HTTP server which is
9 controlled by an attacker. This section documents various types of
10 possible attack and describes what mitigation is used in
11 &neon;.</para>
12
13 <sect2>
14 <title>CPU or memory consumption attacks</title>
15
16 <para>&neon; uses fixed resource limits to prevent the following
17 attacks:</para>
18
19 <itemizedlist>
20 <listitem>
21 <para>memory/CPU consumption attack using an unbounded number
22 of response header fields</para>
23 </listitem>
24
25 <listitem>
26 <para>memory consumption attack using an unbounded length of
27 individual response header lines (or continuation
28 headers)</para>
29 </listitem>
30
31 <listitem>
32 <para>memory consumption attack against the PROPFIND code
33 using an unbounded number of properties (propstat elements)
34 per resource</para>
35 </listitem>
36
37 <listitem>
38 <para>memory consumption attack against the PROPFIND code
39 using an unbounded CDATA element in a "flat property"
40 value</para>
41 </listitem>
42 </itemizedlist>
43
44 <para>Memory consumption attacks against applications based on
45 &neon; by use of unbounded response length are also possible, but
46 must be mitigated at application level. Memory consumption in
47 &neon; itself is fixed and is not proportional to the response
48 size.</para>
49
50 <para>Test cases for all the above attacks are present in the
51 &neon; test suite.</para>
52
53 </sect2>
54
55 <sect2>
56 <title>SSL/TLS connection security</title>
57
58 <para>When using a connection secured by SSL/TLS, it is necessary
59 for clients to verify that the X.509 certificate presented by the
60 server matches the server's expected identity. The algorithm
61 required for this purpose is described in RFC 2818 and RFC 3280,
62 and is implemented by &neon; in the following manner:</para>
63
64 <itemizedlist>
65 <listitem>
66 <para>the hostname argument passed to <xref
67 linkend="ne_session_create"/> is the expected identity of the
68 server</para>
69 </listitem>
70
71 <listitem>
72 <para>the subjectAltName extension of the certificate is used
73 for comparision against the expected identity, in preference
74 to the Subject name's commonName attribute.</para>
75 </listitem>
76
77 <listitem>
78 <para>the dNSName, iPAddress, and uniformResourceIdentifier
79 classes of GeneralName are supported in subjectAltName
80 comparison.</para>
81 </listitem>
82
83 <listitem>
84 <para>if no subjectAltName is present in the certificate, the
85 most specific commonName attribute in the Subject name is used
86 for comparison instead.</para>
87 </listitem>
88 </itemizedlist>
89
90 <para>In the case where a server certificate is presented that
91 does not match the expected identity (or is otherwise not
92 trusted), &neon; will fail the request by default. This behaviour
93 can be overridden by the use of a callback installed using <xref
94 linkend="ne_ssl_set_verify"/>, which allows the application to
95 present the certificate details to a user for manual/off-line
96 verification, if possible.</para>
97
98 <para>Test cases for the correctness of the implementation of the
99 identity verification algorithm are present in the &neon; test
100 suite.</para>
101
102 </sect2>
103
104 <sect2>
105 <title>Control character insertion in error messages</title>
106
107 <para>Where error messages (as returned by
108 (<xref linkend="ne_get_error"/>) contain data supplied by the
109 server, the untrusted data is sanitised to remove both control
110 characters and non-ASCII characters. This prevents any attacks
111 where such error messages are exposed to the user and can
112 potentially distort the presentation of the interface (for
113 example, through the use of a carriage return character in a text
114 user interface).</para>
115 </sect2>
116
117 <sect2>
118 <title>Attacks against authentication credentials</title>
119
120 <para>Authentication credentials can be compromised by a
121 "downgrade attack" by an active attacker; for example, where a
122 MITM presents a Basic authentication challenge in place of the
123 server's Digest challenge. &neon; mitigates these attacks by
124 allowing the application (and hence, user) to specify that only a
125 specific set of authentication protocols is permitted.</para>
126
127 <para>&neon; supports the Digest and Negotiate authentication
128 schemes, which both allow authentication of users without passing
129 credentials in cleartext over the wire. The "domain" parameter is
130 supported in Digest, allowing the server to restrict an
131 authentication session to a particular set of URIs.</para>
132
133 </sect2>
134
135 </sect1>