CRAM-MD5

In cryptography, CRAM-MD5 is a challenge-response authentication mechanism (CRAM) based on the HMAC-MD5 algorithm. As one of the mechanisms supported by the Simple Authentication and Security Layer (SASL), it is often used in email software as part of SMTP Authentication and for the authentication of POP and IMAP users, as well as in applications implementing LDAP, XMPP, BEEP, and other protocols.

When such software requires authentication over unencrypted connections, CRAM-MD5 is preferred over mechanisms that transmit passwords "in the clear," such as LOGIN and PLAIN. However, it can't prevent derivation of a password through a brute-force attack, so it is less effective than alternative mechanisms that avoid passwords or that use connections encrypted with Transport Layer Security (TLS).

Protocol

The CRAM-MD5 protocol involves a single challenge and response cycle, and is initiated by the server:

  1. Challenge: The server sends a base64-encoded string to the client. Before encoding, it could be any random string, but the standard that currently defines CRAM-MD5 says that it is in the format of a Message-ID email header value (including angle brackets) and includes an arbitrary string of random digits, a timestamp, and the server's fully qualified domain name.
  2. Response: The client responds with a string created as follows.
    1. The challenge is base64-decoded.
    2. The decoded challenge is hashed using HMAC-MD5, with a shared secret (typically, the user's password, or a hash thereof) as the secret key.
    3. The hashed challenge is converted to a string of lowercase hex digits.
    4. The username and a space character are prepended to the hex digits.
    5. The concatenation is then base64-encoded and sent to the server
  3. Comparison: The server uses the same method to compute the expected response. If the given response and the expected response match, then authentication was successful.

Strengths

The one-way hash and the fresh random challenge provide three types of security:

Weaknesses

Standards

CRAM-MD5 is defined by the IETF standards-track document RFC 2195, which supersedes RFC 2095, from earlier in 1997. These de facto standards define CRAM-MD5 as an authentication method for the email mailbox-management protocols POP and IMAP.

CRAM-MD5 is one of the authentication methods supported by Simple Authentication and Security Layer (SASL), defined in 2006 by RFC 4422, which supersedes the 1997 standard RFC 2222.

The Internet Assigned Numbers Authority (IANA) maintains a registry of SASL mechanisms,[3] including CRAM-MD5, for limited use.

CRAM-MD5 is required for On-Demand Mail Relay (ODMR), defined in RFC 2645.

See also

References

  1. "function verify_credentials". Dovecot 2.0 source. Retrieved 23 January 2014.
  2. "file hmac-md5.c". Dovecot 2.0 source. Retrieved 23 January 2014.
  3. "Simple Authentication and Security Layer (SASL) Mechanisms". Protocol Registries. IANA.
This article is issued from Wikipedia - version of the 7/16/2015. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.