idnits 2.17.1 draft-ietf-karp-bfd-analysis-07.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 (January 20, 2015) is 3382 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- No issues found here. Summary: 0 errors (**), 0 flaws (~~), 1 warning (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group M. Bhatia 3 Internet-Draft Ionos Networks 4 Intended status: Informational D. Zhang 5 Expires: July 24, 2015 Huawei Technologies co., LTD. 6 M. Jethanandani 7 Ciena Corporation 8 January 20, 2015 10 Analysis of Bidirectional Forwarding Detection (BFD) Security According 11 to KARP Design Guide 12 draft-ietf-karp-bfd-analysis-07 14 Abstract 16 This document analyzes the Bidirectional Forwarding Detection 17 protocol (BFD) according to the guidelines set forth in section 4.2 18 of KARP Design Guidelines RFC6518. 20 Status of This Memo 22 This Internet-Draft is submitted in full conformance with the 23 provisions of BCP 78 and BCP 79. 25 Internet-Drafts are working documents of the Internet Engineering 26 Task Force (IETF). Note that other groups may also distribute 27 working documents as Internet-Drafts. The list of current Internet- 28 Drafts is at http://datatracker.ietf.org/drafts/current/. 30 Internet-Drafts are draft documents valid for a maximum of six months 31 and may be updated, replaced, or obsoleted by other documents at any 32 time. It is inappropriate to use Internet-Drafts as reference 33 material or to cite them other than as "work in progress." 35 This Internet-Draft will expire on July 24, 2015. 37 Copyright Notice 39 Copyright (c) 2015 IETF Trust and the persons identified as the 40 document authors. All rights reserved. 42 This document is subject to BCP 78 and the IETF Trust's Legal 43 Provisions Relating to IETF Documents 44 (http://trustee.ietf.org/license-info) in effect on the date of 45 publication of this document. Please review these documents 46 carefully, as they describe your rights and restrictions with respect 47 to this document. Code Components extracted from this document must 48 include Simplified BSD License text as described in Section 4.e of 49 the Trust Legal Provisions and are provided without warranty as 50 described in the Simplified BSD License. 52 1. Introduction 54 This document performs a gap analysis of the current state of 55 Bidirectional Forwarding Detection [RFC5880] according to the 56 requirements of KARP Design Guidelines [RFC6518]. Previously, the 57 OPSEC working group has provided an analysis of cryptographic issues 58 with BFD in Issues with Existing Cryptographic Protection Methods for 59 Routing Protocols [RFC6039]. 61 The existing BFD specifications provide a basic security solution. 62 Key ID is provided so that the key used in securing a packet can be 63 changed on demand. Two cryptographic algorithms (MD5 and SHA-1) are 64 supported for integrity protection of the control packets; the 65 algorithms are both demonstrated to be subject to collision attacks. 66 Routing protocols like RIPv2 Cryptographic Authentication [RFC4822], 67 IS-IS Generic Cryptographic Authentication [RFC5310] and OSPFv2 HMAC- 68 SHA Cryptographic Authentication [RFC5709] have started to use BFD 69 for liveliness check. Moving the routing protocols to a stronger 70 algorithm while using weaker algorithm for BFD would allow the 71 attacker to bring down BFD in order to bring down the routing 72 protocol. BFD therefore needs to match the routing protocols in its 73 strength of algorithm. 75 While BFD uses a non-decreasing per-packet sequence number to protect 76 itself from intra-connection replay attacks, it still leaves the 77 protocol vulnerable to the inter-session replay attacks. 79 2. Requirements to Meet 81 There are several requirements described in section 3 of The Threat 82 Analysis and Requirements for Cryptographic Authentication of Routing 83 Protocols' Transports [RFC6862] that BFD as defined in BFD [RFC5880] 84 does not currently meet: 86 Replay Protection: BFD provides an incomplete intra-session and no 87 inter-session replay attack protection; this creates significant 88 denial-of-service opportunities. 90 Strong Algorithms: the cryptographic algorithms adopted for 91 message authentication in BFD are MD5 or SHA-1 based. However, 92 both algorithms are known to be vulnerable to collision attacks. 93 BFD Generic Cryptographic Authentication 94 [I-D.ietf-bfd-generic-crypto-auth] and Authenticating BFD using 95 HMAC-SHA-2 procedures [I-D.ietf-bfd-hmac-sha] together propose a 96 solution to support HMAC with the SHA-2 family of hash functions 97 for BFD. 99 DoS Attacks: BFD packets can be sent at millisecond intervals (the 100 protocol uses timers at microsecond intervals). When malicious 101 packets are sent at short intervals, with the authentication bit 102 set, it can cause a DoS attack. There is currently no known 103 method to address this issue and is one of the reasons BFD 104 authentication is still not deployed in the field. 106 The remainder of this document explains the details of how these 107 requirements fail to be met and proposes mechanisms for addressing 108 them. 110 3. Current State of Security Methods 112 BFD [RFC5880] describes five authentication mechanisms for the 113 integrity protection of BFD control packets: Simple Password, Keyed 114 MD5 The MD5 Message-Digest Algorithm [RFC1321], Meticulous Keyed MD5, 115 Keyed SHA-1 and Meticulous SHA-1. In the simple password mechanism, 116 every control packet is associated with a password transported in 117 plain text; attacks eavesdropping the network traffic can easily 118 learn the password and compromise the security of the corresponding 119 BFD session. In the Keyed MD5 and the Meticulous Keyed MD5 120 mechanisms, BFD nodes use share secret keys to generate keyed MD5 121 digests for control packets. Similarly, in the Keyed SHA-1 and the 122 Meticulous Keyed SHA-1 mechanisms, BFD nodes use shared secret keys 123 to generate keyed SHA-1 digests for control packets. Note that in 124 the keyed authentication mechanisms, every BFD control packet is 125 associated with a non-decreasing 32-bit sequence number to resist 126 replay attacks. In the Keyed MD5 and the Keyed SHA-1 mechanisms, the 127 sequence member is only required to increase occasionally. However, 128 in the Meticulous Keyed MD5 and the Meticulous Keyed SHA-1 129 mechanisms, the sequence member is required to increase with each 130 successive packet. 132 Additionally, limited key updating functionality is provided. There 133 is a Key ID in every authenticated BFD control packet, indicating the 134 key used to hash the packet. However, there is no mechanism 135 described to provide a smooth key rollover that the BFD routers can 136 use when moving from one key to the other. 138 The BFD session timers are defined with the granularity of 139 microseconds, and it is common in practice to send BFD packets at 140 millisecond intervals. Since the cryptographic sequence number space 141 is only 32 bits, a sequence number used in a BFD session may reach 142 its maximum value and roll over within limited period. For instance, 143 if a sequence number is increased by one every 3.3 millisecond, then 144 it will reach its maximum value in less than 24 weeks. This can 145 result in potential inter-session replay attacks especially when BFD 146 uses the non-meticulous authentication modes. 148 Note that when using authentication mechanisms, BFD drops all packets 149 that fall outside the limited range (3* Detection time multiplier). 150 Therefore, when meticulous authentication modes are used, a replayed 151 BFD packet will be rejected if it cannot fit into a relatively short 152 window (3 times the detect interval of the session). This introduces 153 some difficulties for replaying packets. However, in a non- 154 meticulous authentication mode, such windows can be large as sequence 155 numbers are only increased occasionally, thus making it easier to 156 perform replay attacks . 158 In a BFD session, each node needs to select a 32-bit discriminator to 159 identify itself. Therefore, a BFD session is identified by two 160 discriminators. If a node will randomly select a new discriminator 161 for a new session and uses authentication mechanism to secure the 162 control packets, inter-session replay attacks can be mitigated to 163 some extent. However, in existing BFD demultiplexing mechanisms, the 164 discriminators used in a new BFD session may be predictable. In some 165 deployment scenarios, the discriminators of BFD routers may be 166 decided by the destination and source addresses. So, if the sequence 167 number of a BFD router rolls over for some reason (e.g., reboot), the 168 discriminators used to identify the new session will be identical to 169 the ones used in the previous session. This makes performing a reply 170 attack relatively simple. 172 BFD allows a mode called the echo mode. Echo packets are not defined 173 in the BFD specification, though they can keep the BFD session up. 174 The format of the echo packet is local to the sending side and there 175 are no guidelines on the properties of these packets beyond the 176 choice of the source and destination addresses. While the BFD 177 specification recommends applying security mechanisms to prevent 178 spoofing of these packets, there are no guidelines on what type of 179 mechanisms are appropriate. 181 4. Impacts of BFD Replays 183 As discussed, BFD cannot meet the requirements of inter-session or 184 intra-session replay protection. This section discusses the impacts 185 of BFD replays. 187 When cryptographic authentication mechanisms are adopted for BFD, a 188 non-decreasing 32-bit long sequence number is used. In the Keyed MD5 189 and the Keyed SHA-1 mechanisms, the sequence member is not required 190 to increase for every packet. Therefore an attacker can keep 191 replaying the packets with the latest sequence number until the 192 sequence number is updated. This issue is eliminated in the 193 Meticulous Keyed MD5 and the Meticulous Keyed SHA-1 mechanisms. 194 However, note that a sequence number may reach its maximum and be 195 rolled over in a session. In this case, without the support from a 196 automatic key management mechanism, the BFD session will be 197 vulnerable to replay attacks performed by sending the packets before 198 the roll over of the sequence number. For instance, an attacker can 199 replay a packet with a sequence number which is larger than the 200 current one. If the replayed packet is accepted, the victim will 201 reject the legal packets whose sequence members are less than the one 202 in the replayed packet. Therefore, the attacker can get a good 203 chance to bring down the BFD session. This kind of attack assumes 204 that attacker has access to the link when the BFD session is on a 205 point to point link, or can inject packets for a BFD session with 206 multiple hops. 208 Additionally, the BFD specification allows for the change of 209 authentication state based on the state of a received packet. For 210 instance, according to BFD [RFC5880], if the state of a accepted 211 packet is down, the receiver of the packet needs to transfer its 212 state to down as well. Therefore, an carefully selected replayed 213 packet can cause a serious denial-of-service attack. 215 BFD does not provide any solution to deal with inter-session replay 216 attacks. If two subsequent BFD sessions adopt an identical 217 discriminator pair and use the same cryptographic key to secure the 218 control packets, it is intuitive to use a malicious authenticated 219 packet (stored from the past session) to perform inter-connection 220 replay attacks. 222 Any security issues in the BFD echo mode will directly affect the BFD 223 protocol and session states, and hence the network stability. For 224 instance, any replay attacks would be indistinguishable from normal 225 forwarding of the tested router. An attack would still cause a 226 faulty link to be believed to be up, but there is little that can be 227 done about it. However, if the echo packets are guessable, it may be 228 possible to spoof from an external source and cause BFD to believe 229 that a one-way link is really bidirectional. As a result, it is 230 important that the echo packets contain random material that is also 231 checked upon reception. 233 5. Impact of New Authentication Requirements 235 BFD can be run in software or hardware. Hardware implementations run 236 BFD at a much smaller timeout, typically in the order of few 237 milliseconds. For instance with a timeout of 3.3 milliseconds, a BFD 238 session is required to send or receive 3 packets every 10 239 milliseconds. Software implementations typically run with a timeout 240 in hundreds of milliseconds. 242 Additionally, it is not common to find hardware support for computing 243 the authentication data for the BFD session in hardware or software. 244 In the keyed MD5 and Keyed SHA-1 implementation where the sequence 245 number does not increase with every packet, software can be used to 246 compute the authentication data. This is true if the time between 247 increasing sequence number is long enough to compute the data in 248 software. The ability to compute the hash in software is difficult 249 with Meticulous Keyed MD5 and Meticulous Keyed SHA-1 if the time 250 interval between transmits or between receives is small. The 251 computation problem becomes worse if hundred or thousands of sessions 252 require the hash to be recomputed every few milliseconds. 254 Smaller and cheaper boxes that have to support a few hundred BFD 255 sessions are boxes that also use a slower CPU. The CPU is used for 256 running the entire control plane software in addition to supporting 257 the BFD sessions. As a general rule, no more than 40-45% of the CPU 258 can be dedicated towards supporting BFD. Adding computation of the 259 hash for every BFD session, can easily cause the CPU to exceed the 260 40-45% limit even with a few tens of sessions. On higher end boxes 261 with faster and more CPU cores, the expectation is that the number of 262 sessions that need to be supported are in the thousands, but the 263 number of BFD sessions with authentication that CPU can support is 264 still in the hundreds. 266 Implementors should assess the impact of authenticating BFD sessions 267 on their platform. 269 6. Considerations for improvement 271 This section suggests changes that can be adopted to improve the 272 protection of BFD. 274 The security risks brought by SHA-1 and MD5 have been well 275 understood. However, when using stronger digest algorithm, e.g., 276 SHA-2, the imposed computing overhead will seriously affect the 277 performance of BFD implementation. In order to make the trade-off 278 between the strong algorithm requirement and the imposed overhead, 279 Galois Message Authentication Code (GMAC) can be a candidate option. 280 This algorithm is relatively effective and has been supported by 281 IPsec for data origin authentication. More detailed information can 282 be found in The Use of GMAC in IPsec ESP and AH [RFC4543]. 284 7. IANA Considerations 286 This document makes no request of IANA. 288 Note to RFC Editor: this section may be removed on publication as an 289 RFC. 291 8. Security Considerations 293 This document discusses vulnerabilities in the existing BFD protocol 294 and suggests possible mitigations. 296 In analyzing the improvements for BFD the ability to repel a replay 297 attack is discussed. For example, increasing the sequence number to 298 a 64bit value makes the wrap around time much longer and a replay 299 attack can be easily prevented. 301 Mindful of the impact that stronger algorithms can have on the 302 performance of BFD, the document suggests GMAC as a possible 303 candidate for MAC function. 305 9. Acknowledgements 307 We would like to thank Alexander Vainshtein for his comments on this 308 document. 310 10. References 312 10.1. Normative References 314 [RFC1321] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, 315 April 1992. 317 [RFC5880] Katz, D. and D. Ward, "Bidirectional Forwarding Detection 318 (BFD)", RFC 5880, June 2010. 320 [RFC6039] Manral, V., Bhatia, M., Jaeggli, J., and R. White, "Issues 321 with Existing Cryptographic Protection Methods for Routing 322 Protocols", RFC 6039, October 2010. 324 10.2. Informative References 326 [I-D.ietf-bfd-generic-crypto-auth] 327 Bhatia, M., Manral, V., Zhang, D., and M. Jethanandani, 328 "BFD Generic Cryptographic Authentication", draft-ietf- 329 bfd-generic-crypto-auth-06 (work in progress), April 2014. 331 [I-D.ietf-bfd-hmac-sha] 332 Zhang, D., Bhatia, M., Manral, V., and M. Jethanandani, 333 "Authenticating BFD using HMAC-SHA-2 procedures", draft- 334 ietf-bfd-hmac-sha-05 (work in progress), July 2014. 336 [RFC4543] McGrew, D. and J. Viega, "The Use of Galois Message 337 Authentication Code (GMAC) in IPsec ESP and AH", RFC 4543, 338 May 2006. 340 [RFC4822] Atkinson, R. and M. Fanto, "RIPv2 Cryptographic 341 Authentication", RFC 4822, February 2007. 343 [RFC5310] Bhatia, M., Manral, V., Li, T., Atkinson, R., White, R., 344 and M. Fanto, "IS-IS Generic Cryptographic 345 Authentication", RFC 5310, February 2009. 347 [RFC5709] Bhatia, M., Manral, V., Fanto, M., White, R., Barnes, M., 348 Li, T., and R. Atkinson, "OSPFv2 HMAC-SHA Cryptographic 349 Authentication", RFC 5709, October 2009. 351 [RFC6518] Lebovitz, G. and M. Bhatia, "Keying and Authentication for 352 Routing Protocols (KARP) Design Guidelines", RFC 6518, 353 February 2012. 355 [RFC6862] Lebovitz, G., Bhatia, M., and B. Weis, "Keying and 356 Authentication for Routing Protocols (KARP) Overview, 357 Threats, and Requirements", RFC 6862, March 2013. 359 Authors' Addresses 361 Manav Bhatia 362 Ionos Networks 363 Bangalore 364 India 366 Email: manav@ionosnetworks.com 368 Dacheng Zhang 369 Huawei Technologies co., LTD. 370 Beijing 371 China 373 Email: zhangdacheng@huawei.com 374 Mahesh Jethanandani 375 Ciena Corporation 376 3939 North 1st Street 377 San Jose, CA 95134 378 USA 380 Phone: 408.904.2160 381 Fax: 408.436.5582 382 Email: mjethanandani@gmail.com