From 93b1cec7d0925f781fb638818fc0ae85ec44ee7d Mon Sep 17 00:00:00 2001 From: Thilo Molitor Date: Fri, 30 Dec 2022 02:14:05 +0100 Subject: [PATCH] Update protoxep to include generic SASL2 upgrade tasks This part was split-out from XEP-0388 and moved to this XEP. --- inbox/xep-scram-upgrade.xml | 295 +++++++++++++++++++++++++++++++----- 1 file changed, 261 insertions(+), 34 deletions(-) diff --git a/inbox/xep-scram-upgrade.xml b/inbox/xep-scram-upgrade.xml index 0a292200..a67f1932 100644 --- a/inbox/xep-scram-upgrade.xml +++ b/inbox/xep-scram-upgrade.xml @@ -6,8 +6,8 @@
- SCRAM Upgrade Tasks - This specification provides a way to upgrade to newer SCRAM hash algorithms using a SASL2 upgrade task. + SASL Upgrade Tasks + This specification provides a way to upgrade to newer SASL mechanisms using SASL2 tasks. &LEGALNOTICE; xxxx ProtoXEP @@ -23,6 +23,12 @@ sut &tmolitor; + + 0.0.2 + 2022-12-30 + tm + Move SASL upgrade tasks from XEP-0388. + 0.0.1 2022-10-19 @@ -31,62 +37,260 @@
-

&xep0388; section 3 defines a way to upgrade to newer SASL mechanisms by providing the server with the needed data for that mechanism using upgrade tasks.

-

This specification uses those &xep0388; upgrade tasks to upgrade to newer SCRAM mechanisms using hash methods, which the server does not yet have the required data for.

-
- - -

This protocol was designed to allow the client to upgrade to newer SCRAM mechanisms.

+

While &xep0388; provides a modern and extensible way to use SASL in XMPP, it lacks support for SASL mechanism upgrades.

+

Modern XMPP server deployments typically store only the hash of a user's password, to improve account security. At times, it may be desirable for servers to upgrade to newer or different hash algorithms, e.g. so they can offer different authentication mechanisms for improved security or interoperability. Due to the security properties of one-way cryptographic hash algorithms, it is not possible for the server to extract the original data and simply hash it in a new format. To perform such upgrades, the cooperation of the client is necessary - because it has, or can obtain from the user, the original password to derive a hash from.

+

This specification fills that gap by providing a pluggable way to perform such SASL mechanism upgrades using &xep0388; tasks to provide the server with the needed data it does not yet have.

+

This specification also provides a concrete definition of SCRAM upgrade tasks in Section 3.

-

For upgrades of SCRAM mechanisms as defined in &rfc5802;, the server has to provide the needed data for the client to calculate the SaltedPassword as defined in this RFC (or some RFC updating it), namely the iteration count and salt. To do so the server sends a <salt/> element namespaced to "urn:xmpp:scram-upgrade:0" containing the salt and an attribute named "iteration" containing the iteration count as defined in that RFC, omitting the "s=" and "i=" prefix. The <salt/> element is contained within a <task-data/> wrapper element as defined in &xep0388;.

-

The client then calculates the SaltedPassword and sends back its base64 encoded value inside a <hash/> element namespaced to "urn:xmpp:scram-upgrade:0". The <hash/> element is contained within a <task-data/> wrapper element as defined in &xep0388;.

-

The name of the upgrade task MUST NOT conain the "-PLUS" suffix, because channel-binding is not relevant for upgrade tasks.

- element --> +

Clients capable of SASL mechanism upgrades defined herein MUST send the desired bare JID they want to authenticate for in the "from" attribute of the stream-header unless they don't know it (e.g. when using the GSS-API SASL mechanism etc.) according to section 4.7.1 of &rfc6120;. Providing the bare JID in the "from" attribute, rather than introducing additional nonzas, saves one round-trip, see &xep0388;.

+ +

To inform the client which SASL mechanism upgrades it supports, the server adds <upgrade/> elements in the namespace "urn:xmpp:sasl:upgrade:0", each containing the name of one upgrade task, to the SASL2 <authentication/> element inside the stream features.

+

Upgrade task names SHOULD have a prefix of "UPGR-" (to distinguish them from "normal" SASL mechanisms) followed by the SASL mechanism name to upgrade to, and if multiple mechanisms differ only in their support for channel-binding (e.g. SCRAM's -PLUS variants), implementations MUST use only the names of variants without channel-binding for the task names, because mechanism upgrades are independent of any channel-binding. Finally, upgrade tasks MUST NOT transmit plaintext passwords (or any reversible encoding of them) if the SASL mechanism to upgrade allows this to be avoided.

+ + + + + + + + SCRAM-SHA-1 + SCRAM-SHA-1-PLUS + + + + + + + UPGR-BLOOP2 + UPGR-BLOOP-42 + + + + + + + +]]> +
+ +

The client SHOULD always request one or more upgrade tasks it recognises. To do this, it includes the <upgrade/> element namespaced to "urn:xmpp:sasl:upgrade:0" in its <authenticate/> element listing the upgrade tasks it wants to perform, as specified in the Initiation section of &xep0388;, one <upgrade> element for each task.

+

