<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>
<?rfc toc="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc tocompact="yes"?>
<?rfc rfcedstyle="yes"?>

<rfc number="6811" category="std" submissionType="IETF" ipr="trust200902">

<front>

  <title>BGP Prefix Origin Validation</title>

 <author fullname="Pradosh Mohapatra" initials="P." surname="Mohapatra">
   <organization>Cisco Systems</organization>
   <address>
     <postal>
       <street>170 W. Tasman Drive</street>
       <city>San Jose</city>
       <region>CA</region>
       <code>95134</code>
       <country>USA</country>
       </postal>
     <email>pmohapat@cisco.com</email>
     </address>
   </author>

 <author fullname="John Scudder" initials="J." surname="Scudder">
   <organization>Juniper Networks</organization>
   <address>
     <postal>
       <street>1194 N. Mathilda Ave</street>
       <city>Sunnyvale</city>
       <region>CA</region>
       <code>94089</code>
       <country>USA</country>
       </postal>
     <email>jgs@juniper.net</email>
     </address>
   </author>

 <author fullname="David Ward" initials="D." surname="Ward">
   <organization>Cisco Systems</organization>
   <address>
     <postal>
       <street>170 W. Tasman Drive</street>
       <city>San Jose</city>
       <region>CA</region>
       <code>95134</code>
       <country>USA</country>
       </postal>
     <email>dward@cisco.com</email>
     </address>
   </author>

 <author fullname="Randy Bush" initials="R." surname="Bush">
   <organization>Internet Initiative Japan</organization>
   <address>
     <postal>
       <street>5147 Crystal Springs</street>
       <city>Bainbridge Island</city>
       <region>WA</region>
       <code>98110</code>
       <country>USA</country>
       </postal>
     <email>randy@psg.com</email>
     </address>
   </author>

 <author fullname="Rob Austein" initials="R." surname="Austein">
   <organization>Dragon Research Labs</organization>
   <address>
     <email>sra@hactrn.net</email>
     </address>
   </author>

 <date month="January" year="2013" />

<keyword>SIDR</keyword>
<keyword>security</keyword>

 <abstract>

   <t>To help reduce well-known threats against BGP including prefix
    mis-announcing and monkey-in-the-middle attacks, one of the security
    requirements is the ability to validate the origination Autonomous System (AS) of BGP
    routes. More specifically, one needs to validate that the AS number
    claiming to originate an address prefix (as derived from the AS_PATH
    attribute of the BGP route) is in fact authorized by the prefix
    holder to do so. This document describes a simple validation
    mechanism to partially satisfy this requirement.</t>

   </abstract>

 </front>

<middle>

 <section anchor="introduction" title="Introduction">
   <t>A BGP route associates an address prefix with a set of Autonomous
    Systems (ASes) that identify the interdomain path the prefix has
    traversed in the form of BGP announcements. This set is
    represented as the AS_PATH attribute in
    BGP <xref target="RFC4271"></xref> and starts with the AS that
    originated the prefix. To help reduce well-known threats against
    BGP including prefix mis-announcing and monkey-in-the-middle
    attacks, one of the security requirements is the ability to
    validate the origination AS of BGP routes. More specifically, one
    needs to validate that the AS number claiming to originate an
    address prefix (as derived from the AS_PATH attribute of the BGP
    route) is in fact authorized by the prefix holder to do so. This
    document describes a simple validation mechanism to partially
    satisfy this requirement.</t>

  <t>The Resource Public Key Infrastructure (RPKI) describes an
    approach to build a formally verifiable database of IP addresses
    and AS numbers as resources. The overall architecture of RPKI as
    defined in <xref target="RFC6480"></xref> consists of
    three main components:

    <list style="symbols">
      <t>a public key infrastructure (PKI) with the necessary
         certificate objects,</t>
      <t>digitally signed routing objects, and</t>
      <t>a distributed repository system to hold the objects that
         would also support periodic retrieval.</t>
    </list>
  </t>

  <t>The RPKI system is based on resource certificates that define
    extensions to X.509 to represent IP addresses and AS
    identifiers <xref target="RFC3779"></xref>, thus the name RPKI.
    Route Origin Authorizations (ROAs) <xref target="RFC6482"></xref>
    are separate digitally signed objects that define associations
    between ASes and IP address blocks. Finally, the repository system
    is operated in a distributed fashion through the IANA, Regional Internet
