Network Time Protocol Version 4 (NTPv4) Extension Fields
Clarifies where optional NTP extension fields go, how they pair with a MAC, and what hosts do with fields they do not know.
Mizrahi, T. and D. Mayer, "Network Time Protocol Version 4 (NTPv4) Extension Fields", RFC 7822, DOI 10.17487/RFC7822, March 2016, <https://www.rfc-editor.org/info/rfc7822>.
@misc{rfc7822,
series = {Request for Comments},
number = 7822,
howpublished = {RFC 7822},
publisher = {RFC Editor},
doi = {10.17487/RFC7822},
url = {https://www.rfc-editor.org/info/rfc7822},
author = {T. Mizrahi and D. Mayer},
title = {{Network Time Protocol Version 4 (NTPv4) Extension Fields}},
pagetotal = 8,
year = 2016,
month = mar,
} RFC text
Contents
Internet Engineering Task Force (IETF) T. Mizrahi
Request for Comments: 7822 Marvell
Updates: 5905 D. Mayer
Category: Standards Track Network Time Foundation
ISSN: 2070-1721 March 2016
Network Time Protocol Version 4 (NTPv4) Extension Fields
Abstract
The Network Time Protocol version 4 (NTPv4) defines the optional
usage of extension fields. An extension field, as defined in RFC
5905, is an optional field that resides at the end of the NTP header
and that can be used to add optional capabilities or additional
information that is not conveyed in the standard NTP header. This
document updates RFC 5905 by clarifying some points regarding NTP
extension fields and their usage with Message Authentication Codes
(MACs).
Status of This Memo
This is an Internet Standards Track document.
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by the
Internet Engineering Steering Group (IESG). Further information on
Internet Standards is available in Section 2 of RFC 5741.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
http://www.rfc-editor.org/info/rfc7822.
Copyright Notice
Copyright (c) 2016 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
Table of Contents
1. Introduction ....................................................2
2. Conventions Used in This Document ...............................3
2.1. Terminology ................................................3
2.2. Terms and Abbreviations ....................................3
3. NTP Extension Fields - RFC 5905 Update ..........................3
4. Security Considerations .........................................6
5. References ......................................................7
5.1. Normative References .......................................7
5.2. Informative References .....................................7
Acknowledgments ....................................................8
Authors' Addresses .................................................8
1. Introduction
The NTP header format consists of a set of fixed fields that may be
followed by some optional fields. Two types of optional fields are
defined: Message Authentication Codes (MACs), and extension fields as
defined in Section 7.5 of [NTPv4].
If a MAC is used, it resides at the end of the packet. This field
can be either 24 octets long, 20 octets long, or a 4-octet
crypto-NAK.
NTP extension fields were defined in [NTPv4] as a generic mechanism
that allows the addition of future extensions and features without
modifying the NTP header format (Section 16 of [NTPv4]).
The only currently defined extension fields are those fields used by
the Autokey protocol [Autokey] and the Checksum Complement [RFC7821].
The Autokey extension field is always followed by a MAC, and
Section 10 of [Autokey] specifies the parsing rules that allow a host
to distinguish between an extension field and a MAC. However, a MAC
is not mandatory after an extension field; an NTPv4 packet can
include one or more extension fields without including a MAC. This
behavior is specified in Section 7.5 of [NTPv4] and in [Err3627], and
is further clarified in this document.
This document updates [NTPv4] (RFC 5905) by clarifying some points
regarding the usage of extension fields. These updates include
changes to address errors found after the publication of [NTPv4] with
respect to extension fields. Specifically, this document updates
Section 7.5 of [NTPv4], clarifying the relationship between extension
fields and MACs, and defining the behavior of a host that receives an
unknown extension field.
2. Conventions Used in This Document
2.1. Terminology
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 [KEYWORDS].
2.2. Terms and Abbreviations
MAC Message Authentication Code
NTPv4 Network Time Protocol version 4 [NTPv4]
3. NTP Extension Fields - RFC 5905 Update
This document updates Section 7.5 of [NTPv4] as follows:
OLD:
7.5. NTP Extension Field Format
In NTPv4, one or more extension fields can be inserted after the
header and before the MAC, which is always present when an
extension field is present. Other than defining the field format,
this document makes no use of the field contents. An extension
field contains a request or response message in the format shown
in Figure 14.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Field Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
. .
. Value .
. .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Padding (as needed) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 14: Extension Field Format
All extension fields are zero-padded to a word (four octets)
boundary. The Field Type field is specific to the defined
function and is not elaborated here. While the minimum field
length containing required fields is four words (16 octets), a
maximum field length remains to be established.
The Length field is a 16-bit unsigned integer that indicates the
length of the entire extension field in octets, including the
Padding field.
NEW:
7.5. NTP Extension Field Format
In NTPv4, one or more extension fields can be inserted after the
header and before the MAC, if a MAC is present.
Other than defining the field format, this document makes no use
of the field contents. An extension field contains a request or
response message in the format shown in Figure 14.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Field Type | Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
. .
. Value .
. .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Padding (as needed) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 14: Extension Field Format
All extension fields are zero-padded to a word (four octets)
boundary.
The Field Type, Value, and Padding fields are specific to the
defined function and are not elaborated here; the Field Type value
is defined in an IANA registry, and its Length, Value, and Padding
values are defined by the document referred to by the registry.
If a host receives an extension field with an unknown Field Type,
the host SHOULD ignore the extension field and MAY drop the packet
altogether if policy requires it.
While the minimum field length containing required fields is
four words (16 octets), the maximum field length cannot be longer
than 65532 octets, due to the maximum size of the Length field.
The Length field is a 16-bit unsigned integer that indicates the
length of the entire extension field in octets, including the
Padding field.
7.5.1. Extension Fields and MACs
7.5.1.1. Extension Fields in the Presence of a MAC
An extension field can be used in an NTP packet that includes a
MAC -- for example, as defined in [Autokey]. A specification that
defines a new extension field MUST specify whether the extension
field requires a MAC or not. If the extension field requires a
MAC, the extension field specification MUST define the algorithm
to be used to create the MAC and the length of the MAC thus
created. An extension field MAY allow for the use of more than
one algorithm, in which case the information about which algorithm
was used MUST be included in the extension field itself.
7.5.1.2. Multiple Extension Fields with a MAC
If there are multiple extension fields that require a MAC, they
MUST all require the use of the same algorithm and MAC length.
Extension fields that do not require a MAC can be included with
extension fields that do require a MAC.
An NTP packet MUST NOT be sent with two or more extension fields
that require a MAC with different algorithms.
If an NTP packet is received with two or more extension fields
that this receiver recognizes and those fields require a MAC with
different algorithms, the packet MUST be discarded.
7.5.1.3. MAC in the Absence of an Extension Field
A MAC MUST NOT be longer than 24 octets if there is no extension
field present, unless a longer MAC is agreed upon by both client
and server. The client and server can negotiate this behavior
using a previous exchange of packets with an extension field that
defines the size and algorithm of the MAC transmitted in NTP
packets.
7.5.1.4. Extension Fields in the Absence of a MAC
If a MAC is not present, one or more extension fields can be
inserted after the header, according to the following rules:
o If the packet includes a single extension field, the length of
the extension field MUST be at least 7 words, i.e., at least
28 octets.
o If the packet includes more than one extension field, the
length of the last extension field MUST be at least 28 octets.
The length of the other extension fields in this case MUST be
at least 16 octets each.
4. Security Considerations
The security considerations of time protocols in general are
discussed in [SecTime], and the security considerations of NTP are
discussed in [NTPv4].
Distributed Denial-of-Service (DDoS) attacks on NTP servers involve
flooding a server with a high rate of NTP packets. Malicious usage
of extension fields cannot amplify such DDoS attacks; such malicious
attempts are mitigated by NTP servers, since the servers ignore
unknown extension fields (as discussed in Section 3) and only
respond, if needed, with known extension fields. Extension fields
from incoming packets are neither propagated by NTP servers nor
included in any response. NTP servers create their own extension
fields if needed for a response. A large number of extension fields
should be flagged by an NTP server as a potential attack. Large
extension field sizes should also be flagged, unless they are
expected to be large.
Middleboxes such as firewalls MUST NOT filter NTP packets based on
their extension fields. Such middleboxes should not examine
extension fields in the packets, since NTP packets may contain new
extension fields that the middleboxes have not been updated to
recognize.
5. References
5.1. Normative References
[KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997,
<http://www.rfc-editor.org/info/rfc2119>.
[NTPv4] Mills, D., Martin, J., Ed., Burbank, J., and W. Kasch,
"Network Time Protocol Version 4: Protocol and Algorithms
Specification", RFC 5905, DOI 10.17487/RFC5905,
June 2010, <http://www.rfc-editor.org/info/rfc5905>.
5.2. Informative References
[Autokey] Haberman, B., Ed., and D. Mills, "Network Time Protocol
Version 4: Autokey Specification", RFC 5906,
DOI 10.17487/RFC5906, June 2010,
<http://www.rfc-editor.org/info/rfc5906>.
[Err3627] RFC Errata, Erratum ID 3627, RFC 5905.
[RFC7821] Mizrahi, T., "UDP Checksum Complement in the Network Time
Protocol (NTP)", RFC 7821, DOI 10.17487/RFC7821,
March 2016, <http://www.rfc-editor.org/info/rfc7821>.
[SecTime] Mizrahi, T., "Security Requirements of Time Protocols in
Packet Switched Networks", RFC 7384,
DOI 10.17487/RFC7384, October 2014,
<http://www.rfc-editor.org/info/rfc7384>.
Acknowledgments
The authors gratefully acknowledge Dave Mills for his insightful
comments. The authors also thank Tim Chown, Sean Turner, Miroslav
Lichvar, Suresh Krishnan, and Jari Arkko for their thorough review
and helpful comments.
Authors' Addresses
Tal Mizrahi
Marvell
6 Hamada St.
Yokneam, 20692
Israel
Email: talmi@marvell.com
Danny Mayer
Network Time Foundation
PO Box 918
Talent, OR 97540
United States
Email: mayer@ntp.org
AI ELI5
On this page
§1Why Extension Fields Needed Clarifying
An NTP packet has a fixed header that can be followed by two kinds of optional field: a Message Authentication Code (MAC) and extension fields. A MAC sits at the end of the packet and is either 24 octets, 20 octets, or a 4-octet crypto-NAK. Extension fields were defined in RFC 5905 as a generic way to add future features without changing the NTP header.
When this RFC was written, the only extension fields in use were those of the Autokey protocol and the Checksum Complement from RFC 7821. Autokey fields are always followed by a MAC, but a MAC is not mandatory after an extension field. RFC 5905 and an erratum already said so; this document makes the point explicit.
RFC 7822 updates Section 7.5 of RFC 5905. It clarifies how extension fields relate to MACs and defines what a host does when it receives an unknown extension field.
A time message can have extra notes and a signature. People were unsure whether a note always needs a signature. This paper says no, and sorts out the rest.
§3The Extension Field Format
An extension field has a Field Type and a Length, then a Value and Padding. All extension fields are zero-padded to a word (four octets) boundary. The Length field is a 16-bit unsigned integer giving the length of the whole extension field in octets, padding included.
The old text said one or more extension fields come after the header and before the MAC, which is always present. The new text says they come before the MAC if a MAC is present.
The minimum field length is four words (16 octets). The RFC adds an upper bound: because of the size of the Length field, a field cannot be longer than 65532 octets.
Each note has a label, a size, the message itself and some blank space so it ends neatly. The size says how big the whole note is, blanks included.
| Field | Name | Size | Value | Description |
|---|---|---|---|---|
FIELD-TYPE | Field Type | 2 bytes | Identifies the extension; its values are defined in an IANA registry. | |
LENGTH | Length | 2 bytes | Length of the entire extension field in octets, including Padding. |
§3Unknown Field Types
The Field Type value is defined in an IANA registry. The Length, Value and Padding are defined by the document that the registry points to.
The new rule for unknown types is simple. A host that receives an extension field with an unknown Field Type SHOULD ignore that field. It MAY drop the whole packet if its policy requires it.
Ignoring unknown fields is what lets new extension fields be added later without breaking hosts that do not understand them yet.
If you get a note in a language you cannot read, you just skip it. If your rules are strict, you may throw away the whole letter.
§3.1Extension Fields and MACs
A specification that defines a new extension field MUST say whether the field requires a MAC. If it does, the specification MUST define the algorithm used to create the MAC and the length of the MAC. A field MAY allow more than one algorithm, but then the field itself MUST say which algorithm was used.
When several extension fields in one packet require a MAC, they MUST all require the same algorithm and MAC length. Fields that do not need a MAC can be mixed in with those that do. A packet MUST NOT be sent with two or more MAC-requiring fields that use different algorithms. A receiver that gets such a packet, with fields it recognizes, MUST discard it.
Without any extension field, a MAC MUST NOT be longer than 24 octets unless client and server agree on a longer one. They can agree through an earlier exchange of packets with an extension field that defines the MAC size and algorithm.
If several notes each need a signature, they must all use the same kind of signature. Mixing two kinds in one letter is not allowed, and the receiver throws such a letter away.
§3.2Length Rules Without a MAC
If no MAC is present, one or more extension fields can follow the header under two length rules, which let a receiver tell an extension field from a MAC.
- A packet with a single extension field: its length MUST be at least 7 words, that is, at least 28 octets.
- A packet with more than one extension field: the last field MUST be at least 28 octets, and each of the others at least 16 octets.
Notes with no signature must be big enough that nobody mistakes one for a signature. The last note has to be a bit bigger than the others.
§4Security Considerations
The RFC argues that extension fields cannot be used to amplify a Distributed Denial-of-Service (DDoS) attack on NTP servers. Servers ignore unknown extension fields and answer only with known ones. Extension fields from incoming packets are neither propagated nor included in a response; a server creates its own fields if it needs them.
A server should flag a large number of extension fields as a potential attack, and large field sizes too unless they are expected.
Middleboxes such as firewalls MUST NOT filter NTP packets based on their extension fields. They should not examine the fields at all, since packets may carry new fields the middlebox has not been updated to recognize.
A time server does not copy notes from incoming letters into its replies, so bad guys cannot use notes to make it shout. Gatekeepers on the road must not block letters just because of the notes inside.