Upon successfully authenticating the client (including any secondary authentication steps required for the account), but before the final <success/> would be sent, the server sends a <continue/> element, which MUST contain a single task, matching whatever was selected by the client. If the client selected more than one upgrade task, as sequence of upgrade tasks occur. The client then initiates this upgrade task by providing a corresponding <next/> element providing the task name and optionally including any further child-elements as defined by the specification for this concrete upgrade task.

+ + + UPGR-BLOOP2 + UPGR-BLOOP-42 + + cD10bHMtZXhwb3J0ZXIsLG49dXNlcixyPTEyQzRDRDVDLUUzOEUtNEE5OC04RjZELTE1QzM4RjUxQ0NDNg== + + AwesomeXMPP + Kiva's Phone + + +]]> + +[...] + + - - dj1tc1ZIcy9CeklPSERxWGVWSDdFbW1EdTlpZDg9 + SSdtIGJvcmVkIG5vdy4= - UPGR-SCRAM-SHA-256 + UPGR-BLOOP2 + This account requires an upgrade to BLOOP2 as requested by the client + +]]> +
+ +

Upon receiving the <next/> element for the upgrade, the server provides the elements and data needed for the client to calculate the requested data. The concrete elements and exchanges needed for the upgrade are specific to individual tasks. These tasks may be documented in other documents.

+
+ element --> + + + UGxlYXNlIHVwZ3JhZGUgbWUh + + + + + + + U28sIG5leHQgRk9TREVNIC0gMjAxOCwgdGhhdCBpcy4uLg== + BLOOP2 is cool! + + + + + + + Li4uSSdsbCBidXkgYSBiZWVyIGZvciB0aGUgZmlyc3QgcGVyc29uIHdoby4uLg== + 2 + + + + + + + SSdtIGJvcmVkIG5vdy4= + + + UPGR-BLOOP-42 + + This account requires an upgrade to BLOOP-42 as requested by the client - + + + UGxlYXNlIHVwZ3JhZGUgbWUh + + - + - - A_SXCRXQ6sek8bf_Z - + + U28sIG5leHQgRk9TREVNIC0gMjAxOCwgdGhhdCBpcy4uLg== + BLOOP-42 is cool! + - + - - BzOnw3Pc5H4bOLlPZ/8JAy6wnTpH05aH21KW2+Xfpaw= - + + Li4uSSdsbCBidXkgYSBiZWVyIGZvciB0aGUgZmlyc3QgcGVyc29uIHdoby4uLg== + 42 + - + user@example.org ]]>
+ +

For upgrades of SCRAM mechanisms as defined in &rfc5802;, the server has to provide the needed data for the client to calculate the SaltedPassword as defined in this RFC (or some RFC updating it), namely the iteration count and salt. To do so the server sends a <salt/> element namespaced to "urn:xmpp:scram-upgrade:0" containing the salt and an attribute named "iteration" containing the iteration count as defined in that RFC, omitting the "s=" and "i=" prefix. The <salt/> element is contained within a <task-data/> wrapper element as defined in &xep0388;.

+

The client then calculates the SaltedPassword and sends back its base64 encoded value inside a <hash/> element namespaced to "urn:xmpp:scram-upgrade:0". The <hash/> element is contained within a <task-data/> wrapper element as defined in &xep0388;.

+

The name of the upgrade task MUST NOT conain the "-PLUS" suffix, because channel-binding is not relevant for upgrade tasks.

+ + + + + + + + SCRAM-SHA-1 + SCRAM-SHA-1-PLUS + + + + + + + UPGR-SCRAM-SHA-256 + UPGR-SCRAM-SHA-512 + + + + + + + + + + + UPGR-SCRAM-SHA-256 + + cD10bHMtZXhwb3J0ZXIsLG49dXNlcixyPTEyQzRDRDVDLUUzOEUtNEE5OC04RjZELTE1QzM4RjUxQ0NDNg== + + AwesomeXMPP + Kiva's Phone + + + + + [...] + + + + + + dj1tc1ZIcy9CeklPSERxWGVWSDdFbW1EdTlpZDg9 + + + UPGR-SCRAM-SHA-256 + + + + + + + + + + A_SXCRXQ6sek8bf_Z + + + + + + + BzOnw3Pc5H4bOLlPZ/8JAy6wnTpH05aH21KW2+Xfpaw= + + + + + + user@example.org + + ]]> +
+ + +

For compatibility purposes, the server SHOULD keep the older authentication data (password hashes etc.) of all configured mechanisms to continue offering the same mechanisms as before.

+
+ -

Sending the password hash to the server (after authentication) is only protected by TLS and possibly channel-binding. Clients SHOULD use channel-binding, if available, to make sure no MITM can eavesdrop that hash and subsequently use it for authentication.

-

Note that a client can always choose to not take server-offered upgrades to newer SCRAM hash algorithms if it can not use channel-binding or the connection is otherwise deemed not secure enough.

+

Clients SHOULD use channel-binding, if available, when requesting an upgrade to make sure no MITM can eavesdrop that hash and subsequently use it for authentication. Note that a client can always choose to not upgrade SASL mechanisms if it can not use channel-binding or the connection is otherwise deemed not secure enough.

This document requires no interaction with &IANA;.

@@ -95,7 +299,25 @@

This specification does not need any interaction with the ®ISTRAR;.

- + + + + + + + + + + + + +]]> + + ]]> + + +

Thanks to Matthew Wild and Dave Cridland for all of their valuable feedback and improvements.

+
\ No newline at end of file