Registry (RIR) hierarchy, and ISPs.</t>

  <t>In order to benefit from the RPKI system, it is envisioned that
    relying parties at either the AS or organization level obtain a local
    copy of the signed object collection, verify the signatures, and
    process them. The cache must also be refreshed periodically. The
    exact access mechanism used to retrieve the local cache is beyond
    the scope of this document.</t>

  <t>Individual BGP speakers can utilize the processed data contained
    in the local cache to validate BGP announcements. The protocol
    details to retrieve the processed data from the local cache to the
    BGP speakers is beyond the scope of this document (refer
    to <xref target="RFC6810"></xref> for such a
    mechanism).  This document proposes a means by which a BGP speaker
    can make use of the processed data in order to assign a "validation
    state" to each prefix in a received BGP UPDATE message.</t>

  <t>Note that the complete path attestation against the AS_PATH
    attribute of a route is outside the scope of this document.</t>

  <t>Like the DNS, the global RPKI presents only a loosely consistent
    view, depending on timing, updating, fetching, etc.  Thus, one
    cache or router may have different data about a particular prefix
    than another cache or router.  There is no 'fix' for this; it is
    the nature of distributed data with distributed caches.</t>

  <t>Although RPKI provides the context for this document, it is equally
    possible to use any other database that is able to map prefixes
    to their authorized origin ASes. Each distinct database will have
    its own particular operational and security characteristics; such
    characteristics are beyond the scope of this document.</t>

  <section title="Requirements Language">
    <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
      NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL"
      are to be interpreted as described in <xref target="RFC2119">RFC
      2119</xref> only when they appear in all upper case.  They may
      also appear in lower or mixed case as English words, without 
      special meaning.</t>

  </section>
 
 </section>

 <section title="Prefix-to-AS Mapping Database" anchor="mapping_database">

  <t>The BGP speaker loads validated objects from the cache into local
    storage. The objects loaded have the content (IP address, prefix
    length, maximum length, origin AS number). We refer to such a
    locally stored object as a "Validated ROA Payload"
    or "VRP".</t>

  <t>We define several terms in addition to "VRP". Where these terms
    are used, they are capitalized:</t>

  <t><list style="symbols">

    <t>Prefix: (IP address, prefix length), interpreted as is
      customary (see <xref target="RFC4632"></xref>).</t>

    <t> Route: Data derived from a received BGP UPDATE, as defined in 
      <xref target="RFC4271"></xref>, Section 1.1. The Route includes
	one Prefix and an AS_PATH; it may include other attributes to
        characterize the prefix.</t>

    <t>VRP Prefix: The Prefix from a VRP.</t>

    <t>VRP ASN: The origin AS number from a VRP.</t>

    <t>Route Prefix: The Prefix derived from a route.</t>

    <t>Route Origin ASN: The origin AS number derived from a Route as
      follows:
      <list style="symbols">
       <t>the rightmost AS in the final segment of
       the AS_PATH attribute in the Route if that segment is of type
       AS_SEQUENCE, or </t>
       <t>the BGP speaker's own AS number if that segment is of type
       AS_CONFED_SEQUENCE or AS_CONFED_SET or if the AS_PATH is empty, or</t>
       <t>the distinguished value "NONE" if the final segment 
       of the AS_PATH attribute is of any other type.</t>
      </list></t>
    <t>Covered: A Route Prefix is said to be Covered by a VRP when the
      VRP prefix length is less than or equal to the Route prefix
      length, and the VRP prefix address and the Route prefix address
      are identical for all bits specified by the VRP prefix length. 
  (That is, the Route prefix is either identical to the VRP
  prefix or more specific than the VRP prefix.)</t>

    <t>Matched: A Route Prefix is said to be Matched by a VRP when the
      Route Prefix is Covered by that VRP, the Route
      prefix length is less than or equal to the VRP maximum length,
      and the Route Origin ASN is equal to the VRP ASN.</t>
  </list></t>

  <t>Given these definitions, any given BGP Route
    will be found to have one of the following validation
    states:</t>
    <t><list style="symbols">
      <t>NotFound: No VRP Covers the Route Prefix.</t>
      <t>Valid: At least one VRP Matches the Route Prefix.</t>
      <t>Invalid: At least one VRP Covers the Route Prefix, but no VRP 
         Matches it.</t>
    </list></t>

  <t>We observe that no VRP can have the value "NONE" as its
    VRP ASN. Thus, a Route whose Origin ASN is "NONE" cannot be Matched by
    any VRP. Similarly, no valid Route can have an Origin ASN of
    zero <xref target="AS0"></xref>.
    Thus, no Route can be Matched by a VRP whose ASN is zero.</t>

  <t>When a BGP speaker receives an UPDATE from a neighbor, it SHOULD
    perform a lookup as described above for each of the Routes in the
    UPDATE message. The lookup SHOULD also be applied to routes that
    are redistributed into BGP from another source, such as another
    protocol or a locally defined static route. An implementation MAY
    provide configuration options to control which routes the lookup is
    applied to. The validation state of the Route MUST be set to
    reflect the result of the lookup. The implementation should consider
    the validation state as described in the document as a local
    property or attribute of the Route. If validation is not performed
    on a Route, the implementation SHOULD initialize the validation
    state of such a route to "NotFound".</t>

  <t>Use of the validation state is discussed
    in Sections <xref target="policy_control" format="counter"></xref>
    and <xref target="deployment_consideration" format="counter"></xref>. An implementation
    MUST NOT exclude a route from the Adj-RIB-In or from consideration
    in the decision process as a side effect of its validation state,
    unless explicitly configured to do so.</t>

  <t>We observe that a Route can be Matched or Covered by more than
    one VRP. This procedure does not mandate an order in which VRPs
    must be visited; however, the validation state output is fully
    determined.</t>

 <section title="Pseudo-Code">

  <t>The following pseudo-code illustrates the procedure above. In
    case of ambiguity, the procedure above, rather than the
    pseudo-code, should be taken as authoritative.

  <figure align="center">
   <artwork align="left"><![CDATA[

result = BGP_PFXV_STATE_NOT_FOUND;

//Iterate through all the Covering entries in the local VRP
//database, pfx_validate_table.
entry = next_lookup_result(pfx_validate_table, route_prefix);

while (entry != NULL) {
  prefix_exists = TRUE;

  if (route_prefix_length <= entry->max_length) {
    if (route_origin_as != NONE
        && entry->origin_as != 0
        && route_origin_as == entry->origin_as) {
      result = BGP_PFXV_STATE_VALID;
      return (result);
    }
  }
  entry = next_lookup_result(pfx_validate_table, input.prefix);
}

//If one or more VRP entries Covered the route prefix, but
//none Matched, return "Invalid" validation state.
if (prefix_exists == TRUE) {
  result = BGP_PFXV_STATE_INVALID;
}

return (result);

  ]]></artwork>
  </figure></t>
  </section>
 </section>

 <section anchor="policy_control" title="Policy Control">

  <t>An implementation MUST provide the ability to match and set the
    validation state of routes as part of its route policy filtering
    function. Use of validation state in route policy is elaborated
    in <xref target="deployment_consideration"></xref>. For more details
    on operational policy considerations, see 
