2 Network Working Group L. Nerenberg, Editor
3 Internet Draft: The CRAM-MD5 SASL Mechanism Orthanc Systems
4 Document: draft-ietf-sasl-crammd5-02.txt January 2004
8 The CRAM-MD5 SASL Mechanism
13 This document is an Internet Draft and is in full conformance with
14 all provisions of Section 10 of RFC 2026.
16 Internet Drafts are working documents of the Internet Engineering
17 Task Force (IETF), its areas, and its working groups. Note that
18 other groups may also distribute working documents as Internet
21 Internet Drafts are draft documents valid for a maximum of six
22 months and may be updated, replaced, or obsoleted by other docu-
23 ments at any time. It is inappropriate to use Internet Drafts as
24 reference material or to cite them other than as "work in
27 The list of current Internet Drafts can be accessed at
28 http://www.ietf.org/ietf/1id-abstracts.txt The list of Internet
29 Draft Shadow Directories can be accessed at
30 http://www.ietf.org/shadow.html.
32 Copyright 2003,2004 The Internet Society. All Rights Reserved.
34 Please see the Copyright section near the end of this document for
39 This document defines a simple challenge-response authentication
40 mechanism, using a keyed-hash digest, for use with the Simple
41 Authentication and Security Layer (SASL).
43 1. Conventions Used in this Document
45 The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY"
46 in this document are to be interpreted as defined in [KEYWORD].
49 2. CRAM-MD5 Authentication Mechanism
51 This document defines a simple challenge-response [SASL] authenti-
52 cation mechanism, using a [KEYED-MD5] digest, for use with [SASL].
53 The mechanism name associated with CRAM-MD5 is 'CRAM-MD5'.
55 This mechanism does not provide a security layer.
59 Nerenberg draft-ietf-sasl-crammd5-02.txt [Page 1]
61 Internet Draft CRAM-MD5 SASL Mechanism January 2004
64 The data encoded in the challenge contains a presumptively arbi-
65 trary string of random digits, a time-stamp, and the fully-quali-
66 fied primary host name of the server.
68 The client makes note of the data and then responds with a string
69 consisting of the user name, a space, and a "digest." The latter
70 is computed by applying the keyed MD5 algorithm from [KEYED-MD5]
71 where the key is a shared secret and the digested text is the chal-
72 lenge (including angle-brackets). The client MUST NOT interpret or
73 attempt to validate the contents of the challenge in any way.
75 This shared secret is a string known only to the client and server.
76 The "digest" parameter itself is a 16-octet value which is sent in
77 hexadecimal format, using lower-case US-ASCII characters.
79 When the server receives this client response, it verifies the
80 digest provided. Since the user name may contain the space charac-
81 ter, the server MUST scan the client response from right to left;
82 the first space character encountered separates the digest from the
83 user name. If the digest is correct, the server should consider
84 the client authenticated and respond appropriately.
86 The client MUST prepare the user name and shared secret strings
87 using the [SASLPrep] profile of the [StringPrep] algorithm. The
88 resulting values MUST be encoded as UTF-8 [UTF8].
93 The following syntax specification uses the augmented Backus-Naur
94 Form (ABNF) as specified in [ABNF], and incorporates by reference
95 the Core Rules defined in that document.
97 challenge = "<" 1*DIGIT "." 1*DIGIT "@" hostname ">"
99 digest = 32(DIGIT / %x61-66)
100 ; A hexadecimal string using only lower-case
103 hostname = 1*(ALPHA / DIGIT) *("." / "-" / ALPHA / DIGIT)
105 response = user SP digest
112 The examples in this section do NOT form part of the specification.
113 Where conflicts exist between the examples and the formal grammar
114 or specification text, the latter are authoritative.
116 These examples show the use of the CRAM-MD5 mechanism with the
117 IMAP4 AUTHENTICATE command [IMAP4]. The base64 encoding of the
121 Nerenberg draft-ietf-sasl-crammd5-02.txt [Page 2]
123 Internet Draft CRAM-MD5 SASL Mechanism January 2004
126 challenges and responses is part of the IMAP4 AUTHENTICATE command,
127 not part of the CRAM-MD5 specification itself.
129 S: * OK [CAPABILITY IMAP4rev1 STARTTLS LOGINDISABLED AUTH=CRAM-MD5]
130 C: A0001 AUTHENTICATE CRAM-MD5
131 S: + PDE4OTYuNjk3MTcwOTUyQHBvc3RvZmZpY2UuZXhhbXBsZS5uZXQ+
132 C: am9lIDNkYmM4OGYwNjI0Nzc2YTczN2IzOTA5M2Y2ZWI2NDI3
133 S: A0001 OK CRAM-MD5 authentication successful
135 In this example, the shared secret is the string
139 Hence, the Keyed MD5 digest is produced by calculating
141 MD5((tanstaaftanstaaf XOR opad),
142 MD5((tanstaaftanstaaf XOR ipad),
143 <1896.697170952@postoffice.example.net>))
145 where ipad and opad are as defined in [KEYED-MD5] and the string
146 shown in the challenge is the base64 encoding of
147 <1896.697170952@postoffice.example.net>. The shared secret is null-
148 padded to a length of 64 bytes. If the shared secret is longer than
149 64 bytes, the MD5 digest of the shared secret is used as a 16 byte
150 input to the keyed MD5 calculation.
152 This produces a digest value (in hexadecimal) of
154 3dbc88f0624776a737b39093f6eb6427
156 The user name is then prepended to it, forming
158 joe 3dbc88f0624776a737b39093f6eb6427
160 Which is then base64 encoded to meet the requirements of the IMAP4
161 AUTHENTICATE command (or the similar POP3 AUTH command), yielding
163 am9lIDNkYmM4OGYwNjI0Nzc2YTczN2IzOTA5M2Y2ZWI2NDI3
169 3.1. Normative References
172 Crocker, D., P. Overell, "Augmented BNF for Syntax Specifications:
173 ABNF", RFC2234, Internet Mail Consortium and Demon Internet Ltd.,
177 Krawczyk, Bellare, Canetti, "HMAC: Keyed-Hashing for Message
178 Authentication", RFC 2104, IBM and UCSD, February 1997.
183 Nerenberg draft-ietf-sasl-crammd5-02.txt [Page 3]
185 Internet Draft CRAM-MD5 SASL Mechanism January 2004
189 Bradner, S., "Key words for use in RFCs to Indicate Requirement
190 Levels", BCP 14, RFC2119, Harvard University, March 1997.
193 Rivest, R., "The MD5 Message Digest Algorithm", RFC 1321, MIT Labo-
194 ratory for Computer Science and RSA Data Security, Inc., April
198 Myers, J., "Simple Authentication and Security Layer (SASL)," RFC
199 2222, Netscape Communications, October 1997.
202 Zeilenga, K., "SASL String Preparation Profiles", draft-ietf-sasl-
203 saslprep (work in progress)
206 Hoffman, P., M. Blanchet, "Preparation of Internationalized Strings
207 (stringprep)", RFC 3454, IMC and Viagenie, December 2002.
210 Yergeau, F., "UTF-8, a transformation format of ISO 10646", RFC
211 2279, Alis Technologies, January 1998.
213 3.2. Informative References
216 Crispin, M., "Internet Message Access Protocol - Version 4rev1,"
217 RFC 3501, University of Washington, March 2003.
220 4. Security Considerations
222 It is conjectured that use of the CRAM-MD5 authentication mechanism
223 provides replay protection for a session.
225 This mechanism does not obscure the user name in any way. Accord-
226 ingly, a server that implements both a clear-text password command
227 and this authentication type should not allow both methods of
228 access for a given user name.
230 Keyed MD5 is chosen for this application because of the greater
231 security imparted to authentication of short messages. In addition,
232 the use of the techniques described in [KEYED-MD5] for pre-computa-
233 tion of intermediate results make it possible to avoid explicit
234 clear-text storage of the shared secret on the server system by
235 instead storing the intermediate results which are known as "con-
236 texts." While the saving, on the server, of the MD5 "context" is
237 marginally better than saving the shared secrets in clear-text, it
238 is not sufficient to protect the secrets if the server itself is
239 compromised. Consequently, servers that store the secrets or con-
240 texts must both be protected to a level appropriate to the poten-
241 tial information value in the data and services protected by this
245 Nerenberg draft-ietf-sasl-crammd5-02.txt [Page 4]
247 Internet Draft CRAM-MD5 SASL Mechanism January 2004
250 mechanism. In other words, techniques like this one involve a
251 trade-off between vulnerability to network sniffing and I/O buffer
252 snooping and vulnerability of the server host's databases. If one
253 believes that the host and its databases are subject to compromise,
254 and the network is not, this technique (and all others like it) is
255 unattractive. It is perhaps even less attractive than clear-text
256 passwords, which are typically stored on hosts in one-way hash
257 form. On the other hand, if the server databases are perceived as
258 reasonably secure, and one is concerned about client-side or net-
259 work interception of the passwords (secrets), then this (and simi-
260 lar) techniques are preferable to clear-text passwords by a wide
263 As the length of the shared secret increases, so does the diffi-
264 culty of deriving it.
266 While there are now suggestions in the literature that the use of
267 MD5 and keyed MD5 in authentication procedures probably has a lim-
268 ited effective lifetime, the technique is now widely deployed and
269 widely understood. It is believed that this general understanding
270 may assist with the rapid replacement, by CRAM-MD5, of the current
271 uses of permanent clear-text passwords in many protocols. This
272 document has been deliberately written to permit easy upgrading to
273 use SHA (or whatever alternatives emerge) when they are considered
274 to be widely available and adequately safe.
276 Even with the use of CRAM-MD5, users are still vulnerable to active
277 attacks. An example of an increasingly common active attack is
278 'TCP Session Hijacking' as described in CERT Advisory CA-95:01.
280 CRAM-MD5 does not authenticate the server and does not include a
281 client-supplied nonce. As a result, it is possible to construct a
282 server with a fixed challenge string that has pre-computed the
283 hashes for all possible passwords up to a certain length (or from a
284 dictionary). Such a server could then immediately determine the
285 user's password if it is sufficiently short.
288 5. IANA Considerations
290 The SASL Mechanism Registry entry for CRAM-MD5 must be updated to
291 reference this specification.
296 The CRAM-MD5 mechanism was originally specified in RFC 2095,
297 IMAP/POP AUTHorize Extension for Simple Challenge/Response. The
298 authors of that document -- John C. Klensin, Paul Krumviede, and
299 Randy Catoe -- are to be credited with the design and specification
300 of CRAM-MD5, and they are the original authors of the majority of
301 the text in this document. This memo serves only to re-state CRAM-
302 MD5 within the formal context of SASL, which specification it pre-
303 ceded by several months.
307 Nerenberg draft-ietf-sasl-crammd5-02.txt [Page 5]
309 Internet Draft CRAM-MD5 SASL Mechanism January 2004
312 7. Intellectual Property
314 The IETF takes no position regarding the validity or scope of any
315 intellectual property or other rights that might be claimed to per-
316 tain to the implementation or use of the technology described in
317 this document or the extent to which any license under such rights
318 might or might not be available; neither does it represent that it
319 has made any effort to identify any such rights. Information on
320 the IETF's procedures with respect to rights in standards-track and
321 standards-related documentation can be found in BCP-11. Copies of
322 claims of rights made available for publication and any assurances
323 of licenses to be made available, or the result of an attempt made
324 to obtain a general license or permission for the use of such pro-
325 prietary rights by implementers or users of this specification can
326 be obtained from the IETF Secretariat.
328 The IETF invites any interested party to bring to its attention any
329 copyrights, patents or patent applications, or other proprietary
330 rights which may cover technology that may be required to practice
331 this standard. Please address the information to the IETF Execu-
339 Email: lyndon+rfc-crammd5@orthanc.ca
369 Nerenberg draft-ietf-sasl-crammd5-02.txt [Page 6]
371 Internet Draft CRAM-MD5 SASL Mechanism January 2004
374 9. Full Copyright Statement
376 Copyright 2003, 2004, The Internet Society. All Rights Reserved.
378 This document and translations of it may be copied and furnished to
379 others, and derivative works that comment on or otherwise explain
380 it or assist in its implementation may be prepared, copied, pub-
381 lished and distributed, in whole or in part, without restriction of
382 any kind, provided that the above copyright notice and this para-
383 graph are included on all such copies and derivative works. How-
384 ever, this document itself may not be modified in any way, such as
385 by removing the copyright notice or references to the Internet
386 Society or other Internet organizations, except as needed for the
387 purpose of developing Internet standards in which case the proce-
388 dures for copyrights defined in the Internet Standards process must
389 be followed, or as required to translate it into languages other
390 than English. The limited permissions granted above are perpetual
391 and will not be revoked by the Internet Society or its successors
394 This document and the information contained herein is provided on
395 an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGI-
396 NEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
397 INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
398 INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WAR-
399 RANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
431 Nerenberg draft-ietf-sasl-crammd5-02.txt [Page 7]