RFC 3112 INFORMATIONAL LDAP · AUTHENTICATION · SECURITY

LDAP Authentication Password Schema

A schema for storing passwords in an LDAP directory so that the stored form can be a hash rather than the password itself.

On rfc-editor.org ↗
PUBLISHED
May 2001
AUTHORS
K. Zeilenga
STREAM
Legacy
AUTHPASSWORD SYNTAX OID
1.3.6.1.4.1.4203.1.1.2
MINIMUM SALT LENGTH
64 bits
LONGEST SALT TO SUPPORT
128 bits
SCHEMES DESCRIBED
MD5 and SHA1
SCHEME REQUIRED FOR SIMPLE BIND
SHA1
WORKED EXAMPLE
User joe, password mary, salt salt, value marysalt
DOI
10.17487/RFC3112

RFC text

Contents
Original text · RFC Editor View on rfc-editor.org ↗
Network Working Group                                        K. Zeilenga
Request for Comments: 3112                           OpenLDAP Foundation
Category: Informational                                         May 2001


                  LDAP Authentication Password Schema

Status of this Memo

   This memo provides information for the Internet community.  It does
   not specify an Internet standard of any kind.  Distribution of this
   memo is unlimited.

Copyright Notice

   Copyright (C) The Internet Society (2001).  All Rights Reserved.

Abstract

   This document describes schema in support of user/password
   authentication in a LDAP (Lightweight Directory Access Protocol)
   directory including the authPassword attribute type.  This attribute
   type holds values derived from the user's password(s) (commonly using
   cryptographic strength one-way hash).  authPassword is intended to
   used instead of userPassword.

1. Background and Intended Use

   The userPassword attribute type [RFC2256] is intended to be used to
   support the LDAP [RFC2251] "simple" bind operation.  However, values
   of userPassword must be clear text passwords.  It is often desirable
   to store values derived from the user's password(s) instead of actual
   passwords.

   The authPassword attribute type is intended to be used to store
   information used to implement simple password based authentication.
   The attribute type may be used by LDAP servers to implement the LDAP
   Bind operation's "simple" authentication method.

   The attribute type supports multiple storage schemes.  A matching
   rule is provided for use with extensible search filters to allow
   clients to assert that a clear text password "matches" one of the
   attribute's values.

   Storage schemes often use cryptographic strength one-way hashing.
   Though the use of one-way hashing reduces the potential that exposed
   values will allow unauthorized access to the Directory (unless the
   hash algorithm/implementation is flawed), the hashing of passwords is
   intended to be as an additional layer of protection.  It is
   RECOMMENDED that hashed values be protected as if they were clear
   text passwords.

   This attribute may be used in conjunction with server side password
   generation mechanisms (such as the LDAP Password Modify [RFC3062]
   extended operation).

   Access to this attribute may governed by administrative controls such
   as those which implement password change policies.

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", and "MAY" in this document are
   to be interpreted as described in RFC 2119 [RFC2119].

2. Schema Definitions

   The following schema definitions are described in terms of LDAPv3
   Attribute Syntax Definitions [RFC2252] with specific syntax detailed
   using Augmented BNF [RFC2234].

2.1. authPasswordSyntax

      ( 1.3.6.1.4.1.4203.1.1.2
        DESC 'authentication password syntax' )

   Values of this syntax are encoded according to:

      authPasswordValue = w scheme s authInfo s authValue w
      scheme = %x30-39 / %x41-5A / %x2D-2F / %x5F
            ; 0-9, A-Z, "-", ".", "/", or "_"
      authInfo = schemeSpecificValue
      authValue = schemeSpecificValue
              schemeSpecificValue = *( %x21-23 / %x25-7E )
            ; printable ASCII less "$" and " "
      s = w SEP w
      w = *SP
      SEP = %x24 ; "$"
      SP = %x20 ; " " (space)

   where scheme describes the mechanism and authInfo and authValue are a
   scheme specific.  The authInfo field is often a base64 encoded salt.
   The authValue field is often a base64 encoded value derived from a
   user's password(s).  Values of this attribute are case sensitive.

   Transfer of values of this syntax is strongly discouraged where the
   underlying transport service cannot guarantee confidentiality and may
   result in disclosure of the values to unauthorized parties.

   This document describes a number of schemes, as well as requirements
   for the scheme naming, in section 3.

