4 Network Working Group D. Cridland
5 Internet-Draft A. Melnikov
6 Expires: August 30, 2007 Isode Limited
10 The Hash Exchange Authentication SASL Mechanism
11 draft-cridland-sasl-hexa-00
15 By submitting this Internet-Draft, each author represents that any
16 applicable patent or other IPR claims of which he or she is aware
17 have been or will be disclosed, and any of which he or she becomes
18 aware will be disclosed, in accordance with Section 6 of BCP 79.
20 Internet-Drafts are working documents of the Internet Engineering
21 Task Force (IETF), its areas, and its working groups. Note that
22 other groups may also distribute working documents as Internet-
25 Internet-Drafts are draft documents valid for a maximum of six months
26 and may be updated, replaced, or obsoleted by other documents at any
27 time. It is inappropriate to use Internet-Drafts as reference
28 material or to cite them other than as "work in progress."
30 The list of current Internet-Drafts can be accessed at
31 http://www.ietf.org/ietf/1id-abstracts.txt.
33 The list of Internet-Draft Shadow Directories can be accessed at
34 http://www.ietf.org/shadow.html.
36 This Internet-Draft will expire on August 30, 2007.
40 Copyright (C) The IETF Trust (2007).
44 This memo defines and discusses a SASL mechanism that is based on the
45 exchange of hashes. It does not require the storage of a plaintext
46 equivalent on the server, is simple to implement, and provides a
47 reasonable level of security.
55 Cridland & Melnikov Expires August 30, 2007 [Page 1]
57 Internet-Draft SASL HEXA February 2007
62 1. Conventions used in this document . . . . . . . . . . . . . . 3
63 2. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3
64 2.1. Rationale . . . . . . . . . . . . . . . . . . . . . . . . 3
65 2.1.1. Deployability . . . . . . . . . . . . . . . . . . . . 3
66 2.1.2. Hash Agility . . . . . . . . . . . . . . . . . . . . . 3
67 2.1.3. Ease of Implementation . . . . . . . . . . . . . . . . 4
68 3. Notations and Definitions . . . . . . . . . . . . . . . . . . 4
69 3.1. HMAC and Hash functions . . . . . . . . . . . . . . . . . 4
70 3.1.1. Notation . . . . . . . . . . . . . . . . . . . . . . . 4
71 3.2. Wire Message Format . . . . . . . . . . . . . . . . . . . 5
72 3.3. Prior Setup . . . . . . . . . . . . . . . . . . . . . . . 5
73 3.4. Authentication Process . . . . . . . . . . . . . . . . . . 5
74 3.4.1. Initial client message . . . . . . . . . . . . . . . . 5
75 3.4.2. Server challenge message . . . . . . . . . . . . . . . 6
76 3.4.3. Client response message . . . . . . . . . . . . . . . 6
77 3.4.4. Server Authentication and Mutual Auth . . . . . . . . 6
78 4. Mandatory to Implement . . . . . . . . . . . . . . . . . . . . 7
79 5. Formal Syntax . . . . . . . . . . . . . . . . . . . . . . . . 7
80 6. Security Considerations . . . . . . . . . . . . . . . . . . . 8
81 6.1. Plaintext Equivalents . . . . . . . . . . . . . . . . . . 8
82 6.2. Hash algorithm usage . . . . . . . . . . . . . . . . . . . 8
83 6.3. Resistance to attacks . . . . . . . . . . . . . . . . . . 9
84 7. References . . . . . . . . . . . . . . . . . . . . . . . . . . 9
85 7.1. Normative References . . . . . . . . . . . . . . . . . . . 9
86 7.2. Informative References . . . . . . . . . . . . . . . . . . 10
87 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 10
88 Intellectual Property and Copyright Statements . . . . . . . . . . 12
111 Cridland & Melnikov Expires August 30, 2007 [Page 2]
113 Internet-Draft SASL HEXA February 2007
116 1. Conventions used in this document
118 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
119 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
120 document are to be interpreted as described in [KEYWORDS].
125 Although other hash-based [SASL] mechanisms exist, they are being
126 rapidly outdated by advances in computing speed and the discovery of
127 weaknesses in hash functions. Moreover, both [CRAM-MD5] and
128 [DIGEST-MD5] involve the server having plaintext equivalents in the
131 This mechanism was borne out of a percieved need within the system
132 administration community to have a mechanism which was both easier to
133 implement and also safer than [DIGEST-MD5].
137 HEXA is specifically aimed at providing three key features.
141 HEXA is designed to be acceptable to deploy in the real world. Its
142 authentication database is designed such that it may be used directly
143 for local logins, effectively having the same properties as a typical
144 /etc/shadow file on UNIX systems. This allows HEXA to co-exist with
145 very well deployed mechanisms such as [PLAIN], freeing the need for
150 Hash algorithms have an alarming tendancy to age. It is therefore
151 beneficial to allow a server administrator to switch hash algorithms.
152 This is only practical, however, when it is known that the new hash
153 algorithm can be well supported by the clients in use. Where the
154 clients are out of the control of the administrator, for example in
155 typical commercial settings, it is useful for the administrator to be
156 aware of what the current deployed base is able to use.
158 Therefore, in HEXA, clients advertise their capability to the server,
159 allowing a server administrator to upgrade the hash algorithm as
167 Cridland & Melnikov Expires August 30, 2007 [Page 3]
169 Internet-Draft SASL HEXA February 2007
172 2.1.3. Ease of Implementation
174 In general, [DIGEST-MD5] has been found to be difficult to implement
175 interoperably. Even well known implementations have been found to
176 have interoperability problems under some circumstances. HEXA
177 attempts to tackle this by using a small number of operation types,
178 and simple parsing. This allows for simple scripting languages to
179 implement, as well as using hash algorithms and related functions
180 that are known to be well deployed.
182 Since no mechanism can be considered secure in practise if no
183 implementations exist, this specification chooses easily available
184 pre-existing source code above stronger, less well implemented
188 3. Notations and Definitions
190 3.1. HMAC and Hash functions
192 This specification requires the use of [HMAC], based on hash
193 functions such as [MD5], SHA1, or SHA-256.
195 Messages are shown in plain text, with the CR LF pair shown as a line
198 Mandatory to implement hashes are discussed in Section 4, and are
199 considered volatile parts of this specification, very likely to
200 change in future revisions of this specification.
204 We use a relatively simple notation to show the calculations
207 An agreed hash algorithm, used to produce a cryptographically
208 secure hash of the input data T.
210 An [HMAC] function used with an agreed hash function, used to
211 produce a MAC for T with a key of K.
213 Where n is an integer, expands to HMAC(HMAC[n-1](K,T),T).
214 HMAC[1](K,T) is equivalent to HMAC(K,T).
216 Where Q and W are strings, represents simple concatenation.
223 Cridland & Melnikov Expires August 30, 2007 [Page 4]
225 Internet-Draft SASL HEXA February 2007
229 Where Q and W are strings, represents an octet by octet XOR.
231 Where X is a string, represents the application of the [SASLPREP]
232 algorithm to the string.
234 3.2. Wire Message Format
236 HEXA uses a wire format based on a simplified variant of email
237 message header formats, and only transfers text. No folding or
238 encoding is required or allowed.
240 The message contains keys and values, where each key appears a
241 maximum of once. Keys consist of ASCII letters, numbers, and the
242 hyphen character. Values contain UTF-8, and begin with a non-space
243 character. They never contain NUL, CR, or LF. Each Key Value pair
244 ends with a CR LF pair.
246 Keys appear first, followed by a single colon (":"), followed by the
247 value. Any surrounding spaces are considered part of the value.
251 The client is assumed to have an Authcid, an optional Authzid, and a
254 The server has a Realm, and a database keyed against Authcid
255 containing a Salt, and hash output known as the Verifier.
257 Verifier := HMAC[n](Intermediate, Salt)
258 Intermediate := HMAC[n](Realm + SASLprep(Authcid)
259 + SASLprep(Password), Salt)
261 The server's database is initially populated before authentication by
262 temporarily calculating the Intermediate from the supplied Password,
263 and choosing a new Salt. A new Salt SHOULD be used whenever the
264 Password is changed. The hash algorithm used is also remembered by
265 the server - servers MAY use multiple hash algorithms.
267 After calculating and storing the Verifier, the Intermediate MUST be
270 3.4. Authentication Process
272 3.4.1. Initial client message
274 Initially, the client sends a message containing Authcid, optionally
275 Authzid, a list of hash algorithm names it supports, and some random
279 Cridland & Melnikov Expires August 30, 2007 [Page 5]
281 Internet-Draft SASL HEXA February 2007
284 data to use as a client nonce, this message is ClientMessage:
287 Hashes:MD5 SHA1 SHA-256
288 Client-Nonce:laksjdoijcosijdv
291 3.4.2. Server challenge message
293 The server looks up Authcid in its database, selects the strongest
294 hash algorithm mutually supported, and returns the hash algorithm,
295 the number of cycles it uses, and the value of Salt. It also creates
296 some random data for use as a server nonce. Because this MUST be
297 textual, servers MAY base64 encode this data, however, this is an
298 implementation detail. The server sends the server nonce, Salt, and
299 Realm to the client, along with an indication of which channel
300 binding the server will use, if any:
303 Salt:aajvskjhvslkjdnvcn
306 Server-Nonce:ksjdnclksdhufdh
309 3.4.3. Client response message
311 The client stores this message precisely as received, as
314 The client now calculates Intermediate and Verifier as above, and in
315 addition a hash Key, and a value Exchange, such that:
317 Key := HMAC[n](Verifier, ClientMessage
318 + ServerMessage + ChannelBinding)
319 Exchange := Key ^ Intermediate
321 If there is no channel binding available that the server supports,
322 then ChannelBinding will be an empty string. Exchange is represented
323 as hex, and the result is sent to the server:
325 Hash-Exchange:1f2d...
327 3.4.4. Server Authentication and Mutual Auth
329 The server can now construct Key, extract Intermediate from Exchange,
330 and verify Intermediate against the stored hash output Verifier. In
331 order to prove to the client that it can do so, it sends the client a
335 Cridland & Melnikov Expires August 30, 2007 [Page 6]
337 Internet-Draft SASL HEXA February 2007
340 final message containing a hash output Authentication, such that:
342 Intermediate := Exchange ^ Key
343 Authentication := HMAC[n](Intermediate, ChannelBinding
344 + ServerMessage + Salt + ClientMessage)
346 This has is sent to the client as:
348 Server-Auth:3f4d5a...
351 4. Mandatory to Implement
353 The rationale behind this mechanism is ease of deployment and
354 implementation, thus implementations MUST provide a configuration
355 which supports the [MD5] hash algorithm using a minimal number of
356 cycles of 16. Implementations SHOULD also support SHA-256.
358 This is because both [MD5], and [HMAC] implementations which are
359 hardcoded to use [MD5], are easily available in many languages and
365 Insert boilerplate about [ABNF] here.
367 wire-message = *key-value
368 key-value = key ":" value CRLF
369 key = ALPHA *( ALPHA / "-" / DIGIT )
371 utf8-text = 1*( VCHAR / SP / UTF-2 / UTF8-3 / UTF8-4 )
372 ; visible UTF-8 or space.
373 hash-output = 1*( HEXDIG )
374 ; Output of hash algorithm, generally 32 or more has digits.
376 ; Following productions all conform to wire-message:
378 client-init-message = authcid [ authzid ] hashes client-nonce
379 [ channel-bindings ] *( extension )
380 server-challenge-message = realm hash hash-cycles server-nonce
381 [ channel-binding ] *( extension )
382 client-response-message = hash-exchange *( extension )
383 server-auth-message = server-auth *( extension )
385 ; Following productions all conform to key-value:
387 ; client-init-message:
391 Cridland & Melnikov Expires August 30, 2007 [Page 7]
393 Internet-Draft SASL HEXA February 2007
396 authcid = "Authcid" ":" utf8text CRLF
397 authzid = "Authzid" ":" utf8text CRLF
398 ; SASLPrepped authcid/authzid.
399 hashes = "Hashes" ":" hash-name *( SP hash-name ) CRLF
400 client-nonce = "Client-Nonce" ":" utf8text CRLF
401 ; MUST be generated afresh with reasonable entropy.
402 channel-bindings = "Channel-Bindings" ":" channel-binding-name
403 *( SP channel-binding-name ) CRLF
405 ; server-challenge-message:
406 realm = "Realm" ":" utf8text CRLF
407 hash = "Hash" ":" hash-name CRLF
408 hash-cycles = "Cycles" ":" 1*( DIGIT ) CRLF
409 server-nonce = "Server-Nonce" ":" utf8text CRLF
410 ; MUST be generated afresh with reasonable entropy.
411 channel-binding = "Channel-Binding:" ":" channel-binding-name CRLF
413 ; client-response-message:
414 hash-exchange = "Hash-Exchange" ":" hash-output CRLF
416 ; server-auth-message:
417 server-auth = "Server-Auth" ":" hash-output CRLF
420 channel-binding-name = ALPHA *( ALPHA / DIGIT / "-" )
421 hash-name = ALPHA *( ALPHA / DIGIT / "-" )
424 extension = key-value
427 6. Security Considerations
429 6.1. Plaintext Equivalents
431 The intermediate hash B is a plaintext equivalent. Clients SHOULD
432 NOT store this, and MUST NOT store the original plaintext password.
433 Servers MUST NOT store B.
435 6.2. Hash algorithm usage
437 In general, it is thought that the recursive application of hash
438 functions increases the strength of a hash. In particular, if the
439 hash has no weaknesses at all, merely doubling the number of
440 iterations will cause an offline dictionary attack to take twice as
441 much CPU resource. Making this a variable, negotiated, factor allows
442 very simple increases in security, as long as the hash algorithm
443 itself is not compromised sufficiently that a non-brute-force attack
447 Cridland & Melnikov Expires August 30, 2007 [Page 8]
449 Internet-Draft SASL HEXA February 2007
454 The exact hash algorithm used may be changed by live deployments.
455 HEXA provides a simple method for server administrators to discover
456 actual availability of new hash algorithms in clients, simplifying a
457 hash algorithm change.
459 6.3. Resistance to attacks
461 HEXA is thought to be resistent to slightly more attacks than
464 Assuming that HEXA can be negotiated at all, a downgrade attack
465 inside HEXA cannot be mounted, as complete messages are used as
466 input to the hashing functions - a man-in-the-middle attack will
467 cause the authentication to fail.
469 Merely obtaining the authentication database will not directly
470 allow an attcker to authenticate masquerading as a legitimate user
471 without substantial offline dictionary attacks. However, if an
472 attacker can both obtain the authentication database and observe
473 traffic on the wire, then the attacker can obtain B. As with
474 [DIGEST-MD5], this will not yield the password without an
475 expensive offline-dictionary attack.
477 Clients typically store sufficient data to reauthenticate later
478 without interactively requesting passwords from the user. Like
479 [DIGEST-MD5], clients need not store the actual password, but can
480 merely store B for this purpose. This practise is not
481 recommended, as an attacker obtaining B can authenticate as the
487 7.1. Normative References
489 [ABNF] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax
490 Specifications: ABNF", RFC 4234, October 2005.
492 [HMAC] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed-
493 Hashing for Message Authentication", RFC 2104,
497 Bradner, S., "Key words for use in RFCs to Indicate
498 Requirement Levels", BCP 14, RFC 2119, March 1997.
503 Cridland & Melnikov Expires August 30, 2007 [Page 9]
505 Internet-Draft SASL HEXA February 2007
508 [MD5] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321,
511 [SASL] Melnikov, A. and K. Zeilenga, "Simple Authentication and
512 Security Layer (SASL)", RFC 4422, June 2006.
515 Zeilenga, K., "SASLprep: Stringprep Profile for User Names
516 and Passwords", RFC 4013, February 2005.
518 [UTF-8] Yergeau, F., "UTF-8, a transformation format of ISO
519 10646", STD 63, RFC 3629, November 2003.
521 7.2. Informative References
524 Klensin, J., Catoe, R., and P. Krumviede, "IMAP/POP
525 AUTHorize Extension for Simple Challenge/Response",
526 RFC 2195, September 1997.
529 Leach, P. and C. Newman, "Using Digest Authentication as a
530 SASL Mechanism", RFC 2831, May 2000.
532 [PLAIN] Zeilenga, K., "The PLAIN Simple Authentication and
533 Security Layer (SASL) Mechanism", RFC 4616, August 2006.
540 5 Castle Business Village
542 Hampton, Middlesex TW12 2BX
545 Email: dave.cridland@isode.com
559 Cridland & Melnikov Expires August 30, 2007 [Page 10]
561 Internet-Draft SASL HEXA February 2007
566 5 Castle Business Village
568 Hampton, Middlesex TW12 2BX
571 Email: alexey.melnikov@isode.com
615 Cridland & Melnikov Expires August 30, 2007 [Page 11]
617 Internet-Draft SASL HEXA February 2007
620 Full Copyright Statement
622 Copyright (C) The IETF Trust (2007).
624 This document is subject to the rights, licenses and restrictions
625 contained in BCP 78, and except as set forth therein, the authors
626 retain all their rights.
628 This document and the information contained herein are provided on an
629 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
630 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND
631 THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS
632 OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
633 THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
634 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
637 Intellectual Property
639 The IETF takes no position regarding the validity or scope of any
640 Intellectual Property Rights or other rights that might be claimed to
641 pertain to the implementation or use of the technology described in
642 this document or the extent to which any license under such rights
643 might or might not be available; nor does it represent that it has
644 made any independent effort to identify any such rights. Information
645 on the procedures with respect to rights in RFC documents can be
646 found in BCP 78 and BCP 79.
648 Copies of IPR disclosures made to the IETF Secretariat and any
649 assurances of licenses to be made available, or the result of an
650 attempt made to obtain a general license or permission for the use of
651 such proprietary rights by implementers or users of this
652 specification can be obtained from the IETF on-line IPR repository at
653 http://www.ietf.org/ipr.
655 The IETF invites any interested party to bring to its attention any
656 copyrights, patents or patent applications, or other proprietary
657 rights that may cover technology that may be required to implement
658 this standard. Please address the information to the IETF at
664 Funding for the RFC Editor function is provided by the IETF
665 Administrative Support Activity (IASA).
671 Cridland & Melnikov Expires August 30, 2007 [Page 12]