draft-ietf-kitten-password-storage-00.txt   draft-ietf-kitten-password-storage-01.txt 
Common Authentication Technology Next Generation S. Whited Common Authentication Technology Next Generation S. Whited
Internet-Draft 20 May 2020 Internet-Draft 29 October 2020
Intended status: Best Current Practice Intended status: Best Current Practice
Expires: 21 November 2020 Expires: 2 May 2021
Best practices for password hashing and storage Best practices for password hashing and storage
draft-ietf-kitten-password-storage-00 draft-ietf-kitten-password-storage-01
Abstract Abstract
This document outlines best practices for handling user passwords and This document outlines best practices for handling user passwords and
other authenticator secrets in client-server systems making use of other authenticator secrets in client-server systems making use of
SASL. SASL.
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
skipping to change at page 1, line 32 skipping to change at page 1, line 32
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/. Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on 21 November 2020. This Internet-Draft will expire on 2 May 2021.
Copyright Notice Copyright Notice
Copyright (c) 2020 IETF Trust and the persons identified as the Copyright (c) 2020 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents (https://trustee.ietf.org/ Provisions Relating to IETF Documents (https://trustee.ietf.org/
license-info) in effect on the date of publication of this document. license-info) in effect on the date of publication of this document.
Please review these documents carefully, as they describe your rights Please review these documents carefully, as they describe your rights
skipping to change at page 2, line 11 skipping to change at page 2, line 11
extracted from this document must include Simplified BSD License text extracted from this document must include Simplified BSD License text
as described in Section 4.e of the Trust Legal Provisions and are as described in Section 4.e of the Trust Legal Provisions and are
provided without warranty as described in the Simplified BSD License. provided without warranty as described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1. Conventions and Terminology . . . . . . . . . . . . . . . 2 1.1. Conventions and Terminology . . . . . . . . . . . . . . . 2
2. SASL Mechanisms . . . . . . . . . . . . . . . . . . . . . . . 3 2. SASL Mechanisms . . . . . . . . . . . . . . . . . . . . . . . 3
3. Client Best Practices . . . . . . . . . . . . . . . . . . . . 3 3. Client Best Practices . . . . . . . . . . . . . . . . . . . . 3
3.1. Mechanism Pinning . . . . . . . . . . . . . . . . . . . . 3 3.1. Mechanism Pinning . . . . . . . . . . . . . . . . . . . . 4
3.2. Storage . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.2. Storage . . . . . . . . . . . . . . . . . . . . . . . . . 5
4. Server Best Practices . . . . . . . . . . . . . . . . . . . . 5 4. Server Best Practices . . . . . . . . . . . . . . . . . . . . 5
4.1. Additional SASL Requirements . . . . . . . . . . . . . . 5 4.1. Additional SASL Requirements . . . . . . . . . . . . . . 5
4.2. Storage . . . . . . . . . . . . . . . . . . . . . . . . . 5 4.2. Storage . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.3. Authentication and Rotation . . . . . . . . . . . . . . . 6 4.3. Authentication and Rotation . . . . . . . . . . . . . . . 6
5. KDF Recommendations . . . . . . . . . . . . . . . . . . . . . 6 5. KDF Recommendations . . . . . . . . . . . . . . . . . . . . . 6
5.1. Argon2 . . . . . . . . . . . . . . . . . . . . . . . . . 6 5.1. Argon2 . . . . . . . . . . . . . . . . . . . . . . . . . 6
5.2. Bcrypt . . . . . . . . . . . . . . . . . . . . . . . . . 7 5.2. Bcrypt . . . . . . . . . . . . . . . . . . . . . . . . . 7
5.3. PBKDF2 . . . . . . . . . . . . . . . . . . . . . . . . . 7 5.3. PBKDF2 . . . . . . . . . . . . . . . . . . . . . . . . . 7
5.4. Scrypt . . . . . . . . . . . . . . . . . . . . . . . . . 8 5.4. Scrypt . . . . . . . . . . . . . . . . . . . . . . . . . 8
6. Password Complexity Requirements . . . . . . . . . . . . . . 8 6. Password Complexity Requirements . . . . . . . . . . . . . . 8
7. Internationalization Considerations . . . . . . . . . . . . . 9 7. Internationalization Considerations . . . . . . . . . . . . . 9
8. Security Considerations . . . . . . . . . . . . . . . . . . . 9 8. Security Considerations . . . . . . . . . . . . . . . . . . . 9
9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 10
10. References . . . . . . . . . . . . . . . . . . . . . . . . . 10 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 10
10.1. Normative References . . . . . . . . . . . . . . . . . . 10 10.1. Normative References . . . . . . . . . . . . . . . . . . 10
10.2. Informative References . . . . . . . . . . . . . . . . . 10 10.2. Informative References . . . . . . . . . . . . . . . . . 10
Appendix A. Acknowledgments . . . . . . . . . . . . . . . . . . 13 Appendix A. Acknowledgments . . . . . . . . . . . . . . . . . . 13
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 13 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 13
1. Introduction 1. Introduction
Following best practices when hashing and storing passwords for use Following best practices when hashing and storing passwords for use
with SASL impacts a great deal more than just a user's identity. It with SASL impacts a great deal more than just a user's identity. It
skipping to change at page 3, line 5 skipping to change at page 2, line 51
Various security-related terms are to be understood in the sense Various security-related terms are to be understood in the sense
defined in [RFC4949]. Some may also be defined in [NISTSP63-3] defined in [RFC4949]. Some may also be defined in [NISTSP63-3]
Appendix A.1 and in [NISTSP132] section 3.1. Appendix A.1 and in [NISTSP132] section 3.1.
Throughout this document the term "password" is used to mean any Throughout this document the term "password" is used to mean any
password, passphrase, PIN, or other memorized secret. password, passphrase, PIN, or other memorized secret.
Other common terms used throughout this document include: Other common terms used throughout this document include:
Pepper A secret added to a password hash like a salt. Unlike a
salt, peppers are secret and not unique. They must not be stored
alongside the hashed password.
Mechanism pinning A security mechanism which allows SASL clients to Mechanism pinning A security mechanism which allows SASL clients to
resist downgrade attacks. Clients that implement mechanism resist downgrade attacks. Clients that implement mechanism
pinning remember the perceived strength of the SASL mechanism used pinning remember the perceived strength of the SASL mechanism used
in a previous successful authentication attempt and thereafter in a previous successful authentication attempt and thereafter
only authenticate using mechanisms of equal or higher perceived only authenticate using mechanisms of equal or higher perceived
strength. strength.
Pepper A secret added to a password hash like a salt. Unlike a
salt, peppers are secret and the same pepper may be reused for
many hashed passwords. They must not be stored alongside the
hashed password.
Salt In this document salt is used as defined in [RFC4949].
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in BCP "OPTIONAL" in this document are to be interpreted as described in BCP
14 [RFC2119] [RFC8174] when, and only when, they appear in all 14 [RFC2119] [RFC8174] when, and only when, they appear in all
capitals, as shown here. capitals, as shown here.
2. SASL Mechanisms 2. SASL Mechanisms
For clients and servers that support password based authentication For clients and servers that support password based authentication
using SASL [RFC4422] it is RECOMMENDED that the following mechanisms using SASL [RFC4422] it is RECOMMENDED that the following mechanisms
skipping to change at page 4, line 27 skipping to change at page 4, line 35
3. SCRAM-SHA-1, SCRAM-SHA-256 3. SCRAM-SHA-1, SCRAM-SHA-256
4. PLAIN 4. PLAIN
5. DIGEST-MD5, CRAM-MD5 5. DIGEST-MD5, CRAM-MD5
The EXTERNAL mechanism defined in [RFC4422] appendix A is placed at The EXTERNAL mechanism defined in [RFC4422] appendix A is placed at
the top of the list. However, its perceived strength depends on the the top of the list. However, its perceived strength depends on the
underlying authentication protocol. In this example, we assume that underlying authentication protocol. In this example, we assume that
TLS [RFC8446] services are being used which can provide a strong TLS [RFC8446] services are being used.
authenticator assurance level.
The channel binding ("-PLUS") variants of SCRAM [RFC5802] are listed The channel binding ("-PLUS") variants of SCRAM [RFC5802] are listed
above their non-channel binding cousins, but may not always be above their non-channel binding cousins, but may not always be
available depending on the type of channel binding data available to available depending on the type of channel binding data available to
the SASL negotiator. the SASL negotiator.
The PLAIN mechanism sends the username and password in plain text, The PLAIN mechanism sends the username and password in plain text,
but does allow for the use of a strong key derivation function for but does allow for the use of a strong key derivation function (KDF)
the stored version of the password on the server. for the stored version of the password on the server.
Finally, the DIGEST-MD5 and CRAM-MD5 mechanisms are listed last Finally, the DIGEST-MD5 and CRAM-MD5 mechanisms are listed last
because they use weak hashes and ciphers and prevent the server from because they use weak hashes and ciphers and prevent the server from
storing passwords using a strong key derivation function. For a list storing passwords using a KDF. For a list of problems with DIGEST-
of problems with DIGEST-MD5 see [RFC6331]. MD5 see [RFC6331].
3.2. Storage 3.2. Storage
Clients SHOULD always store authenticators in a trusted and encrypted Clients SHOULD always store authenticators in a trusted and encrypted
keystore such as the system keystore, or an encrypted store created keystore such as the system keystore, or an encrypted store created
specifically for the clients use. They SHOULD NOT store specifically for the clients use. They SHOULD NOT store
authenticators as plain text. authenticators as plain text.
If clients know that they will only ever authenticate using a If clients know that they will only ever authenticate using a
mechanism such as SCRAM [RFC5802] where the original password is not mechanism such as SCRAM [RFC5802] where the original password is not
skipping to change at page 5, line 22 skipping to change at page 5, line 29
original password so long as an appropriate keystore is used. original password so long as an appropriate keystore is used.
4. Server Best Practices 4. Server Best Practices
4.1. Additional SASL Requirements 4.1. Additional SASL Requirements
Servers MUST NOT support any mechanism that would require Servers MUST NOT support any mechanism that would require
authenticators to be stored in such a way that they could be authenticators to be stored in such a way that they could be
recovered in plain text from the stored information. This includes recovered in plain text from the stored information. This includes
mechanisms that store authenticators using reversable encryption, mechanisms that store authenticators using reversable encryption,
obsolete hashing mechanisms such as MD5, and hashes that are obsolete hashing mechanisms such as MD5 or hashing mechanisms that
unsuitable for use with authenticators such as SHA256. are cryptographically secure but designed for speed such as SHA256.
4.2. Storage 4.2. Storage
Servers MUST always store passwords only after they have been salted Servers MUST always store passwords only after they have been salted
and hashed. A distinct salt SHOULD be used for each user, and each and hashed using a strong KDF. A distinct salt SHOULD be used for
SCRAM family supported. Salts MUST be generated using a each user, and each SCRAM family supported. Salts SHOULD be
cryptographically secure random number generator. The salt MAY be generated using a cryptographically secure random number generator.
stored in the same datastore as the password. If it is stored The salt MAY be stored in the same datastore as the password. If it
alongside the password, it SHOULD be combined with a pepper stored in is stored alongside the password, it SHOULD be combined with a pepper
the application configuration, an environment variable, or some stored in the application configuration, or a secure location other
location other than the datastore containing the salts. than the datastore containing the salts.
The following restrictions MUST be observed when generating salts and The following restrictions MUST be observed when generating salts and
peppers: peppers, more up to date numbers may be found in
[OWASP.CS.passwords].
+-----------------------+----------+ +=======================+==========+
| Parameter | Value | | Parameter | Value |
+=======================+==========+ +=======================+==========+
| Minimum Salt Length | 16 bytes | | Minimum Salt Length | 16 bytes |
+-----------------------+----------+ +-----------------------+----------+
| Minimum Pepper Length | 32 bytes | | Minimum Pepper Length | 32 bytes |
+-----------------------+----------+ +-----------------------+----------+
Table 1: Common Parameters Table 1: Common Parameters
4.3. Authentication and Rotation 4.3. Authentication and Rotation
skipping to change at page 7, line 5 skipping to change at page 7, line 9
5.1. Argon2 5.1. Argon2
Argon2 [ARGON2ESP] is the 2015 winner of the Password Hashing Argon2 [ARGON2ESP] is the 2015 winner of the Password Hashing
Competition and has been recomended by OWASP for password hashing. Competition and has been recomended by OWASP for password hashing.
Security considerations, test vectors, and parameters for tuning Security considerations, test vectors, and parameters for tuning
argon2 can be found in [I-D.irtf-cfrg-argon2]. They are copied here argon2 can be found in [I-D.irtf-cfrg-argon2]. They are copied here
for easier reference. for easier reference.
+---------------------------+--------------+ +===========================+==============+
| Parameter | Value | | Parameter | Value |
+===========================+==============+ +===========================+==============+
| Degree of parallelism (p) | 1 | | Degree of parallelism (p) | 1 |
+---------------------------+--------------+ +---------------------------+--------------+
| Memory size (m) | 32*1024 | | Memory size (m) | 32*1024 |
+---------------------------+--------------+ +---------------------------+--------------+
| Number of iterations (t) | 1 | | Number of iterations (t) | 1 |
+---------------------------+--------------+ +---------------------------+--------------+
| Algorithm type (y) | Argon2id (2) | | Algorithm type (y) | Argon2id (2) |
+---------------------------+--------------+ +---------------------------+--------------+
Table 2: Argon Parameters Table 2: Argon Parameters
5.2. Bcrypt 5.2. Bcrypt
bcrypt [BCRYPT] is a Blowfish-based KDF that is the current OWASP bcrypt [BCRYPT] is a Blowfish-based KDF that is the current OWASP
recommendation for password hashing. recommendation for password hashing.
+-------------------------+-------+ +=========================+=======================+
| Parameter | Value | | Parameter | Value |
+=========================+=======+ +=========================+=======================+
| Recommended Cost | 12 | | Recommended Cost | 12 |
+-------------------------+-------+ +-------------------------+-----------------------+
| Maximum Password Length | 64 | | Maximum Password Length | 50-72 bytes depending |
+-------------------------+-------+ | | on the implementation |
+-------------------------+-----------------------+
Table 3: Bcrypt Parameters Table 3: Bcrypt Parameters
5.3. PBKDF2 5.3. PBKDF2
PBKDF2 [RFC8018] is used by the SCRAM [RFC5802] family of SASL PBKDF2 [RFC8018] is used by the SCRAM [RFC5802] family of SASL
mechanisms. mechanisms.
+-----------------------------+-------------------------------------+ +=============================+==================================+
| Parameter | Value | | Parameter | Value |
+=============================+=====================================+ +=============================+==================================+
| Minimum iteration count (c) | 10,000 | | Minimum iteration count (c) | 10,000 |
+-----------------------------+-------------------------------------+ +-----------------------------+----------------------------------+
| Hash | SHA256 | | Hash | SHA256 |
+-----------------------------+-------------------------------------+ +-----------------------------+----------------------------------+
| Output length (dkLen) | 64 (or length of | | Output length (dkLen) | hLen (length of the chosen hash) |
| | chosen hash, hLen) | +-----------------------------+----------------------------------+
+-----------------------------+-------------------------------------+
Table 4: PBKDF2 Parameters Table 4: PBKDF2 Parameters
5.4. Scrypt 5.4. Scrypt
The [SCRYPT] KDF is designed to be memory-hard and sequential memory- The [SCRYPT] KDF is designed to be memory-hard and sequential memory-
hard to prevent against custom hardware based attacks. hard to prevent against custom hardware based attacks.
Security considerations, test vectors, and further notes on tuning Security considerations, test vectors, and further notes on tuning
scrypt may be found in [RFC7914]. scrypt may be found in [RFC7914].
+-----------+----------------+ +===========+================+
| Parameter | Value | | Parameter | Value |
+===========+================+ +===========+================+
| N | 32768 (N=2^15) | | N | 32768 (N=2^15) |
+-----------+----------------+ +-----------+----------------+
| r | 8 | | r | 8 |
+-----------+----------------+ +-----------+----------------+
| p | 1 | | p | 1 |
+-----------+----------------+ +-----------+----------------+
Table 5: Scrypt Parameters Table 5: Scrypt Parameters
skipping to change at page 8, line 38 skipping to change at page 8, line 50
preparation and enforcement steps of the OpaqueString profile of preparation and enforcement steps of the OpaqueString profile of
[RFC8265] SHOULD be applied (for more information see the [RFC8265] SHOULD be applied (for more information see the
Internationalization Considerations section). Entities SHOULD Internationalization Considerations section). Entities SHOULD
enforce a minimum length of 8 characters for user passwords. If enforce a minimum length of 8 characters for user passwords. If
using a mechanism such as PLAIN where the server performs hashing on using a mechanism such as PLAIN where the server performs hashing on
the original password, a maximum length between 64 and 128 characters the original password, a maximum length between 64 and 128 characters
MAY be imposed to prevent denial of service (DoS) attacks. Entities MAY be imposed to prevent denial of service (DoS) attacks. Entities
SHOULD NOT apply any other password restrictions. SHOULD NOT apply any other password restrictions.
In addition to these password complexity requirements, servers SHOULD In addition to these password complexity requirements, servers SHOULD
maintain a password blacklist and reject attempts by a claimant to maintain a password blocklist and reject attempts by a claimant to
use passwords on the blacklist during registration or password reset. use passwords on the blocklist during registration or password reset.
The contents of this blacklist are a matter of server policy. Some The contents of this blocklist are a matter of server policy. Some
common recommendations include lists of common passwords that are not common recommendations include lists of common passwords that are not
otherwise prevented by length requirements, passwords present in otherwise prevented by length requirements, and passwords present in
known breaches (when paired with the same email or other uniquely known breaches.
identifying information) to prevent reuse of compromised passwords,
and password that match commonly used patterns such as "any single
repeated character".
7. Internationalization Considerations 7. Internationalization Considerations
The PRECIS framework (Preparation, Enforcement, and Comparison of The PRECIS framework (Preparation, Enforcement, and Comparison of
Internationalized Strings) defined in [RFC8264] is used to enforce Internationalized Strings) defined in [RFC8264] is used to enforce
internationalization rules on strings and to prevent common internationalization rules on strings and to prevent common
application security issues arrising from allowing the full range of application security issues arrising from allowing the full range of
Unicode codepoints in usernames, passwords, and other identifiers. Unicode codepoints in usernames, passwords, and other identifiers.
The OpaqueString profile of [RFC8265] is used in this document to The OpaqueString profile of [RFC8265] is used in this document to
ensure that codepoints in passwords are treated carefully and ensure that codepoints in passwords are treated carefully and
 End of changes. 22 change blocks. 
56 lines changed or deleted 56 lines changed or added

This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/