2.2. authPasswordExactMatch

      ( 1.3.6.1.4.1.4203.1.2.2
        NAME 'authPasswordExactMatch'
        DESC 'authentication password exact matching rule'
        SYNTAX 1.3.6.1.4.1.4203.1.1.2 )

   This matching rule allows a client to assert that an asserted
   authPasswordSyntax value matches authPasswordSyntax values.  It is
   meant to be used as the EQUALITY matching rule of attributes whose
   SYNTAX is authPasswordSyntax.

   The assertion is "TRUE" if there is an attribute value which has the
   same scheme, authInfo, and authValue components as the asserted
   value; "FALSE" if no attribute value has the same components as the
   asserted value; and "Undefined" otherwise.

2.3. authPasswordMatch

       ( 1.3.6.1.4.1.4203.1.2.3
         NAME 'authPasswordMatch'
         DESC 'authentication password matching rule'
         SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{128} )

   This matching rule allows a client to assert that a password matches
   values of authPasswordSyntax using an extensibleMatch filter
   component.  Each value is matched per its scheme.  The assertion is
   "TRUE" if one or more attribute values matches the asserted value,
   "FALSE" if all values do not matches, and "Undefined" otherwise.

   Servers which support use of this matching rule SHOULD publish
   appropriate matchingRuleUse values per [RFC2252], 4.4.

   Transfer of authPasswordMatch assertion values is strongly
   discouraged where the underlying transport service cannot guarantee
   confidentiality and may result in disclosure of the values to
   unauthorized parties.

2.4. supportedAuthPasswordSchemes

      ( 1.3.6.1.4.1.4203.1.3.3
        NAME 'supportedAuthPasswordSchemes'
        DESC 'supported password storage schemes'
        EQUALITY caseExactIA5Match
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32}
        USAGE dSAOperation )

   The values of this attribute are names of supported authentication
   password schemes which the server supports.  The syntax of a scheme
   name is described in section 2.1.  This attribute may only be present
   in the root DSE.  If the server does not support any password
   schemes, this attribute will not be present.

2.5. authPassword

      ( 1.3.6.1.4.1.4203.1.3.4 NAME 'authPassword'
        DESC 'password authentication information'
        EQUALITY 1.3.6.1.4.1.4203.1.2.2
        SYNTAX 1.3.6.1.4.1.4203.1.1.2 )

   The values of this attribute are representative of the user's
   password(s) and conform to the authPasswordSyntax described in 2.1.
   The values of this attribute may be used for authentication purposes.

   Transfer of authPassword values is strongly discouraged where the
   underlying transport service cannot guarantee confidentiality and may
   result in disclosure of the values to unauthorized parties.

2.6. authPasswordObject

      ( 1.3.6.1.4.1.4203.1.4.7 NAME 'authPasswordObject'
        DESC 'authentication password mix in class'
        MAY 'authPassword'
        AUXILIARY )

   Entries of this object class may contain authPassword attribute
   types.

3. Schemes

   This section describes the "MD5" and "SHA1" schemes.  Other schemes
   may be defined by other documents.  Schemes which are not described
   in an RFC SHOULD be named with a leading "X-" to indicate they are a
   private or implementation specific scheme, or may be named using the
   dotted-decimal representation [RFC2252] of an OID assigned to the
   scheme.

3.1. MD5 scheme

   The MD5 [RFC1321] scheme name is "MD5".

   The authValue is the base64 encoding of an MD5 digest of the
   concatenation the user password and salt.  The base64 encoding of the
   salt is provided in the authInfo field.  The salt MUST be at least 64
   bits long.  Implementations of this scheme MUST support salts up to
   128 bits in length.

   Example:
      Given a user "joe" who's password is "mary" and a salt of "salt",
      the authInfo field would be the base64 encoding of "salt" and the
      authValue field would be the base64 encoding of the MD5 digest of
      "marysalt".

   A match against an asserted password and an attribute value of this
   scheme SHALL be true if and only if the MD5 digest of concatenation
   of the asserted value and the salt is equal to the MD5 digest
   contained in AuthValue.  The match SHALL be undefined if the server
   is unable to complete the equality test for any reason.  Otherwise
   the match SHALL be false.

   Values of this scheme SHOULD only be used to implement simple
   user/password authentication.

