idnits 2.17.1 draft-ietf-babel-hmac-02.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- -- The draft header indicates that this document updates RFC6126bis, but the abstract doesn't seem to mention this, which it should. -- The abstract seems to indicate that this document updates RFC6126, but the header doesn't have an 'Updates:' line to match this. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (December 23, 2018) is 1922 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) ** Downref: Normative reference to an Informational RFC: RFC 2104 == Outdated reference: A later version (-20) exists of draft-ietf-babel-rfc6126bis-06 ** Downref: Normative reference to an Informational RFC: RFC 6234 ** Downref: Normative reference to an Informational RFC: RFC 7693 == Outdated reference: A later version (-10) exists of draft-ietf-babel-dtls-01 -- Obsolete informational reference (is this intentional?): RFC 7298 (Obsoleted by RFC 8967) Summary: 3 errors (**), 0 flaws (~~), 3 warnings (==), 4 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group C. Do 3 Internet-Draft W. Kolodziejak 4 Obsoletes: 7298 (if approved) J. Chroboczek 5 Updates: 6126bis (if approved) IRIF, University of Paris-Diderot 6 Intended status: Standards Track December 23, 2018 7 Expires: June 26, 2019 9 HMAC authentication for the Babel routing protocol 10 draft-ietf-babel-hmac-02 12 Abstract 14 This document describes a cryptographic authentication for the Babel 15 routing protocol that has provisions for replay avoidance. This 16 document updates RFC 6126bis and obsoletes RFC 7298. 18 Status of This Memo 20 This Internet-Draft is submitted in full conformance with the 21 provisions of BCP 78 and BCP 79. 23 Internet-Drafts are working documents of the Internet Engineering 24 Task Force (IETF). Note that other groups may also distribute 25 working documents as Internet-Drafts. The list of current Internet- 26 Drafts is at https://datatracker.ietf.org/drafts/current/. 28 Internet-Drafts are draft documents valid for a maximum of six months 29 and may be updated, replaced, or obsoleted by other documents at any 30 time. It is inappropriate to use Internet-Drafts as reference 31 material or to cite them other than as "work in progress." 33 This Internet-Draft will expire on June 26, 2019. 35 Copyright Notice 37 Copyright (c) 2018 IETF Trust and the persons identified as the 38 document authors. All rights reserved. 40 This document is subject to BCP 78 and the IETF Trust's Legal 41 Provisions Relating to IETF Documents 42 (https://trustee.ietf.org/license-info) in effect on the date of 43 publication of this document. Please review these documents 44 carefully, as they describe your rights and restrictions with respect 45 to this document. Code Components extracted from this document must 46 include Simplified BSD License text as described in Section 4.e of 47 the Trust Legal Provisions and are provided without warranty as 48 described in the Simplified BSD License. 50 Table of Contents 52 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 53 1.1. Applicability . . . . . . . . . . . . . . . . . . . . . . 3 54 1.2. Assumptions and security properties . . . . . . . . . . . 3 55 1.3. Specification of Requirements . . . . . . . . . . . . . . 4 56 2. Conceptual overview of the protocol . . . . . . . . . . . . . 4 57 3. Data Structures . . . . . . . . . . . . . . . . . . . . . . . 5 58 3.1. The Interface Table . . . . . . . . . . . . . . . . . . . 5 59 3.2. The Neighbour table . . . . . . . . . . . . . . . . . . . 6 60 4. Protocol Operation . . . . . . . . . . . . . . . . . . . . . 6 61 4.1. HMAC computation . . . . . . . . . . . . . . . . . . . . 6 62 4.2. Packet Transmission . . . . . . . . . . . . . . . . . . . 7 63 4.3. Packet Reception . . . . . . . . . . . . . . . . . . . . 8 64 4.4. Expiring per-neighbour state . . . . . . . . . . . . . . 10 65 5. Packet Format . . . . . . . . . . . . . . . . . . . . . . . . 11 66 5.1. HMAC TLV . . . . . . . . . . . . . . . . . . . . . . . . 11 67 5.2. PC TLV . . . . . . . . . . . . . . . . . . . . . . . . . 11 68 5.3. Challenge Request TLV . . . . . . . . . . . . . . . . . . 12 69 5.4. Challenge Reply TLV . . . . . . . . . . . . . . . . . . . 12 70 6. Security Considerations . . . . . . . . . . . . . . . . . . . 13 71 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 14 72 8. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 14 73 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 14 74 9.1. Normative References . . . . . . . . . . . . . . . . . . 14 75 9.2. Informational References . . . . . . . . . . . . . . . . 15 76 Appendix A. Incremental deployment and key rotation . . . . . . 15 77 Appendix B. Changes from previous versions . . . . . . . . . . . 16 78 B.1. Changes since draft-ietf-babel-hmac-00 . . . . . . . . . 16 79 B.2. Changes since draft-ietf-babel-hmac-00 . . . . . . . . . 16 80 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 16 82 1. Introduction 84 By default, the Babel routing protocol trusts the information 85 contained in every UDP packet it receives on the Babel port. An 86 attacker can redirect traffic to itself or to a different node in the 87 network, causing a variety of potential issues. In particular, an 88 attacker might: 90 o spoof a Babel packet, and redirect traffic by announcing a smaller 91 metric, a larger seqno, or a longer prefix; 93 o spoof a malformed packet, which could cause an insufficiently 94 robust implementation to crash or interfere with the rest of the 95 network; 97 o replay a previously captured Babel packet, which could cause 98 traffic to be redirected or otherwise interfere with the network. 100 Protecting a Babel network is challenging due to the fact that the 101 Babel protocol uses both unicast and multicast communication. One 102 possible approach, used notably by the Babel over Datagram Transport 103 Layer Security (DTLS) protocol [I-D.ietf-babel-dtls], is to use 104 unicast communication for all semantically significant communication, 105 and then use a standard unicast security protocol to protect the 106 Babel traffic. In this document, we take the opposite approach: we 107 define a cryptographic extension to the Babel protocol that is able 108 to protect both unicast and multicast traffic, and thus requires very 109 few changes to the core protocol. 111 1.1. Applicability 113 The protocol defined in this document assumes that all interfaces on 114 a given link are equally trusted and share a small set of symmetric 115 keys (usually just one, and two during key rotation). The protocol 116 is inapplicable in situations where asymmetric keying is required, 117 where the trust relationship is partial, or where large numbers of 118 trusted keys are provisioned on a single link at the same time. 120 This protocol supports incremental deployment (where an insecure 121 Babel network is made secure with no service interruption), and it 122 supports graceful key rotation (where the set of keys is changed with 123 no service interruption). 125 This protocol does not require synchronised clocks, it does not 126 require persistently monotonic clocks, and it does not require 127 persistent storage except for what might be required for storing 128 cryptographic keys. 130 1.2. Assumptions and security properties 132 The correctness of the protocol relies on the following assumptions: 134 o that the Hashed Message Authentication Code (HMAC) being used is 135 invulnerable to pre-image attacks, i.e., that an attacker is 136 unable to generate a packet with a correct HMAC; 138 o that a node never generates the same index or nonce twice over the 139 lifetime of a key. 141 The first assumption is a property of the HMAC being used. The 142 second assumption can be met either by using a robust random number 143 generator and sufficiently large indices and nonces, by using a 144 reliable hardware clock, or by rekeying whenever a collision becomes 145 likely. 147 If the assumptions above are met, the protocol described in this 148 document has the following properties: 150 o it is invulnerable to spoofing: any packet accepted as authentic 151 is the exact copy of a packet originally sent by an authorised 152 node; 154 o locally to a single node, it is invulnerable to replay: if a node 155 has previously accepted a given packet, then it will never again 156 accept a copy of this packet or an earlier packet from the same 157 sender; 159 o among different nodes, it is only vulnerable to immediate replay: 160 if a node A has accepted a packet from C as valid, then a node B 161 will only accept a copy of that packet as authentic if B has 162 accepted an older packet from C and B has received no later packet 163 from C. 165 While this protocol makes serious efforts to mitigate the effects of 166 a denial of service attack, it does not fully protect against such 167 attacks. 169 1.3. Specification of Requirements 171 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 172 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 173 "OPTIONAL" in this document are to be interpreted as described in BCP 174 14 [RFC2119] [RFC8174] when, and only when, they appear in all 175 capitals, as shown here. 177 2. Conceptual overview of the protocol 179 When a node B sends out a Babel packet through an interface that is 180 configured for cryptographic protection, it computes one or more 181 HMACs which it appends to the packet. When a node A receives a 182 packet over an interface that requires cryptographic protection, it 183 independently computes a set of HMACs and compares them to the HMACs 184 appended to the packet; if there is no match, the packet is 185 discarded. 187 In order to protect against replay B maintains a per-interface 32-bit 188 integer known as the "packet counter" (PC). Whenever B sends a 189 packet through the interface, it embeds the current value of the PC 190 within the region of the packet that is protected by the HMACs and 191 increases the PC by at least one. When A receives the packet, it 192 compares the value of the PC with the one contained in the previous 193 packet received from B, and unless it is strictly greater, the packet 194 is discarded. 196 By itself, the PC mechanism is not sufficient to protect against 197 replay. Consider a peer A that has no information about a peer B 198 (e.g., because it has recently rebooted). Suppose that A receives a 199 packet ostensibly from B carrying a given PC; since A has no 200 information about B, it has no way to determine whether the packet is 201 freshly generated or a replay of a previously sent packet. 203 In this situation, A discards the packet and challenges B to prove 204 that it knows the HMAC key. It sends a "challenge request", a TLV 205 containing a unique nonce, a value that has never been used before 206 and will never be used again. B replies to the challenge request 207 with a "challenge reply", a TLV containing a copy of the nonce chosen 208 by A, in a packet protected by HMAC and containing the new value of 209 B's PC. Since the nonce has never been used before, B's reply proves 210 B's knowledge of the HMAC key and the freshness of the PC. 212 By itself, this mechanism is safe against replay if B never resets 213 its PC. In practice, however, this is difficult to ensure, as 214 persistent storage is prone to failure, and hardware clocks, even 215 when available, are occasionally reset. Suppose that B resets its PC 216 to an earlier value, and sends a packet with a previously used PC n. 217 A challenges B, B successfully responds to the challenge, and A 218 accepts the PC equal to n + 1. At this point, an attacker C may send 219 a replayed packet with PC equal to n + 2, which will be accepted by 220 A. 222 Another mechanism is needed to protect against this attack. In this 223 protocol, every PC is tagged with an "index", an arbitrary string of 224 octets. Whenever B resets its PC, or whenever B doesn't know whether 225 its PC has been reset, it picks an index that it has never used 226 before (either by drawing it randomly or by using a reliable hardware 227 clock) and starts sending PCs with that index. Whenever A detects 228 that B has changed its index, it challenges B again. 230 With this additional mechanism, this protocol is invulnerable to 231 replay attacks (see Section 1.2 above). 233 3. Data Structures 235 3.1. The Interface Table 237 Every Babel node maintains an interface table, as described in 238 [RFC6126bis] Section 3.2.3. This protocol extends the entries in 239 this table with a set of HMAC keys, and a pair (Index, PC), where 240 Index is an arbitrary string of bytes and PC is a 32-bit integer. 241 The Index is initialised to a value that has never been used before 242 (e.g., by choosing a random string of sufficient length). 244 3.2. The Neighbour table 246 Every Babel node maintains a neighbour table, as described in 247 [RFC6126bis] Section 3.2.4. This protocol extends the entries in 248 this table with a pair (Index, PC), as well as a nonce (an arbitrary 249 string of bytes) and a challenge expiry timer. The Index and PC are 250 initially undefined, and are managed as described in Section 4.3. 251 The Nonce and expiry timer are initially undefined and used as 252 described in Section 4.3.1.1. 254 4. Protocol Operation 256 4.1. HMAC computation 258 A Babel node computes an HMAC as follows. 260 First, the node builds a pseudo-header that will participate in HMAC 261 computation but will not be sent. If the packet was carried over 262 IPv6, the pseudo-header has the following format: 264 0 1 2 3 265 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 266 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 267 | | 268 + + 269 | | 270 + Src address + 271 | | 272 + + 273 | | 274 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 275 | Src port | | 276 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + 277 | | 278 + + 279 | Dest address | 280 + + 281 | | 282 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 283 | | Dest port | 284 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 286 If the packet was carried over IPv4, the pseudo-header has the 287 following format: 289 0 1 2 3 290 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 291 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 292 | Src address | 293 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 294 | Src port | Dest address | 295 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 296 | | Dest port | 297 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 299 Fields : 301 Src address The source IP address of the packet. 303 Src port The source UDP port number of the packet. 305 Dest address The destination IP address of the packet. 307 Src port The destination UDP port number of the packet. 309 The node takes the concatenation of the pseudo-header and the packet 310 including the packet header but excluding the packet trailer (from 311 octet 0 inclusive up to Body Length + 4 exclusive) and computes an 312 HMAC with one of the implemented hash algorithms. Every 313 implementation MUST implement HMAC-SHA256 as defined in [RFC6234] and 314 Section 2 of [RFC2104], SHOULD implement keyed BLAKE2s [RFC7693], and 315 MAY implement other HMAC algorithms. 317 4.2. Packet Transmission 319 A Babel node may delay actually sending TLVs by a small amount, in 320 order to aggregate multiple TLVs in a single packet up to the 321 interface MTU (Section 4 of [RFC6126bis]). For an interface on which 322 HMAC protection is configured, the TLV aggregation logic MUST take 323 into account the overhead due to PC TLVs (one in each packet) and 324 HMAC TLVs (one per configured key). 326 Before sending a packet, the following actions are performed: 328 o a PC TLV containing the PC and Index associated with the outgoing 329 interface is appended to the packet body; the PC is incremented by 330 a strictly positive amount (typically just 1); if the PC 331 overflows, a new index is generated; 333 o for each key configured on the interface, an HMAC is computed as 334 specified in Section 4.1 above, and an HMAC TLV is appended to the 335 packet trailer (see Section 4.2 of [RFC6126bis]). 337 4.3. Packet Reception 339 When a packet is received on an interface that is configured for HMAC 340 protection, the following steps are performed before the packet is 341 passed to normal processing: 343 o First, the receiver checks whether the trailer of the received 344 packet carries at least one HMAC TLV; if not, the packet is 345 immediately dropped and processing stops. Then, for each key 346 configured on the receiving interface, the implementation computes 347 the HMAC of the packet. It then compares every generated HMAC 348 against every HMAC included in the packet; if there is at least 349 one match, the packet passes the HMAC test; if there is none, the 350 packet is silently dropped and processing stops at this point. In 351 order to avoid memory exhaustion attacks, an entry in the 352 Neighbour Table MUST NOT be created before the HMAC test has 353 passed successfully. The HMAC of the packet MUST NOT be computed 354 for each HMAC TLV contained in the packet, but only once for each 355 configured key. 357 o The packet body is then parsed a first time. During this 358 "preparse" phase, the packet body is traversed and all TLVs are 359 ignored except PC TLVs, Challenge Requests and Challenge Replies. 360 When a PC TLV is encountered, the enclosed PC and Index are saved 361 for later processing; if multiple PCs are found, only the first 362 one is processed, the remaining ones are silently ignored. If a 363 Challenge Request is encountered, a Challenge Reply is scheduled, 364 as described in Section 4.3.1.2, and if a Challenge Reply is 365 encountered, it is tested for validity as described in 366 Section 4.3.1.3 and a note is made of the result of the test. 368 o The preparse phase above has yielded two pieces of data: the PC 369 and Index from the first PC TLV, and a bit indicating whether the 370 packet contains a successful Challenge Reply. If the packet does 371 not contain a PC TLV, the packet is dropped and processing stops 372 at this point. If the packet contains a successful Challenge 373 Reply, then the PC and Index contained in the PC TLV are stored in 374 the Neighbour Table entry corresponding to the sender (which may 375 need to be created at this stage). 377 o If there is no entry in the Neighbour Table corresponding to the 378 sender, or if such an entry exists but contains no Index, or if 379 the Index it contains is different from the Index contained in the 380 PC TLV, then a challenge is sent as described in Section 4.3.1.1, 381 processing stops at this stage, and the packet is dropped. 383 o At this stage, the Index contained in the PC TLV is equal to the 384 Index in the Neighbour Table entry corresponding to the sender. 386 The receiver compares the received PC with the PC contained in the 387 Neighbour Table; if the received PC smaller or equal than the PC 388 contained in the Neighbour Table, the packet is silently dropped 389 and processing stops (no challenge is sent in this case, since the 390 mismatch might be caused by harmless packet reordering on the 391 link). Otherwise, the PC contained in the Neighbour Table entry 392 is set to the received PC, and the packet is accepted. 394 After the packet has been accepted, it is processed as normal, except 395 that any PC, Challenge Request and Challenge Reply TLVs that it 396 contains are silently ignored. 398 4.3.1. Challenge Requests and Replies 400 During the preparse stage, the receiver might encounter a mismatched 401 Index, to which it will react by scheduling a Challenge Request. It 402 might encounter a Challenge Request TLV, to which it will reply with 403 a Challenge Reply TLV. Finally, it might encounter a Challenge Reply 404 TLV, which it will attempt to match with a previously sent Challenge 405 Request TLV in order to update the Neighbour Table entry 406 corresponding to the sender of the packet. 408 4.3.1.1. Sending challenges 410 When it encounters a mismatched Index during the preparse phase, a 411 node picks a nonce that it has never used before, for example by 412 drawing a sufficiently large random string of bytes or by consulting 413 a strictly monotonic hardware clock. It stores the nonce in the 414 entry of the Neighbour Table of the neighbour (the entry might need 415 to be created at this stage), initialises the neighbour's challenge 416 expiry timer to 30 seconds, and sends a Challenge Request TLV to the 417 unicast address corresponding to the neighbour. 419 A node MAY aggregate a Challenge Request with other TLVs; in other 420 words, if it has already buffered TLVs to be sent to the unicast 421 address of the sender of the neighbour, it MAY send the buffered TLVs 422 in the same packet as the Challenge Request. However, it MUST 423 arrange for the Challenge Request to be sent in a timely manner, as 424 any packets received from that neighbour will be silently ignored 425 until the challenge completes. 427 Since a challenge may be prompted by a replayed packet, a node MUST 428 impose a rate limitation to the challenges it sends; a limit of one 429 challenge every 300ms for each neighbour is suggested. 431 4.3.1.2. Replying to challenges 433 When it encounters a Challenge Request during the preparse phase, a 434 node constructs a Challenge Reply TLV by copying the Nonce from the 435 Challenge Request into the Challenge Reply. It sends the Challenge 436 Reply to the unicast address of the sender of the Challenge Reply. 438 A node MAY aggregate a Challenge Reply with other TLVs; in other 439 words, if it has already buffered TLVs to be sent to the unicast 440 address of the sender of the Challenge Request, it MAY send the 441 buffered TLVs in the same packet as the Challenge Reply. However, it 442 MUST arrange for the Challenge Reply to be sent in a timely manner 443 (within a few seconds), and SHOULD NOT send any other packets over 444 the same interface before sending the Challenge Reply, as those would 445 be dropped by the challenger. 447 A challenge sent to a multicast address MUST be silently ignored. 449 4.3.1.3. Receiving challenge replies 451 When it encounters a Challenge Reply during the preparse phase, a 452 node consults the Neighbour Table entry corresponding to the 453 neighbour that sent the Challenge Reply. If no challenge is in 454 progress, i.e., if there is no Nonce stored in the Neighbour 455 Table entry or the Challenge timer has expired, the Challenge Reply 456 is silently ignored and the challenge has failed. 458 Otherwise, the node compares the Nonce contained in the Challenge 459 Reply with the Nonce contained in the Neighbour Table entry. If the 460 two are equal (they have the same length and content), then the 461 challenge has succeeded; otherwise, the challenge has failed. 463 4.4. Expiring per-neighbour state 465 The per-neighbour (Index, PC) pair is maintained in the neighbour 466 table, and is normally discarded when the neighbour table entry 467 expires. Implementations MUST ensure that an (Index, PC) pair is 468 discarded within a finite time since the last time a packet has been 469 accepted. In particular, unsuccessful challenges MUST NOT prevent an 470 (Index, PC) pair from being discarded for unbounded periods of time. 472 Implementations that use a Hello history (Appendix A of [RFC6126bis]) 473 may discard the (Index, PC) pair whenever the Hello history becomes 474 empty. Other impementations may use a timer that is reset whenever a 475 packet is accepted, and discard the (Index, PC) pair whenever the 476 timer expires (an timeout of 5 min is suggested). 478 5. Packet Format 480 5.1. HMAC TLV 482 0 1 2 3 483 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 484 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 485 | Type | Length | HMAC... 486 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 488 Fields : 490 Type Set to TBD to indicate an HMAC TLV. 492 Length The length of the body, exclusive of the Type and Length 493 fields. The length of the body depends on the hash 494 function used. 496 HMAC The body contains the HMAC of the whole packet plus the 497 pseudo header. 499 This TLV is allowed in the packet trailer (see Section 4.2 of 500 [RFC6126bis]), and MUST be ignored if it is found in the packet body. 502 5.2. PC TLV 504 0 1 2 3 505 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 506 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 507 | Type | Length | PC 508 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 509 | Index... 510 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 512 Fields : 514 Type Set to TBD to indicate a PC TLV. 516 Length The length of the body, exclusive of the Type and Length 517 fields. 519 PC The Packet Counter (PC), which is increased with every 520 packet sent over this interface. A new index MUST be 521 generated whenever the PC overflows. 523 Index The sender's Index. 525 Indices are limited to a size of 32 octets: a node MUST NOT send a 526 TLV with an index of size strictly larger than 32 octets, and a node 527 MAY silently ignore a PC TLV with an index of size strictly larger 528 than 32 octets. 530 5.3. Challenge Request TLV 532 0 1 2 3 533 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 534 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 535 | Type | Length | Nonce... 536 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 538 Fields : 540 Type Set to TBD to indicate a Challenge Request TLV. 542 Length The length of the body, exclusive of the Type and Length 543 fields. 545 Nonce The nonce uniquely identifying the challenge. 547 Nonces are limited to a size of 192 octets: a node MUST NOT send a 548 Challenge Request TLV with a nonce of size strictly larger than 192 549 octets, and a node MAY ignore a nonce that is of size strictly larger 550 than 192 octets. 552 5.4. Challenge Reply TLV 554 0 1 2 3 555 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 556 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 557 | Type | Length | Nonce... 558 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 560 Fields : 562 Type Set to TBD to indicate a Challenge Reply TLV. 564 Length The length of the body, exclusive of the Type and Length 565 fields. The length of the body is set to the same size as 566 the challenge request TLV length received. 568 Nonce A copy of the nonce contained in the corresponding 569 challenge request. 571 6. Security Considerations 573 This document defines a mechanism that provides basic security 574 properties for the Babel routing protocol. The scope of this 575 protocol is strictly limited: it only provides authentication (we 576 assume that routing information is not confidential), it only 577 supports symmetric keying, and it only allows for the use of a small 578 number of symmetric keys on every link. Deployments that need more 579 features, e.g., confidentiality or asymmetric keying, should use a 580 more featureful security mechanism such as the one described in 581 [I-D.ietf-babel-dtls]. 583 This mechanism relies on two assumptions, as described in 584 Section 1.2. First, it assumes that the hash being used is 585 invulnerable to pre-image attacks (Section 1.1 of [RFC6039]); at the 586 time of writing, SHA-256, which is mandatory to implement 587 (Section 4.1), is believed to be safe against practical attacks. 589 Second, it assumes that indices and nonces are generated uniquely 590 over the lifetime of a key used for HMAC computation (more precisely, 591 indices must be unique for a given (key, source) pair, and nonces 592 must be unique for a given (key, source, destination) triple). This 593 property can be satisfied either by using a cryptographically secure 594 random number generator to generate indices and nonces that contain 595 enough entropy (64-bit values are believed to be large enough for all 596 practical applications), or by using a reliably monotonic hardware 597 clock. If unicity cannot be guaranteed (e.g., because a hardware 598 clock has been reset), then rekeying is necessary. 600 The expiry mechanism mandated in Section 4.4 is required to prevent 601 an attacker from delaying an authentic packet by an unbounded amount 602 of time. If an attacker is able to delay the delivery of a packet 603 (e.g., because it is located at a layer 2 switch), then the packet 604 will be accepted as long as the corresponding (Index, PC) pair is 605 present at the receiver. If the attacker is able to cause the 606 (Index, PC) pair to persist for arbitrary amounts of time (e.g., by 607 causing failed challenges), then it is able to delay the packet by 608 arbitrary amounts of time, even after the sender has left the 609 network. 611 While it is probably not possible to be immune against denial of 612 service (DoS) attacks in general, this protocol includes a number of 613 mechanisms designed to mitigate such attacks. In particular, 614 reception of a packet with no correct HMAC creates no local state 615 whatsoever (Section 4.3). Reception of a replayed packet with 616 correct hash, on the other hand, causes a challenge to be sent; this 617 is mitigated somewhat by requiring that challenges be rate-limited. 619 At first sight, sending a challenge requires retaining enough 620 information to validate the challenge reply. However, the nonce 621 included in a challenge request and echoed in the challenge reply can 622 be fairly large (up to 192 octets), which should in principle permit 623 encoding the per-challenge state as a secure "cookie" within the 624 nonce itself. 626 7. IANA Considerations 628 IANA is instructed to allocate the following values in the Babel TLV 629 Numbers registry: 631 +------+-------------------+---------------+ 632 | Type | Name | Reference | 633 +------+-------------------+---------------+ 634 | TBD | HMAC | this document | 635 | | | | 636 | TBD | PC | this document | 637 | | | | 638 | TBD | Challenge Request | this document | 639 | | | | 640 | TBD | Challenge Reply | this document | 641 +------+-------------------+---------------+ 643 8. Acknowledgments 645 The protocol described in this document is based on the original HMAC 646 protocol defined by Denis Ovsienko [RFC7298]. The use of a pseudo- 647 header was suggested by David Schinazi. The use of an index to avoid 648 replay was suggested by Markus Stenberg. The authors are also 649 indebted to Toke Hoiland-Jorgensen, Florian Horn, and Dave Taht. 651 9. References 653 9.1. Normative References 655 [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 656 Hashing for Message Authentication", RFC 2104, 657 DOI 10.17487/RFC2104, February 1997, 658 . 660 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 661 Requirement Levels", BCP 14, RFC 2119, 662 DOI 10.17487/RFC2119, March 1997. 664 [RFC6126bis] 665 Chroboczek, J. and D. Schinazi, "The Babel Routing 666 Protocol", draft-ietf-babel-rfc6126bis-06 (work in 667 progress), October 2018. 669 [RFC6234] Eastlake 3rd, D. and T. Hansen, "US Secure Hash Algorithms 670 (SHA and SHA-based HMAC and HKDF)", RFC 6234, 671 DOI 10.17487/RFC6234, May 2011, 672 . 674 [RFC7693] Saarinen, M-J., Ed. and J-P. Aumasson, "The BLAKE2 675 Cryptographic Hash and Message Authentication Code (MAC)", 676 RFC 7693, DOI 10.17487/RFC7693, November 2015, 677 . 679 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 680 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 681 May 2017. 683 9.2. Informational References 685 [I-D.ietf-babel-dtls] 686 Decimo, A., Schinazi, D., and J. Chroboczek, "Babel 687 Routing Protocol over Datagram Transport Layer Security", 688 draft-ietf-babel-dtls-01 (work in progress), October 2018. 690 [RFC6039] Manral, V., Bhatia, M., Jaeggli, J., and R. White, "Issues 691 with Existing Cryptographic Protection Methods for Routing 692 Protocols", RFC 6039, DOI 10.17487/RFC6039, October 2010, 693 . 695 [RFC7298] Ovsienko, D., "Babel Hashed Message Authentication Code 696 (HMAC) Cryptographic Authentication", RFC 7298, 697 DOI 10.17487/RFC7298, July 2014, 698 . 700 Appendix A. Incremental deployment and key rotation 702 This protocol supports incremental deployment (transitioning from an 703 insecure network to a secured network with no service interruption) 704 and key rotation (transitioning from a set of keys to a different set 705 of keys). 707 In order to perform incremental deployment, the nodes in the network 708 are first configured in a mode where packets are sent with 709 authentication but not checked on reception. Once all the nodes in 710 the network are configured to send authenticated packets, nodes are 711 reconfigured to reject unauthenticated packets. 713 In order to perform key rotation, the new key is added to all the 714 nodes; once this is done, both the old and the new key are sent in 715 all packets, and packets are accepted if they are properly signed by 716 either of the keys. At that point, the old key is removed. 718 In order to support incremental deployment and key rotation, 719 implementations SHOULD support an interface configuration in which 720 they send authenticated packets but accept all packets, and SHOULD 721 allow changing the set of keys associated with an interface without a 722 restart. 724 Appendix B. Changes from previous versions 726 B.1. Changes since draft-ietf-babel-hmac-00 728 o Changed the title. 730 o Removed the appendix about the packet trailer, this is now in 731 rfc6126bis. 733 o Removed the appendix with implicit indices. 735 o Clarified the definitions of acronyms. 737 o Limited the size of nonces and indices. 739 B.2. Changes since draft-ietf-babel-hmac-00 741 o Made BLAKE2s a recommended HMAC algorithm. 743 o Added requirement to expire per-neighbour crypto state. 745 Authors' Addresses 747 Clara Do 748 IRIF, University of Paris-Diderot 749 75205 Paris Cedex 13 750 France 752 Email: clarado_perso@yahoo.fr 754 Weronika Kolodziejak 755 IRIF, University of Paris-Diderot 756 75205 Paris Cedex 13 757 France 759 Email: weronika.kolodziejak@gmail.com 760 Juliusz Chroboczek 761 IRIF, University of Paris-Diderot 762 Case 7014 763 75205 Paris Cedex 13 764 France 766 Email: jch@irif.fr