3 Network Working Group S. Josefsson
4 Internet-Draft November 2002
8 A Kerberos 5 SASL Mechanism
9 draft-josefsson-sasl-kerberos5-00
13 This document is an Internet-Draft and is in full conformance with
14 all provisions of Section 10 of RFC2026.
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
21 Internet-Drafts are draft documents valid for a maximum of six months
22 and may be updated, replaced, or obsoleted by other documents at any
23 time. It is inappropriate to use Internet-Drafts as reference
24 material or to cite them other than as "work in progress."
26 The list of current Internet-Drafts can be accessed at http://
27 www.ietf.org/ietf/1id-abstracts.txt.
29 The list of Internet-Draft Shadow Directories can be accessed at
30 http://www.ietf.org/shadow.html.
32 This Internet-Draft will expire on May 2, 2003.
36 Copyright (C) The Internet Society (2002). All Rights Reserved.
40 This document specifies a Simple Authentication and Security Layer
41 (SASL) [3] mechanism for Kerberos 5 Client/Server Authentication [1],
42 with optional initial Authentication Service (AS) and/or
43 Ticket-Granting-Service (TGS) exchanges.
55 Josefsson Expires May 2, 2003 [Page 1]
57 Internet-Draft A Kerberos 5 SASL Mechanism November 2002
62 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3
63 2. Kerberos version 5 mechanism . . . . . . . . . . . . . . . . . 3
64 3. Theory of operation . . . . . . . . . . . . . . . . . . . . . 5
65 3.1 Separate SASL and Kerberos 5 server . . . . . . . . . . . . . 5
66 3.2 Combined SASL and Kerberos 5 server . . . . . . . . . . . . . 6
67 4. Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
68 5. Security Considerations . . . . . . . . . . . . . . . . . . . 7
69 Normative References . . . . . . . . . . . . . . . . . . . . . 9
70 Informative References . . . . . . . . . . . . . . . . . . . . 9
71 Author's Address . . . . . . . . . . . . . . . . . . . . . . . 9
72 Intellectual Property and Copyright Statements . . . . . . . . 10
111 Josefsson Expires May 2, 2003 [Page 2]
113 Internet-Draft A Kerberos 5 SASL Mechanism November 2002
118 Kerberos 5 provides client and optional server authentication,
119 usually employing symmetric encryption and a trusted (symmetric) key
120 distribution center. Specifying Kerberos 5 authentication for each
121 network protocol where there is a need to use Kerberos 5 is a tedious
122 task. However, as many protocols already specify support for the
123 SASL framework, by specifying a Kerberos 5 SASL mechanism, support
124 for Kerberos 5 in many protocols is accomplished. Even for protocols
125 that do not support SASL, specifying SASL support (and thereby
126 implicitely Kerberos 5) is often advantageous over specifying
127 Kerberos 5 support directly. The advantages include better
128 flexibility if or when new Kerberos versions are released, and
129 perhaps more commonly, when circumstances demand that other
130 authentication methods (supported by SASL) should be used.
132 It should be mentioned that Kerberos 5 authentication via SASL is
133 already possible, by using the Generic Security Service Application
134 Program Interface [6] framework. However, GSSAPI adds some amount of
135 overhead, both in terms of code complexity, code size and additional
136 network round trips. More importantly, GSSAPI do not support the
137 authentication steps (AS and TGS). These are some of the motivation
138 behind this "slimmer" Kerberos 5 SASL mechanism.
140 2. Kerberos version 5 mechanism
142 The mechanism name associated with Kerberos version 5 is
143 "KERBEROS_V5". The exchange consists of one initial server packet
144 (containing some parameters and a challenge, described below), and
145 then an unfixed number of messages containing Kerberos 5 packets,
146 with the last exchange being an AP-REQ, and optional AP-REP, for the
147 desired SASL service on a format described below.
149 The normal packet exchange, after the required initial server packet,
150 are one optional AS-REQ and AS-REP exchange, one optional TGS-REQ and
151 TGS-REP exchange and then the AP-REQ packet and optional AP-REP
152 reply. The only steps that are required by this SASL mechanism is
153 the initial server packet and the final AP-REQ and optional AP-REP
154 exchange. The AP-REP is sent when and only when mutual
155 authentication is required. The AP-REQ is for the SASL service that
156 is requested. The AP-REQ must contain authenticated application data
157 on a format described below. The AS and TGS exchanges is usually
158 used by clients to aquire the proper tickets required for the AP
159 phase. It is not expected that any other Kerberos 5 packets will be
160 exchanged, but this mechanism do not disallow such packets in order
161 to make it possible to use this SASL mechanism with future Kerberos
167 Josefsson Expires May 2, 2003 [Page 3]
169 Internet-Draft A Kerberos 5 SASL Mechanism November 2002
172 As discussed above, the client is allowed to send any valid Kerberos
173 5 message and the server should handle any message, subject to local
174 policy restrictions. If the server do not understand the meaning of
175 a packet or do not wish to respond to it (e.g., it cannot proxy a
176 TGS-REQ), it SHOULD respond with a empty response and await further
177 packets. Reasons for aborting the authentication phase instead of
178 sending an empty response includes if the number of received packets
179 exceeds a pre-defined limit. AS-REQ and TGS-REQ packets destined for
180 non-local Kerberos Key Distribution Centers (KDCs) is proxied to the
181 correct server by the SASL server. No provisions are made in the
182 protocol to allow the client to specify the addresses of the KDCs,
183 instead the SASL server is required to discover this information
184 (usually by static configuration or by using DNS). It is legitimate
185 for the SASL server to abort the authentication phase with an error
186 saying that the indicated realm was not found or is restricted by
187 policy (i.e., a policy that only permits local KDC requests is
190 Since it is expected that clients may not yet have IP addresses when
191 they invoke this SASL mechanism (invoking this mechanism may be one
192 step in aquiring an IP address), clients commonly leave the address
193 fields in the AS-REQ empty.
195 The initial server packet should contain one octet containing a bit
196 mask of supported security layers, four octets indicating the maximum
197 cipher-text buffer size the server is able to receive (or 0 if no
198 security layers are supported) in network byte order, and then 16
199 octets containing random data (see [4] on how random data might be
202 The last exchange must be an AP-REQ for the desired SASL service,
203 optionaly followed by an AP-REP. The SASL service is translated into
204 a Kerberos principal and realm as follows: The first element of the
205 principal is the service name specified in the protocol that uses
206 SASL. The second element is the address of the SASL server, usually
207 expressed as a hostname. The realm should be the Kerberos realm of
208 the SASL server. The checksum field in the Authenticator of the
209 AP-REQ must be on a string where the first octet indicate the desired
210 security layer requested by the client (a bitmask with one bit set,
211 which must also be set in the server offered security layer bitmask),
212 the next four octets indicate the maximum cipher-text buffer size the
213 client is able to receive in network byte order (or 0 if a security
214 layer is not indicated by the first octet), followed by the entire
215 initial server packet, in turn followed by the desired authorization
216 identity (which can be empty to indicate that the authorization
217 identity should be the same as the authentication identity provided
218 by the Kerberos ticket in the AP-REQ).
223 Josefsson Expires May 2, 2003 [Page 4]
225 Internet-Draft A Kerberos 5 SASL Mechanism November 2002
228 Upon decrypting and verifying the ticket and authenticator (i.e.,
229 standard AP-REQ processing), the server verifies that the contained
230 security layer bit mask, server maximum cipher-text buffer size, and
231 the random data equals the data provided in the original server
232 challenge. The server also verify that the client selected security
233 level matches one of the offered security levels. Should the
234 verification be successful, the server must verify that the principal
235 identified in the Kerberos ticket is authorized to connect to the
236 service as the authorization identity specified by the client (or, if
237 absent, the Kerberos ticket principal). Unless the client requested
238 mutual authentication, the authentication process is complete.
240 If the client requested mutual authentication, the server constructs
241 an AP-REP according to Kerberos 5. The checksum field in the
242 Authenticator of the AP-REP must contain one octet with the desired
243 security level (must be equal to what the client requested) followed
244 by the application the client provided in the AP-REQ Authenticator
247 The security layers and their corresponding bit-masks are as follows:
249 Bit 0 No security layer
250 Bit 1 Integrity (KRB-SAFE) protection
251 Bit 2 Privacy (KRB-PRIV) protection
252 Bit 3 Mutual authentication is required (AP option MUTUAL-
253 REQUIRED must also be present).
255 Other bit-masks may be defined in the future; bits which are not
256 understood must be negotiated off.
258 3. Theory of operation
260 This section describes, for illustrion only, two scenarios where this
261 mechanism can be used.
263 3.1 Separate SASL and Kerberos 5 server
265 Normally a SASL server is an application server such as a mail
266 system. The server is configured to belong to at least one Kerberos
267 5 realm, and the server shares a symmetric key with the Kerberos 5
268 Key Distribution Center in that realm. The server cannot perform the
269 initial Kerberos AS and TGS operation itself but rather acts as a
270 proxy, and once the user acquired credentials the server it is able
271 to carry out the AP-REQ/AP-REP phase using its symmetric key. The
272 steps are as follows:
279 Josefsson Expires May 2, 2003 [Page 5]
281 Internet-Draft A Kerberos 5 SASL Mechanism November 2002
284 0) Server sends initial token.
286 1) Client constructs AS-REQ using username and realm supplied by user,
287 in order to acquire a ticket granting ticket.
289 2) Server finds address of KDC and forwards the AS-REQ to and waits
290 for the AS-REP response which it forwards back to the client.
292 3) Client parses AS-REP and constructs a TGS-REQ using the ticket
293 granting ticket encryption key, in order to acquire a ticket for
296 4) Server finds address of KDC and forwards the TGS-REQ to and waits
297 for the TGS-REP response which it forwards back to the client.
299 5) Client parses TGS-REP and generates the AP-REQ using the session
302 4) Server parses AP-REQ and generates the AP-REP if requested.
304 5) Client optionally parses AP-REP.
307 3.2 Combined SASL and Kerberos 5 server
309 Kerberos 5 is usually a distributed security system, but we wish to
310 point out that this Kerberos 5 SASL mechanism may be used in a
311 standalone SASL server to provide the security advantages that the
312 Kerberos 5 Authentication Service (AS) provides over other methods.
314 Specifically, the SASL server may use a legacy password database such
315 as a CRAM-MD5 clear text password file to generate Kerberos 5
316 principals "on the fly". Authentication may thus proceed as follows:
318 0) Server sends initial token.
320 1) Client constructs AS-REQ using username supplied by user, in order to
321 acquire a ticket for the server directly.
323 2) Server parses AS-REQ and generates AS-REP based on password in database.
325 3) Client parses AS-REP and construct a ticket and the AP-REQ using
326 the session encryption key.
328 4) Server parses AP-REQ and generates the AP-REP if requested.
330 5) Client optionally parses AP-REP.
335 Josefsson Expires May 2, 2003 [Page 6]
337 Internet-Draft A Kerberos 5 SASL Mechanism November 2002
340 This may be extended further, i.e. by using the password and
341 Kerberos 5 pre-authentication in step 1.
345 The following is one Kerberos version 5 login scenarios to the IMAP4
346 protocol (note that the line breaks in the sample authenticators are
347 for editorial clarity and are not in real authenticators).
349 S: * OK IMAP4rev1 server
350 C: . AUTHENTICATE KERBEROS_V5
351 S: + AAAAAAB2ZXJ5IHJhbmRvbSBkYXRh
352 C: aoGNMIGKoQMCAQWiAwIBCqMCMACkejB4oAcDBQAAAAAAoRAwDqADAgEBoQcwBRsD
353 amFzog8bDUpPU0VGU1NPTi5PUkejIjAgoAMCAQGhGTAXGwZrcmJ0Z3QbDUpPU0VG
354 U1NPTi5PUkelERgPMjAwMzAxMDgyMzAwMDBapwYCBEbYfGaoCzAJAgESAgEQAgED
355 S: + a4ICITCCAh2gAwIBBaEDAgELow8bDUpPU0VGU1NPTi5PUkekEDAOoAMCAQGhBzAF
356 GwNqYXOlggECYYH/MIH8oAMCAQWhDxsNSk9TRUZTU09OLk9SR6IiMCCgAwIBAaEZ
357 MBcbBmtyYnRndBsNSk9TRUZ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+
374 m8/qfYjYx/cho274VGzMrREKEg9lK8s1ajkeq4yrNQWxblwA3zx6Q2HzX0DHomhj
375 6Lm1TnB8VKJziZmFocyG3nicOuORf1oqO+qLmr9S3yNQUseKBFOEfX8=
376 S: . OK KERBEROS_V5 successful
378 (XXX this is not a real example)
380 5. Security Considerations
382 The authentication phase is belived to be no less secure than the
383 Client/Server Authentication exchange described in the Kerberos 5
386 If no security layer is negotiated, the connection is subject to
387 active man-in-the-middle attackers that hijack the connection after
391 Josefsson Expires May 2, 2003 [Page 7]
393 Internet-Draft A Kerberos 5 SASL Mechanism November 2002
396 authentication has been completed.
398 When security layers are used, it is believed that the communication
399 channel negotiated by this specification is no less secure than the
400 KRB_SAFE and KRB_PRIV primitives. In other words, it is believed
401 that if an attack that breaches integrity or privacy of this
402 mechanism, the same attack also applies to the Kerberos 5
403 specification, and vice versa.
405 Server implementations should be aware that this proxying function
406 can be abused, and MAY implement precaution against this if it is
407 considered a threat. Useful precautions include limiting the size of
408 packets forwarded, and the number of packets, to abort the SASL
409 exchange when the limit is reached.
411 Server implementations should make sure the method to look up KDC for
412 the client indicated realm does not cause security problems. In
413 particular, trusting unprotected DNS lookups to find the KDC of a
414 realm may be considered as dangerous by a server.
416 The forward-compatibility behaviour of returning empty responses to
417 unsupported commands may be abused as a covert channel.
419 The reason for the client to send, in the Authenticator checksum
420 field, not only the server random number but the entire initial
421 server packet with the security layer bitmask and maximum cipher-text
422 buffer size accepted by server, is to prevent an attacker from
423 downgrading the security layer ultimately selected. The random
424 number ties the client and server to the same network session,
425 prevent man-in-the-middle attacks assuming a Kerberos 5 security
426 layer is chosen and that the Kerberos 5 security layer is secure.
428 The security considerations of Kerberos 5 and SASL are inherited.
429 Some immediates consequences of this follows (this is an inconclusive
432 Note that some of the Kerberos 5 encryption types are considered
433 weak, implementations must decide which algorithms are trusted.
435 Note that Kerberos 5 do not authorize users, it only authenticate
436 users. Applications using this mechanism must thus perform checks,
437 not described in detail in this document, to make sure the
438 authenticated user is authorized to the service she is requesting.
440 Note that the SASL framework is subject to "downgrade" attacks where
441 an attacker forces a weaker SASL mechanism to be used. The use of,
442 e.g., TLS [5] can be used to mitigate this.
447 Josefsson Expires May 2, 2003 [Page 8]
449 Internet-Draft A Kerberos 5 SASL Mechanism November 2002
454 [1] Kohl, J. and B. Neuman, "The Kerberos Network Authentication
455 Service (V5)", RFC 1510, September 1993.
457 [2] Bradner, S., "Key words for use in RFCs to Indicate Requirement
458 Levels", BCP 14, RFC 2119, March 1997.
460 [3] Myers, J., "Simple Authentication and Security Layer (SASL)",
461 RFC 2222, October 1997.
463 Informative References
465 [4] Eastlake, D., Crocker, S. and J. Schiller, "Randomness
466 Recommendations for Security", RFC 1750, December 1994.
468 [5] Dierks, T., Allen, C., Treese, W., Karlton, P., Freier, A. and
469 P. Kocher, "The TLS Protocol Version 1.0", RFC 2246, January
472 [6] Linn, J., "Generic Security Service Application Program
473 Interface Version 2, Update 1", RFC 2743, January 2000.
483 EMail: simon@josefsson.org
487 Text and ideas was borrowed from the Kerberos version 4 SASL
488 mechanism in RFC 2222.
503 Josefsson Expires May 2, 2003 [Page 9]
505 Internet-Draft A Kerberos 5 SASL Mechanism November 2002
508 Intellectual Property Statement
510 The IETF takes no position regarding the validity or scope of any
511 intellectual property or other rights that might be claimed to
512 pertain to the implementation or use of the technology described in
513 this document or the extent to which any license under such rights
514 might or might not be available; neither does it represent that it
515 has made any effort to identify any such rights. Information on the
516 IETF's procedures with respect to rights in standards-track and
517 standards-related documentation can be found in BCP-11. Copies of
518 claims of rights made available for publication and any assurances of
519 licenses to be made available, or the result of an attempt made to
520 obtain a general license or permission for the use of such
521 proprietary rights by implementors or users of this specification can
522 be obtained from the IETF Secretariat.
524 The IETF invites any interested party to bring to its attention any
525 copyrights, patents or patent applications, or other proprietary
526 rights which may cover technology that may be required to practice
527 this standard. Please address the information to the IETF Executive
531 Full Copyright Statement
533 Copyright (C) The Internet Society (2002). All Rights Reserved.
535 This document and translations of it may be copied and furnished to
536 others, and derivative works that comment on or otherwise explain it
537 or assist in its implementation may be prepared, copied, published
538 and distributed, in whole or in part, without restriction of any
539 kind, provided that the above copyright notice and this paragraph are
540 included on all such copies and derivative works. However, this
541 document itself may not be modified in any way, such as by removing
542 the copyright notice or references to the Internet Society or other
543 Internet organizations, except as needed for the purpose of
544 developing Internet standards in which case the procedures for
545 copyrights defined in the Internet Standards process must be
546 followed, or as required to translate it into languages other than
549 The limited permissions granted above are perpetual and will not be
550 revoked by the Internet Society or its successors or assignees.
552 This document and the information contained herein is provided on an
553 "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
554 TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
555 BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
559 Josefsson Expires May 2, 2003 [Page 10]
561 Internet-Draft A Kerberos 5 SASL Mechanism November 2002
564 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
565 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
570 Funding for the RFC Editor function is currently provided by the
615 Josefsson Expires May 2, 2003 [Page 11]