3.2. SHA1 scheme

   The SHA1 [SHA1] scheme name is "SHA1".

   The authValue is the base64 encoding of a SHA1 digest of the
   concatenation the user password and the salt.  The base64 encoding of
   the salt is provided in the authInfo field.  The salt MUST be at
   least 64 bits long.  Implementations of this scheme MUST support
   salts up to 128 bits in length.

   Example:
      Given a user "joe" who's password is "mary" and a salt of "salt",
      the authInfo field would be the base64 encoding of "salt" and the
      authValue field would be the base64 encoding of the SHA1 digest of
      "marysalt".

   A match against an asserted password and an attribute value of this
   scheme SHALL be true if and only if the SHA1 digest of concatenation
   of the asserted value and the salt is equal to the SHA1 digest
   contained in AuthValue.  The match SHALL be undefined if the server
   is unable to complete the equality test for any reason.  Otherwise
   the match SHALL be false.

   Values of this scheme SHOULD only be used to implement simple
   user/password authentication.

4. Implementation Issues

   For all implementations of this specification:

      Servers MAY restrict which schemes are used in conjunction with a
      particular authentication process but SHOULD use all values of
      selected schemes.  If the asserted password matches any of the
      stored values, the asserted password SHOULD be considered valid.
      Servers MAY use other authentication storage mechanisms, such as
      userPassword or an external password store, in conjunction with
      authPassword to support the authentication process.

      Servers that support simple bind MUST support the SHA1 scheme and
      SHOULD support the MD5 scheme.

      Servers SHOULD NOT publish values of authPassword nor allow
      operations which expose authPassword values or AuthPasswordMatch
      assertions to unless confidentiality protection is in place.

      Clients SHOULD NOT initiate operations which provide or request
      values of authPassword or make authPasswordMatch assertions unless
      confidentiality protection is in place.

      Clients SHOULD NOT assume that a successful AuthPasswordMatch,
      whether by compare or search, is sufficient to gain directory
      access.  The bind operation MUST be used to authenticate to the
      directory.

5. Security Considerations

   This document describes how authentication information may be stored
   in a directory.  Authentication information MUST be adequately
   protected as unintended disclosure will allow attackers to gain
   immediate access to the directory as described by [RFC2829].

   As flaws may be discovered in the hashing algorithm or with a
   particular implementation of the algorithm or values could be subject
   to various attacks if exposed, values of AuthPassword SHOULD be
   protected as if they were clear text passwords.  When values are
   transferred, privacy protections, such as IPSEC or TLS, SHOULD be in
   place.

   Clients SHOULD use strong authentication mechanisms [RFC2829].

   AuthPasswordMatch matching rule allows applications to test the
   validity of a user password and, hence, may be used to mount an
   attack.  Servers SHOULD take appropriate measures to protect the
   directory from such attacks.

   Some password schemes may require CPU intensive operations.  Servers
   SHOULD take appropriate measures to protect against Denial of Service
   attacks.

   AuthPassword does not restrict an authentication identity to a single
   password.  An attacker who gains write access to this attribute may
   store additional values without disabling the user's true
   password(s).  Use of policy aware clients and servers is RECOMMENDED.

   The level of protection offered against various attacks differ from
   scheme to scheme.  It is RECOMMENDED that servers support scheme
   selection as a configuration item.  This allows for a scheme to be
   easily disabled if a significant security flaw is discovered.

6. Acknowledgment

   This document borrows from a number of IETF documents and is based
   upon input from the IETF LDAPext working group.

