%ents; ]>
SASL Upgrade Tasks This specification provides a way to upgrade to newer SASL mechanisms using SASL2 tasks. &LEGALNOTICE; 0480 Experimental Standards Track Standards Council XMPP Core RFC 5802 XEP-0388 sut &tmolitor; 0.1.0 2023-05-04 XEP Editor: ks Promote to Experimental. 0.0.2 2022-12-30 tm Move SASL upgrade tasks from XEP-0388. 0.0.1 2022-10-19 tm Initial version.

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.

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 ]]> [...] SSdtIGJvcmVkIG5vdy4= 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 U28sIG5leHQgRk9TREVNIC0gMjAxOCwgdGhhdCBpcy4uLg== BLOOP-42 is cool! 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.

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;.

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.