<xref target="ORIGIN-OPS"></xref>.</t>

  <t>An implementation MUST also support four-octet AS numbers
    <xref target="RFC4893"></xref>.</t>

 </section>

 <section title="Interaction with Local Cache" anchor="local_cache">

  <t>Each BGP speaker supporting prefix validation as described in
    this document is expected to communicate with one or more RPKI
    caches, each of which stores a local copy of the global RPKI
    database. The protocol mechanisms used to gather and validate
    these data and present them to BGP speakers are described in
    <xref target="RFC6810"></xref>.</t>

  <t>The prefix-to-AS mappings used by the BGP speaker are expected to
    be updated over time. When a mapping is added or deleted, the
    implementation MUST re-validate any affected prefixes and run the
    BGP decision process if needed. An "affected prefix" is any prefix
    that was matched by a deleted or updated mapping, or could be
    matched by an added or updated mapping.</t>

 </section>

 <section anchor="deployment_consideration" title="Deployment Considerations">

  <t>Once a Route is selected for validation, it is categorized
    according the procedure given in
    <xref target="mapping_database"></xref>. Subsequently, routing
    policy as discussed in <xref target="policy_control"></xref> can
    be used to take action based on the validation state.</t>

  <t>Policies that could be implemented include filtering routes
    based on validation state (for example, rejecting all "invalid"
    routes) or adjusting a route's degree of preference in the
    selection algorithm based on its validation state. The latter
    could be accomplished by adjusting the value of such attributes as
    LOCAL_PREF. Considering invalid routes for BGP decision process is
    a purely local policy matter and should be done with utmost care.</t>

  <t>In some cases (particularly when the selection algorithm is
    influenced by the adjustment of a route property that is not
    propagated into Internal BGP (IBGP)) it could be necessary for routing
    correctness to propagate the validation state to the IBGP peer.
    This can be accomplished on the sending side by setting a
    community or extended community based on the validation state, and
    on the receiving side by matching the (extended) community and
    setting the validation state.</t>

 </section>


 <section anchor="Security" title="Security Considerations">

  <t>Although this specification discusses one portion of a system to
    validate BGP routes, it should be noted that it relies on a
    database (RPKI or other) to provide validation information. As
    such, the security properties of that database must be considered
    in order to determine the security provided by the overall
    solution. If "invalid" routes are blocked as this specification
    suggests, the overall system provides a possible denial-of-service
    vector; for example, if an attacker is able to inject (or remove) one
    or more records into (or from) the validation database, it could lead an
    otherwise valid route to be marked as invalid.</t>

  <t>In addition, this system is only able to provide limited
    protection against a determined attacker -- the attacker need only
    prepend the "valid" source AS to a forged BGP route announcement
    in order to defeat the protection provided by this system.</t>

  <t>This mechanism does not protect against "AS-in-the-middle
    attacks" or provide any path validation. It only attempts to
    verify the origin. In general, this system should be thought of
    more as a protection against misconfiguration than as true
    "security" in the strong sense.</t>
 </section>

 <section anchor="Acknowledgments" title="Acknowledgments">

  <t>The authors wish to thank Rex Fernando, Hannes Gredler, Mouhcine
    Guennoun, Russ Housley, Junaid Israr, Miya Kohno, Shin Miyakawa,
    Taka Mizuguchi, Hussein Mouftah, Keyur Patel, Tomoya
    Yoshida, Kannan Varadhan, Wes George, Jay Borkenhagen, and Sandra
    Murphy. The authors are grateful 
    for the feedback from the members of the SIDR working group.</t>

  <t>Junaid Israr's contribution to this specification was part of his
    PhD research work and thesis at University of Ottawa.</t>

 </section>
 </middle>