7. Bibliography

   [RFC1321] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321,
             April 1992

   [RFC2219] Bradner, S., "Key words for use in RFCs to Indicate
             Requirement Levels", BCP 14, RFC 2119, March 1997.

   [RFC2234] Crocker, D., Editor, P. Overell, "Augmented BNF for Syntax
             Specifications: ABNF", RFC 2234, November 1997.

   [RFC2251] Wahl, M., Howes, T. and S. Kille, "Lightweight Directory
             Access Protocol (v3)", RFC 2251, December 1997.

   [RFC2252] Wahl, M., Coulbeck, A., Howes, T., and S. Kille,
             "Lightweight Directory Access Protocol (v3): Attribute
             Syntax Definitions", RFC 2252, December 1997.

   [RFC2256] Wahl, A., "A Summary of the X.500(96) User Schema for use
             with LDAPv3", RFC 2256, December 1997.

   [RFC2307] Howard, L., "An Approach for Using LDAP as a Network
             Information Service", RFC 2307, March 1998.

   [RFC2829] Wahl, M., Alvestrand, H., Hodges, J. and R. Morgan,
             "Authentication Methods for LDAP", RFC 2829, June 2000.

   [RFC3062] Zeilenga, K., "LDAP Password Modify Extended Operation",
             RFC 3062, February 2001.

   [SHA1]    NIST, FIPS PUB 180-1: Secure Hash Standard, April 1995.

8. Author's Address

   Kurt D. Zeilenga
   OpenLDAP Foundation

   EMail: Kurt@OpenLDAP.org

9.  Full Copyright Statement

   Copyright (C) The Internet Society (2001).  All Rights Reserved.

   This document and translations of it may be copied and furnished to
   others, and derivative works that comment on or otherwise explain it
   or assist in its implementation may be prepared, copied, published
   and distributed, in whole or in part, without restriction of any
   kind, provided that the above copyright notice and this paragraph are
   included on all such copies and derivative works.  However, this
   document itself may not be modified in any way, such as by removing
   the copyright notice or references to the Internet Society or other
   Internet organizations, except as needed for the purpose of
   developing Internet standards in which case the procedures for
   copyrights defined in the Internet Standards process must be
   followed, or as required to translate it into languages other than
   English.

   The limited permissions granted above are perpetual and will not be
   revoked by the Internet Society or its successors or assigns.

   This document and the information contained herein is provided on an
   "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
   TASK FORCE DISCLAIMS 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.

Acknowledgement

   Funding for the RFC Editor function is currently provided by the
   Internet Society.

ISO Plain Language

On this page
PROBLEMThe standard LDAP attribute for passwords can only hold the password in clear text, so a directory that wants to store a hashed password has nowhere to put it.
MECHANISMThe memo defines the authPassword attribute, whose values carry a scheme name, some scheme-specific information and a scheme-specific value. It also defines two matching rules so a client can ask whether a clear text password matches, and two schemes, MD5 and SHA1, that hash the password together with a salt.
WHAT IT REQUIRESServers that support simple bind must support the SHA1 scheme, and hashed values are still to be protected as if they were clear text passwords. The memo is Informational.

§1Background and Intended Use

The userPassword attribute type is intended to support the LDAP simple bind operation, in which a client proves its identity by giving a name and a password. However, values of userPassword must be clear text passwords, and it is often desirable to store values derived from the user's password instead of the actual password.

The authPassword attribute type is intended to store the information used to implement simple password based authentication, and may be used by LDAP servers to implement the simple authentication method of the bind operation. The attribute type supports multiple storage schemes. A matching rule is provided for use with extensible search filters, allowing clients to assert that a clear text password matches one of the attribute's values.

Storage schemes often use cryptographic strength one-way hashing. The memo notes that hashing reduces the potential that exposed values will allow unauthorized access to the directory, unless the hash algorithm or its implementation is flawed, and that the hashing of passwords is intended to be an additional layer of protection. It is RECOMMENDED that hashed values be protected as if they were clear text passwords.

The attribute may be used in conjunction with server side password generation mechanisms, such as the LDAP Password Modify extended operation. Access to it may be governed by administrative controls, such as those that implement password change policies.

The usual LDAP password attribute stores the password itself, so anyone who can read the directory can read the passwords. This memo adds an attribute that can store a scrambled form instead, along with the rules a server needs to check a typed password against it.

