RFC 4616
The PLAIN Simple Authentication and Security Layer (SASL) Mechanism
RFC 4616: The PLAIN Simple Authentication and Security Layer (SASL) Mechanism π
okay bestie, this one is a Standards Track doc π It's from K. Zeilenga, Ed. at the OpenLDAP Foundation, dated August 2006. The only update line in the title block is Updates: 2595, and the Introduction says it replaces Section 6 of RFC 2595 β¨ It's from the Network Working Group, so it's very much an Internet-community-wide vibe π§
Status of This Memo β¨
This doc specifies an Internet standards track protocol for the Internet community, and it asks for discussion and suggestions for improvements π¬ For the standardization state and status of this protocol, check the current edition of the "Internet Official Protocol Standards" (STD 1). Distribution of this memo is unlimited πΈ
Copyright Notice π
Copyright (C) The Internet Society (2006).
Abstract π¦
So this doc defines a simple clear-text user/password Simple Authentication and Security Layer (SASL) mechanism called the PLAIN mechanism π It's meant to be used together with data confidentiality services from a lower layer, in protocols that don't have a simple password authentication command π
1. Introduction π
Clear-text, multiple-use passwords are simple, they work with almost every existing operating system authentication database, and they're useful for a smooth transition to a more secure password-based authentication mechanism β¨ The catch is that they're unacceptable over network connections where data confidentiality isn't ensured π
This document defines the PLAIN Simple Authentication and Security Layer ([SASL]) mechanism for protocols with no clear-text login command (e.g., [ACAP] or [SMTP-AUTH]). It updates RFC 2595, replacing Section 6. Changes since RFC 2595 are detailed in Appendix A π
The name for this mechanism is "PLAIN" π«Ά
The PLAIN SASL mechanism does not provide a security layer π
The PLAIN mechanism should not be used without adequate data security protection, because it gives no integrity or confidentiality protections on its own π It's meant to be paired with data security protections from the application-layer protocol, usually via its use of Transport Layer Security ([TLS]) services π
By default, implementations SHOULD advertise and make use of the PLAIN mechanism only when adequate data security services are in place π‘οΈ Specifications for IETF protocols that say this mechanism is an applicable authentication mechanism MUST mandate that implementations support a strong data security service, such as TLS π
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [Keywords] π
2. PLAIN SASL Mechanism π₯
The whole mechanism is a single message, a string of [UTF-8] encoded [Unicode] characters, sent from the client to the server π¨ The client sends the authorization identity (the identity to act as), then a NUL (U+0000) character, then the authentication identity (the identity whose password gets used), then another NUL (U+0000) character, then the clear-text password π§© Same as other SASL mechanisms, the client does not provide an authorization identity when it wants the server to derive one from the credentials and use that as the authorization identity πͺ
The formal grammar for the client message, using Augmented BNF [ABNF], goes like this:
message = [authzid] UTF8NUL authcid UTF8NUL passwd
authcid = 1*SAFE ; MUST accept up to 255 octets
authzid = 1*SAFE ; MUST accept up to 255 octets
passwd = 1*SAFE ; MUST accept up to 255 octets
UTF8NUL = %x00 ; UTF-8 encoded NUL character
SAFE = UTF1 / UTF2 / UTF3 / UTF4
;; any UTF-8 encoded Unicode character except NUL
UTF1 = %x01-7F ;; except NUL
UTF2 = %xC2-DF UTF0
UTF3 = %xE0 %xA0-BF UTF0 / %xE1-EC 2(UTF0) /
%xED %x80-9F UTF0 / %xEE-EF 2(UTF0)
UTF4 = %xF0 %x90-BF 2(UTF0) / %xF1-F3 3(UTF0) /
%xF4 %x80-8F 2(UTF0)
UTF0 = %x80-BF
The authorization identity (authzid), authentication identity (authcid), password (passwd), and NUL character delimiters SHALL be transferred as [UTF-8] encoded strings of [Unicode] characters π¦ Since the NUL (U+0000) character is used as a delimiter, the NUL (U+0000) character MUST NOT appear in the authzid, authcid, or passwd productions π«
The form of the authzid production is specific to the application-level protocol's SASL profile [SASL] π The authcid and passwd productions are form-free π Using non-visible characters, or characters a user may be unable to enter on some keyboards, is discouraged β¨οΈ
Servers MUST be capable of accepting authzid, authcid, and passwd productions up to and including 255 octets π Heads up that the UTF-8 encoding of a Unicode character may be as long as 4 octets π
When the message arrives, the server verifies the presented authentication identity (authcid) and password (passwd) against the system authentication database. It also verifies that the authentication credentials let the client act as the presented (or derived) authorization identity (authzid). If both steps succeed, the user is authenticated π₯³
The presented authentication identity and password strings, plus the database authentication identity and password strings, are to be prepared before they're used in verification π§Ό The [SASLPrep] profile of the [StringPrep] algorithm is the RECOMMENDED preparation algorithm π SASLprep is recommended because it helps comparisons behave the way you'd expect β¨ It's not mandatory, though, so the server can use other preparation algorithms (including none) when that makes sense. For example, a different preparation algorithm might be needed for the server to interoperate with an external system π
When preparing the presented strings with [SASLPrep], they're treated as "query" strings (Section 7 of [StringPrep]), so unassigned code points are allowed in their prepared output π When preparing the database strings with [SASLPrep], they're treated as "stored" strings (Section 7 of [StringPrep]), so unassigned code points are prohibited from appearing in their prepared output π·
No matter which preparation algorithm is used, if the output of a non-invertible function (e.g., hash) of the expected string is stored, the string MUST be prepared before it's input to that function π
No matter which preparation algorithm is used, if preparation fails or results in an empty string, verification SHALL fail β
When no authorization identity is provided, the server derives an authorization identity from the prepared representation of the provided authentication identity string πͺ This means different representations of the authentication identity produce the same authorization identity π
The server MAY use the credentials to initialize any new authentication database, such as one suitable for [CRAM-MD5] or [DIGEST-MD5] π±
3. Pseudo-Code π§
This section has pseudo-code showing the verification process (using hashed passwords and the SASLprep preparation function) that we just talked about. This section is not definitive π«§
boolean Verify(string authzid, string authcid, string passwd) {
string pAuthcid = SASLprep(authcid, true); # prepare authcid
string pPasswd = SASLprep(passwd, true); # prepare passwd
if (pAuthcid == NULL || pPasswd == NULL) {
return false; # preparation failed
}
if (pAuthcid == "" || pPasswd == "") {
return false; # empty prepared string
}
storedHash = FetchPasswordHash(pAuthcid);
if (storedHash == NULL || storedHash == "") {
return false; # error or unknown authcid
}
if (!Compare(storedHash, Hash(pPasswd))) {
return false; # incorrect password
}
if (authzid == NULL ) {
authzid = DeriveAuthzid(pAuthcid);
if (authzid == NULL || authzid == "") {
return false; # could not derive authzid
}
}
if (!Authorize(pAuthcid, authzid)) {
return false; # not authorized
}
return true;
}
The second parameter of the SASLprep function, when true, means unassigned code points are allowed in the input π When SASLprep is called to prepare the password before computing the stored hash, the second parameter would be false π
The second parameter given to the Authorize function is not prepared by this code. The application-level SASL profile should be consulted to figure out what preparation, if any, is necessary π
Heads up that the DeriveAuthzid and Authorize functions need knowledge and understanding of the mechanism and the application-level protocol specification and/or implementation details to implement. That's true whether they're one function or two, and whether they're designed so the mechanism implementation can be reused elsewhere π§
The Authorize function outcome is clearly dependent on details of the local authorization model and policy ποΈ Both functions may depend on other factors too β¨
4. Examples π
This section has examples of PLAIN authentication exchanges. They're there to help you understand the text above. The examples are not definitive π«Ά
"C:" and "S:" mark lines sent by the client and server, respectively. <NUL> represents a single NUL (U+0000) character. The Application Configuration Access Protocol ([ACAP]) is used in the examples π
The first example shows how the PLAIN mechanism might be used for user authentication π
S: * ACAP (SASL "CRAM-MD5") (STARTTLS)
C: a001 STARTTLS
S: a001 OK "Begin TLS negotiation now"
<TLS negotiation, further commands are under TLS layer>
S: * ACAP (SASL "CRAM-MD5" "PLAIN")
C: a002 AUTHENTICATE "PLAIN"
S: + ""
C: {21}
C: <NUL>tim<NUL>tanstaaftanstaaf
S: a002 OK "Authenticated"
The second example shows how the PLAIN mechanism might be used to try to assume the identity of another user π³ In this one, the server rejects the request. This example also uses the protocol's optional initial response capability to skip a round-trip πββοΈ
S: * ACAP (SASL "CRAM-MD5") (STARTTLS)
C: a001 STARTTLS
S: a001 OK "Begin TLS negotiation now"
<TLS negotiation, further commands are under TLS layer>
S: * ACAP (SASL "CRAM-MD5" "PLAIN")
C: a002 AUTHENTICATE "PLAIN" {20+}
C: Ursel<NUL>Kurt<NUL>xipj3plmq
S: a002 NO "Not authorized to requested authorization identity"
5. Security Considerations β¨
okay bestie, this section is SERIOUS and I'm not gonna sugarcoat it ππ«Ά. PLAIN sends the password with zero integrity or confidentiality protection of its own, so it should not be used without adequate external data security protection, like the TLS services that tons of application-layer protocols provide π. By default, implementations SHOULD NOT advertise and SHOULD NOT make use of the PLAIN mechanism unless adequate data security services are in place π .
When PLAIN is used, the server gains the ability to impersonate the user to ALL services that use the same password π, even if TLS or other confidentiality protection is in place. Lots of other auth mechanisms have similar weaknesses, but stronger SASL mechanisms fix this issue π¦. Clients are encouraged to have an operational mode where every mechanism that's likely to reveal the user's password to the server is disabled πΈ.
General [SASL] security considerations apply to this mechanism too π. Unicode, [UTF-8], and [StringPrep] security considerations also apply β¨.
6. IANA Considerations π§
okay so the IANA SASL Mechanism registry [IANA-SASL] entry for PLAIN got updated π. The IANA changed it to reflect that this document now provides its technical specification β¨.
Here's the update request, verbatim:
To: iana@iana.org
Subject: Updated Registration of SASL mechanism PLAIN
SASL mechanism name: PLAIN
Security considerations: See RFC 4616.
Published specification (optional, recommended): RFC 4616
Person & email address to contact for further information:
Kurt Zeilenga <kurt@openldap.org>
IETF SASL WG <ietf-sasl@imc.org>
Intended usage: COMMON
Author/Change controller: IESG <iesg@ietf.org>
Note: Updates existing entry for PLAIN
7. Acknowledgements π
this doc is a revision of RFC 2595 by Chris Newman π. Parts of the grammar in Section 2 were borrowed from [UTF-8] by Francois Yergeau π.
This document is a product of the IETF Simple Authentication and Security Layer (SASL) Working Group π.
8. Normative References π
[ABNF] Crocker, D., Ed. and P. Overell, "Augmented BNF for
Syntax Specifications: ABNF", RFC 4234, October 2005.
[Keywords] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
[SASL] Melnikov, A., Ed., and K. Zeilenga, Ed., "Simple
Authentication and Security Layer (SASL)", RFC 4422,
June 2006.
[SASLPrep] Zeilenga, K., "SASLprep: Stringprep Profile for User
Names and Passwords", RFC 4013, February 2005.
[StringPrep] Hoffman, P. and M. Blanchet, "Preparation of
Internationalized Strings ("stringprep")", RFC 3454,
December 2002.
[Unicode] The Unicode Consortium, "The Unicode Standard, Version
3.2.0" is defined by "The Unicode Standard, Version
3.0" (Reading, MA, Addison-Wesley, 2000. ISBN 0-201-
61633-5), as amended by the "Unicode Standard Annex
#27: Unicode 3.1"
(http://www.unicode.org/reports/tr27/) and by the
"Unicode Standard Annex #28: Unicode 3.2"
(http://www.unicode.org/reports/tr28/).
[UTF-8] Yergeau, F., "UTF-8, a transformation format of ISO
10646", STD 63, RFC 3629, November 2003.
[TLS] Dierks, T. and E. Rescorla, "The Transport Layer
Security (TLS) Protocol Version 1.1", RFC 4346, April
2006.
9. Informative References π¦
[ACAP] Newman, C. and J. Myers, "ACAP -- Application
Configuration Access Protocol", RFC 2244, November
1997.
[CRAM-MD5] Nerenberg, L., Ed., "The CRAM-MD5 SASL Mechanism", Work
in Progress, June 2006.
[DIGEST-MD5] Melnikov, A., Ed., "Using Digest Authentication as a
SASL Mechanism", Work in Progress, June 2006.
[IANA-SASL] IANA, "SIMPLE AUTHENTICATION AND SECURITY LAYER (SASL)
MECHANISMS",
<http://www.iana.org/assignments/sasl-mechanisms>.
[SMTP-AUTH] Myers, J., "SMTP Service Extension for Authentication",
RFC 2554, March 1999.
Appendix A. Changes since RFC 2595 π
this appendix is non-normative, so it's just the tea on what changed π«.
This document replaces Section 6 of RFC 2595 β¨.
The spec details how the server is to compare client-provided character strings with stored character strings π.
The ABNF grammar got updated. Specifically, the grammar now allows LINE FEED (U+000A) and CARRIAGE RETURN (U+000D) characters in the authzid, authcid, passwd productions. However, whether these control characters may be used depends on the string preparation rules that apply to the production. For passwd and authcid productions, control characters are prohibited π«. For authzid, you have to consult the application-level SASL profile π. This change lets PLAIN carry all possible authorization identity strings allowed in SASL π.
Pseudo-code was added π§.
The example section was expanded to illustrate more features of the PLAIN mechanism π.
Editor's Address π
Kurt D. Zeilenga
OpenLDAP Foundation
EMail: Kurt@OpenLDAP.org
Full Copyright Statement Β©οΈ
Copyright (C) The Internet Society (2006).
This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights.
This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Intellectual Property π§
The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; nor does it represent that it has made any independent effort to identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and BCP 79.
Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. Please address the information to the IETF at ietf-ipr@ietf.org.
Acknowledgement πΈ
Funding for the RFC Editor function is provided by the IETF Administrative Support Activity (IASA) π.
π¦ where this page comes from
- ietf: rfc4616 2006-08
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms