idnits 2.17.1 draft-melnikov-scram-2fa-03.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 copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (May 24, 2021) is 1040 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 (~~), 1 warning (==), 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 May 24, 2021 5 Expires: November 25, 2021 7 Extensions to Salted Challenge Response (SCRAM) for 2 factor 8 authentication 9 draft-melnikov-scram-2fa-03 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. 19 This specification also gives an example of how TOTP (RFC 6238) can 20 be used as the second factor. 22 Status of This Memo 24 This Internet-Draft is submitted in full conformance with the 25 provisions of BCP 78 and BCP 79. 27 Internet-Drafts are working documents of the Internet Engineering 28 Task Force (IETF). Note that other groups may also distribute 29 working documents as Internet-Drafts. The list of current Internet- 30 Drafts is at https://datatracker.ietf.org/drafts/current/. 32 Internet-Drafts are draft documents valid for a maximum of six months 33 and may be updated, replaced, or obsoleted by other documents at any 34 time. It is inappropriate to use Internet-Drafts as reference 35 material or to cite them other than as "work in progress." 37 This Internet-Draft will expire on November 25, 2021. 39 Copyright Notice 41 Copyright (c) 2021 IETF Trust and the persons identified as the 42 document authors. All rights reserved. 44 This document is subject to BCP 78 and the IETF Trust's Legal 45 Provisions Relating to IETF Documents 46 (https://trustee.ietf.org/license-info) in effect on the date of 47 publication of this document. Please review these documents 48 carefully, as they describe your rights and restrictions with respect 49 to this document. Code Components extracted from this document must 50 include Simplified BSD License text as described in Section 4.e of 51 the Trust Legal Provisions and are provided without warranty as 52 described in the Simplified BSD License. 54 Table of Contents 56 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 57 2. Conventions Used in This Document . . . . . . . . . . . . . . 2 58 2.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . . 3 59 2.2. Notation . . . . . . . . . . . . . . . . . . . . . . . . . 3 60 3. SCRAM Extension for 2FA . . . . . . . . . . . . . . . . . . . 3 61 4. Formal Syntax . . . . . . . . . . . . . . . . . . . . . . . . 4 62 5. Use of TOTP with SCRAM . . . . . . . . . . . . . . . . . . . 4 63 6. Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 64 7. Open Issues . . . . . . . . . . . . . . . . . . . . . . . . . 5 65 8. Security Considerations . . . . . . . . . . . . . . . . . . . 5 66 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 6 67 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 6 68 11. Normative References . . . . . . . . . . . . . . . . . . . . 6 69 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 7 71 1. Introduction 73 SCRAM [RFC5802] is a password based SASL [RFC4422] authentication 74 mechanism that provides (among other things) mutual authentication 75 and binding to an external security layer such as TLS. 77 Two-factor authentication (2FA) is a way to add additional security 78 to an authentication exchange. The first "factor" is a password. 79 The second "factor" is a verification code retrieved from an 80 application on a mobile device or computer. 2FA is conceptually 81 similar to a security token device that banks in some countries 82 require for online banking. Other names for 2FA systems include OTP 83 (one-time password) and TOTP (Time-based One-time Password algorithm, 84 such as [RFC6238]). 86 This specification describes an extension to SCRAM to provide 2 87 factor authentication. SCRAM already relies on passwords for 88 authentication. This document specifies how second "factors" can be 89 incorporated into SCRAM authentication. 91 2. Conventions Used in This Document 93 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 94 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 95 document are to be interpreted as described in [RFC2119]. 97 Formal syntax is defined by [RFC5234] including the core rules 98 defined in Appendix B of [RFC5234]. 100 Example lines prefaced by "C:" are sent by the client and ones 101 prefaced by "S:" by the server. If a single "C:" or "S:" label 102 applies to multiple lines, then the line breaks between those lines 103 are for editorial clarity only, and are not part of the actual 104 protocol exchange. 106 2.1. Terminology 108 This document uses several terms defined in [RFC4949] ("Internet 109 Security Glossary") including the following: authentication, 110 authentication exchange, authentication information, brute force, 111 challenge-response, cryptographic hash function, dictionary attack, 112 eavesdropping, hash result, keyed hash, man-in-the-middle, nonce, 113 one-way encryption function, password, replay attack and salt. 114 Readers not familiar with these terms should use that glossary as a 115 reference. Other terms defined in [RFC5802] are also used in this 116 document. 118 2.2. Notation 120 This document reuses notation defined in SCRAM. 122 3. SCRAM Extension for 2FA 124 This extension doesn't add any extra roundtrips to SCRAM 125 authentication. SCRAM was designed to be extensible, so it allows 126 for optional and mandatory attributes, which covered by MAC codes. 127 Second "factors" are conveyed in the second message ("client-final- 128 message-without-proof" ABNF production) sent from the client to the 129 server. 131 This extension doesn't change how the client authenticates the 132 server. 134 The server authenticates the client after receiving the second 135 message as described in Section 3 of [RFC5802] If the client included 136 "type" and "second-factor" attributes defined in this document (see 137 Section 4) and the server supports the specified second factor type, 138 the server verifies content of the "second-factor" according to the 139 "type". If the second factor verification fails, the server MUST 140 fail authentication and SHOULD return either "replayed-second-factor" 141 or "invalid-second-factor" error in the "e" attribute. [[It would be 142 possible to make the extra attributes mandatory by using SCRAM's 143 "m=", but the text above doesn't do that.]] 145 4. Formal Syntax 147 This document defines the following new SCRAM attributes: 149 o t: This attribute specifies the type of second factor. [[Create 150 IANA registry for these?]] This document defines one type: "totp". 151 If this attribute is specified, the "f" attribute MUST also be 152 specified. 154 o f: This attribute specifies the value of the second factor. For 155 "t=totp" it is 6 digit decimal number. [[Use 8 digits per Rick 156 van Rein?]] This attribute MUST be ignored unless the "t" 157 attribute is also specified. 159 The following syntax specification uses the Augmented Backus-Naur 160 Form (ABNF) notation as specified in [RFC5234]. 162 type = "t=" type-value 163 ; Complies with "attr-val" syntax. 164 type-value = "totp" / value 165 ; Type of second factor. 166 ; Should be registered with IANA. 167 second-factor = "f=" second-factor-value 168 ; Complies with "attr-val" syntax. 169 second-factor-value = 6DIGIT / value 170 ; 6DIGIT when "t=totp" 171 server-error-value-ext = 172 "replayed-second-factor" / 173 "invalid-second-factor" / 174 "second-factor-value-missing" 176 value = 178 5. Use of TOTP with SCRAM 180 When TOTP is used with SCRAM, the following values for "t" and "f" 181 attributes (see Section 4 for their generic syntax) are used: 183 o t: This attribute specifies the type of second factor. For TOTP 184 the value is "totp". If this attribute is specified, the "f" 185 attribute MUST also be specified. 187 o f: This attribute specifies the value of the second factor. For 188 "t=totp" it is 6 digit decimal number. This attribute MUST be 189 ignored unless the "t" attribute is also specified. 191 A TOTP URI is specified with the following ABNF: 193 totp-uri = "otpauth" "://" "totp/" label "?secret=" secret 194 "&issuer=" issuer 195 label = issuer (":" / "%3A") identity 196 identity = 1*CHAR ; URI-encoded SASL identity 197 secret = 40 * HEXCHAR ; Base32 (hex) encoded secret with no padding. 198 issuer = 1*CHAR ; Issuer name. 200 6. Example 202 The following example extends the example from Section 5 of [RFC5802] 203 to demonstrate use of TOTP: 205 C: n,,n=user,r=fyko+d2lbbFgONRv9qkxdawL 206 S: r=fyko+d2lbbFgONRv9qkxdawL3rfcNHYJY1ZVvWVs7j,s=QSXCR+Q6sek8bf92, 207 i=4096 208 C: c=biws,r=fyko+d2lbbFgONRv9qkxdawL3rfcNHYJY1ZVvWVs7j, 209 t=totp,f=776804,p=v0X8v3Bz2T0CJGbJQyF0X+HI4Ts= 210 S: v=lz59pqV8S7suAoZWja4dJRkFsKQ= 212 Please note that TOTP extension described in this document works in 213 the same way with SCRAM-SHA-256/SCRAM-SHA-256-PLUS and SCRAM-SHA-512/ 214 SCRAM-SHA-512-PLUS variants of SCRAM. 216 7. Open Issues 218 Simon Josefsson: should this be a new SASL mechanism name, e.g. 219 CROTP-SHA-256? 221 Simon Josefsson: cookie option for fast reauthentication? Alexey: 222 can do or just used CLIENT-KEY (draft-cridland-kitten-clientkey)? 224 Rick van Rein: specify a HOTP variant as well? 226 Rick van Rein: use TOTP with 6 or 8 digits? Register both variants? 228 8. Security Considerations 230 Unless an external security layer (such as TLS) is also used, the OTP 231 value is sent in unencrypted/unhashed form from the client to the 232 server, which allows an attacker to read the OTP value and perform a 233 race with the server to validate the OTP. 235 TBD 237 9. IANA Considerations 239 IANA is requested to update the definition of the SASL family SCRAM 240 in the SASL Mechanism registry established by [RFC4422] to also point 241 to this document. 243 IANA is also requested to create a new subregistry of "SASL 244 mechanism" for registering second factor schemes used in the "t" 245 attribute as specified in this document. 247 The registration template is as follows: 249 SCRAM Second Factor Scheme Name: 250 Pointer to specification text: 251 Notes (optional): 253 The registration procedure for the above subregistry is Expert 254 Review. 256 IANA is requested to register a new value in the subregistry defined 257 above: 259 SCRAM Second Factor Scheme Name: TOTP 260 Pointer to specification text: [[ this document ]] 261 Notes (optional): (none) 263 10. Acknowledgements 265 Thank you to Stephen Farrell for motivating creation of this document 266 and to Dave Cridland for describing how TOTP can be used with XMPP in 267 XEP-400. Thank you to Rick van Rein and Simon Josefsson for comments 268 and corrections, but all final errors in this document remain mine. 270 11. Normative References 272 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 273 Requirement Levels", BCP 14, RFC 2119, 274 DOI 10.17487/RFC2119, March 1997, 275 . 277 [RFC4422] Melnikov, A., Ed. and K. Zeilenga, Ed., "Simple 278 Authentication and Security Layer (SASL)", RFC 4422, 279 DOI 10.17487/RFC4422, June 2006, 280 . 282 [RFC4949] Shirey, R., "Internet Security Glossary, Version 2", 283 FYI 36, RFC 4949, DOI 10.17487/RFC4949, August 2007, 284 . 286 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 287 Specifications: ABNF", STD 68, RFC 5234, 288 DOI 10.17487/RFC5234, January 2008, 289 . 291 [RFC5802] Newman, C., Menon-Sen, A., Melnikov, A., and N. Williams, 292 "Salted Challenge Response Authentication Mechanism 293 (SCRAM) SASL and GSS-API Mechanisms", RFC 5802, 294 DOI 10.17487/RFC5802, July 2010, 295 . 297 [RFC6238] M'Raihi, D., Machani, S., Pei, M., and J. Rydell, "TOTP: 298 Time-Based One-Time Password Algorithm", RFC 6238, 299 DOI 10.17487/RFC6238, May 2011, 300 . 302 Author's Address 304 Alexey Melnikov 305 Isode Ltd 307 Email: Alexey.Melnikov@isode.com