Skip to content

Commit f61cfcb

Browse files
XEP-0440: Rework Security Considerations and related sections
1 parent 6329974 commit f61cfcb

File tree

1 file changed

+111
-50
lines changed

1 file changed

+111
-50
lines changed

xep-0440.xml

Lines changed: 111 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<!DOCTYPE xep SYSTEM 'xep.dtd' [
3-
<!ENTITY rfc5056 "<span class='ref'><link url='http://tools.ietf.org/html/rfc5056'>RFC 5056</link></span> <note>RFC 5056: On the Use of Channel Bindings to Secure Channels &lt;<link url='http://tools.ietf.org/html/rfc5056'>http://tools.ietf.org/html/rfc5056</link>&gt;.</note>" >
43
<!ENTITY iana-cb-types "<span class='ref'><link url='https://www.iana.org/assignments/channel-binding-types/channel-binding-types.xhtml'>IANA Channel-Binding Types Registry</link></span> <note>IANA Channel-Binding Types Registry &lt;<link url='https://www.iana.org/assignments/channel-binding-types/channel-binding-types.xhtml'>https://www.iana.org/assignments/channel-binding-types/channel-binding-types.xhtml</link>&gt;.</note>" >
54
<!ENTITY % ents SYSTEM 'xep.ent'>
65
%ents;
@@ -24,6 +23,17 @@
2423
<supersededby/>
2524
<shortname>sasl-cb-types</shortname>
2625
&flow;
26+
&tmolitor;
27+
<revision>
28+
<version>0.5</version>
29+
<date>2025-10-25</date>
30+
<initials>tm</initials>
31+
<remark>
32+
<ul>
33+
<li>Rework whole 'Interaction with SASL mechanisms' and 'Security Considerations' sections</li>
34+
</ul>
35+
</remark>
36+
</revision>
2737
<revision>
2838
<version>0.4.2</version>
2939
<date>2024-07-02</date>
@@ -32,7 +42,7 @@
3242
<ul>
3343
<li>Add an XML schema.</li>
3444
<li>Mention that this specification does add a new namespace that should go to the registrar.</li>
35-
<li>Fix indentation, typos, misuse of '' vs. &lt;/&gt; for elements, etc.</li>
45+
<li>Fix indentation, typos, misuse of '' vs. &lt;/&gt; for elements, etc.</li>
3646
</ul>
3747
</remark>
3848
</revision>
@@ -93,7 +103,7 @@
93103
basically unspecified.</p>
94104

95105
<p>The extension defined herein fills the gap left by &rfc6120;, by
96-
allowing the server the announce its supported channel-binding
106+
allowing the server to announce its supported channel-binding
97107
types.</p>
98108

99109
</section1>
@@ -108,7 +118,7 @@
108118
SHOULD be the "Channel-binding unique prefix" of a channel-binding
109119
type which was registered with the &iana-cb-types;.</p>
110120

111-
<p>A server declares that it supports particular channel-binding
121+
<p>A server declares that it supports a particular channel-binding
112122
types by listing the supported types via the &lt;sasl-channel-binding/&gt;
113123
stream feature defined herein. The &lt;sasl-channel-binding/&gt; element could
114124
appear next to the SASL &lt;mechanisms/&gt;
@@ -119,7 +129,7 @@
119129
&lt;authentication/&gt; stream-feature element as specified in the
120130
&xep0388;.</p>
121131

122-
<example caption='Example &lt;mechanisms/&gt; stream feature with SASL Channel-Binding Type Capability.'><![CDATA[
132+
<example caption='Example SASL1 &lt;mechanisms/&gt; stream feature with SASL Channel-Binding Type Capability.'><![CDATA[
123133
<stream:features>
124134
<sasl-channel-binding xmlns='urn:xmpp:sasl-cb:0'>
125135
<channel-binding type='tls-server-end-point'/>
@@ -132,60 +142,111 @@
132142
</mechanisms>
133143
</stream:features>]]></example>
134144

145+
<example caption='Example SASL2 &lt;authentication&gt; stream feature with SASL Channel-Binding Type Capability.'><![CDATA[
146+
<stream:features>
147+
<sasl-channel-binding xmlns='urn:xmpp:sasl-cb:0'>
148+
<channel-binding type='tls-server-end-point'/>
149+
<channel-binding type='tls-exporter'/>
150+
</sasl-channel-binding>
151+
<authentication xmlns='urn:xmpp:sasl:2'>
152+
<mechanism>SCRAM-SHA-1</mechanism>
153+
<mechanism>SCRAM-SHA-1-PLUS</mechanism>
154+
<inline>
155+
<sm xmlns='urn:xmpp:sm:3'/>
156+
<bind xmlns='urn:xmpp:bind:0'/>
157+
</inline>
158+
</authentication>
159+
</stream:features>]]></example>
160+
135161
</section1>
136162

137163
<section1 topic='Interaction with SASL mechanisms' anchor='sasl-mech-interaction'>
138164

139-
<p>Some channel-binding enabled SASL mechanisms reflect the server's
140-
presumed channel-binding abilities back to the server. This prevents
141-
SASL mechanism stripping attacks, where a Man in the Middle (MITM)
142-
removes certain SASL mechanisms in an attempt to downgrade the
143-
mechanism choosen for authentication to a non-channel-binding enabled
144-
one. An example of a SASL mechanism family with this feature is
145-
&rfc5802;. This standard specifies the gs2-cbind-flag. The flag has a
146-
tristate value of "I don't support channel-binding" (n), "I think you
147-
do not support channel-binding, but I do" (y), or, "Let us use
148-
channel-binding type X" (p).</p>
149-
150-
<p>Clients using the information provided
151-
via &lt;sasl-channel-binding/&gt; MAY want to indicate to the server
152-
that they do not support channel-binding (even if they do) if no
153-
mutual supported channel-binding type was found. The only alternative
154-
is, that the client signals the server that it believes that the server
155-
does not support channel binding. But this may cause the server to
156-
terminate the connection, because it indicates a potential ongoing
157-
SASL mechanism stripping attack.</p>
165+
<p>Client developers MUST follow the following rules to ensure that implementing this specification
166+
in conjunction with SCRAM (&rfc5802;) or any other SASL mechanism supporting channel-binding
167+
does not introduce a MITM attack vector.</p>
168+
169+
<ol>
170+
<li>Servers MUST implement tls-server-end-point and enable/advertise it.
171+
Clients SHOULD implement tls-server-end-point and use it if no other
172+
(stronger) channel-binding method is supported by both sides.</li>
173+
<li>If the client doesn't support channel-binding, it MUST send "n" in the GSS-header (see &rfc5802;).</li>
174+
<li>If the client supports channel-binding, but the server announced neither 'SCRAM-*-PLUS' nor
175+
channel-binding types (via this specification), it MUST send "y" in accordance to &rfc5802;.</li>
176+
<li>If the client is using SASL2 (&xep0388;) to authenticate and received announcements
177+
for 'SCRAM-*-PLUS' from the server, but no channel-binding types, it MUST abort the authentication
178+
(this is either an implementation error or ongoing MITM attack).
179+
This condition is undefined with SASL1 (&rfc6120;), but the client MAY also abort authentication
180+
in this case (or just randomly pick a channel-binding and hope for the best).</li>
181+
<li>If the client is using SASL2 to authenticate and it receives channel-binding announcements,
182+
from the server, but no 'SCRAM-*-PLUS' methods are announced, it MUST abort authentication
183+
(this is an implementation error or ongoing MITM attack). It SHOULD do the same when using SASL1.</li>
184+
<li>If the client is using either SASL1 or SASL2 to authenticate and receives announcements for
185+
'SCRAM-*-PLUS' methods and channel-binding types, but none of these announced channel-binding types are
186+
supported by it, it MUST abort authentication, if tls-server-end-point is also not advertised by the server
187+
(this is an ongoing MITM attack, as per our first rule above).</li>
188+
<li>The client SHOULD use a channel-binding stronger than tls-server-end-point, if advertised
189+
by the server and implemented by it (that is: set the p=&lt;channel-binding-name&gt; GSS-header
190+
to that channel-binding type according to &rfc5802;).</li>
191+
</ol>
192+
193+
<p>When implementing &xep0474; the above rules might be relaxed a bit, see that specification for details.</p>
158194

159195
</section1>
160196

161197
<section1 topic='Security Considerations' anchor='security'>
162198

163-
<p>If a client signals to the server that it does not support
164-
channel binding, because it found no mutual supported
165-
channel-binding types, another MITM attack
166-
vector is introduced. An active attacker could replace the
167-
&lt;sasl-channel-binding;&gt; list with channel bindings unlikely
168-
(or impossible) to be supported by the client. If the client is
169-
configured to use non-channel-binding SASL mechanisms as a fallback,
170-
this could be used to downgrade the connection security. Note that
171-
this attack is a different one than the SASL mechanism stripping one:
172-
Here the attacker tempers with the announced channel-binding types,
173-
i.e., the values within &lt;sasl-channel-binding;&gt;</p>
174-
175-
<p>Depending on the application's security policy, clients may
176-
refrain from falling back to non-channel-binding SASL mechanisms
177-
if no mutual supported channel-binding type is available.
178-
Alternatively, they may try channel-binding with a supported type
179-
nevertheless. To mitigate the attack describe above, clients
180-
could "pin" the announced channel bindings types by a service. In that
181-
case, implementations may want to allow the set of pinned channel-binding
182-
types to be extended to stronger ones.</p>
183-
184-
<p>As further mitigation, servers MUST and clients are RECOMMENDED to
185-
at least implement the channel-binding type tls-server-end-point (&rfc5929;)
186-
to increase the probability of a mutual supported channel-binding type. However,
187-
due its improved security properties, the tls-exporter (&rfc9266;) channel-binding
188-
type should be prefered over tls-server-end-point.</p>
199+
<p>The following considerations refer to SCRAM,
200+
as it is the only widely depolyed mechanism with channel binding
201+
at the time of writing this document.</p>
202+
203+
<p>In SCRAM (&rfc5802;) the client-first-message contains three possible values in the
204+
GSS-header part:</p>
205+
<ol>
206+
<li>y - The client would have used channel-binding, but the server did not offer any.</li>
207+
<li>n - The client does not support channel-binding (even if the server offered any).</li>
208+
<li>p=&lt;cb-name&gt; - The name of the channel-binding, the client wants to use.</li>
209+
</ol>
210+
211+
<p>The RFC explains, that sending "y" when the server advertised channel-binding
212+
support is to be used as a MITM-detection. An attacker stripping out all *-PLUS variants can be detected this way:
213+
the server knows it advertised them and the client reports via "y", that it would have used them if it saw them advertised,
214+
so the server can abort the authentication in this case.</p>
215+
216+
<p>This works reasonably well, if there is only one single channel-binding
217+
possible. But that's the exact assumption this specification now changes:
218+
it is now possible to advertise a list of different channel-bindings for the client
219+
to choose.</p>
220+
221+
<p>But this creates a problem: what to do if the server advertised a list of
222+
channel-binding algorithms, but the client doesn't support any of these?
223+
Assuming there is no MITM attacker present, the client can't send "y" in the GSS-header,
224+
because the server would then abort the authentication because it advertised channel-bindings.
225+
Sending "n" and continuing without channel-binding is fine in this case,
226+
but it won't be if a MITM attacker were present.
227+
<note>This isn't fully hypothetical. An older client might only support tls-unique,
228+
while the server only advertises tls-exporter (which can be used for tls 1.2,
229+
too, if the extended master secret is used).
230+
Blocking the connection entirely is of course at the discretion of the client
231+
developer, but it hinders interoperability, especially while phasing out one
232+
channel-binding-type and introducing a new one.</note></p>
233+
234+
<p>Any MITM attacker could just manipulate the list of channel-bindings advertised using this specification
235+
to just list some dummy mechanisms the client doesn't support. If the client acted like
236+
in the non-attacker case depicted in the last paragraph and sent "n",
237+
the attacker would have successfully downgraded the client to non-channel-binding.
238+
The client won't be able to distinguish the attacker case from the non-attacker one.</p>
239+
240+
<p>The rules in the <link url="#sasl-mech-interaction">Interaction with SASL mechanisms</link>
241+
section fix that loophole. Tls-server-end-point was picked, because it is the lowest denominator
242+
that can be implemented by virtually everyone and even though it isn't as strong as tls-exporter
243+
or tls-unique, it still catches many attacks.
244+
<strong>This only works reliably, if <em>every</em> server supports and announces tls-server-end-point.</strong></p>
245+
246+
<p>A client following the rules above and seeing a server-advertised list without
247+
tls-sever-end-point, immediately knows, that some attacker tampered with the list of channel-binding types
248+
and can abort the authentication. It never needs to send "n" even though it supports channel-binding and
249+
can still safely send "y" if it doesn't see any 'SCRAM-*-PLUS' variants and channel-bindings announced.</p>
189250

190251
</section1>
191252

0 commit comments

Comments
 (0)