NTP Working Group | D. Sibold |
Internet-Draft | PTB |
Intended status: Standards Track | S. Röttger |
Expires: September 4, 2015 | Google Inc. |
K. Teichel | |
PTB | |
March 3, 2015 |
Network Time Security
draft-ietf-ntp-network-time-security-07.txt
This document describes Network Time Security (NTS), a collection of measures that enable secure time synchronization with time servers using protocols like the Network Time Protocol (NTP) or the Precision Time Protocol (PTP). Its design considers the special requirements of precise timekeeping which are described in Security Requirements of Time Protocols in Packet Switched Networks [RFC7384].
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 [RFC2119].
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on September 4, 2015.
Copyright (c) 2015 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.
Time synchronization protocols are increasingly utilized to synchronize clocks in networked infrastructures. Successful attacks against the time synchronization protocol can seriously degrade the reliable performance of such infrastructures. Therefore, time synchronization protocols have to be secured if they are applied in environments that are prone to malicious attacks. This can be accomplished either by utilization of external security protocols, like IPsec or TLS, or by intrinsic security measures of the time synchronization protocol.
The two most popular time synchronization protocols, the Network Time Protocol (NTP) [RFC5905] and the Precision Time Protocol (PTP) [IEEE1588], currently do not provide adequate intrinsic security precautions. This document specifies security measures which enable these and possibly other protocols to verify the authenticity of the time server/master and the integrity of the time synchronization protocol packets. The utilization of these measures for a given specific time synchronisation protocol has to be described in a separate document.
[RFC7384] specifies that a security mechanism for timekeeping must be designed in such a way that it does not degrade the quality of the time transfer. This implies that for time keeping the increase in bandwidth and message latency caused by the security measures should be small. Also, NTP as well as PTP work via UDP and connections are stateless on the server/master side. Therefore, all security measures in this document are designed in such a way that they add little demand for bandwidth, that the necessary calculations can be executed in a fast manner, and that the measures do not require a server/master to keep state of a connection.
This document refers to different time synchronization protocols, in particular to both the PTP and the NTP. Throughout the document the term "server" applies to both a PTP master and an NTP server. Accordingly, the term "client" applies to both a PTP slave and an NTP client.
The document "Security Requirements of Time Protocols in Packet Switched Networks" [RFC7384] contains a profound analysis of security threats and requirements for time synchronization protocols.
The objectives of the NTS specification are as follows:
NTS applies X.509 certificates to verify the authenticity of the time server and to exchange a symmetric key, the so-called cookie. It then uses the cookie to protect the authenticity and the integrity of subsequent unicast-type time synchronization packets. In order to do this, a Message Authentication Code (MAC) is attached to each time synchronization packet. The calculation of the MAC includes the whole time synchronization packet and the cookie which is shared between client and server. The cookie is calculated according to:[RFC7384]. See Section 7 for details on seed refreshing.
with the server seed as the key, where H is a hash function, and where the function MSB_<b> cuts off the b most significant bits of the result of the HMAC function. The client's certificate contains the client's public key and enables the server to identify the client, if client authorization is desired. The server seed is a random value of bit length b that the server possesses, which has to remain secret. The cookie never changes as long as the server seed stays the same, but the server seed has to be refreshed periodically in order to provide key freshness as required in
Since the server does not keep a state of the client, it has to recalculate the cookie each time it receives a unicast time synchronization request from the client. To this end, the client has to attach the hash value of its certificate to each request (see Section 6.3).
For broadcast-type messages, authenticity and integrity of the time synchronization packets are also ensured by a MAC, which is attached to the time synchronization packet by the sender. Verification of the broadcast-type packets' authenticity is based on the TESLA protocol, in particular on its "not re-using keys" scheme, see Section 3.7.2 of [RFC4082]. TESLA uses a one-way chain of keys, where each key is the output of a one-way function applied to the previous key in the chain. The server securely shares the last element of the chain with all clients. The server splits time into intervals of uniform duration and assigns each key to an interval in reverse order, starting with the penultimate. At each time interval, the server sends a broadcast packet appended by a MAC, calculated using the corresponding key, and the key of the previous disclosure interval. The client verifies the MAC by buffering the packet until disclosure of the key in its associated disclosure interval occurs. In order to be able to verify the timeliness of the packets, the client has to be loosely time synchronized with the server. This has to be accomplished before broadcast associations can be used. For checking timeliness of packets, NTS uses another, more rigorous check in addition to just the clock lookup used in the TESLA protocol. For a more detailed description of how NTS employs and customizes TESLA, see Appendix B.
This section describes the types of messages needed for secure time synchronization with NTS.
For some guidance on how these message types can be realized in practice, and integrated into the communication flow of existing time synchronization protocols, see [I-D.ietf-ntp-cms-for-nts-message], a companion document for NTS. Said document describes ASN.1 encodings for those message parts that have to be added to a time synchronization protocol for security reasons as well as CMS (Cryptographic Message Syntax, see [RFC5652]) conventions that can be used to get the cryptographic aspects right.
In this message exchange, the participants negotiate the hash and encryption algorithms that are used throughout the protocol. In addition, the client receives the certification chain up to a trusted anchor. With the established certification chain the client is able to verify the server's signatures and, hence, the authenticity of future NTS messages from the server is ensured.
The association exchange:
The protocol sequence starts with the client sending an association message, called client_assoc. This message contains
This message is sent by the server upon receipt of client_assoc. It contains
For an association exchange, the following steps are performed:
If one of the checks fails, the client MUST abort the run.
+------------------------+ | o Choose version | | o Choose algorithms | | o Acquire certificates | | o Assemble response | | o Create signature | +-----------+------------+ | <-+-> Server ---------------------------> /| \ client_ / \ server_ assoc / \ assoc / \| Client ---------------------------> <------ Association -----> exchange
Procedure for association and cookie exchange.
During this message exchange, the server transmits a secret cookie to the client securely. The cookie will later be used for integrity protection during unicast time synchronization.
The cookie exchange:
This message is sent by the client upon successful authentication of the server. In this message, the client requests a cookie from the server. The message contains
This message is sent by the server upon receipt of a client_cook message. The server generates the hash of the client's certificate, as conveyed during client_cook, in order to calculate the cookie according to Section 5. This message contains
For a cookie exchange, the following steps are performed:
If one of those checks fails, the client MUST abort the run.
+----------------------------+ | o OPTIONAL: Check client's | | authorization | | o Generate cookie | | o Encrypt inner message | | o Generate signature | +-------------+--------------+ | <-+-> Server ---------------------------> /| \ client_ / \ server_ cook / \ cook / \| Client ---------------------------> <--- Cookie exchange -->
Procedure for association and cookie exchange.
In this message exchange, the usual time synchronization process is executed, with the addition of integrity protection for all messages that the server sends. This message can be repeatedly exchanged as often as the client desires and as long as the integrity of the server's time responses is verified successfully.
The unicast time synchronization exchange:
This message is sent by the client when it requests a time exchange. It contains
This message is sent by the server after it has received a time_request message. Prior to this the server MUST recalculate the client's cookie by using the hash of the client's certificate and the transmitted hash algorithm. The message contains
For a unicast time synchronization exchange, the following steps are performed:
If at least one of the first three checks fails (i.e. if the version number does not match, if the client has never used the nonce transmitted in the time_response message, or if it has used the nonce with initial time synchronization data different from that in the response), then the client MUST ignore this time_response message. If the MAC is invalid, the client MUST do one of the following: abort the run or go back to step 5 (because the cookie might have changed due to a server seed refresh). If both checks are successful, the client SHOULD continue time synchronization by going back to step 7.
+-----------------------+ | o Re-generate cookie | | o Assemble response | | o Generate MAC | +-----------+-----------+ | <-+-> Server -----------------------------------------------> /| \ time_ / \ time_ request / \ response / \| Client -----------------------------------------------> <------ Unicast time ------> <- Client-side -> synchronization validity exchange checks
Procedure for unicast time synchronization exchange.
In this message exchange, the client receives the necessary information to execute the TESLA protocol in a secured broadcast association. The client can only initiate a secure broadcast association after successful association and cookie exchanges and only if it has made sure that its clock is roughly synchronized to the server's.
See Appendix B for more details on TESLA.
The broadcast parameter exchange
This message is sent by the client in order to establish a secured time broadcast association with the server. It contains
This message is sent by the server upon receipt of a client_bpar message during the broadcast loop of the server. It contains
A broadcast parameter exchange consists of the following steps:
If any information is missing or if the server's signature cannot be verified, the client MUST abort the broadcast run. If all checks are successful, the client MUST remember all the broadcast parameters received for later checks.
+---------------------+ | o Assemble response | | o Create public-key | | signature | +----------+----------+ | <-+-> Server ---------------------------------------------> /| \ client_ / \ server_ bpar / \ bpar / \| Client ---------------------------------------------> <------- Broadcast ------> <- Client-side -> parameter validity exchange checks
Procedure for unicast time synchronization exchange.
Via a stream of messages of the following message type, the server keeps sending broadcast time synchronization messages to all participating clients.
The broadcast time synchronization exchange:
This message is sent by the server over the course of its broadcast schedule. It is part of any broadcast association. It contains
A broadcast time synchronization message exchange consists of the following steps:
See RFC 4082
[RFC4082] for a detailed description of the packet verification process.Server ----------------------------------> \ \ server_ \ broad \| Client ----------------------------------> < Broadcast > <- Client-side -> time sync. validity and exchange timeliness checks
Procedure for broadcast time synchronization exchange.
This message exchange is performed for an additional check of packet timeliness in the course of the TESLA scheme, see Appendix B.
The keycheck exchange:
A message of this type is sent by the client in order to initiate an additional check of packet timeliness for the TESLA scheme. It contains
A message of this type is sent by the server upon receipt of a client_keycheck message during the broadcast loop of the server. Prior to this, the server MUST recalculate the client's cookie by using the hash of the client's certificate and the transmitted hash algorithm. It contains
A broadcast keycheck message exchange consists of the following steps:
+----------------------+ | o Assemble response | | o Re-generate cookie | | o Generate MAC | +-----------+----------+ | <-+-> Server ---------------------------------------------> \ /| \ \ server_ client_ / \ server_ \ broad keycheck / \ keycheck \| / \| Client ---------------------------------------------> <-------- Extended broadcast time -------> synchronization. exchange <---- Keycheck exchange --->
Procedure for extended broadcast time synchronization exchange.
The server has to calculate a random seed which has to be kept secret. The server MUST generate a seed for each supported hash algorithm, see Section 8.1.
According to the requirements in [RFC7384], the server MUST refresh each server seed periodically. Consequently, the cookie memorized by the client becomes obsolete. In this case, the client cannot verify the MAC attached to subsequent time response messages and has to respond accordingly by re-initiating the protocol with a cookie request (Section 6.2).
Hash algorithms are used at different points: calculation of the cookie and the MAC, and hashing of the client's certificate. The client and the server negotiate a hash algorithm H during the association message exchange (Section 6.1) at the beginning. The selected algorithm H is used for all hashing processes in that run.
In the TESLA scheme, hash algorithms are used as pseudo-random functions to construct the one-way key chain. Here, the utilized hash algorithm is communicated by the server and is non-negotiable.
Note:
For the calculation of the MAC, client and server use a Keyed-Hash Message Authentication Code (HMAC) approach [RFC2104]. The HMAC is generated with the hash algorithm specified by the client (see Section 8.1).
The payload of time synchronization protocol packets of two-way time transfer approaches like NTP and PTP consists basically of time stamps, which are not considered secret [RFC7384]. Therefore, encryption of the time synchronization protocol packet's payload is not considered in this document. However, an attacker can exploit the exchange of time synchronization protocol packets for topology detection and inference attacks as described in [I-D.iab-privsec-confidentiality-threat]. To make such attacks more difficult, that draft recommends the encryption of the packet payload. Yet, in the case of time synchronization protocols the confidentiality protection of time synchronization packet's payload is of secondary role since the packets meta data (IP addresses, port numbers, possibly packet size and regular sending intervals) carry more information than the payload. To enhance the privacy of the time synchronization partners, the usage of tunnel protocols such as IPsec and MACsec, where applicable, is therefore more suited than confidentiality protection of the payload.
The client has to verify the validity of the certificates during the certification message exchange (Section 6.1.3). Since it generally has no reliable time during this initial communication phase, it is impossible to verify the period of validity of the certificates. To solve this chicken-and-egg problem, the client as to rely on external means.
According to Section 7, it is the client's responsibility to initiate a new association with the server after the server's certificate expires. To this end, the client reads the expiration date of the certificate during the certificate message exchange (Section 6.1.3). Furthermore, certificates may also be revoked prior to the normal expiration date. To increase security the client MAY periodically verify the state of the server's certificate via OCSP.
TESLA authentication buffers packets for delayed authentication. This makes the protocol vulnerable to flooding attacks, causing the client to buffer excessive numbers of packets. To add stronger DoS protection to the protocol, the client and the server use the "not re-using keys" scheme of TESLA as pointed out in Section 3.7.2 of RFC 4082 [RFC4082]. In this scheme the server never uses a key for the MAC generation more than once. Therefore, the client can discard any packet that contains a disclosed key it already knows, thus preventing memory flooding attacks.
Note that an alternative approach to enhance TESLA's resistance against DoS attacks involves the addition of a group MAC to each packet. This requires the exchange of an additional shared key common to the whole group. This adds additional complexity to the protocol and hence is currently not considered in this document.
In a packet delay attack, an adversary with the ability to act as a MITM delays time synchronization packets between client and server asymmetrically [RFC7384]. This prevents the client from accurately measuring the network delay, and hence its time offset to the server [Mizrahi]. The delay attack does not modify the content of the exchanged synchronization packets. Therefore, cryptographic means do not provide a feasible way to mitigate this attack. However, several non-cryptographic precautions can be taken in order to detect this attack.
Additional provision against delay attacks has to be taken for broadcast-type messages. This mode relies on the TESLA scheme which is based on the requirement that a client and the broadcast server are loosely time synchronized. Therefore, a broadcast client has to establish time synchronization with its broadcast server before it starts utilizing broadcast messages for time synchronization.
One possible way to achieve this initial synchronization is to establish a unicast association with its broadcast server until time synchronization and calibration of the packet delay time is achieved. After that, the client can establish a broadcast association with the broadcast server and utilizes TESLA to verify integrity and authenticity of any received broadcast packets.
An adversary who is able to delay broadcast packets can cause a time adjustment at the receiving broadcast clients. If the adversary delays broadcast packets continuously, then the time adjustment will accumulate until the loose time synchronization requirement is violated, which breaks the TESLA scheme. To mitigate this vulnerability the security condition in TESLA has to be supplemented by an additional check in which the client, upon receipt of a broadcast message, verifies the status of the corresponding key via a unicast message exchange with the broadcast server (see Appendix B.4 for a detailed description of this check). Note that a broadcast client should also apply the above-mentioned precautions as far as possible.
At various points of the protocol, the generation of random numbers is required. The employed methods of generation need to be cryptographically secure. See [RFC4086] for guidelines concerning this topic.
The authors would like to thank Tal Mizrahi, Russ Housley, Steven Bellovin, David Mills and Kurt Roeckx for discussions and comments on the design of NTS. Also, thanks go to Harlan Stenn for his technical review and specific text contributions to this document.
[RFC2104] | Krawczyk, H., Bellare, M. and R. Canetti, "HMAC: Keyed-Hashing for Message Authentication", RFC 2104, February 1997. |
[RFC2119] | Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. |
[RFC4082] | Perrig, A., Song, D., Canetti, R., Tygar, J. and B. Briscoe, "Timed Efficient Stream Loss-Tolerant Authentication (TESLA): Multicast Source Authentication Transform Introduction", RFC 4082, June 2005. |
[RFC5652] | Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, RFC 5652, September 2009. |
[RFC7384] | Mizrahi, T., "Security Requirements of Time Protocols in Packet Switched Networks", RFC 7384, October 2014. |
The following table compares the NTS specifications against the TICTOC security requirements [RFC7384].
Section | Requirement from RFC 7384 | Requirement level | NTS |
---|---|---|---|
5.1.1 | Authentication of Servers | MUST | OK |
5.1.1 | Authorization of Servers | MUST | OK |
5.1.2 | Recursive Authentication of Servers (Stratum 1) | MUST | OK |
5.1.2 | Recursive Authorization of Servers (Stratum 1) | MUST | OK |
5.1.3 | Authentication and Authorization of Clients | MAY | Optional, Limited |
5.2 | Integrity protection | MUST | OK |
5.3 | Spoofing Prevention | MUST | OK |
5.4 | Protection from DoS attacks against the time protocol | SHOULD | OK |
5.5 | Replay protection | MUST | OK |
5.6 | Key freshness | MUST | OK |
Security association | SHOULD | OK | |
Unicast and multicast associations | SHOULD | OK | |
5.7 | Performance: no degradation in quality of time transfer | MUST | OK |
Performance: lightweight computation | SHOULD | OK | |
Performance: storage | SHOULD | OK | |
Performance: bandwidth | SHOULD | OK | |
5.8 | Confidentiality protection | MAY | NO |
5.9 | Protection against Packet Delay and Interception Attacks | MUST | Limited*) |
5.10 | Secure mode | MUST | OK |
Hybrid mode | SHOULD | - |
*) See discussion in Section 10.5.
For broadcast-type messages , NTS adopts the TESLA protocol with some customizations. This appendix provides details on the generation and usage of the one-way key chain collected and assembled from [RFC4082]. Note that NTS uses the "not re-using keys" scheme of TESLA as described in Section 3.7.2. of [RFC4082].
server setup:
The server SHOULD calculate d according to
where ceil yields the smallest integer greater than or equal to its argument.
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Generation of Keys F F F F K_0 <-------- K_1 <-------- ... <-------- K_{n-1} <------- K_n | | | | | | | | | F' | F' | F' | F' | | | | v v v v K'_0 K'_1 ... K'_{n-1} K'_n [______________|____ ____|_________________|_______] I_1 ... I_{n-1} I_n Course of Time/Usage of Keys - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ->
A schematic explanation of the TESLA protocol's one-way key chain
A client needs the following information in order to participate in a TESLA broadcast:
Note that if D_t is greater than (d - 1) * L, then some authentic packets might be discarded. If D_t is greater than d * L, then all authentic packets will be discarded. In the latter case, the client should not participate in the broadcast, since there will be no benefit in doing so.
During each time interval I_i, the server sends at most one authenticated broadcast packet P_i. Such a packet consists of:
When a client receives a packet P_i as described above, it first checks that it has not already received a packet with the same disclosed key. This is done to avoid replay/flooding attacks. A packet that fails this test is discarded.
Next, the client begins to check the packet's timeliness by ensuring that according to the disclosure schedule and with respect to the upper bound D_t determined above, the server cannot have disclosed the key K_i yet. Specifically, it needs to check that the server's clock cannot read a time that is in time interval I_{i+d} or later. Since it works under the assumption that the server's clock is not more than D_t "ahead" of the client's clock, the client can calculate an upper bound t_i for the server's clock at the time when P_i arrived. This upper bound t_i is calculated according to
where R is the client's clock at the arrival of P_i. This implies that at the time of arrival of P_i, the server could have been in interval I_x at most, with[RFC4082]). If it is falsified, it is discarded.
where floor gives the greatest integer less than or equal to its argument. The client now needs to verify that
is valid (see also Section 3.5 of
If the check above is successful, the client performs another more rigorous check: it sends a key check request to the server (in the form of a client_keycheck message), asking explicitly if K_i has already been disclosed. It remembers the time stamp t_check of the sending time of that request as well as the nonce it used correlated with the interval number i. If it receives an answer from the server stating that K_i has not yet been disclosed and it is able to verify the HMAC on that response, then it deduces that K_i was undisclosed at t_check and therefore also at R. In this case, the client accepts P_i as timely.
Next the client verifies that a newly disclosed key K_{i-d} belongs to the one-way key chain. To this end, it applies the one-way function F to K_{i-d} until it can verify the identity with an earlier disclosed key (see Clause 3.5 in RFC 4082, item 3).
Next the client verifies that the transmitted time value s_i belongs to the time interval I_i, by checking
If it is falsified, the packet MUST be discarded and the client MUST reinitialize its broadcast module by performing time synchronization by other means than broadcast messages, and it MUST perform a new broadcast parameter exchange (because a falsification of this check yields that the packet was not generated according to protocol, which suggests an attack).
If a packet P_i passes all the tests listed above, it is stored for later authentication. Also, if at this time there is a package with index i-d already buffered, then the client uses the disclosed key K_{i-d} to derive K'_{i-d} and uses that to check the MAC included in package P_{i-d}. Upon success, it regards M_{i-d} as authenticated.
+---------+--------------+--------+-------------------------------+ | Issuer | Type | Owner | Description | +---------+--------------+--------+-------------------------------+ | Server | private key | server | Used for server_assoc, | | PKI | (signature) | | server_cook, server_bpar. | | +--------------+--------+ The server uses the private | | | public key | client | key to sign these messages. | | | (signature) | | The client uses the public | | +--------------+--------+ key to verify them. | | | certificate | server | The certificate is used in | | | | | server_assoc messages, for | | | | | verifying authentication and | | | | | (optionally) authorization. | +---------+--------------+--------+-------------------------------+ | Client | private key | client | The server uses the client's | | PKI | (encryption) | | public key to encrypt the | | +--------------+--------+ content of server_cook | | | public key | server | messages. The client uses | | | (encryption) | | the private key to decrypt | | +--------------+--------+ them. The certificate is | | | certificate | client | sent in client_cook messages, | | | | | where it is used for trans- | | | | | portation of the public key | | | | | as well as (optionally) for | | | | | verification of client | | | | | authorization. | +---------+--------------+--------+-------------------------------+
+------------<---------------+ | At least one | V successful | ++====[ ]===++ ++=====^=====++ || Cookie || ||Association|| || Exchange || || Exchange || ++====_ _===++ ++===========++ | | At least one | successful V ++=======[ ]=======++ || Unicast Time |>-----\ As long as further || Synchronization || | synchronization || Exchange(s) |<-----/ is desired ++=======_ _=======++ | \ Other (unspecified) Sufficient \ / methods which give accuracy \ either or / sufficient accuracy \----------\ /---------/ | | V ++========[ ]=========++ || Broadcast || || Parameter Exchange || ++========_ _=========++ | | One successful | per client V ++=======[ ]=======++ || Broadcast Time |>--------\ As long as further || Synchronization || | synchronization || Reception |<--------/ is desired ++=======_ _=======++ | / \ either / \ or /----------/ \-------------\ | | V V ++========[ ]========++ ++========[ ]========++ || Keycheck Exchange || || Keycheck Exchange || ++===================++ || with TimeSync || ++===================++