Kerberos TCP Extensions: Extended Kerberos Version 5 Key Distribution Center (KDC) Exchanges over TCP
A way for Kerberos clients and servers to negotiate extensions over TCP using a spare bit in the length field.
Josefsson, S., "Extended Kerberos Version 5 Key Distribution Center (KDC) Exchanges over TCP", RFC 5021, DOI 10.17487/RFC5021, August 2007, <https://www.rfc-editor.org/info/rfc5021>.
@misc{rfc5021,
series = {Request for Comments},
number = 5021,
howpublished = {RFC 5021},
publisher = {RFC Editor},
doi = {10.17487/RFC5021},
url = {https://www.rfc-editor.org/info/rfc5021},
author = {S. Josefsson},
title = {{Extended Kerberos Version 5 Key Distribution Center (KDC) Exchanges over TCP}},
pagetotal = 7,
year = 2007,
month = aug,
} RFC text
Contents
Network Working Group S. Josefsson
Request for Comments: 5021 SJD
Updates: 4120 August 2007
Category: Standards Track
Extended Kerberos Version 5 Key Distribution Center (KDC)
Exchanges over TCP
Status of This Memo
This document specifies an Internet standards track protocol for the
Internet community, and requests discussion and suggestions for
improvements. Please refer to the current edition of the "Internet
Official Protocol Standards" (STD 1) for the standardization state
and status of this protocol. Distribution of this memo is unlimited.
Copyright Notice
Copyright (C) The IETF Trust (2007).
Abstract
This document describes an extensibility mechanism for the Kerberos
V5 protocol when used over TCP transports. The mechanism uses the
reserved high-bit in the length field. It can be used to negotiate
TCP-specific Kerberos extensions.
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 2
2. Conventions Used in This Document . . . . . . . . . . . . . . . 2
3. Extension Mechanism for TCP Transport . . . . . . . . . . . . . 2
4. Interoperability Consideration . . . . . . . . . . . . . . . . 3
5. Security Considerations . . . . . . . . . . . . . . . . . . . . 4
6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 4
7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 5
8. Normative References . . . . . . . . . . . . . . . . . . . . . 5
Appendix A. Copying Conditions . . . . . . . . . . . . . . . . . . 6
1. Introduction
The Kerberos V5 [3] specification, in section 7.2.2, reserves the
high order bit in the initial length field for TCP transport for
future expansion. This document updates [3] to describe the
behaviour when that bit is set. This mechanism is intended for
extensions that are specific for the TCP transport.
2. Conventions Used in This Document
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119 [1].
3. Extension Mechanism for TCP Transport
The reserved high bit of the request length field is used to signal
the use of this extension mechanism. When the reserved high bit is
set in the length field, the remaining 31 bits of the initial 4
octets are interpreted as a bitmap. Each bit in the bitmask can be
used to request a particular extension. The 31 bits form the
"extension bitmask". It is expected that other documents will
describe the details associated with particular bits.
A 4-octet value with only the high bit set, and thus the extension
bitmask all zeros, is called a PROBE. A client may send a probe to
find out which extensions a KDC supports. A client may also set
particular bits in the extension bitmask directly, if it does not
need to query the KDC for available extensions before deciding which
extension to request.
Note that clients are not forced to use this extension mechanism, and
further, clients are expected to only use it when they wish to
negotiate a particular extension.
The protocol is as follows. The client MUST begin by sending a
4-octet value with the high bit set. The packet is thus either a
PROBE or a specific request for some extension(s). The client MUST
NOT send additional data before the server has responded.
If a KDC receives a request for a set of extensions that it supports,
it MUST respond by sending a 4-octet zero value, i.e., 0x00000000.
The KDC MAY directly send additional data after the zero value,
without waiting for the client to respond, as specified by the
particular negotiated extension. (Note: A 4-octet zero value can
never be sent by an implementation that conforms to RFC 4120 and that
does not support this extension mechanism, because a KRB-ERROR is
always of non-zero size.)
If a KDC receives a PROBE, or if a KDC does not support all
extensions corresponding to set bits in the extension bitmask, the
KDC MUST return 4 octets with the high bit set, and with the
remaining bitmask indicating which extensions it supports. The KDC
then MUST wait, and the client MUST send a second 4-octet value with
the high bit set. If the second 4-octet value is a PROBE or an
unsupported extension, the KDC MUST close the connection. This can
be used by the client to shut down a session when the KDC did not
support an extension that is required by the client. If the second
4-octet value is a supported extension, the KDC MUST respond by
sending a 4-octet zero value, i.e., 0x00000000. The KDC MAY directly
send additional data after the zero value, as specified by the
particular negotiated extension.
The client and KDC SHOULD wait for the other side to respond
according to this protocol, and the client and KDC SHOULD NOT close
the connection prematurely. Resource availability considerations may
influence whether, and for how long, the client and KDC will wait for
the other side to respond to a request.
The KDC MUST NOT support the extension mechanism if it does not
support any extensions. If no extensions are supported, the KDC MUST
return a KRB-ERROR message with the error KRB_ERR_FIELD_TOOLONG and
MUST close the TCP stream, similar to what an implementation that
does not understand this extension mechanism would do.
The behaviour when more than one non-high bit is set depends on the
particular extension mechanisms. If a requested extension (bit X)
does not specify how it interacts with another requested extension
(bit Y), the KDC MUST treat the request as a PROBE or unsupported
extension, and proceed as above.
Each extension MUST describe the structure of protocol data beyond
the length field, and the behaviour of the client and KDC. In
particular, the structure may be a protocol with its own message
framing. If an extension mechanism reserves multiple bits, it MUST
describe how they interact.
4. Interoperability Consideration
Implementations with support for TCP that do not claim to conform to
RFC 4120 may not handle the high bit correctly. The KDC behaviour
may include closing the TCP connection without any response, and
logging an error message in the KDC log. When this was written, this
problem existed in modern versions of popular KDC implementations.
Implementations experiencing trouble getting the expected responses
from a KDC might assume that the KDC does not support this extension
mechanism. A client might remember this semi-permanently, to avoid
triggering the same problematic behaviour on the KDC every time.
Care should be taken to avoid unexpected behaviour for the user when
the KDC is eventually upgraded. Implementations might also provide a
way to enable and disable this extension on a per-realm basis. How
to handle these backwards compatibility quirks are in general left
unspecified.
5. Security Considerations
Because the initial length field is not protected, it is possible for
an active attacker (i.e., one that is able to modify traffic between
the client and the KDC) to make it appear to the client that the
server does not support this extension mechanism (a downgrade
attack). Further, active attackers can also interfere with the
negotiation of which extensions are supported, which may also result
in a downgrade attack. This problem can be solved by having a policy
in the clients and in the KDC to reject connections that do not have
the desired properties. The problem can also be mitigated by having
the negotiated extension send a cryptographic checksum of the offered
extensions.
6. IANA Considerations
IANA has created a new registry for "Kerberos TCP Extensions". The
initial contents of this registry are:
Bit # Reference
----- ---------
0..29 AVAILABLE for registration.
30 RESERVED. RFC 5021
IANA will register values 0 to 29 after IESG Approval, as defined in
BCP 64 [2]. Assigning value 30 requires a Standards Action that
updates or obsoletes this document.
Registration policy: The IESG will act as a steward for the
namespace, considering whether the registration is justified given
the limited size of the namespace. The IESG will also confirm that
proposed registrations are not harmful to the Internet.
7. Acknowledgements
Nicolas Williams, Jeffrey Hutzelman, Sam Hartman, and Chris Newman
provided comments that improved the protocol and document.
Thanks to Andrew Bartlett who pointed out that some implementations
(MIT Kerberos and Heimdal) did not follow RFC 4120 properly with
regards to the high bit, which resulted in an Interoperability
Consideration.
8. Normative References
[1] Bradner, S., "Key words for use in RFCs to Indicate Requirement
Levels", BCP 14, RFC 2119, March 1997.
[2] Narten, T. and H. Alvestrand, "Guidelines for Writing an IANA
Considerations Section in RFCs", BCP 26, RFC 2434, October 1998.
[3] Neuman, C., Yu, T., Hartman, S., and K. Raeburn, "The Kerberos
Network Authentication Service (V5)", RFC 4120, July 2005.
Appendix A. Copying Conditions
Regarding this entire document or any portion of it, the author makes
no guarantees and is not responsible for any damage resulting from
its use. The author grants irrevocable permission to anyone to use,
modify, and distribute it in any way that does not diminish the
rights of anyone else to use, modify, and distribute it, provided
that redistributed derivative works do not contain misleading author
or version information. Derivative works need not be licensed under
similar terms.
Author's Address
Simon Josefsson
SJD
EMail: simon@josefsson.org
Full Copyright Statement
Copyright (C) The IETF Trust (2007).
This document is subject to the rights, licenses and restrictions
contained in BCP 78, and except as set forth therein, the authors
retain all their rights.
This document and the information contained herein are provided on an
"AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND
THE INTERNET ENGINEERING TASK FORCE DISCLAIM 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.
Intellectual Property
The IETF takes no position regarding the validity or scope of any
Intellectual Property Rights or other rights that might be claimed to
pertain to the implementation or use of the technology described in
this document or the extent to which any license under such rights
might or might not be available; nor does it represent that it has
made any independent effort to identify any such rights. Information
on the procedures with respect to rights in RFC documents can be
found in BCP 78 and BCP 79.
Copies of IPR disclosures made to the IETF Secretariat and any
assurances of licenses to be made available, or the result of an
attempt made to obtain a general license or permission for the use of
such proprietary rights by implementers or users of this
specification can be obtained from the IETF on-line IPR repository at
http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention any
copyrights, patents or patent applications, or other proprietary
rights that may cover technology that may be required to implement
this standard. Please address the information to the IETF at
ietf-ipr@ietf.org.
Acknowledgement
Funding for the RFC Editor function is currently provided by the
Internet Society.
AI ELI5
On this page
§1A Reserved Bit Gets a Meaning
The Kerberos V5 specification (RFC 4120), in section 7.2.2, reserves the high-order bit in the initial length field for the TCP transport for future expansion. RFC 5021 updates RFC 4120 to describe what happens when that bit is set. The mechanism is meant for extensions that are specific to the TCP transport.
Clients are not forced to use it; they are expected to use it only when they want to negotiate a particular extension.
The message length had one spare switch nobody used. This RFC says what flipping it means.
§3The Extension Bitmask and PROBE
When the reserved high bit of the request length field is set, the remaining 31 bits of the initial 4 octets are read as a bitmap, the extension bitmask. Each bit can request one particular extension. Other documents are expected to define the details for particular bits.
A 4-octet value with only the high bit set, so the bitmask is all zeros, is called a PROBE. A client may send a probe to learn which extensions a KDC supports, or it may set particular bits directly if it does not need to ask first.
Each of 31 little switches stands for one feature. Flip a switch to ask for that feature. Flip none to just ask what is on offer.
§3The Exchange
The client MUST begin by sending a 4-octet value with the high bit set, either a PROBE or a request for specific extensions, and MUST NOT send more data until the server responds.
If the KDC supports the requested set, it MUST reply with a 4-octet zero value, 0x00000000, and MAY send additional data right after, as the negotiated extension specifies. A zero value cannot be confused with a normal reply, because a conforming RFC 4120 implementation never sends one: a KRB-ERROR is always of non-zero size.
If the KDC receives a PROBE, or does not support every requested bit, it MUST return 4 octets with the high bit set and the bitmask showing what it does support. It then MUST wait, and the client MUST send a second 4-octet value with the high bit set. If that second value is a PROBE or an unsupported extension, the KDC MUST close the connection; this lets a client shut down when a required extension is missing. If it is a supported extension, the KDC replies with the zero value as before.
Both sides SHOULD wait for the other to respond and SHOULD NOT close the connection prematurely, though resource considerations may limit how long they wait.
You ask, the server either says okay or shows what it can do, and you pick again. If it cannot do what you need, you hang up.
- 4 octets, high bit set (PROBE or request)
- 4 octets, high bit set, bitmask of supported extensions
- Second 4 octets, high bit setA PROBE or unsupported extension makes the KDC close the connection.
- 0x00000000Sent for a supported extension; extension data may follow.
§3Rules for Servers and Extensions
A KDC MUST NOT support the extension mechanism if it supports no extensions. In that case it MUST return a KRB-ERROR with KRB_ERR_FIELD_TOOLONG and MUST close the TCP stream, just as an implementation that does not understand the mechanism would.
If a request sets more than one bit and the extensions do not say how they interact, the KDC MUST treat it as a PROBE or unsupported extension. Each extension MUST describe the structure of protocol data after the length field and the behaviour of client and KDC; it may be a protocol with its own message framing. An extension that reserves multiple bits MUST describe how they interact.
A server with no special features acts as if it never heard of the switches. Anyone who adds a feature must explain exactly how it works.
§4Interoperability Problems
Implementations with TCP support that do not conform to RFC 4120 may mishandle the high bit. A KDC might close the TCP connection without any response and log an error. When the RFC was written, this problem existed in modern versions of popular KDC implementations.
A client that gets no sensible answer might assume the KDC lacks the mechanism and remember that semi-permanently, taking care to avoid surprising the user when the KDC is later upgraded. Implementations might also allow enabling or disabling the mechanism per realm. The RFC leaves these compatibility details unspecified.
Some old servers do not know about the spare switch and just hang up. Clients may remember that and not ask again.
§5Security Considerations
The initial length field is not protected. An active attacker who can modify traffic between client and KDC could make the client think the server lacks this mechanism, a downgrade attack, or interfere with which extensions are agreed, which can also downgrade.
The RFC offers two mitigations: a policy in clients and the KDC to reject connections lacking the desired properties, and having the negotiated extension send a cryptographic checksum of the offered extensions.
Someone in the middle could scribble over the mark and trick you into using the plain version. Rules about what you will accept, or a check over what was offered, stop that.
§6The Kerberos TCP Extensions Registry
IANA created a registry called "Kerberos TCP Extensions". Bits 0 to 29 are available for registration, and bit 30 is reserved by RFC 5021. Values 0 to 29 are registered after IESG Approval; assigning value 30 requires a Standards Action that updates or obsoletes this document.
The IESG acts as steward of the namespace, considering whether a registration is justified given its limited size and confirming it is not harmful to the Internet.
There is an official list of which switch means which feature. Most switches are free, and one is kept back.