idnits 2.17.1 draft-ietf-ipsecme-ikev2-fragmentation-08.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 : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (May 23, 2014) is 3597 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) == Missing Reference: 'CERTREQ' is mentioned on line 201, but not defined == Outdated reference: A later version (-04) exists of draft-kivinen-ipsecme-ikev2-rfc5996bis-03 -- Possible downref: Normative reference to a draft: ref. 'IKEv2' -- Obsolete informational reference (is this intentional?): RFC 1981 (Obsoleted by RFC 8201) -- Obsolete informational reference (is this intentional?): RFC 2460 (Obsoleted by RFC 8200) -- Obsolete informational reference (is this intentional?): RFC 5405 (Obsoleted by RFC 8085) Summary: 0 errors (**), 0 flaws (~~), 3 warnings (==), 5 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group V. Smyslov 3 Internet-Draft ELVIS-PLUS 4 Intended status: Standards Track May 23, 2014 5 Expires: November 24, 2014 7 IKEv2 Fragmentation 8 draft-ietf-ipsecme-ikev2-fragmentation-08 10 Abstract 12 This document describes the way to avoid IP fragmentation of large 13 IKEv2 messages. This allows IKEv2 messages to traverse network 14 devices that do not allow IP fragments to pass through. 16 Status of this Memo 18 This Internet-Draft is submitted in full conformance with the 19 provisions of BCP 78 and BCP 79. 21 Internet-Drafts are working documents of the Internet Engineering 22 Task Force (IETF). Note that other groups may also distribute 23 working documents as Internet-Drafts. The list of current Internet- 24 Drafts is at http://datatracker.ietf.org/drafts/current/. 26 Internet-Drafts are draft documents valid for a maximum of six months 27 and may be updated, replaced, or obsoleted by other documents at any 28 time. It is inappropriate to use Internet-Drafts as reference 29 material or to cite them other than as "work in progress." 31 This Internet-Draft will expire on November 24, 2014. 33 Copyright Notice 35 Copyright (c) 2014 IETF Trust and the persons identified as the 36 document authors. All rights reserved. 38 This document is subject to BCP 78 and the IETF Trust's Legal 39 Provisions Relating to IETF Documents 40 (http://trustee.ietf.org/license-info) in effect on the date of 41 publication of this document. Please review these documents 42 carefully, as they describe your rights and restrictions with respect 43 to this document. Code Components extracted from this document must 44 include Simplified BSD License text as described in Section 4.e of 45 the Trust Legal Provisions and are provided without warranty as 46 described in the Simplified BSD License. 48 Table of Contents 50 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 51 1.1. Problem description . . . . . . . . . . . . . . . . . . . 3 52 1.2. Proposed solution . . . . . . . . . . . . . . . . . . . . 3 53 1.3. Conventions Used in This Document . . . . . . . . . . . . 4 54 2. Protocol details . . . . . . . . . . . . . . . . . . . . . . . 5 55 2.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . 5 56 2.2. Limitations . . . . . . . . . . . . . . . . . . . . . . . 5 57 2.3. Negotiation . . . . . . . . . . . . . . . . . . . . . . . 5 58 2.4. Using IKE Fragmentation . . . . . . . . . . . . . . . . . 6 59 2.5. Fragmenting Message . . . . . . . . . . . . . . . . . . . 7 60 2.5.1. Selecting Fragment Size . . . . . . . . . . . . . . . 9 61 2.5.2. PMTU Discovery . . . . . . . . . . . . . . . . . . . . 10 62 2.5.3. Fragmenting Messages containing unprotected 63 Payloads . . . . . . . . . . . . . . . . . . . . . . . 11 64 2.6. Receiving IKE Fragment Message . . . . . . . . . . . . . . 12 65 2.6.1. Replay Detection and Retransmissions . . . . . . . . . 14 66 3. Interaction with other IKE extensions . . . . . . . . . . . . 15 67 4. Transport Considerations . . . . . . . . . . . . . . . . . . . 16 68 5. Security Considerations . . . . . . . . . . . . . . . . . . . 17 69 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 18 70 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 19 71 8. References . . . . . . . . . . . . . . . . . . . . . . . . . . 20 72 8.1. Normative References . . . . . . . . . . . . . . . . . . . 20 73 8.2. Informative References . . . . . . . . . . . . . . . . . . 20 74 Appendix A. Design rationale . . . . . . . . . . . . . . . . . . 22 75 Appendix B. Correlation between IP Datagram size and 76 Encrypted Payload content size . . . . . . . . . . . 23 77 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 25 79 1. Introduction 81 1.1. Problem description 83 The Internet Key Exchange Protocol version 2 (IKEv2), specified in 84 [IKEv2], uses UDP as a transport for its messages. Most IKEv2 85 messages are relatively small, usually below several hundred bytes. 86 Noticeable exception is IKE_AUTH Exchange, which requires fairly 87 large messages, up to several kbytes, especially when certificates 88 are transferred. When IKE message size exceeds path MTU, it gets 89 fragmented by IP level. The problem is that some network devices, 90 specifically some NAT boxes, do not allow IP fragments to pass 91 through. This apparently blocks IKE communication and, therefore, 92 prevents peers from establishing IPsec SA. Section 2 of [IKEv2] 93 discusses the impact of IP fragmentation on IKEv2 and acknowledges 94 this problem. 96 Widespread deployment of Carrier-Grade NATs (CGN) introduces new 97 challenges. [RFC6888] describes requirements for CGNs. It states, 98 that CGNs must comply with Section 11 of [RFC4787], which requires 99 NAT to support receiving IP fragments (REQ-14). In real life 100 fulfillment of this requirement creates an additional burden in terms 101 of memory, especially for high-capacity devices, used in CGNs. It 102 was found by people deploying IKE, that more and more ISPs use 103 equipment that drop IP fragments, violating this requirement. 105 Security researchers have found and continue to find attack vectors 106 that rely on IP fragmentation. For these reasons, and also 107 articulated in [FRAGDROP], many network operators filter all IPv6 108 fragments. Also, the default behavior of many currently deployed 109 firewalls is to discard IPv6 fragments. 111 In one recent study [BLACKHOLES], two researchers utilized a 112 measurement network to measure fragment filtering. They sent 113 packets, fragmented to the minimum MTU of 1280, to 502 IPv6 enabled 114 and reachable probes. They found that during any given trial period, 115 ten percent of the probes did not receive fragmented packets. 117 Thus this problem is valid for both IPv4 and IPv6 and may be caused 118 either by deficiency of network devices or by operational choice. 120 1.2. Proposed solution 122 The solution to the problem described in this document is to perform 123 fragmentation of large messages by IKEv2 itself, replacing them by 124 series of smaller messages. In this case the resulting IP Datagrams 125 will be small enough so that no fragmentation on IP level will take 126 place. 128 The primary goal of this solution is to allow IKEv2 to operate in 129 environments, that may block IP fragments. This goal does not assume 130 that IP fragmentation should be avoided completely, but only in those 131 cases when it interferes with IKE operations. However this solution 132 could be used to avoid IP fragmentation in all situations where 133 fragmentation within IKE is applicable, as it is recommended in 134 Section 3.2 of [RFC5405]. Avoiding IP fragmentation would be 135 beneficial for IKEv2 in general. Security Considerations Section of 136 [IKEv2] mentions exhausting of the IP reassembly buffers as one of 137 the possible attacks on the protocol. In the paper [DOSUDPPROT] 138 several aspects of attacks on IKE using IP fragmentation are 139 discussed, and one of the defenses it proposes is to perform 140 fragmentation within IKE similarly to the solution described in this 141 document. 143 1.3. Conventions Used in This Document 145 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 146 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 147 document are to be interpreted as described in [RFC2119]. 149 2. Protocol details 151 2.1. Overview 153 The idea of the protocol is to split large IKEv2 message into a set 154 of smaller ones, called IKE Fragment Messages. Fragmentation takes 155 place before the original message is encrypted and authenticated, so 156 that each IKE Fragment Message receives individual protection. On 157 the receiving side IKE Fragment Messages are collected, verified, 158 decrypted and merged together to get the original message before 159 encryption. See Appendix A for design rationale. 161 2.2. Limitations 163 Since IKE Fragment Messages are cryptographically protected, SK_a and 164 SK_e must already be calculated. In general, it means that original 165 message can be fragmented if and only if it contains Encrypted 166 Payload. 168 This implies that messages of the IKE_SA_INIT Exchange cannot be 169 fragmented. In most cases this is not a problem because IKE_SA_INIT 170 messages are usually small enough to avoid IP fragmentation. But in 171 some cases (advertising a badly structured long list of algorithms, 172 using large MODP Groups, etc.) these messages may become fairly large 173 and get fragmented by IP level. In this case the described solution 174 will not help. 176 Among existing IKEv2 extensions, messages of IKE_SESSION_RESUME 177 Exchange, defined in [RFC5723], cannot be fragmented either. See 178 Section 3 for details. 180 Another limitation is that the minimal size of IP Datagram bearing 181 IKE Fragment Message is about 100 bytes depending on the algorithms 182 employed. According to [RFC0791] the minimum IPv4 Datagram size that 183 is guaranteed not to be further fragmented is 68 bytes. So, even the 184 smallest IKE Fragment Messages could be fragmented by IP level in 185 some circumstances. But such extremely small PMTU sizes are very 186 rare in real life. 188 2.3. Negotiation 190 Initiator indicates its support for the IKE Fragmentation and 191 willingness to use it by including Notification Payload of type 192 IKEV2_FRAGMENTATION_SUPPORTED in IKE_SA_INIT request message. If 193 Responder also supports this extension and is willing to use it, it 194 includes this notification in response message. 196 Initiator Responder 197 ----------- ----------- 198 HDR, SAi1, KEi, Ni, 199 [N(IKEV2_FRAGMENTATION_SUPPORTED)] --> 201 <-- HDR, SAr1, KEr, Nr, [CERTREQ], 202 [N(IKEV2_FRAGMENTATION_SUPPORTED)] 204 The Notify payload is formatted as follows: 206 1 2 3 207 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 208 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 209 | Next Payload |C| RESERVED | Payload Length | 210 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 211 |Protocol ID(=0)| SPI Size (=0) | Notify Message Type | 212 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 214 o Protocol ID (1 octet) MUST be 0. 216 o SPI Size (1 octet) MUST be 0, meaning no SPI is present. 218 o Notify Message Type (2 octets) - MUST be xxxxx, the value assigned 219 for IKEV2_FRAGMENTATION_SUPPORTED notification. 221 This Notification contains no data. 223 2.4. Using IKE Fragmentation 225 The IKE Fragmentation MUST NOT be used unless both peers have 226 indicated their support for it. After that it is up to the the 227 Initiator of each exchange to decide whether to use it or not. The 228 Responder usually replies in the same form as the request message, 229 but other considerations might override this. 231 The Initiator may employ various policies regarding the use of IKE 232 Fragmentation. It may first try to send an unfragmented message and 233 resend it as fragmented only if no complete response is received even 234 after several retransmissions. Alternatively, it may choose always 235 to send fragmented messages (but see Section 3), or it may fragment 236 only large messages and messages that are expected to result in large 237 responses. 239 The following general guidelines apply: 241 o If either peer has information that a part of the transaction is 242 likely to be fragmented at the IP layer, causing interference with 243 the IKE exchange, that peer SHOULD use IKE Fragmentation. This 244 information may be passed from a lower layer, provided by 245 configuration, or derived through heuristics. Examples of 246 heuristics are the lack of a complete response after several 247 retransmissions for the Initiator, and receiving repeated 248 retransmissions of the request for the Responder. 250 o If either peer knows that IKE Fragmentation has been used in a 251 previous exchange in the context of the current IKE SA, that peer 252 SHOULD continue the use of IKE Fragmentation for the messages that 253 are larger than the current fragmentation threshold (see 254 Section 2.5.1). 256 o IKE Fragmentation SHOULD NOT be used in cases where IP-layer 257 fragmentation of both the request and response messages is 258 unlikely. For example, there is no point in fragmenting Liveness 259 Check messages. 261 o If none of the above apply, the Responder SHOULD respond in the 262 same form (fragmented or not) as the request message it is 263 responding to. Note that the other guidelines might override this 264 because of information or heuristics available to the Responder. 266 In most cases IKE Fragmentation will be used in the IKE_AUTH 267 Exchange, especially if certificates are employed. 269 2.5. Fragmenting Message 271 Message to be fragmented MUST contain Encrypted Payload. For the 272 purpose of IKE Fragment Messages construction original (unencrypted) 273 content of Encrypted Payload is split into chunks. The content is 274 treated as a binary blob and is split regardless of inner Payloads 275 boundaries. Each of resulting chunks is treated as an original 276 content of Encrypted Fragment Payload and is then encrypted and 277 authenticated. Thus, the Encrypted Fragment Payload contains a chunk 278 of the original content of Encrypted Payload in encrypted form. The 279 cryptographic processing of Encrypted Fragment Payload is identical 280 to Section 3.14 of [IKEv2], as well as documents updating it for 281 particular algorithms or modes, such as [RFC5282]. 283 The Encrypted Fragment Payload, similarly to the Encrypted Payload, 284 if present in a message, MUST be the last payload in the message. 286 The Encrypted Fragment Payload is denoted SKF{...} and its payload 287 type is XXX (TBA by IANA). This payload is also called the 288 "Encrypted and Authenticated Fragment" payload. 290 1 2 3 291 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 292 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 293 | Next Payload |C| RESERVED | Payload Length | 294 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 295 | Fragment Number | Total Fragments | 296 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 297 | Initialization Vector | 298 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 299 ~ Encrypted content ~ 300 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 301 | | Padding (0-255 octets) | 302 +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ 303 | | Pad Length | 304 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 305 ~ Integrity Checksum Data ~ 306 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 308 Encrypted Fragment Payload 310 o Next Payload (1 octet) - in the very first fragment (with Fragment 311 Number equal to 1) this field MUST be set to Payload Type of the 312 first inner Payload (similarly to the Encrypted Payload). In the 313 rest fragments MUST be set to zero. 315 o Fragment Number (2 octets) - current fragment number starting from 316 1. This field MUST be less than or equal to the next field, Total 317 Fragments. This field MUST NOT be zero. 319 o Total Fragments (2 octets) - number of fragments original message 320 was divided into. This field MUST NOT be zero. With PMTU 321 discovery this field plays additional role. See Section 2.5.2 for 322 details. 324 The other fields are identical to those specified in Section 3.14 of 325 [IKEv2]. 327 When prepending IKE Header to the IKE Fragment Messages it MUST be 328 taken intact from the original message, except for the Length and the 329 Next Payload fields. The Length field is adjusted to reflect the 330 length of the constructed message and the Next Payload field is set 331 to the payload type of the first Payload in constructed message (in 332 most cases it will be Encrypted Fragment Payload). After prepending 333 IKE Header and all Payloads that possibly precede Encrypted Payload 334 in original message (if any, see Section 2.5.3), the resulting 335 messages are sent to the peer. 337 Below is an example of fragmenting a message. 339 HDR(MID=n), SK(NextPld=PLD1) {PLD1 ... PLDN} 341 Original Message 343 HDR(MID=n), SKF(NextPld=PLD1, Frag#=1, TotalFrags=m) {...}, 344 HDR(MID=n), SKF(NextPld=0, Frag#=2, TotalFrags=m) {...}, 345 ... 346 HDR(MID=n), SKF(NextPld=0, Frag#=m, TotalFrags=m) {...} 348 IKE Fragment Messages 350 2.5.1. Selecting Fragment Size 352 When splitting content of Encrypted Payload into chunks sender SHOULD 353 choose their size so, that resulting IP Datagrams be smaller than 354 some fragmentation threshold. Implementation may calculate 355 fragmentation threshold using various sources of information. 357 If sender has information about PMTU size it SHOULD use it. The 358 Responder in the exchange may use maximum size of received IKE 359 Fragment Message IP Datagrams as threshold when constructing 360 fragmented response. Successful completion of previous exchanges 361 (including those exchanges, that cannot employ IKE Fragmentation, 362 e.g. IKE_SA_INIT) may be an indication, that fragmentation threshold 363 can be set to the size of the largest of already sent messages. 365 Otherwise for messages to be sent over IPv6 it is RECOMMENDED to use 366 value 1280 bytes as a maximum IP Datagram size ([RFC2460]). For 367 messages to be sent over IPv4 it is RECOMMENDED to use value 576 368 bytes as a maximum IP Datagram size. Presence of tunnels on the path 369 may reduce these values. Implementation may use other values if they 370 are appropriate in current environment. 372 According to [RFC0791] the minimum IPv4 datagram size that is 373 guaranteed not to be further fragmented is 68 bytes, but it is 374 generally impossible to use such small value for solution, described 375 in this document. Using 576 bytes is a compromise - the value is 376 large enough for the presented solution and small enough to avoid IP 377 fragmentation in most situations. Several other UDP-based protocol 378 assume the value 576 bytes as a safe low limit for IP datagrams size 379 (Syslog, DNS, etc.). 381 See Appendix B for correlation between IP Datagram size and Encrypted 382 Payload content size. 384 2.5.2. PMTU Discovery 386 The amount of traffic that IKE endpoint produces during lifetime of 387 IKE SA is fairly modest - usually it is below one hundred kBytes 388 within a period of several hours. Most of this traffic consists of 389 relatively short messages - usually below several hundred bytes. In 390 most cases the only time when IKE endpoints exchange messages of 391 several kBytes in size is IKE SA establishment and often each 392 endpoint sends exactly one such message. 394 For the reasons atriculated above implementing PMTU discovery in IKE 395 is OPTIONAL. It is believed that using the values recommended in 396 Section 2.5.1 as fragmentation threshold will be sufficient in most 397 cases. Using these values could lead to suboptimal fragmentation, 398 but it is acceptable given the amount of traffic IKE produces. 399 Implementation may support PMTU discovery if there are good reasons 400 to do it (for example if it is intended to be used in environments 401 where MTU size is possible to be less that values listed in 402 Section 2.5.1). 404 PMTU discovery in IKE follows recommendations given in Section 10.4 405 of [RFC4821] with the difference, induced by the specialties of IKE 406 listed above. The difference is that the PMTU search is performed 407 downward, while in [RFC4821] it is performed upward. The reason for 408 this change is that IKE usually sends large messages only when IKE SA 409 is being established and in many cases there is only one such 410 message. If the probing were performed upward this message would be 411 fragmented using the smallest allowable threshold, and usually all 412 other messages are small enough to avoid IP fragmentation, so there 413 would be little value to continue probing. 415 It is the Initiator of the exchange, who performs PMTU discovery. It 416 is done by probing several values of fragmentation threshold. 417 Implementation MUST be prepared to probe in every exchange that 418 utilizes IKE Fragmentation to deal with possible changes of path MTU 419 over time. While doing probes, it MUST start from larger values and 420 refragment original message using next smaller value of threshold if 421 it did not receive response in a reasonable time after several 422 retransmissions. The exact number of retransmissions and length of 423 timeouts are not covered in this specification because they do not 424 affect interoperability. However, the timeout interval is supposed 425 to be relatively short, so that unsuccessful probes would not delay 426 IKE operations too much. Performimg few retries within several 427 seconds for each probe seems appropriate, but different environments 428 may require different rules. When starting new probe node MUST reset 429 its retransmission timers so, that if it employs exponential back- 430 off, the timers will start over. After reaching the smallest allowed 431 value for fragmentation threshold implementation MUST continue 432 retransmitting until either exchange completes or times out using 433 timeout interval from Section 2.4 of [IKEv2]. 435 PMTU discovery in IKE is supposed to be coarse-grained, i.e. it is 436 expected, that node will try only few fragmentation thresholds, in 437 order to minimize delays caused by unsuccessful probes. If no 438 information about path MTU is known yet, endpoint may start probing 439 from link MTU size. In the following exchanges node should start 440 from the current value of fragmentation threshold. 442 If implementation is capable to receive ICMP error messages it may 443 additionally utilize classic PMTU discovery methods, described in 444 [RFC1191] and [RFC1981]. In particular, if the Initiator receives 445 Packet Too Big error in response to the probe, and it contains 446 smaller value, than current fragmentation threshold, then the 447 Initiator SHOULD stop retransmitting the probe and SHOULD select new 448 value for fragmentation threshold that is less than or equal to the 449 value from the ICMP message and meets the requirements listed below. 451 In case of PMTU discovery Total Fragments field is used to 452 distinguish between different sets of fragments, i.e. the sets that 453 were created by fragmenting original message using different 454 fragmentation thresholds. Since sender starts from larger fragments 455 and then make them smaller, the value in Total Fragments field 456 increases with each new probe. When selecting next smaller value for 457 fragmentation threshold, sender MUST ensure that the value in Total 458 Fragments field is really increased. This requirement should not be 459 a problem for the sender, because PMTU discovery in IKE is supposed 460 to be coarse-grained, so difference between previous and next 461 fragmentation thresholds should be significant anyway. The necessity 462 to distinguish between the sets is vital for receiver since receiving 463 valid fragment from newer set means that it have to start 464 reassembling over and not to mix fragments from different sets. 466 2.5.3. Fragmenting Messages containing unprotected Payloads 468 Currently there are no IKEv2 exchanges that define messages, 469 containing both unprotected payloads and payloads, protected by 470 Encrypted Payload. However IKEv2 does not prohibit such 471 construction. If some future IKEv2 extension defines such a message 472 and it needs to be fragmented, all unprotected payloads MUST be 473 placed in the first fragment (with Fragment Number field equal to 1), 474 along with Encrypted Fragment Payload, which MUST be present in every 475 IKE Fragment Message and be the last payload in it. 477 Below is an example of fragmenting message, containing both protected 478 and unprotected Payloads. 480 HDR(MID=n), PLD0, SK(NextPld=PLD1) {PLD1 ... PLDN} 482 Original Message 484 HDR(MID=n), PLD0, SKF(NextPld=PLD1, Frag#=1, TotalFrags=m) {...}, 485 HDR(MID=n), SKF(NextPld=0, Frag#=2, TotalFrags=m) {...}, 486 ... 487 HDR(MID=n), SKF(NextPld=0, Frag#=m, TotalFrags=m) {...} 489 IKE Fragment Messages 491 Note that the size of each IP Datagram bearing IKE Fragment Messages 492 should not exceed fragmentation threshold, including the first one, 493 that contains unprotected Payloads. This will reduce the size of 494 Encrypted Fragment Payload content in the first IKE Fragment Message 495 to accommodate all unprotected Payloads. In extreme case Encrypted 496 Fragment Payload will contain no data, but it still must be present 497 in the message, because only its presence allows receiver to 498 determine that sender have used IKE Fragmentation. 500 2.6. Receiving IKE Fragment Message 502 Receiver identifies IKE Fragment Message by the presence of Encrypted 503 Fragment Payload in it. In most cases it will be the first and the 504 only payload in the message, however this may not be true for some 505 hypothetical IKE exchanges (see Section 2.5.3) 507 Upon receiving IKE Fragment Message the following actions are 508 performed: 510 o Check message validity - in particular, check whether values of 511 Fragment Number and Total Fragments in Encrypted Fragment Payload 512 are valid. The following tests need to be performed. 514 * check that Fragment Number and Total Fragments fields are non- 515 zero 517 * check that Fragment Number field is less than or equal to Total 518 Fragments field 520 * if reassembling has already started, check that Total Fragments 521 field is equal to or greater than Total Fragments field in 522 fragments that have already been stored in the reassembling 523 queue 525 If any of this tests fails message MUST be silently discarded. 527 o Check, that this IKE Fragment Message is new for the receiver and 528 not a replay. If IKE Fragment message with the same Message ID, 529 same Fragment Number and same Total Fragments fields is already 530 present in the reassembling queue, this message is considered a 531 replay and MUST be silently discarded. 533 o Verify IKE Fragment Message authenticity by checking ICV in 534 Encrypted Fragment Payload. If ICV check fails message MUST be 535 silently discarded. 537 o If reassembling is not finished yet and Total Fragments field in 538 received fragment is greater than this field in those fragments, 539 that are in the reassembling queue, receiver MUST discard all 540 received fragments and start reassembling over with just received 541 IKE Fragment Message. 543 o Store message in the reassembling queue waiting for the rest of 544 fragments to arrive. 546 When all IKE Fragment Messages (as indicated in the Total Fragments 547 field) are received, decrypted content of all Encrypted Fragment 548 Payloads is merged together to form content of original Encrypted 549 Payload, and, therefore, along with IKE Header and unprotected 550 Payloads (if any), original message. Then it is processed as if it 551 was received, verified and decrypted as regular IKE message. 553 If receiver does not get all IKE fragments needed to reassemble 554 original Message within a timeout interval, it MUST discard all 555 received so far IKE Fragment Messages for the exchange. Next actions 556 depend on the role of receiver in the exchange. 558 o The Initiator acts as described in Section 2.1 of [IKEv2]. It 559 either retransmits the fragmented request Message or deems IKE SA 560 to have failed and deletes it. The number of retransmits and 561 length of timeouts for the Initiator are not covered in this 562 specification since they are assumed to be the same as in regular 563 IKEv2 exchange and are discussed in Section 2.4 of [IKEv2]. 565 o The Responder in this case acts as if no request message was 566 received. The reassembling timeout for Responder is RECOMMENDED 567 to be equal to the time interval that implementation waits before 568 completely giving up when acting as Initiator of exchange. 569 Section 2.4 of [IKEv2] gives recommendations for selecting this 570 interval. Implementation MAY use shorter timeout to conserve 571 memory. 573 2.6.1. Replay Detection and Retransmissions 575 According to [IKEv2] implementation must reject message with the same 576 Message ID as it has seen before (taking into consideration Response 577 bit). This logic has already been updated by [RFC6311], which 578 deliberately allows any number of messages with zero Message ID. 579 This document also updates this logic for the situations, when IKE 580 Fragmentation is in use. 582 If incomimg message contains Encrypted Fragment Payload, the values 583 of Fragment Number and Total Fragments fields MUST be used along with 584 Message ID to detect retransmissions and replays. 586 If Responder receives retransmitted fragment of request when it has 587 already processed that request and has sent back a response, that 588 event MUST only trigger retransmission of the response message 589 (fragmented or not) if Fragment Number field in received fragment is 590 set to 1 and MUST be ignored otherwise. 592 3. Interaction with other IKE extensions 594 IKE Fragmentation is compatible with most of IKE extensions, such as 595 IKE Session Resumption ([RFC5723]), Quick Crash Detection Method 596 ([RFC6290]) and so on. It neither affect their operation, nor is 597 affected by them. It is believed that IKE Fragmentation will also be 598 compatible with future IKE extensions, if they follow general 599 principles of formatting, sending and receiving IKE messages, 600 described in [IKEv2]. 602 When IKE Fragmentation is used with IKE Session Resumption 603 ([RFC5723]), messages of IKE_SESSION_RESUME Exchange cannot be 604 fragmented since they do not contain Encrypted Payload. These 605 messages may be large due to the ticket size. To avoid IP 606 Fragmentation in this situation it is recommended to use smaller 607 tickets, e.g. by utilizing "ticket by reference" approach instead of 608 "ticket by value". 610 One exception that requires a special care is Protocol Support for 611 High Availability of IKEv2/IPsec ([RFC6311]). Since it deliberately 612 allows any number of synchronization exchanges to have the same 613 Message ID, namely zero, standard IKEv2 replay detection logic, based 614 on checking Message ID is not applicable for such messages, and 615 receiver has to check message content to detect replays. When 616 implementing IKE Fragmentation along with [RFC6311], IKE Message ID 617 Synchronization messages MUST NOT be sent fragmented to simplify 618 receiver's task of detecting replays. Fortunately, these messages 619 are small and there is no point in fragmenting them anyway. 621 4. Transport Considerations 623 With IKE Fragmentation if any single IKE Fragment Message get lost, 624 receiver becomes unable to reassemble original Message. So, in 625 general, using IKE Fragmentation implies higher probability for the 626 Message not to be delivered to the peer. Although in most network 627 environments the difference will be insignificant, on some lossy 628 networks it may become noticeable. When using IKE Fragmentation 629 implementations MAY use longer timeouts and do more retransmits than 630 usual before considering peer dead. 632 Note that Fragment Messages are not individually acknowledged. The 633 response Fragment Messages are sent back all together only when all 634 fragments of request are received, the original request Message is 635 reassembled and successfully processed. 637 5. Security Considerations 639 Most of the security considerations for IKE Fragmentation are the 640 same as those for the base IKEv2 protocol described in [IKEv2]. This 641 extension introduces Encrypted Fragment Payload to protect content of 642 IKE Message Fragment. This allows receiver to individually check 643 authenticity of fragments, thus protecting peers from DoS attack. 645 Security Considerations Section of [IKEv2] mentions possible attack 646 on IKE by exhausting of the IP reassembly buffers. The mechanism, 647 described in this document, allows IKE to avoid IP fragmentation and 648 therefore increases its robustness to DoS attacks. 650 The following attack is possible with IKE Fragmentation. An attacker 651 can initiate IKE_SA_INIT Exchange, complete it, compute SK_a and SK_e 652 and then send a large, but still incomplete, set of IKE_AUTH 653 fragments. These fragments will pass the ICV check and will be 654 stored in reassembly buffers, but since the set is incomplete, the 655 reassembling will never succeed and eventually will time out. If the 656 set is large, this attack could potentially exhaust the receiver's 657 memory resources. 659 To mitigate the impact of this attack, it is RECOMMENDED that 660 receiver limits the number of fragments it stores in reassembling 661 queue so that the sum of the sizes of Encrypted Fragment Payload 662 contents (after decryption) for fragments that are already placed 663 into the reassembling queue be less than some value that is 664 reasonable for the implementation. If the peer sends so many 665 fragments, that the above condition is not met, the receiver can 666 consider this situation to be either attack or as broken sender 667 implementation. In either case, the receiver SHOULD drop the 668 connection and discard all the received fragments. 670 This value can be predefined, can be a configurable option, or can be 671 calculated dynamically depending on receiver's memory load. In any 672 case, the value SHOULD NOT exceed 64 Kbytes (the maximum size of UDP 673 datagram) because any IKE message before fragmentation must be 674 shorter than that. 676 6. IANA Considerations 678 This document defines new Payload in the "IKEv2 Payload Types" 679 registry: 681 Encrypted and Authenticated Fragment SKF 683 This document also defines new Notify Message Types in the "Notify 684 Message Types - Status Types" registry: 686 IKEV2_FRAGMENTATION_SUPPORTED 688 7. Acknowledgements 690 The author would like to thank Tero Kivinen, Yoav Nir, Paul Wouters, 691 Yaron Sheffer, Joe Touch, Derek Atkins, Ole Troan and others for 692 their reviews and valuable comments. Thanks to Ron Bonica for 693 contributing text to the Introduction Section. Thanks to Paul 694 Hoffman and Barry Leiba for improving text clarity. 696 8. References 698 8.1. Normative References 700 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 701 Requirement Levels", BCP 14, RFC 2119, March 1997. 703 [IKEv2] Kaufman, C., Hoffman, P., Nir, Y., Eronen, P., and T. 704 Kivinen, "Internet Key Exchange Protocol Version 2 705 (IKEv2)", draft-kivinen-ipsecme-ikev2-rfc5996bis-03 (work 706 in progress), April 2014. 708 [RFC6311] Singh, R., Kalyani, G., Nir, Y., Sheffer, Y., and D. 709 Zhang, "Protocol Support for High Availability of IKEv2/ 710 IPsec", RFC 6311, July 2011. 712 8.2. Informative References 714 [RFC0791] Postel, J., "Internet Protocol", STD 5, RFC 791, 715 September 1981. 717 [RFC1191] Mogul, J. and S. Deering, "Path MTU discovery", RFC 1191, 718 November 1990. 720 [RFC1981] McCann, J., Deering, S., and J. Mogul, "Path MTU Discovery 721 for IP version 6", RFC 1981, August 1996. 723 [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6 724 (IPv6) Specification", RFC 2460, December 1998. 726 [RFC4787] Audet, F. and C. Jennings, "Network Address Translation 727 (NAT) Behavioral Requirements for Unicast UDP", BCP 127, 728 RFC 4787, January 2007. 730 [RFC4821] Mathis, M. and J. Heffner, "Packetization Layer Path MTU 731 Discovery", RFC 4821, March 2007. 733 [RFC5282] Black, D. and D. McGrew, "Using Authenticated Encryption 734 Algorithms with the Encrypted Payload of the Internet Key 735 Exchange version 2 (IKEv2) Protocol", RFC 5282, 736 August 2008. 738 [RFC5405] Eggert, L. and G. Fairhurst, "Unicast UDP Usage Guidelines 739 for Application Designers", BCP 145, RFC 5405, 740 November 2008. 742 [RFC5723] Sheffer, Y. and H. Tschofenig, "Internet Key Exchange 743 Protocol Version 2 (IKEv2) Session Resumption", RFC 5723, 744 January 2010. 746 [RFC6290] Nir, Y., Wierbowski, D., Detienne, F., and P. Sethi, "A 747 Quick Crash Detection Method for the Internet Key Exchange 748 Protocol (IKE)", RFC 6290, June 2011. 750 [RFC6888] Perreault, S., Yamagata, I., Miyakawa, S., Nakagawa, A., 751 and H. Ashida, "Common Requirements for Carrier-Grade NATs 752 (CGNs)", BCP 127, RFC 6888, April 2013. 754 [FRAGDROP] 755 Jaeggli, J., Colitti, L., Kumari, W., Vyncke, E., Kaeo, 756 M., and T. Taylor, "Why Operators Filter Fragments and 757 What It Implies", draft-taylor-v6ops-fragdrop-02 (work in 758 progress), December 2013. 760 [BLACKHOLES] 761 De Boer, M. and J. Bosma, "Discovering Path MTU black 762 holes on the Internet using RIPE Atlas", July 2012, . 766 [DOSUDPPROT] 767 Kaufman, C., Perlman, R., and B. Sommerfeld, "DoS 768 protection for UDP-based protocols", ACM Conference on 769 Computer and Communications Security, October 2003. 771 Appendix A. Design rationale 773 The simplest approach to the IKE fragmentation would have been to 774 fragment message that is fully formed and ready to be sent. But if 775 message got fragmented after being encrypted and authenticated, this 776 could open a possibility for a simple Denial of Service attack. The 777 attacker could infrequently emit forged but valid looking fragments 778 into the network, and some of these fragments would be fetched by 779 receiver into the reassembling queue. Receiver could not distinguish 780 forged fragments from valid ones and could only determine that some 781 of received fragments were forged when the whole message got 782 reassembled and check for its authenticity failed. 784 To prevent this kind of attack and also to reduce vulnerability to 785 some other kinds of DoS attacks it was decided to make fragmentation 786 before applying cryptographic protection to the message. In this 787 case each Fragment Message becomes individually encrypted and 788 authenticated, that allows receiver to determine forged fragments and 789 not to store them in the reassembling queue. 791 Appendix B. Correlation between IP Datagram size and Encrypted Payload 792 content size 794 For IPv4 Encrypted Payload content size is less than IP Datagram size 795 by the sum of the following values: 797 o IPv4 header size (typically 20 bytes, up to 60 if IP options are 798 present) 800 o UDP header size (8 bytes) 802 o non-ESP marker size (4 bytes if present) 804 o IKE Header size (28 bytes) 806 o Encrypted Payload header size (4 bytes) 808 o IV size (varying) 810 o padding and its size (at least 1 byte) 812 o ICV size (varying) 814 The sum may be estimated as 61..105 bytes + IV + ICV + padding. 816 For IPv6 Encrypted Payload content size is less than IP Datagram size 817 by the sum of the following values: 819 o IPv6 header size (40 bytes) 821 o IPv6 extension headers (optional, size varies) 823 o UDP header size (8 bytes) 825 o non-ESP marker size (4 bytes if present) 827 o IKE Header size (28 bytes) 829 o Encrypted Payload header size (4 bytes) 831 o IV size (varying) 833 o padding and its size (at least 1 byte) 835 o ICV size (varying) 837 If no extension header is present, the sum may be estimated as 81..85 838 bytes + IV + ICV + padding. If extension headers are present, the 839 payload content size is further reduced by the sum of the size of the 840 extension headers. The length of each extension header can be 841 calculated as 8 * (Hdr Ext Len) bytes except for the fragment header 842 which is always 8 bytes in length. 844 Author's Address 846 Valery Smyslov 847 ELVIS-PLUS 848 PO Box 81 849 Moscow (Zelenograd) 124460 850 Russian Federation 852 Phone: +7 495 276 0211 853 Email: svan@elvis.ru