idnits 2.17.00 (12 Aug 2021) /tmp/idnits30071/draft-ietf-kitten-scram-2fa-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- -- The document date (25 January 2022) is 109 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) ** Downref: Normative reference to an Informational RFC: RFC 4949 ** Downref: Normative reference to an Informational RFC: RFC 6238 Summary: 2 errors (**), 0 flaws (~~), 0 warnings (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group A. Melnikov 3 Internet-Draft Isode Ltd 4 Intended status: Standards Track 25 January 2022 5 Expires: 29 July 2022 7 Extensions to Salted Challenge Response (SCRAM) for 2 factor 8 authentication 9 draft-ietf-kitten-scram-2fa-01 11 Abstract 13 This specification describes an extension to family of Simple 14 Authentication and Security Layer (SASL; RFC 4422) authentication 15 mechanisms called the Salted Challenge Response Authentication 16 Mechanism (SCRAM), which provides support for 2 factor 17 authentication. It also includes a separate extension for quick 18 reauthentication. 20 This specification also gives an example of how TOTP (RFC 6238) can 21 be used as the second factor. 23 Status of This Memo 25 This Internet-Draft is submitted in full conformance with the 26 provisions of BCP 78 and BCP 79. 28 Internet-Drafts are working documents of the Internet Engineering 29 Task Force (IETF). Note that other groups may also distribute 30 working documents as Internet-Drafts. The list of current Internet- 31 Drafts is at https://datatracker.ietf.org/drafts/current/. 33 Internet-Drafts are draft documents valid for a maximum of six months 34 and may be updated, replaced, or obsoleted by other documents at any 35 time. It is inappropriate to use Internet-Drafts as reference 36 material or to cite them other than as "work in progress." 38 This Internet-Draft will expire on 29 July 2022. 40 Copyright Notice 42 Copyright (c) 2022 IETF Trust and the persons identified as the 43 document authors. All rights reserved. 45 This document is subject to BCP 78 and the IETF Trust's Legal 46 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 47 license-info) in effect on the date of publication of this document. 48 Please review these documents carefully, as they describe your rights 49 and restrictions with respect to this document. Code Components 50 extracted from this document must include Revised BSD License text as 51 described in Section 4.e of the Trust Legal Provisions and are 52 provided without warranty as described in the Revised BSD License. 54 Table of Contents 56 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 57 2. Conventions Used in This Document . . . . . . . . . . . . . . 3 58 2.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 59 2.2. Notation . . . . . . . . . . . . . . . . . . . . . . . . 3 60 3. SCRAM Extension for 2FA . . . . . . . . . . . . . . . . . . . 3 61 4. SCRAM Extension for reauthentication . . . . . . . . . . . . 4 62 5. Formal Syntax . . . . . . . . . . . . . . . . . . . . . . . . 4 63 6. Use of TOTP with SCRAM . . . . . . . . . . . . . . . . . . . 5 64 7. Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 65 8. Open Issues . . . . . . . . . . . . . . . . . . . . . . . . . 6 66 9. Security Considerations . . . . . . . . . . . . . . . . . . . 6 67 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 7 68 11. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 7 69 12. Normative References . . . . . . . . . . . . . . . . . . . . 7 70 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 8 72 1. Introduction 74 SCRAM [RFC5802] is a password based SASL [RFC4422] authentication 75 mechanism that provides (among other things) mutual authentication 76 and binding to an external security layer such as TLS. 78 Two-factor authentication (2FA) is a way to add additional security 79 to an authentication exchange. The first "factor" is a password. 80 The second "factor" is a verification code retrieved from an 81 application on a mobile device or computer. 2FA is conceptually 82 similar to a security token device that banks in some countries 83 require for online banking. Other names for 2FA systems include OTP 84 (one-time password) and TOTP (Time-based One-time Password algorithm, 85 such as [RFC6238]). 87 This specification describes an extension to SCRAM to provide 2 88 factor authentication. SCRAM already relies on passwords for 89 authentication. This document specifies how second "factors" can be 90 incorporated into SCRAM authentication. It also includes a separate 91 (but frequently used together with the 2 factor authentication) 92 extension for quick reauthentication. 94 2. Conventions Used in This Document 96 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 97 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 98 document are to be interpreted as described in [RFC2119]. 100 Formal syntax is defined by [RFC5234] including the core rules 101 defined in Appendix B of [RFC5234]. 103 Example lines prefaced by "C:" are sent by the client and ones 104 prefaced by "S:" by the server. If a single "C:" or "S:" label 105 applies to multiple lines, then the line breaks between those lines 106 are for editorial clarity only, and are not part of the actual 107 protocol exchange. 109 2.1. Terminology 111 This document uses several terms defined in [RFC4949] ("Internet 112 Security Glossary") including the following: authentication, 113 authentication exchange, authentication information, brute force, 114 challenge-response, cryptographic hash function, dictionary attack, 115 eavesdropping, hash result, keyed hash, man-in-the-middle, nonce, 116 one-way encryption function, password, replay attack and salt. 117 Readers not familiar with these terms should use that glossary as a 118 reference. Other terms defined in [RFC5802] are also used in this 119 document. 121 2.2. Notation 123 This document reuses notation defined in SCRAM. 125 3. SCRAM Extension for 2FA 127 This extension doesn't add any extra roundtrips to SCRAM 128 authentication. SCRAM was designed to be extensible, so it allows 129 for optional and mandatory attributes, which covered by MAC codes. 130 Second "factors" are conveyed in the second message ("client-final- 131 message-without-proof" ABNF production) sent from the client to the 132 server. 134 This extension doesn't change how the client authenticates the 135 server. 137 The server authenticates the client after receiving the second 138 message as described in Section 3 of [RFC5802] If the client included 139 "type" and "second-factor" attributes defined in this document (see 140 Section 5) and the server supports the specified second factor type, 141 the server verifies content of the "second-factor" according to the 142 "type". If the second factor verification fails, the server MUST 143 fail authentication and SHOULD return either "replayed-second-factor" 144 or "invalid-second-factor" error in the "e" attribute. [[It would be 145 possible to make the extra attributes mandatory by using SCRAM's 146 "m=", but the text above doesn't do that. This is one of open issues 147 to resolve.]] 149 4. SCRAM Extension for reauthentication 151 This reauthentication extension to SCRAM allows the server to return 152 a token that can be used for quick reauthentication and bypasses 2 153 factor authentication prompt to the user. The reauthentication token 154 is randomly generated value. The reauthentication token is returned 155 in the "o" attribute that is appended to the end of the "server- 156 final-message". 158 [[Note: it would be possible to extend SCRAM itself to do 159 reauthentication, by including an earlier received reauthentication 160 token in the "client-first-message" of a subsequent SCRAM 161 authentication. This will also turn off the server checking for 2 162 factor authentication information, unless the reauthentication 163 attempt is rejected by the server. In the meantime, this document 164 presents a couple of other alternatives on how to use other SASL 165 mechanisms with the reauthentication token.]] 167 When the CLIENT-KEY/CLIENT-KEY-PLUS mechanism (see draft-cridland- 168 kitten-clientkey) is used for the reauthentication after a successful 169 SCRAM authentication, the reauthentication token is the Client Secret 170 Key. [[Need to also somehow convey token expiration?]] 172 When the HT-* mechanism (see draft-schmaus-kitten-sasl-ht) is used 173 for the reauthentication after a successful SCRAM authentication, the 174 reauthentication token is the draft-schmaus-kitten-sasl-ht token. 175 [[Note that the HT hash should probably match the SCRAM hash used.]] 177 5. Formal Syntax 179 This document defines the following new SCRAM attributes: 181 * t: This attribute specifies the type of second factor. [[Create 182 IANA registry for these?]] This document defines one type: "totp". 183 If this attribute is specified, the "f" attribute MUST also be 184 specified. 186 * f: This attribute specifies the value of the second factor. For 187 "t=totp" it is 6 digit decimal number. [[Use 8 digits per Rick 188 van Rein?]] This attribute MUST be ignored unless the "t" 189 attribute is also specified. 191 * o: This attribute specifies the base64-encoded value of the 192 reauthentication token. 194 The following syntax specification uses the Augmented Backus-Naur 195 Form (ABNF) notation as specified in [RFC5234]. 197 type = "t=" type-value 198 ; Complies with "attr-val" syntax. 199 type-value = "totp" / value 200 ; Type of second factor. 201 ; Should be registered with IANA. 202 second-factor = "f=" second-factor-value 203 ; Complies with "attr-val" syntax. 204 second-factor-value = 6DIGIT / value 205 ; 6DIGIT when "t=totp" 206 server-error-value-ext = 207 "replayed-second-factor" / 208 "invalid-second-factor" / 209 "second-factor-value-missing" 211 value = 213 reauth-token = "o=" base64 214 ;; base64 encoding of reauthentication 215 ;; token. 217 6. Use of TOTP with SCRAM 219 When TOTP is used with SCRAM, the following values for "t" and "f" 220 attributes (see Section 5 for their generic syntax) are used: 222 * t: This attribute specifies the type of second factor. For TOTP 223 the value is "totp". If this attribute is specified, the "f" 224 attribute MUST also be specified. 226 * f: This attribute specifies the value of the second factor. For 227 "t=totp" it is 6 digit decimal number. This attribute MUST be 228 ignored unless the "t" attribute is also specified. 230 A TOTP URI is specified with the following ABNF: 232 totp-uri = "otpauth" "://" "totp/" label "?secret=" secret 233 "&issuer=" issuer 234 label = issuer (":" / "%3A") identity 235 identity = 1*CHAR ; URI-encoded SASL identity 236 secret = 40 * HEXCHAR ; Base32 (hex) encoded secret with no padding. 237 issuer = 1*CHAR ; Issuer name. 239 7. Example 241 The following example extends the example from Section 5 of [RFC5802] 242 to demonstrate use of TOTP: 244 C: n,,n=user,r=fyko+d2lbbFgONRv9qkxdawL 245 S: r=fyko+d2lbbFgONRv9qkxdawL3rfcNHYJY1ZVvWVs7j,s=QSXCR+Q6sek8bf92, 246 i=4096 247 C: c=biws,r=fyko+d2lbbFgONRv9qkxdawL3rfcNHYJY1ZVvWVs7j, 248 t=totp,f=776804,p=v0X8v3Bz2T0CJGbJQyF0X+HI4Ts= 249 S: v=lz59pqV8S7suAoZWja4dJRkFsKQ= 251 Please note that TOTP extension described in this document works in 252 the same way with SCRAM-SHA-256/SCRAM-SHA-256-PLUS, SCRAM-SHA-512/ 253 SCRAM-SHA-512-PLUS or any other SCRAM variants that use other hash 254 functions. 256 8. Open Issues 258 Simon Josefsson: should this be a new SASL mechanism name, e.g. 259 CROTP-SHA-256? 261 Simon Josefsson: cookie option for fast reauthentication? Alexey: 262 can do or just used CLIENT-KEY (draft-cridland-kitten-clientkey)? 264 Rick van Rein: specify a HOTP variant as well? 266 Rick van Rein: use TOTP with 6 or 8 digits? Register both variants? 268 9. Security Considerations 270 Unless an external security layer (such as TLS) is also used, the OTP 271 value is sent in unencrypted/unhashed form from the client to the 272 server, which allows an attacker to read the OTP value and perform a 273 race with the server to validate the OTP. 275 TBD 277 10. IANA Considerations 279 IANA is requested to update the definition of the SASL family SCRAM 280 in the SASL Mechanism registry established by [RFC4422] to also point 281 to this document. 283 IANA is also requested to create a new subregistry of "SASL 284 mechanism" for registering second factor schemes used in the "t" 285 attribute as specified in this document. 287 The registration template is as follows: 289 SCRAM Second Factor Scheme Name: 290 Pointer to specification text: 291 Notes (optional): 293 The registration procedure for the above subregistry is Expert 294 Review. 296 IANA is requested to register a new value in the subregistry defined 297 above: 299 SCRAM Second Factor Scheme Name: TOTP 300 Pointer to specification text: [[ this document ]] 301 Notes (optional): (none) 303 11. Acknowledgements 305 Thank you to Stephen Farrell for motivating creation of this document 306 and to Dave Cridland for describing how TOTP can be used with XMPP in 307 XEP-0400. Thank you to Rick van Rein and Simon Josefsson for 308 comments and corrections, but all final errors in this document 309 remain mine. 311 12. Normative References 313 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 314 Requirement Levels", BCP 14, RFC 2119, 315 DOI 10.17487/RFC2119, March 1997, 316 . 318 [RFC4422] Melnikov, A., Ed. and K. Zeilenga, Ed., "Simple 319 Authentication and Security Layer (SASL)", RFC 4422, 320 DOI 10.17487/RFC4422, June 2006, 321 . 323 [RFC4949] Shirey, R., "Internet Security Glossary, Version 2", 324 FYI 36, RFC 4949, DOI 10.17487/RFC4949, August 2007, 325 . 327 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 328 Specifications: ABNF", STD 68, RFC 5234, 329 DOI 10.17487/RFC5234, January 2008, 330 . 332 [RFC5802] Newman, C., Menon-Sen, A., Melnikov, A., and N. Williams, 333 "Salted Challenge Response Authentication Mechanism 334 (SCRAM) SASL and GSS-API Mechanisms", RFC 5802, 335 DOI 10.17487/RFC5802, July 2010, 336 . 338 [RFC6238] M'Raihi, D., Machani, S., Pei, M., and J. Rydell, "TOTP: 339 Time-Based One-Time Password Algorithm", RFC 6238, 340 DOI 10.17487/RFC6238, May 2011, 341 . 343 Author's Address 345 Alexey Melnikov 346 Isode Ltd 348 Email: Alexey.Melnikov@isode.com