§2.1The authPassword Syntax

Values of the syntax are encoded according to the following structure: a scheme, then scheme-specific information, then a scheme-specific value, separated by spaces and a dollar sign. The scheme may contain the digits 0 to 9, the letters A to Z, and the characters hyphen, full stop, forward slash and underscore. The two scheme-specific fields hold printable ASCII less the dollar sign and the space.

The scheme describes the mechanism. The authInfo field is often a base64 encoded salt, and the authValue field is often a base64 encoded value derived from a user's password. Values of this attribute are case sensitive.

The syntax has the object identifier 1.3.6.1.4.1.4203.1.1.2. Transfer of values of this syntax is strongly discouraged where the underlying transport service cannot guarantee confidentiality, because that may result in disclosure of the values to unauthorized parties. The schema definitions are described in terms of the LDAPv3 Attribute Syntax Definitions, with the syntax itself detailed using Augmented BNF.

Each stored value has three parts: the name of the scheme used, the extra information that scheme needs, and the value itself. They are separated by a dollar sign and spaces, and the two scheme-specific parts can hold any printable character except those two.

THE SYNTAX DEFINITION AS PRINTED IN THE RFC
authPasswordValue
authPasswordValue = w scheme s authInfo s authValue w
scheme = %x30-39 / %x41-5A / %x2D-2F / %x5F
      ; 0-9, A-Z, "-", ".", "/", or "_"
authInfo = schemeSpecificValue
authValue = schemeSpecificValue
        schemeSpecificValue = *( %x21-23 / %x25-7E )
      ; printable ASCII less "$" and " "
s = w SEP w
w = *SP
SEP = %x24 ; "$"
SP = %x20 ; " " (space)

§2.2Matching Rules and Attributes

Two matching rules are defined. The authPasswordExactMatch rule allows a client to assert that an asserted authPasswordSyntax value matches authPasswordSyntax values, and is meant to be used as the EQUALITY matching rule of attributes whose SYNTAX is authPasswordSyntax. The assertion is TRUE if there is an attribute value which has the same scheme, authInfo and authValue components as the asserted value; FALSE if no attribute value has the same components as the asserted value; and Undefined otherwise.

The authPasswordMatch rule allows a client to assert that a password matches values of authPasswordSyntax using an extensibleMatch filter component. Each value is matched according to its own scheme. The assertion is TRUE if one or more attribute values match the asserted value, FALSE if all values do not match, and Undefined otherwise. Servers which support use of this matching rule SHOULD publish appropriate matchingRuleUse values. Transfer of authPasswordMatch assertion values is strongly discouraged where the underlying transport service cannot guarantee confidentiality.

Two attributes complete the schema. supportedAuthPasswordSchemes holds the names of the authentication password schemes the server supports, may only be present in the root DSE, and is not present at all if the server supports no password schemes. authPassword holds the values that are representative of the user's passwords and may be used for authentication purposes; transfer of these values is also strongly discouraged where the transport cannot guarantee confidentiality. A helper object class, authPasswordObject, allows entries of that class to contain authPassword attribute types.

Two ways to check a password are provided. The exact rule compares the three stored parts, so it only matches a value built the same way. The general rule lets the server check each stored value according to the scheme it was written in. The server also publishes a list of the schemes it supports.

§3The MD5 and SHA1 Schemes

The memo describes two schemes. Schemes which are not described in an RFC SHOULD be named with a leading X-, to indicate a private or implementation specific scheme, or may be named using the dotted-decimal representation of an object identifier assigned to the scheme.

The MD5 scheme is named MD5. Its authValue is the base64 encoding of an MD5 digest of the concatenation of the user password and the salt, and the base64 encoding of the salt is provided in the authInfo field. The salt MUST be at least 64 bits long, and implementations of this scheme MUST support salts up to 128 bits in length. The worked example: given a user joe whose password is mary and a salt of salt, the authInfo field would be the base64 encoding of salt, and the authValue field would be the base64 encoding of the MD5 digest of marysalt. A match against an asserted password and an attribute value of this scheme SHALL be true if and only if the MD5 digest of the concatenation of the asserted value and the salt is equal to the MD5 digest contained in the authValue. The match SHALL be undefined if the server is unable to complete the equality test for any reason, and otherwise it SHALL be false. Values of this scheme SHOULD only be used to implement simple user and password authentication.