<back>

   <references title="Normative References">
     <?rfc include="reference.RFC.2119"?>
     <?rfc include="reference.RFC.3779"?>
     <?rfc include="reference.RFC.4271"?>
     <?rfc include="reference.RFC.4632"?>
     <?rfc include="reference.RFC.4893"?>
     <?rfc include="reference.RFC.6482"?>
     </references>
   <references title="Informational References">
     <?rfc include="reference.RFC.6480"?>

<!-- companion doc: draft-ietf-sidr-rpki-rtr -->
<reference anchor='RFC6810'>
<front>
<title>The RPKI/Router Protocol</title>

<author initials='R' surname='Bush' fullname='Randy Bush'>
    <organization />
</author>

<author initials='R' surname='Austein' fullname='Rob Austein'>
    <organization />
</author>

<date month='January' year='2013' />

</front>
<seriesInfo name='RFC' value='6810'/>

</reference>

<!-- draft-ietf-sidr-origin-ops : I-D Exists -->
<reference anchor='ORIGIN-OPS'>
<front>
<title>RPKI-Based Origin Validation Operation</title>

<author initials='R' surname='Bush' fullname='Randy Bush'>
    <organization />
</author>

<date month='August' day='16' year='2012' />

<abstract><t>Deployment of RPKI-based BGP origin validation has many operational considerations.  This document attempts to collect and present the most critical.  It is expected to evolve as RPKI-based origin validation is deployed and the dynamics are better understood.</t></abstract>

</front>
<seriesInfo name='Work in' value='Progress'/>
</reference>

<!-- draft-ietf-idr-as0-06 in queue in MISSREF -->
<reference anchor='AS0'>
<front>
<title>Codification of AS 0 processing.</title>

<author initials='W' surname='Kumari' fullname='Warren Kumari'>
    <organization />
</author>

<author initials='R' surname='Bush' fullname='Randy Bush'>
    <organization />
</author>

<author initials='H' surname='Schiller' fullname='Heather Schiller'>
    <organization />
</author>

<author initials='K' surname='Patel' fullname='Keyur Patel'>
    <organization />
</author>

<date month='August' day='26' year='2012' />

<abstract><t>This document updates RFC 4271 and proscribes the use of Autonomous System (AS) 0 in the Border Gateway Protocol (BGP) OPEN and AS_PATH / AS4_PATH BGP attribute.</t></abstract>

</front>
<seriesInfo name='Work in' value='Progress'/>

</reference>

     </references>

 </back>

</rfc>
