RFC 9319

The Use of maxLength in the Resource Public Key Infrastructure (RPKI)

πŸ“… published October 2022, from ietf

Internet Engineering Task Force (IETF) πŸŽ€ BCP 185 Β· RFC 9319

Okay bestie, let's get into it ✨ This is RFC 9319, titled The Use of maxLength in the Resource Public Key Infrastructure (RPKI), and it's a Best Current Practice πŸ’… (BCP 185, if you're keeping score). It came out in October 2022 πŸ“ and it's published under the IETF stream, with ISSN 2070-1721 🧚.

The authors are Y. Gilad (Hebrew University of Jerusalem), S. Goldberg (Boston University), K. Sriram (USA NIST), J. Snijders (Fastly), and B. Maddison (Workonline Communications) 🫢. Nothing in the title block says it obsoletes or updates anything, but it does complement and extend [RFC7115] πŸ¦‹, which is something you'll see come up again.


1. Introduction 🌸

Okay so the RPKI [RFC6480] uses Route Origin Authorizations (ROAs) to make a cryptographically verifiable mapping from an IP prefix to a set of Autonomous Systems (ASes) that are allowed to originate that prefix πŸ”. Each ROA holds a set of IP prefixes plus the AS number of one of the ASes allowed to originate all of them [RFC6482], and it gets cryptographically signed by whoever holds the certificate for that set of prefixes πŸ’œ.

The ROA format also has a maxLength attribute ✨. According to [RFC6482], "When present, the maxLength specifies the maximum length of the IP address prefix that the AS is authorized to advertise." So instead of listing every single prefix an AS is allowed to originate, maxLength is a shorthand that authorizes a whole set of prefixes at once πŸŽ€.

Here's the tea 🫒 Measurements of RPKI deployments found that maxLength in ROAs tends to cause security problems 😭. Specifically, measurements from June 2017 showed that 84% of the prefixes in ROAs using maxLength were vulnerable to a forged-origin sub-prefix hijack [GSG17]. A forged-origin prefix or sub-prefix hijack means inserting the legitimate AS (the one named in the ROA) as the origin AS in the AS_PATH, and it can be launched against any IP prefix or sub-prefix that has a ROA πŸ’€. Now here's the twist: if a ROA's prefix is unused (not announced in BGP by a legitimate AS), a forged-origin hijack on it can spread widely across the Internet 🌈. If the prefix were announced by the legitimate AS, the hijack spreads less because its AS_PATH is longer than the legit announcement. Forged-origin hijacks are harmful either way, but they're worse for unannounced prefixes 😀. See Section 3 for the full drama.

So this document recommends that, whenever possible, operators SHOULD use "minimal ROAs" that authorize only the IP prefixes actually originated in BGP, and no other prefixes πŸ“. It also recommends ways to shrink the forged-origin attack surface by carefully limiting the address space included in ROAs, and the big one is avoiding maxLength except in some specific cases πŸ™ˆ. These recommendations complement and extend [RFC7115] πŸ¦‹. The document also covers creating ROAs to help with DDoS mitigation services, and it highlights considerations for ROAs and RPKI-ROV when you're doing destination-based Remotely Triggered Discard Route (RTDR) filtering, which is also called "Remotely Triggered Black Hole" πŸ•³οΈ.

Quick note πŸ“: "RPKI-based Route Origin Validation" and its acronym "RPKI-ROV" mean the same thing as "Prefix Origin Validation" from [RFC6811] πŸ’….

Ideally, the ROA-related recommendations get implemented in the user interfaces for configuring ROAs πŸ–₯️, and Section 7 has the guidance for implementors of those interfaces πŸ‘‘.

Also, the practices here need no changes to the RPKI specifications and won't increase the number of signed ROAs in the RPKI, because ROAs already support lists of IP prefixes [RFC6482] ✨ iconic, no notes.

1.1. Requirements πŸ’–

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here πŸ“š.

1.2. Documentation Prefixes 🧚

The documentation prefixes recommended in [RFC5737] aren't enough to use as example prefixes in this document πŸ™ƒ. So this document uses the address space defined in [RFC1918] to build its example prefixes 🌸.

Heads up: even though the examples here use IPv4 prefixes, all the analysis and recommendations are equally valid for the equivalent IPv6 cases 🌈.

2. Suggested Reading πŸ“–

It's assumed you already understand BGP [RFC4271], RPKI [RFC6480], ROAs [RFC6482], RPKI-ROV [RFC6811], and BGPsec [RFC8205] 🫢. No pressure, but yeah, go read those first πŸ’….


(Part 1 of 4. More parts coming, so stay tuned, bestie πŸ’œβœ¨)

3. Forged-Origin Sub-Prefix Hijack ✨

okay bestie, this section is a deep dive into forged-origin sub-prefix hijacks πŸ•΅οΈβ€β™€οΈπŸ’€. The really spicy case is when the sub-prefix is not announced in BGP. This one applies in a scenario where:

  1. the RPKI [RFC6480] is deployed, and
  2. routers use RPKI-ROV to drop invalid routes [RFC6811], but
  3. BGPsec [RFC8205] (or any similar method to validate the truthfulness of the BGP AS_PATH attribute) is not deployed.

ngl this combo describes a huge and growing number of big Internet networks at the time of writing πŸ“ˆπŸ«Ά

The forged-origin sub-prefix hijack [RFC7115] [GCHSS] is explained here with a running example, so let's go πŸŽ€

Say we have the IP prefix 192.168.0.0/16, which is allocated to an organization that also runs AS 64496. In BGP, AS 64496 originates 192.168.0.0/16 and also its sub-prefix 192.168.225.0/24. So the RPKI should contain a ROA authorizing AS 64496 to originate those two IP prefixes πŸ“

Now, suppose the organization issues and publishes a ROA with a maxLength value of 24:

ROA:(192.168.0.0/16-24, AS 64496)

We call this a "loose ROA" 🧢 because it authorizes AS 64496 to originate any sub-prefix of 192.168.0.0/16 up to and including length /24, rather than only the prefixes that are actually meant to be announced in BGP. Yikes 😭

Because AS 64496 only originates two prefixes in BGP (192.168.0.0/16 and 192.168.225.0/24), every other prefix the loose ROA covers (for instance, 192.168.0.0/24) is vulnerable to this forged-origin sub-prefix hijack [RFC7115] [GCHSS] πŸ’€

  1. The hijacker AS 64511 sends the BGP announcement 192.168.0.0/24: AS 64511, AS 64496, falsely claiming that AS 64511 is a neighbor of AS 64496 and that AS 64496 originates 192.168.0.0/24. Plot twist: AS 64496 does not originate 192.168.0.0/24 at all πŸ™ˆ
  2. The hijacker's announcement is valid according to the RPKI, since the ROA (192.168.0.0/16-24, AS 64496) authorizes AS 64496 to originate BGP routes for 192.168.0.0/24. The loose ROA basically handed over the keys πŸ”‘
  3. Because AS 64496 doesn't actually originate a route for 192.168.0.0/24, the hijacker's route is the only route for 192.168.0.0/24. Longest-prefix-match routing means the hijacker's route to the sub-prefix 192.168.0.0/24 is always preferred over the legitimate route to 192.168.0.0/16 originated by AS 64496. Main character energy for the attacker, but not for us πŸ’…

So the hijacker's route spreads across the Internet, and traffic destined for IP addresses in 192.168.0.0/24 gets delivered to the hijacker. Not iconic at all 😀

The forged-origin sub-prefix hijack would have failed if a minimal ROA (see Section 5) had been used instead of the loose ROA πŸ™Œ In this example, the minimal ROA would be:

ROA:(192.168.0.0/16, 192.168.225.0/24, AS 64496)

This ROA is "minimal" because it includes only the IP prefixes that AS 64496 originates in BGP, and no other IP prefixes [RFC6907] ✨

The minimal ROA makes AS 64511's BGP announcement invalid, because:

  1. this ROA "covers" the attacker's announcement (since 192.168.0.0/24 is a sub-prefix of 192.168.0.0/16), and
  2. there is no ROA "matching" the attacker's announcement (there is no ROA for AS 64511 and IP prefix 192.168.0.0/24) [RFC6811].

If routers ignore invalid BGP announcements, the minimal ROA above makes sure the sub-prefix hijack fails πŸ¦‹

With a minimal ROA, the attacker would be forced to try a forged-origin prefix hijack to attract traffic instead. It goes like this:

The hijacker AS 64511 sends the BGP announcement 192.168.0.0/16: AS 64511, AS 64496, falsely claiming that AS 64511 is a neighbor of AS 64496.

This forged-origin prefix hijack is way less damaging than the forged-origin sub-prefix hijack πŸ™…β€β™€οΈ Here's why:

  • AS 64496 legitimately originates 192.168.0.0/16 in BGP, so the hijacker AS 64511 is not presenting the only route to 192.168.0.0/16.
  • The path originated by AS 64511 is one hop longer than the path originated by the legitimate origin AS 64496.

As discussed in [LSG16], this means the hijacker attracts less traffic than it would in the forged-origin sub-prefix hijack, where it presents the only route to the hijacked sub-prefix πŸ“‰

To sum up: a forged-origin sub-prefix hijack has the same impact as a regular sub-prefix hijack, even though the illegitimate route has a longer AS_PATH 😩 And it's also more damaging than the forged-origin prefix hijack. Periodt πŸ’œ


4. Measurements of the RPKI πŸ“Š

Network measurements taken in June 2017 showed that 12% of the IP prefixes authorized in ROAs have a maxLength value longer than their prefix length. Of those, the vast majority (84%) were non-minimal 😬 They included sub-prefixes that aren't announced in BGP by the legitimate AS, which made them vulnerable to forged-origin sub-prefix hijacks. See [GSG17] for the details πŸ”

These measurements suggest that operators commonly misconfigure the maxLength attribute, and they unknowingly open themselves up to forged-origin sub-prefix hijacks πŸ₯Ί Basically, they're exposing a much bigger attack surface for forged-origin hijacks than necessary. Not it 🚩


5. Recommendations about Minimal ROAs and maxLength πŸŽ€

Operators SHOULD use minimal ROAs whenever possible 🧁 A minimal ROA contains only the IP prefixes that an AS actually originates in BGP, and no other IP prefixes. See Section 3 for an example.

In general, operators SHOULD avoid using the maxLength attribute in their ROAs, since including it will usually make the ROA non-minimal πŸ™ƒ

There are a couple of exceptions. One is when all the more specific prefixes permitted by the maxLength value are actually announced by the AS in the ROA βœ… Another is where (a) the maxLength value is substantially larger than the specified prefix length in the ROA, and (b) a large number of more specific prefixes in that range are announced by the AS in the ROA. Honestly, this case should occur rarely, if at all πŸ€·β€β™€οΈ Operator discretion is necessary here.

This practice requires no changes to the RPKI specifications, and it doesn't need to increase the number of signed ROAs in the RPKI, because ROAs already support lists of IP prefixes [RFC6482]. See [GSG17] for more on why this practice will have minimal impact on the performance of the RPKI ecosystem 🧚

Operators that implement these recommendations and already have ROAs published in the RPKI system MUST perform a review of those objects, especially where they use the maxLength attribute. The goal is to make sure the set of included prefixes is "minimal" with respect to the current BGP origination and routing policies. Published ROAs MUST be replaced as necessary, and this exercise MUST be repeated whenever the operator makes changes to either policy. No skipping this one, bestie πŸ’…πŸ’–

5.1. Facilitating Ad Hoc Routing Changes and DDoS Mitigation πŸ›‘οΈ

Okay so sometimes an operator needs a route for an IP prefix to get originated on an ad hoc basis, with little or no warning 😭. A super common example is when an operator wants to use DDoS mitigation services that use BGP to redirect traffic via a "scrubbing center" 🧼.

To make sure those ad hoc routing changes actually work, a ROA validating the new route should exist. But here's the tea: newly created objects in the RPKI show up for relying parties way more slowly than routing updates in BGP πŸ’πŸ’¨.

Ideally you wouldn't have to pre-create the ROA that validates the ad hoc route, and could just make it "on the fly" when needed ✨. But that only works if the latency from RPKI data propagation is guaranteed to stay within acceptable limits. For time-critical stuff like responding to a DDoS attack, that's unlikely to be the case πŸ’€.

So the ROA in question will usually need to be created well in advance of the routing intervention πŸ“…. Because it includes an IP prefix that is sometimes (but not always) originated in BGP, that ROA will be non-minimal πŸ™ˆ.

In this case, the ROA SHOULD only include:

  1. the set of IP prefixes that are always originated in BGP, and
  2. the set of IP prefixes that are sometimes, but not always, originated in BGP.

The ROA SHOULD NOT include any IP prefixes that the operator knows will not be originated in BGP 🚫. In general, the ROA SHOULD NOT make use of the maxLength attribute unless doing so has no impact on the set of included prefixes πŸ’….

The running example is now extended to illustrate one situation where it is not possible to issue a minimal ROA πŸŽ€.

Consider the following scenario prior to the deployment of RPKI 🌸. Suppose AS 64496 announced 192.168.0.0/16 and has a contract with a DDoS mitigation service provider that holds AS 64500. Further, assume that the DDoS mitigation service contract applies to all IP addresses covered by 192.168.0.0/22. When a DDoS attack is detected and reported by AS 64496, AS 64500 immediately originates 192.168.0.0/22, thus attracting all the DDoS traffic to itself 🧲. The traffic is scrubbed at AS 64500 and then sent back to AS 64496 over a backhaul link. Notice that, during a DDoS attack, the DDoS mitigation service provider AS 64500 originates a /22 prefix that is longer than AS 64496's /16 prefix, so all the traffic (destined to addresses in 192.168.0.0/22) that normally goes to AS 64496 goes to AS 64500 instead πŸ‘€. In some deployments, the origination of the /22 route is performed by AS 64496 and announced only to AS 64500, which then announces transit for that prefix. This variation does not change the properties considered here.

First, suppose the RPKI only had the minimal ROA for AS 64496, as described in Section 3. However, if there is no ROA authorizing AS 64500 to announce the /22 prefix, then the DDoS mitigation (and traffic scrubbing) scheme would not work 😩. That is, if AS 64500 originates the /22 prefix in BGP during DDoS attacks, the announcement would be invalid [RFC6811].

Therefore, the RPKI should have two ROAs: one for AS 64496 and one for AS 64500 🫢.

ROA:(192.168.0.0/16, 192.168.225.0/24, AS 64496)

ROA:(192.168.0.0/22, AS 64500)

Neither ROA uses the maxLength attribute, but the second ROA is not "minimal" because it contains a /22 prefix that is not originated by anyone in BGP during normal operations πŸ™ƒ. The /22 prefix is only originated by AS 64500 as part of its DDoS mitigation service during a DDoS attack.

Notice, however, that this scheme does not come without risks ⚠️. Namely, all IP addresses in 192.168.0.0/22 are vulnerable to a forged-origin sub-prefix hijack during normal operations when the /22 prefix is not originated. (The hijacker AS 64511 would send the BGP announcement 192.168.0.0/22: AS 64511, AS 64500, falsely claiming that AS 64511 is a neighbor of AS 64500 and falsely claiming that AS 64500 originates 192.168.0.0/22.) Yikes 😱.

In some situations, the DDoS mitigation service at AS 64500 might want to limit the amount of DDoS traffic that it attracts and scrubs 🧹. Suppose that a DDoS attack only targets IP addresses in 192.168.0.0/24. Then, the DDoS mitigation service at AS 64500 only wants to attract the traffic designated for the /24 prefix that is under attack, but not the entire /22 prefix. To allow for this, the RPKI should have two ROAs: one for AS 64496 and one for AS 64500.

ROA:(192.168.0.0/16, 192.168.225.0/24, AS 64496)

ROA:(192.168.0.0/22-24, AS 64500)

The second ROA uses the maxLength attribute because it is designed to explicitly enable AS 64500 to originate any /24 sub-prefix of 192.168.0.0/22 🎯.

As before, the second ROA is not "minimal" because it contains prefixes that are not originated by anyone in BGP during normal operations. Also, all IP addresses in 192.168.0.0/22 are vulnerable to a forged-origin sub-prefix hijack during normal operations when the /22 prefix is not originated 😬.

The use of the maxLength attribute in this second ROA also comes with additional risk 🚨. While it permits the DDoS mitigation service at AS 64500 to originate prefix 192.168.0.0/24 during a DDoS attack in that space, it also makes the other /24 prefixes covered by the /22 prefix (i.e., 192.168.1.0/24, 192.168.2.0/24, and 192.168.3.0/24) vulnerable to forged-origin sub-prefix attacks. Not ideal, bestie πŸ’”.

5.2. Defensive De-aggregation in Response to Prefix Hijacks πŸͺž

When responding to certain classes of prefix hijack (in particular, the forged-origin sub-prefix hijack described above), it may be desirable for the victim to perform "defensive de-aggregation", i.e., to begin originating more-specific prefixes in order to compete with the hijack routes for selection as the best path in networks that are not performing RPKI-ROV [RFC6811] πŸ₯Š.

In topologies where at least one AS on every path between the victim and hijacker filters RPKI-ROV invalid prefixes, it may be the case that the existence of a minimal ROA issued by the victim prevents the defensive more-specific prefixes from being propagated to the networks topologically close to the attacker 🫠. That can hamper the effectiveness of this response.

Nevertheless, this document recommends that, where possible, network operators publish minimal ROAs even in the face of this risk πŸ’–. This is because:

  • Minimal ROAs offer the best possible protection against the immediate impact of such an attack, rendering the need for such a response less likely;
  • Increasing RPKI-ROV adoption by network operators will, over time, decrease the size of the neighborhoods in which this risk exists; and
  • Other methods for reducing the size of such neighborhoods are available to potential victims, such as establishing direct External BGP (EBGP) adjacencies with networks from whom the defensive routes would otherwise be hidden 🀝.

6. Considerations for RTDR Filtering Scenarios 🌈

Considerations related to ROAs and RPKI-ROV [RFC6811] for the case of destination-based RTDR (elsewhere referred to as "Remotely Triggered Black Hole") filtering are addressed here πŸ•³οΈ. In RTDR filtering, highly specific prefixes (greater than /24 in IPv4 and greater than /48 in IPv6, or possibly even /32 in IPv4 and /128 in IPv6) are announced in BGP. These announcements are tagged with the well-known BGP community defined by [RFC7999]. For the reasons set out above, it is obviously not desirable to use a large maxLength value or include any such highly specific prefixes in the ROAs to accommodate destination-based RTDR filtering πŸ™…β€β™€οΈ.

As a result, RPKI-ROV [RFC6811] is a poor fit for the validation of RTDR routes. Specification of new procedures to address this use case through the use of the RPKI is outside the scope of this document πŸ§ƒ.

Therefore:

  • Operators SHOULD NOT create non-minimal ROAs (by either creating additional ROAs or using the maxLength attribute) for the purpose of advertising RTDR routes; and
  • Operators providing a means for operators of neighboring autonomous systems to advertise RTDR routes via BGP MUST NOT make the creation of non-minimal ROAs a pre-requisite for its use.

7. User Interface Design Recommendations 🎨

Most operator interaction with the RPKI system when creating or modifying ROAs will occur via a user interface that abstracts the underlying encoding, signing, and publishing operations πŸͺ„.

This document recommends that designers and/or providers of such user interfaces SHOULD provide warnings to draw the user's attention to the risks of creating non-minimal ROAs in general and using the maxLength attribute in particular 🚩.

Warnings provided by such a system may vary in nature from generic warnings based purely on the inclusion of the maxLength attribute to customised guidance based on the observable BGP routing policy of the operator in question. The choices made in this respect are expected to be dependent on the target user audience of the implementation πŸ’….


8. Operational Considerations βš™οΈ

The recommendations specified in this document (in particular, those in Section 5) involve trade-offs between operational agility and security βš–οΈ.

Operators adopting the recommended practice of issuing minimal ROAs will, by definition, need to make changes to their existing set of issued ROAs in order to effect changes to the set of prefixes that are originated in BGP πŸ”„.

Even in the case of routing changes that are planned in advance, existing procedures may need to be updated to incorporate changes to issued ROAs and may require additional time allowed for those changes to propagate ⏳.

Operators are encouraged to carefully review the issues highlighted (especially those in Sections 5.1 and 5.2) in light of their specific operational requirements πŸ”. Failure to do so could, in the worst case, result in a self-inflicted denial of service πŸ’€.

The recommendations made in Section 5 are likely to be more onerous for operators utilising large IP address space allocations from which many more-specific advertisements are made in BGP. Operators of such networks are encouraged to seek opportunities to automate the required procedures in order to minimise manual operational burden πŸ€–.


9. Security Considerations πŸ”

This document makes recommendations regarding the use of RPKI-ROV as defined in [RFC6811] and, as such, introduces no additional security considerations beyond those specified therein πŸ›‘οΈ.


10. IANA Considerations πŸ¦‹

This document has no IANA actions.


11. References πŸ“š

11.1. Normative References πŸ“š

okay so these are the must-reads πŸ€“ the docs this spec leans on so hard you can't really build it without them. no cap, go in with these first πŸ’–

11.2. Informative References 🌸

these ones are the extra reading πŸ¦‹ the background, the research papers, and the "wait, how did we get here" stuff. super useful, just not strictly required to build the thing ✨


Acknowledgments 🫢

the authors gave a huge shoutout to these people for reviewing and contributing to the doc πŸ’œ bestie energy all over this list πŸŽ€

The authors would like to thank the following people for their review and contributions to this document: Omar Sagga and Aris Lambrianidis. Thanks are also due to Matthias Waehlisch, Ties de Kock, Amreesh Phokeer, Γ‰ric Vyncke, Alvaro Retana, John Scudder, Roman Danyliw, Andrew Alston, and Murray Kucherawy for comments and suggestions, to Roni Even for the Gen-ART review, to Jean Mahoney for the ART-ART review, to Acee Lindem for the Routing Area Directorate review, and to Sean Turner for the Security Area Directorate review.

Authors' Addresses πŸ’Œ

here's where you can find the authors 🧚 slide into their emails if you have questions ✨

Yossi Gilad
Hebrew University of Jerusalem
Rothburg Family Buildings
Edmond J. Safra Campus
Jerusalem 9190416
Israel
Email: yossigi@cs.huji.ac.il
Sharon Goldberg
Boston University
111 Cummington St, MCS135
Boston, MA 02215
United States of America
Email: goldbe@cs.bu.edu
Kotikalapudi Sriram
USA National Institute of Standards and Technology
100 Bureau Drive
Gaithersburg, MD 20899
United States of America
Email: kotikalapudi.sriram@nist.gov
Job Snijders
Fastly
Amsterdam
Netherlands
Email: job@fastly.com
Ben Maddison
Workonline Communications
114 West St
Johannesburg
2196
South Africa
Email: benm@workonline.africa
πŸ“¦ where this page comes from