The SHA1 scheme is named SHA1 and works in the same way, with a SHA1 digest in place of the MD5 digest and the same salt length requirements. Its worked example uses the same user joe, password mary and salt salt, so the authInfo field is again the base64 encoding of salt and the authValue field is the base64 encoding of the SHA1 digest of marysalt.

Two schemes are defined. In each, the server hashes the password with a salt and stores the result, so the password itself is never written down. The salt must be at least 64 bits long and implementations must cope with salts of 128 bits.

THE TWO SCHEMES THE MEMO DEFINES
AspectMD5 schemeSHA1 scheme
Scheme nameMD5SHA1
Stored valueBase64 encoding of an MD5 digest of the password concatenated with the saltBase64 encoding of a SHA1 digest of the password concatenated with the salt
Salt fieldBase64 encoding of the salt, in authInfoBase64 encoding of the salt, in authInfo
Minimum salt length64 bits64 bits
Longest salt to support128 bits128 bits

§4Implementation Issues

Servers MAY restrict which schemes are used in conjunction with a particular authentication process, but SHOULD use all values of the selected schemes. If the asserted password matches any of the stored values, the asserted password SHOULD be considered valid. Servers MAY use other authentication storage mechanisms, such as userPassword or an external password store, in conjunction with authPassword to support the authentication process.

Servers that support simple bind MUST support the SHA1 scheme and SHOULD support the MD5 scheme. Servers SHOULD NOT publish values of authPassword, nor allow operations which expose authPassword values or authPasswordMatch assertions, unless confidentiality protection is in place. Clients SHOULD NOT initiate operations which provide or request values of authPassword, or make authPasswordMatch assertions, unless confidentiality protection is in place.

One point is worth stating on its own: clients SHOULD NOT assume that a successful authPasswordMatch, whether by compare or by search, is sufficient to gain directory access. The bind operation MUST be used to authenticate to the directory.

A server may support only some schemes, but it should check every value it holds for a chosen scheme. Servers and clients should keep the attribute off the wire unless the connection is protected. And a successful password check is not a login: the client still has to bind to the directory.

THE RULES THE MEMO SETS FOR SERVERS AND CLIENTS
  • Simple bindServers MUST support the SHA1 scheme and SHOULD support the MD5 scheme.
  • Publishing valuesServers SHOULD NOT publish authPassword values without confidentiality protection.
  • Client requestsClients SHOULD NOT request or assert authPassword values without confidentiality protection.
  • Getting accessA successful match is not access; the bind operation MUST be used to authenticate.

§5Security Considerations

Authentication information MUST be adequately protected, because unintended disclosure will allow attackers to gain immediate access to the directory. As flaws may be discovered in the hashing algorithm or with a particular implementation of it, and because values could be subject to various attacks if exposed, values of authPassword SHOULD be protected as if they were clear text passwords. When values are transferred, privacy protections such as IPSEC or TLS SHOULD be in place. Clients SHOULD use strong authentication mechanisms.

The authPasswordMatch matching rule allows applications to test the validity of a user password and, hence, may be used to mount an attack. Servers SHOULD take appropriate measures to protect the directory from such attacks. Some password schemes may require CPU intensive operations, so servers SHOULD take appropriate measures to protect against Denial of Service attacks.

Two further points. authPassword does not restrict an authentication identity to a single password: an attacker who gains write access to this attribute may store additional values without disabling the user's true passwords, so use of policy aware clients and servers is RECOMMENDED. And because the level of protection differs from scheme to scheme, it is RECOMMENDED that servers support scheme selection as a configuration item, which allows a scheme to be disabled if a significant security flaw is discovered.

A stored hash still has to be kept out of reach, because exposing it gives attackers a direct way in. The matching rule is itself a way to attack a directory by guessing passwords one at a time, and some schemes cost the server a lot of processor time. The memo recommends making the scheme a configurable choice, so a broken scheme can be switched off.

§7References