idnits 2.17.1 draft-ietf-idr-error-handling-19.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 RFC4360, but the abstract doesn't seem to mention this, which it should. -- The draft header indicates that this document updates RFC4760, but the abstract doesn't seem to mention this, which it should. -- The draft header indicates that this document updates RFC1997, but the abstract doesn't seem to mention this, which it should. -- The draft header indicates that this document updates RFC4456, but the abstract doesn't seem to mention this, which it should. -- The draft header indicates that this document updates RFC4271, but the abstract doesn't seem to mention this, which it should. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year (Using the creation date from RFC1997, updated by this document, for RFC5378 checks: 1996-04-10) -- The document seems to contain a disclaimer for pre-RFC5378 work, and may have content which was first submitted before 10 November 2008. The disclaimer is necessary when there are original authors that you have been unable to contact, or if some do not wish to grant the BCP78 rights to the IETF Trust. If you are able to get all authors (current and original) to grant those rights, you can and should remove the disclaimer; otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (April 21, 2015) is 3286 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: 'OPT-TRANS-BGP' is mentioned on line 659, but not defined -- Possible downref: Non-RFC (?) normative reference: ref. 'IANA-BGP-ATTRS' -- Obsolete informational reference (is this intentional?): RFC 5549 (Obsoleted by RFC 8950) Summary: 0 errors (**), 0 flaws (~~), 2 warnings (==), 9 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Internet Engineering Task Force E. Chen, Ed. 3 Internet-Draft Cisco Systems, Inc. 4 Updates: 1997, 4271, 4360, 4456, 4760, J. Scudder, Ed. 5 5543, 5701, 6368 (if approved) Juniper Networks 6 Intended status: Standards Track P. Mohapatra 7 Expires: October 23, 2015 Sproute Networks 8 K. Patel 9 Cisco Systems, Inc. 10 April 21, 2015 12 Revised Error Handling for BGP UPDATE Messages 13 draft-ietf-idr-error-handling-19 15 Abstract 17 According to the base BGP specification, a BGP speaker that receives 18 an UPDATE message containing a malformed attribute is required to 19 reset the session over which the offending attribute was received. 20 This behavior is undesirable, because a session reset would impact 21 not only routes with the offending attribute, but also other, valid 22 routes exchanged over the session. This document partially revises 23 the error handling for UPDATE messages and provides guidelines for 24 the authors of documents defining new attributes. Finally, it 25 revises the error handling procedures for a number of existing 26 attributes. 28 This document updates error handling for RFCs 1997, 4271, 4360, 4456, 29 4760, 5543, 5701 and 6368. 31 Status of This Memo 33 This Internet-Draft is submitted in full conformance with the 34 provisions of BCP 78 and BCP 79. 36 Internet-Drafts are working documents of the Internet Engineering 37 Task Force (IETF). Note that other groups may also distribute 38 working documents as Internet-Drafts. The list of current Internet- 39 Drafts is at http://datatracker.ietf.org/drafts/current/. 41 Internet-Drafts are draft documents valid for a maximum of six months 42 and may be updated, replaced, or obsoleted by other documents at any 43 time. It is inappropriate to use Internet-Drafts as reference 44 material or to cite them other than as "work in progress." 46 This Internet-Draft will expire on October 23, 2015. 48 Copyright Notice 50 Copyright (c) 2015 IETF Trust and the persons identified as the 51 document authors. All rights reserved. 53 This document is subject to BCP 78 and the IETF Trust's Legal 54 Provisions Relating to IETF Documents 55 (http://trustee.ietf.org/license-info) in effect on the date of 56 publication of this document. Please review these documents 57 carefully, as they describe your rights and restrictions with respect 58 to this document. Code Components extracted from this document must 59 include Simplified BSD License text as described in Section 4.e of 60 the Trust Legal Provisions and are provided without warranty as 61 described in the Simplified BSD License. 63 This document may contain material from IETF Documents or IETF 64 Contributions published or made publicly available before November 65 10, 2008. The person(s) controlling the copyright in some of this 66 material may not have granted the IETF Trust the right to allow 67 modifications of such material outside the IETF Standards Process. 68 Without obtaining an adequate license from the person(s) controlling 69 the copyright in such materials, this document may not be modified 70 outside the IETF Standards Process, and derivative works of it may 71 not be created outside the IETF Standards Process, except to format 72 it for publication as an RFC or to translate it into languages other 73 than English. 75 Table of Contents 77 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 78 1.1. Requirements Language . . . . . . . . . . . . . . . . . . 4 79 2. Error-Handling Approaches . . . . . . . . . . . . . . . . . . 4 80 3. Revision to BGP UPDATE Message Error Handling . . . . . . . . 4 81 4. Attribute Length Fields . . . . . . . . . . . . . . . . . . . 6 82 5. Parsing of Network Layer Reachability Information (NLRI) 83 Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 84 5.1. Encoding NLRI . . . . . . . . . . . . . . . . . . . . . . 7 85 5.2. Missing NLRI . . . . . . . . . . . . . . . . . . . . . . 7 86 5.3. Syntactic Correctness of NLRI Fields . . . . . . . . . . 8 87 5.4. Typed NLRI . . . . . . . . . . . . . . . . . . . . . . . 8 88 6. Operational Considerations . . . . . . . . . . . . . . . . . 9 89 7. Error Handling Procedures for Existing Attributes . . . . . . 10 90 7.1. ORIGIN . . . . . . . . . . . . . . . . . . . . . . . . . 10 91 7.2. AS_PATH . . . . . . . . . . . . . . . . . . . . . . . . . 10 92 7.3. NEXT_HOP . . . . . . . . . . . . . . . . . . . . . . . . 11 93 7.4. MULTI_EXIT_DISC . . . . . . . . . . . . . . . . . . . . . 11 94 7.5. LOCAL_PREF . . . . . . . . . . . . . . . . . . . . . . . 11 95 7.6. ATOMIC_AGGREGATE . . . . . . . . . . . . . . . . . . . . 11 96 7.7. AGGREGATOR . . . . . . . . . . . . . . . . . . . . . . . 12 97 7.8. Community . . . . . . . . . . . . . . . . . . . . . . . . 12 98 7.9. ORIGINATOR_ID . . . . . . . . . . . . . . . . . . . . . . 12 99 7.10. CLUSTER_LIST . . . . . . . . . . . . . . . . . . . . . . 12 100 7.11. MP_REACH_NLRI . . . . . . . . . . . . . . . . . . . . . . 13 101 7.12. MP_UNREACH_NLRI . . . . . . . . . . . . . . . . . . . . . 13 102 7.13. Traffic Engineering path attribute . . . . . . . . . . . 13 103 7.14. Extended Community . . . . . . . . . . . . . . . . . . . 13 104 7.15. IPv6 Address Specific BGP Extended Community Attribute . 14 105 7.16. ATTR_SET . . . . . . . . . . . . . . . . . . . . . . . . 14 106 8. Guidance for Authors of BGP Specifications . . . . . . . . . 14 107 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 15 108 10. Security Considerations . . . . . . . . . . . . . . . . . . . 15 109 11. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 16 110 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 16 111 12.1. Normative References . . . . . . . . . . . . . . . . . . 16 112 12.2. Informative References . . . . . . . . . . . . . . . . . 17 113 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 17 115 1. Introduction 117 According to the base BGP specification [RFC4271], a BGP speaker that 118 receives an UPDATE message containing a malformed attribute is 119 required to reset the session over which the offending attribute was 120 received. This behavior is undesirable, because a session reset 121 impacts not only routes with the offending attribute, but also other, 122 valid routes exchanged over the session. In the case of optional 123 transitive attributes, the behavior is especially troublesome and may 124 present a potential security vulnerability. This is because 125 attributes may have been propagated without being checked by 126 intermediate routers that don't recognize the attributes. In effect, 127 the attributes may have been tunneled; and when they reach a router 128 that recognizes and checks the attributes, the session that is reset 129 may not be associated with the router that is at fault. To make 130 matters worse, in such cases although the problematic attributes may 131 have originated with a single update transmitted by a single BGP 132 speaker, by the time they encounter a router that checks them they 133 may have been replicated many times, and thus may cause the reset of 134 many peering sessions. Thus the damage inflicted may be multiplied 135 manyfold. 137 The goal for revising the error handling for UPDATE messages is to 138 minimize the impact on routing by a malformed UPDATE message, while 139 maintaining protocol correctness to the extent possible. This can be 140 achieved largely by maintaining the established session and keeping 141 the valid routes exchanged, but removing the routes carried in the 142 malformed UPDATE from the routing system. 144 This document partially revises the error handling for UPDATE 145 messages, and provides guidelines for the authors of documents 146 defining new attributes. Finally, it revises the error handling 147 procedures for a number of existing attributes. Specifically, the 148 error handling procedures of [RFC1997], [RFC4271], [RFC4360], 149 [RFC4456], [RFC4760], [RFC5543], [RFC5701], and [RFC6368] are 150 revised. 152 1.1. Requirements Language 154 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 155 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 156 document are to be interpreted as described in RFC 2119 [RFC2119]. 158 2. Error-Handling Approaches 160 In this document we refer to four different approaches to handle 161 errors found in BGP path attributes. They are as follows (listed in 162 order, from the one with the "strongest" action to the one with the 163 "weakest" action): 165 o Session reset: This is the approach used throughout the base BGP 166 specification [RFC4271], where a NOTIFICATION is sent and the 167 session terminated. 169 o AFI/SAFI disable: [RFC4760] specifies a procedure for disabling a 170 particular AFI/SAFI (Address Family Identifier and Subsequent 171 Address Family Identifier). 173 o Treat-as-withdraw: In this approach, the UPDATE message containing 174 the path attribute in question MUST be treated as though all 175 contained routes had been withdrawn just as if they had been 176 listed in the WITHDRAWN ROUTES field (or in the MP_UNREACH_NLRI 177 attribute if appropriate) of the UPDATE message, thus causing them 178 to be removed from the Adj-RIB-In according to the procedures of 179 [RFC4271]. 181 o Attribute discard: In this approach the malformed attribute MUST 182 be discarded and the UPDATE message continues to be processed. 183 This approach MUST NOT be used except in the case of an attribute 184 that has no effect on route selection or installation. 186 3. Revision to BGP UPDATE Message Error Handling 188 This specification amends [RFC4271] Section 6.3 in a number of ways. 189 See also Section 7 for treatment of specific path attributes. 191 a. The first paragraph is revised as follows: 193 Old Text: 195 All errors detected while processing the UPDATE message 196 MUST be indicated by sending the NOTIFICATION message with 197 the Error Code UPDATE Message Error. The error subcode 198 elaborates on the specific nature of the error. 200 New Text: 202 An error detected while processing the UPDATE message for 203 which a session reset is specified MUST be indicated by 204 sending the NOTIFICATION message with the Error Code UPDATE 205 Message Error. The error subcode elaborates on the 206 specific nature of the error. 208 b. Error handling for the following case remains unchanged: 210 If the Withdrawn Routes Length or Total Attribute Length is 211 too large (i.e., if Withdrawn Routes Length + Total 212 Attribute Length + 23 exceeds the message Length), then the 213 Error Subcode MUST be set to Malformed Attribute List. 215 c. Attribute Flag error handling is revised as follows: 217 Old Text: 219 If any recognized attribute has Attribute Flags that 220 conflict with the Attribute Type Code, then the Error 221 Subcode MUST be set to Attribute Flags Error. The Data 222 field MUST contain the erroneous attribute (type, length, 223 and value). 225 New Text: 227 If the value of either the Optional or Transitive bits in 228 the Attribute Flags is in conflict with their specified 229 values, then the attribute MUST be treated as malformed and 230 the treat-as-withdraw approach used, unless the 231 specification for the attribute mandates different handling 232 for incorrect Attribute Flags. 234 d. If any of the well-known mandatory attributes are not present in 235 an UPDATE message, then "treat-as-withdraw" MUST be used. (Note 236 that [RFC4760] reclassifies NEXT_HOP as what is effectively 237 discretionary.) 239 e. "Treat-as-withdraw" MUST be used for the cases that specify a 240 session reset and involve any of the attributes ORIGIN, AS_PATH, 241 NEXT_HOP, MULTI_EXIT_DISC, or LOCAL_PREF. 243 f. "Attribute discard" MUST be used for any of the cases that 244 specify a session reset and involve ATOMIC_AGGREGATE or 245 AGGREGATOR. 247 g. If the MP_REACH_NLRI attribute or the MP_UNREACH_NLRI [RFC4760] 248 attribute appears more than once in the UPDATE message, then a 249 NOTIFICATION message MUST be sent with the Error Subcode 250 "Malformed Attribute List". If any other attribute (whether 251 recognized or unrecognized) appears more than once in an UPDATE 252 message, then all the occurrences of the attribute other than the 253 first one SHALL be discarded and the UPDATE message continue to 254 be processed. 256 h. When multiple attribute errors exist in an UPDATE message, if the 257 same approach (either "session reset", "treat-as-withdraw" or 258 "attribute discard") is specified for the handling of these 259 malformed attributes, then the specified approach MUST be used. 260 Otherwise the approach with the strongest action MUST be used. 262 i. The Withdrawn Routes field MUST be checked for syntactic 263 correctness in the same manner as the NLRI (network layer 264 reachability information) field. This is discussed further 265 below, and in Section 5.3. 267 j. Finally, we observe that in order to use the approach of "treat- 268 as-withdraw", the entire NLRI field and/or the MP_REACH_NLRI and 269 MP_UNREACH_NLRI attributes need to be successfully parsed -- what 270 this entails is discussed in more detail in Section 5. If this 271 is not possible, the procedures of [RFC4271] and/or [RFC4760] 272 continue to apply, meaning that the "session reset" approach (or 273 the "AFI/SAFI disable" approach) MUST be followed. 275 4. Attribute Length Fields 277 There are two error cases in which the Total Attribute Length value 278 can be in conflict with the enclosed path attributes, which 279 themselves carry length values. In the "overrun" case, as the 280 enclosed path attributes are parsed, the length of the last 281 encountered path attribute would cause the Total Attribute Length to 282 be exceeded. In the "underrun" case, as the enclosed path attributes 283 are parsed, after the last successfully-parsed attribute, fewer than 284 three octets remain, or fewer than four octets, if the Attribute 285 Flags field has the Extended Length bit set -- that is, there remains 286 unconsumed data in the path attributes but yet insufficient data to 287 encode a single minimum-sized path attribute. In either of these 288 cases, an error condition exists and the treat-as-withdraw approach 289 MUST be used (unless some other, more severe error is encountered 290 dictating a stronger approach), and the Total Attribute Length MUST 291 be relied upon to enable the beginning of the NLRI field to be 292 located. 294 For all path attributes other than those specified as having an 295 attribute length that may be zero, it SHALL be considered a syntax 296 error for the attribute to have a length of zero. (Of the path 297 attributes considered in this specification, only AS_PATH and 298 ATOMIC_AGGREGATE may validly have an attribute length of zero.) 300 5. Parsing of Network Layer Reachability Information (NLRI) Fields 302 5.1. Encoding NLRI 304 To facilitate the determination of the NLRI field in an UPDATE with a 305 malformed attribute: 307 o The MP_REACH_NLRI or MP_UNREACH_NLRI attribute (if present) SHALL 308 be encoded as the very first path attribute in an UPDATE. 310 o An UPDATE message MUST NOT contain more than one of the following: 311 non-empty Withdrawn Routes field, non-empty Network Layer 312 Reachability Information field, MP_REACH_NLRI attribute, and 313 MP_UNREACH_NLRI attribute. 315 Since older BGP speakers may not implement these restrictions, an 316 implementation MUST still be prepared to receive these fields in any 317 position or combination. 319 If the encoding of [RFC4271] is used, the NLRI field for the IPv4 320 unicast address family is carried immediately following all the 321 attributes in an UPDATE. When such an UPDATE is received, we observe 322 that the NLRI field can be determined using the "Message Length", 323 "Withdrawn Route Length" and "Total Attribute Length" (when they are 324 consistent) carried in the message instead of relying on the length 325 of individual attributes in the message. 327 5.2. Missing NLRI 329 [RFC4724] specifies an End-of-RIB message ("EoR") that can be encoded 330 as an UPDATE message that contains only a MP_UNREACH_NLRI attribute 331 that encodes no NLRI (it can also be a completely empty UPDATE 332 message in the case of the "legacy" encoding). In all other well- 333 specified cases, an UPDATE either carries only withdrawn routes 334 (either in the Withdrawn Routes field, or the MP_UNREACH_NLRI 335 attribute), or it advertises reachable routes (either in the Network 336 Layer Reachability Information field, or the MP_REACH_NLRI 337 attribute). 339 Thus, if an UPDATE message is encountered that does contain path 340 attributes other than MP_UNREACH_NLRI and doesn't encode any 341 reachable NLRI, we cannot be confident that the NLRI have been 342 successfully parsed as Section 3 (j) requires. For this reason, if 343 any path attribute errors are encountered in such an UPDATE message, 344 and if any encountered error specifies an error-handling approach 345 other than "attribute discard", then the "session reset" approach 346 MUST be used. 348 5.3. Syntactic Correctness of NLRI Fields 350 The NLRI field or Withdrawn Routes field SHALL be considered 351 "syntactically incorrect" if either of the following are true: 353 o The length of any of the included NLRI is greater than 32, 355 o When parsing NLRI contained in the field, the length of the last 356 NLRI found exceeds the amount of unconsumed data remaining in the 357 field. 359 Similarly, the MP_REACH_NLRI or MP_UNREACH_NLRI attribute of an 360 update SHALL be considered to be incorrect if any of the following 361 are true: 363 o The length of any of the included NLRI is inconsistent with the 364 given AFI/SAFI (for example, if an IPv4 NLRI has a length greater 365 than 32 or an IPv6 NLRI has a length greater than 128), 367 o When parsing NLRI contained in the attribute, the length of the 368 last NLRI found exceeds the amount of unconsumed data remaining in 369 the attribute. 371 o The attribute flags of the attribute are inconsistent with those 372 specified in [RFC4760]. 374 o The length of the MP_UNREACH_NLRI attribute is less than 3, or the 375 length of the MP_REACH_NLRI attribute is less than 5. 377 5.4. Typed NLRI 379 Certain address families, for example MCAST-VPN [RFC6514], MCAST-VPLS 380 [RFC7117] and EVPN [RFC7432] have NLRI that are typed. Since 381 supported type values within the address family are not expressed in 382 the MP-BGP capability [RFC4760], it is possible for a BGP speaker to 383 advertise support for the given address family and sub-address family 384 while still not supporting a particular type of NLRI within that AFI/ 385 SAFI. 387 A BGP speaker advertising support for such a typed address family 388 MUST handle routes with unrecognized NLRI types within that address 389 family by discarding them, unless the relevant specification for that 390 address family specifies otherwise. 392 6. Operational Considerations 394 Although the "treat-as-withdraw" error-handling behavior defined in 395 Section 2 makes every effort to preserve BGP's correctness, we note 396 that if an UPDATE received on an IBGP session is subjected to this 397 treatment, inconsistent routing within the affected Autonomous System 398 may result. The consequences of inconsistent routing can include 399 long-lived forwarding loops and black holes. While lamentable, this 400 issue is expected to be rare in practice, and, more importantly, is 401 seen as less problematic than the session-reset behavior it replaces. 403 When a malformed attribute is indeed detected over an IBGP session, 404 we recommend that routes with the malformed attribute be identified 405 and traced back to the ingress router in the network where the routes 406 were sourced or received externally, and then a filter be applied on 407 the ingress router to prevent the routes from being sourced or 408 received. This will help maintain routing consistency in the 409 network. 411 Even if inconsistent routing does not arise, the "treat-as-withdraw" 412 behavior can cause either complete unreachability or sub-optimal 413 routing for the destinations whose routes are carried in the affected 414 UPDATE message. 416 Note that "treat-as-withdraw" is different from discarding an UPDATE 417 message. The latter violates the basic BGP principle of incremental 418 update, and could cause invalid routes to be kept. 420 Because of these potential issues, a BGP speaker must provide 421 debugging facilities to permit issues caused by a malformed attribute 422 to be diagnosed. At a minimum, such facilities must include logging 423 an error listing the NLRI involved, and containing the entire 424 malformed UPDATE message when such an attribute is detected. The 425 malformed UPDATE message should be analyzed, and the root cause 426 should be investigated. 428 Section 8 mentions that attribute discard should not be used in cases 429 where "the attribute in question has or may have an effect on route 430 selection." Although all cases that specify attribute discard in 431 this document do not affect route selection by default, in principle 432 routing policies could be written that affect selection based on such 433 an attribute. Operators should take care when writing such policies 434 to consider the possible consequences of an attribute discard. (In 435 general, as long as such policies are only applied to external BGP 436 sessions, correctness issues are not expected to arise.) 438 7. Error Handling Procedures for Existing Attributes 440 In the following subsections, we elaborate on the conditions for 441 error-checking various path attributes, and specify what approach(es) 442 should be used to handle malformations. It is possible that 443 implementations may apply other error checks not contemplated here. 444 If so, the error handling approach given here should generally be 445 applied. 447 This section addresses all path attributes that are defined at the 448 time of this writing, that were not defined with error-handling 449 consistent with Section 8, and that are not marked as "deprecated" in 450 [IANA-BGP-ATTRS]. Attributes 17 (AS4_PATH), 18 (AS4_AGGREGATOR), 22 451 (PMSI_TUNNEL), 23 (Tunnel Encapsulation Attribute), 26 (AIGP), 27 (PE 452 Distinguisher Labels) and 29 (BGP-LS Attribute) do have error- 453 handling consistent with Section 8 and thus are not further discussed 454 herein. Attributes 11 (DPA), 12 (ADVERTISER), 13 (RCID_PATH / 455 CLUSTER_ID), 19 (SAFI Specific Attribute), 20 (Connector Attribute), 456 21 (AS_PATHLIMIT) and 28 (BGP Entropy Label Capability Attribute) are 457 deprecated and thus are not further discussed herein. 459 7.1. ORIGIN 461 The attribute is considered malformed if its length is not 1, or it 462 has an undefined value [RFC4271]. 464 An UPDATE message with a malformed ORIGIN attribute SHALL be handled 465 using the approach of "treat-as-withdraw". 467 7.2. AS_PATH 469 An AS_PATH is considered malformed if an unrecognized segment type is 470 encountered, or if it contains a malformed segment. A segment is 471 considered malformed if any of the following obtains: 473 o There is an overrun, where the path segment length field of the 474 last segment encountered would cause the Attribute Length to be 475 exceeded. 477 o There is an underrun, where after the last successfully-parsed 478 segment, there is only a single octet remaining (that is, there is 479 not enough unconsumed data to provide even an empty segment 480 header). 482 o It has a path segment length field of zero. 484 An UPDATE message with a malformed AS_PATH attribute SHALL be handled 485 using the approach of "treat-as-withdraw". 487 [RFC4271] also says that an implementation optionally "MAY check 488 whether the leftmost ... AS in the AS_PATH attribute is equal to the 489 autonomous system number of the peer that sent the message". A BGP 490 implementation SHOULD also handle routes that violate this check 491 using "treat-as-withdraw", but MAY follow the session reset behavior 492 if configured to do so. 494 7.3. NEXT_HOP 496 The attribute is considered malformed if its length is not 4 497 [RFC4271]. 499 An UPDATE message with a malformed NEXT_HOP attribute SHALL be 500 handled using the approach of "treat-as-withdraw". 502 7.4. MULTI_EXIT_DISC 504 The attribute is considered malformed if its length is not 4 505 [RFC4271]. 507 An UPDATE message with a malformed MULTI_EXIT_DISC attribute SHALL be 508 handled using the approach of "treat-as-withdraw". 510 7.5. LOCAL_PREF 512 The error handling of [RFC4271] is revised as follows. 514 o If the LOCAL_PREF attribute is received from an external neighbor, 515 it SHALL be discarded using the approach of "attribute discard", 516 or 518 o if received from an internal neighbor, it SHALL be considered 519 malformed if its length is not equal to 4. If malformed, the 520 UPDATE SHALL be handled using the approach of "treat-as-withdraw". 522 7.6. ATOMIC_AGGREGATE 524 The attribute SHALL be considered malformed if its length is not 0 525 [RFC4271]. 527 An UPDATE message with a malformed ATOMIC_AGGREGATE attribute SHALL 528 be handled using the approach of "attribute discard". 530 7.7. AGGREGATOR 532 The error conditions specified in [RFC4271] for the attribute are 533 revised as follows: 535 The AGGREGATOR attribute SHALL be considered malformed if any of the 536 following applies: 538 o Its length is not 6 (when the "4-octet AS number capability" is 539 not advertised to, or not received from the peer [RFC6793]). 541 o Its length is not 8 (when the "4-octet AS number capability" is 542 both advertised to, and received from the peer). 544 An UPDATE message with a malformed AGGREGATOR attribute SHALL be 545 handled using the approach of "attribute discard". 547 7.8. Community 549 The error handling of [RFC1997] is revised as follows: 551 The Community attribute SHALL be considered malformed if its length 552 is not a nonzero multiple of 4. 554 An UPDATE message with a malformed Community attribute SHALL be 555 handled using the approach of "treat-as-withdraw". 557 7.9. ORIGINATOR_ID 559 The error handling of [RFC4456] is revised as follows. 561 o If the ORIGINATOR_ID attribute is received from an external 562 neighbor, it SHALL be discarded using the approach of "attribute 563 discard", or 565 o if received from an internal neighbor, it SHALL be considered 566 malformed if its length is not equal to 4. If malformed, the 567 UPDATE SHALL be handled using the approach of "treat-as-withdraw". 569 7.10. CLUSTER_LIST 571 The error handling of [RFC4456] is revised as follows. 573 o If the CLUSTER_LIST attribute is received from an external 574 neighbor, it SHALL be discarded using the approach of "attribute 575 discard", or 577 o if received from an internal neighbor, it SHALL be considered 578 malformed if its length is not a nonzero multiple of 4. If 579 malformed, the UPDATE SHALL be handled using the approach of 580 "treat-as-withdraw". 582 7.11. MP_REACH_NLRI 584 If the Length of Next Hop Network Address field of the MP_REACH 585 attribute is inconsistent with that which was expected, the attribute 586 is considered malformed. Since the next hop precedes the NLRI field 587 in the attribute, in this case it will not be possible to reliably 588 locate the NLRI, and thus the "session reset" or "AFI/SAFI disable" 589 approach MUST be used. 591 "That which was expected", while somewhat vague, is intended to 592 encompass the next hop specified for the Address Family Identifier 593 and Subsequent Address Family Identifier fields and potentially 594 modified by any extensions in use. For example, if [RFC5549] is in 595 use then the next hop would have to have a length of 4 or 16. 597 Section 3 and Section 5 provide further discussion of the handling of 598 this attribute. 600 7.12. MP_UNREACH_NLRI 602 Section 3 and Section 5 discuss the handling of this attribute. 604 7.13. Traffic Engineering path attribute 606 We note that [RFC5543] does not detail what constitutes 607 "malformation" for the Traffic Engineering path attribute. A future 608 update to that specification may provide more guidance. In the 609 interim, an implementation that determines (for whatever reason) that 610 an UPDATE message contains a malformed Traffic Engineering path 611 attribute MUST handle it using the approach of "treat-as-withdraw". 613 7.14. Extended Community 615 The error handling of [RFC4360] is revised as follows: 617 The Extended Community attribute SHALL be considered malformed if its 618 length is not a nonzero multiple of 8. 620 An UPDATE message with a malformed Extended Community attribute SHALL 621 be handled using the approach of "treat-as-withdraw". 623 Note that a BGP speaker MUST NOT treat an unrecognized Extended 624 Community Type or Sub-Type as an error. 626 7.15. IPv6 Address Specific BGP Extended Community Attribute 628 The error handling of [RFC5701] is revised as follows: 630 The IPv6 Address Specific Extended Community attribute SHALL be 631 considered malformed if its length is not a nonzero multiple of 20. 633 An UPDATE message with a malformed IPv6 Address Specific Extended 634 Community attribute SHALL be handled using the approach of "treat-as- 635 withdraw". 637 Note that a BGP speaker MUST NOT treat an unrecognized IPv6 Address 638 Specific Extended Community Type or Sub-Type as an error. 640 7.16. ATTR_SET 642 The final paragraph of Section 5 of [RFC6368] is revised as follows: 644 Old Text: 646 An UPDATE message with a malformed ATTR_SET attribute SHALL be 647 handled as follows. If its Partial flag is set and its 648 Neighbor-Complete flag is clear, the UPDATE is treated as a 649 route withdraw as discussed in [OPT-TRANS-BGP]. Otherwise 650 (i.e., Partial flag is clear or Neighbor-Complete is set), the 651 procedures of the BGP-4 base specification [RFC4271] MUST be 652 followed with respect to an Optional Attribute Error. 654 New Text: 656 An UPDATE message with a malformed ATTR_SET attribute SHALL be 657 handled using the approach of "treat as withdraw". 659 Furthermore, the normative reference to [OPT-TRANS-BGP] in [RFC6368] 660 is removed. 662 8. Guidance for Authors of BGP Specifications 664 A document that specifies a new BGP attribute MUST provide specifics 665 regarding what constitutes an error for that attribute and how that 666 error is to be handled. Allowable error-handling approaches are 667 detailed in Section 2. The treat-as-withdraw approach is generally 668 preferred. The document SHOULD also provide consideration of what 669 debugging facilities may be required to permit issues caused by a 670 malformed attribute to be diagnosed. 672 For any malformed attribute that is handled by the "attribute 673 discard" instead of the "treat-as-withdraw" approach, it is critical 674 to consider the potential impact of doing so. In particular, if the 675 attribute in question has or may have an effect on route selection or 676 installation, the presumption is that discarding it is unsafe, unless 677 careful analysis proves otherwise. The analysis should take into 678 account the tradeoff between preserving connectivity and potential 679 side effects. 681 Authors can refer to Section 7 for examples. 683 9. IANA Considerations 685 This document makes no request of IANA. 687 10. Security Considerations 689 This specification addresses the vulnerability of a BGP speaker to a 690 potential attack whereby a distant attacker can generate a malformed 691 optional transitive attribute that is not recognized by intervening 692 routers. Since the intervening routers do not recognize the 693 attribute, they propagate it without checking it. When the malformed 694 attribute arrives at a router that does recognize the given attribute 695 type, that router resets the session over which it arrived. Since 696 significant fan-out can occur between the attacker and the routers 697 that do recognize the attribute type, this attack could potentially 698 be particularly harmful. 700 The improved error handling of this specification could in theory 701 interact badly with some now-known weaker cryptographic mechanisms 702 should such be used in future to secure BGP. For example, if a 703 (fictional) mechanism that did not supply data integrity was used, an 704 attacker could manipulate ciphertext in any attempt to change or 705 observe how the receiver reacts. Absent this specification, the BGP 706 session would have been terminated, while with this specification the 707 attacker could make potentially many attempts. While such a 708 confidentiality-only mechanism would not be defined today, we have in 709 the past seen mechanism definitions that result in similar though not 710 as obviously exploitable vulnerabilities. [RFC7366] The approach 711 recommended today to avoid such issues is to prefer use of 712 Authenticated Encryption with Additional Data (AEAD) ciphers 713 [RFC5116] and (thus) to discard messages that don't verify. 715 In other respects, this specification does not change BGP's security 716 characteristics. 718 11. Acknowledgements 720 The authors wish to thank Juan Alcaide, Deniz Bahadir, Ron Bonica, 721 Mach Chen, Andy Davidson, Bruno Decraene, Stephen Farrell, Rex 722 Fernando, Jeff Haas, Chris Hall, Joel Halpern, Dong Jie, Akira Kato, 723 Miya Kohno, Warren Kumari, Tony Li, Alton Lo, Shin Miyakawa, Tamas 724 Mondal, Jonathan Oddy, Tony Przygienda, Robert Raszuk, Yakov Rekhter, 725 Eric Rosen, Shyam Sethuram, Rob Shakir, Naiming Shen, Adam Simpson, 726 Ananth Suryanarayana, Kaliraj Vairavakkalai, Lili Wang and Ondrej 727 Zajicek for their observations and discussion of this topic, and 728 review of this document. 730 12. References 732 12.1. Normative References 734 [IANA-BGP-ATTRS] 735 "BGP Path Attributes", . 738 [RFC1997] Chandrasekeran, R., Traina, P., and T. Li, "BGP 739 Communities Attribute", RFC 1997, August 1996. 741 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 742 Requirement Levels", BCP 14, RFC 2119, March 1997. 744 [RFC4271] Rekhter, Y., Li, T., and S. Hares, "A Border Gateway 745 Protocol 4 (BGP-4)", RFC 4271, January 2006. 747 [RFC4360] Sangli, S., Tappan, D., and Y. Rekhter, "BGP Extended 748 Communities Attribute", RFC 4360, February 2006. 750 [RFC4456] Bates, T., Chen, E., and R. Chandra, "BGP Route 751 Reflection: An Alternative to Full Mesh Internal BGP 752 (IBGP)", RFC 4456, April 2006. 754 [RFC4724] Sangli, S., Chen, E., Fernando, R., Scudder, J., and Y. 755 Rekhter, "Graceful Restart Mechanism for BGP", RFC 4724, 756 January 2007. 758 [RFC4760] Bates, T., Chandra, R., Katz, D., and Y. Rekhter, 759 "Multiprotocol Extensions for BGP-4", RFC 4760, January 760 2007. 762 [RFC5543] Ould-Brahim, H., Fedyk, D., and Y. Rekhter, "BGP Traffic 763 Engineering Attribute", RFC 5543, May 2009. 765 [RFC5701] Rekhter, Y., "IPv6 Address Specific BGP Extended Community 766 Attribute", RFC 5701, November 2009. 768 [RFC6368] Marques, P., Raszuk, R., Patel, K., Kumaki, K., and T. 769 Yamagata, "Internal BGP as the Provider/Customer Edge 770 Protocol for BGP/MPLS IP Virtual Private Networks (VPNs)", 771 RFC 6368, September 2011. 773 [RFC6793] Vohra, Q. and E. Chen, "BGP Support for Four-Octet 774 Autonomous System (AS) Number Space", RFC 6793, December 775 2012. 777 12.2. Informative References 779 [RFC5116] McGrew, D., "An Interface and Algorithms for Authenticated 780 Encryption", RFC 5116, January 2008. 782 [RFC5549] Le Faucheur, F. and E. Rosen, "Advertising IPv4 Network 783 Layer Reachability Information with an IPv6 Next Hop", RFC 784 5549, May 2009. 786 [RFC6514] Aggarwal, R., Rosen, E., Morin, T., and Y. Rekhter, "BGP 787 Encodings and Procedures for Multicast in MPLS/BGP IP 788 VPNs", RFC 6514, February 2012. 790 [RFC7117] Aggarwal, R., Kamite, Y., Fang, L., Rekhter, Y., and C. 791 Kodeboniya, "Multicast in Virtual Private LAN Service 792 (VPLS)", RFC 7117, February 2014. 794 [RFC7366] Gutmann, P., "Encrypt-then-MAC for Transport Layer 795 Security (TLS) and Datagram Transport Layer Security 796 (DTLS)", RFC 7366, September 2014. 798 [RFC7432] Sajassi, A., Aggarwal, R., Bitar, N., Isaac, A., Uttaro, 799 J., Drake, J., and W. Henderickx, "BGP MPLS-Based Ethernet 800 VPN", RFC 7432, February 2015. 802 Authors' Addresses 804 Enke Chen (editor) 805 Cisco Systems, Inc. 807 Email: enkechen@cisco.com 808 John G. Scudder (editor) 809 Juniper Networks 811 Email: jgs@juniper.net 813 Pradosh Mohapatra 814 Sproute Networks 816 Email: mpradosh@yahoo.com 818 Keyur Patel 819 Cisco Systems, Inc. 821 Email: keyupate@cisco.com