<?xml version="1.0" encoding="US-ASCII"?>

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
        <!ENTITY RFC2119 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
        <!ENTITY RFC8174 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml">
        <!ENTITY RFC4271 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4271.xml">
        <!ENTITY RFC8205 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8205.xml">
        <!ENTITY RFC6483 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6483.xml">
        <!ENTITY RFC7908 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7908.xml">
        <!ENTITY RFC6480 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6480.xml">
        <!ENTITY RFC5280 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5280.xml">
        <!ENTITY RFC3779 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3779.xml">
        <!ENTITY I-D.ietf-grow-route-leak-detection-mitigation SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-ietf-grow-route-leak-detection-mitigation-00.xml">
        <!ENTITY I-D.ietf-sidrops-aspa-profile SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-ietf-sidrops-aspa-profile-00.xml">
        <!ENTITY I-D.ietf-idr-bgp-open-policy SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-ietf-idr-bgp-open-policy-05.xml">
        <!ENTITY I-D.white-sobgp-architecture SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-white-sobgp-architecture-02.xml">
        <!ENTITY I-D.draft-kumari-deprecate-as-set-confed-set SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-kumari-deprecate-as-set-confed-set-12.xml">
        ]>


<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc strict="yes" ?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>

<rfc category="std" docName="draft-ietf-sidrops-aspa-verification-02" ipr="trust200902">
  <front>

    <title abbrev="AS_PATH Verification">
      Verification of AS_PATH Using the Resource Certificate Public Key Infrastructure and Autonomous System Provider Authorization
    </title>

    <author fullname="Alexander Azimov" initials="A"
            surname="Azimov">
      <organization>Yandex</organization>
      <address>
        <email>a.e.azimov@gmail.com</email>
      </address>
    </author>

    <author fullname="Eugene Bogomazov" initials="E"
            surname="Bogomazov">
      <organization>Qrator Labs</organization>
      <address>
        <email>eb@qrator.net</email>
      </address>
    </author>

    <author fullname="Keyur Patel" initials="K"
            surname="Patel">
      <organization>Arrcus, Inc.</organization>
      <address>
        <email>keyur@arrcus.com</email>
      </address>
    </author>

    <author fullname="Job Snijders" initials="J." surname="Snijders">
      <organization abbrev="NTT">NTT Communications</organization>
      <address>
        <postal>
          <street>Theodorus Majofskistraat 100</street>
          <code>1065 SZ</code>
          <city>Amsterdam</city>
          <country>The Netherlands</country>
        </postal>
        <email>job@ntt.net</email>
      </address>
    </author>

    <date />

    <keyword>BGP</keyword>
    <keyword>Route leak</keyword>
    <keyword>Hijacks</keyword>

    <abstract>
      <t>
        This document defines the semantics of an Autonomous System Provider Authorization object in the Resource Public Key Infrastructure to verify the AS_PATH attribute of routes advertised in the Border Gateway Protocol.
      </t>
    </abstract>

    <note title="Requirements Language">
      <t>
        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 <xref target="RFC2119" /> <xref target="RFC8174" /> when, and only when, they appear in all capitals, as shown here.
      </t>
    </note>
  </front>

  <middle>

    <section title="Introduction" anchor="intro">
      <t>
        The Border Gateway Protocol (BGP) was designed without mechanisms to validate BGP attributes.
        Two consequences are BGP Hijacks and BGP Route Leaks <xref target="RFC7908" />.
        BGP extensions are able to partially solve these problems.
        For example, ROA-based Origin Validation <xref target="RFC6483" /> can be used to detect and filter accidental mis-originations, and <xref target="I-D.ietf-grow-route-leak-detection-mitigation" /> can be used to detect accidental route leaks.
        While these upgrades to BGP are quite useful, they still rely on transitive BGP attributes, i.e. AS_PATH, that can be manipulated by attackers.
      </t>
      <t>
        BGPSec <xref target="RFC8205" /> was designed to solve the problem of AS_PATH validation.
        Unfortunately, strict cryptographic validation brought expensive computational overhead for BGP routers.
        BGPSec also proved vulnerable to downgrade attacks that nullify the benefits of AS_PATH signing.
        As a result, to abuse the AS_PATH or any other signed transit attribute, an attacker merely needs to downgrade to 'old' BGP-4.
      </t>
      <t>
        An alternative approach was introduced with soBGP <xref target="I-D.white-sobgp-architecture"/>.
        Instead of strong cryptographic AS_PATH validation, it created an AS_PATH security function based on a shared database of ASN adjacencies.
        While such an approach has reasonable computational
        cost, the two side adjacencies don't provide a way to
        automate anomaly detection without high adoption rate -
        an attacker can easily create a one-way adjacency.
        SO-BGP transported data about adjacencies in new
        additional BGP messages, which was recursively complex thus significantly increasing adoption complexity and risk.
        In addition, the general goal to verify all AS_PATHs was
        not achievable given the indirect adjacencies at internet exchange points.
      </t>
      <t>
        Instead of checking AS_PATH correctness, this document focuses on solving real-world operational problems - automatic detection of malicious hijacks and route leaks.
        To achieve this a new AS_PATH verification
        procedure is defined which is able to automatically
        detect invalid (malformed) AS_PATHs in announcements that are received from customers and peers.
        This procedure uses a shared signed database of
        customer-to-provider relationships using a
        new RPKI object - Autonomous System Provider Authorization (ASPA).
        This technique provides benefits for participants
        even during early and incremental adoption.
      </t>

    </section>

    <section title="Anomaly Propagation" anchor="propagation">
      <t>
        Both route leaks and hijacks have similar effects on ISP operations - they redirect traffic, resulting in increased latency, packet loss, or possible MiTM attacks.
        But the level of risk depends significantly on the propagation of the anomalies.
        For example, a hijack that is propagated only to customers may concentrate traffic in a particular ISP's customer cone; while if the anomaly is propagated through peers, upstreams, or reaches Tier-1 networks, thus distributing globally, traffic may be redirected at the level of entire countries and/or global providers.
      </t>
      <t>
        The ability to constrain propagation of BGP anomalies to upstreams and peers, without requiring support from the source of the anomaly (which is critical if source has malicious intent), should significantly improve the security of inter-domain routing and solve the majority of problems.
      </t>
    </section>

    <section title="Autonomous System Provider Authorization" anchor="ASPA">
      <t>
        As described in <xref target="RFC6480" />, the RPKI is based on a hierarchy of resource certificates that are aligned to the Internet Number Resource allocation structure.
        Resource certificates are X.509 certificates that conform to the PKIX profile <xref target="RFC5280" />, and to the extensions for IP addresses and AS identifiers <xref target="RFC3779" />.
        A resource certificate is a binding by an issuer of IP address blocks and Autonomous System (AS) numbers to the subject of a certificate, identified by the unique association of the subject's private key with the public key contained in the resource certificate.
        The RPKI is structured so that each current resource certificate matches a current resource allocation or assignment.
      </t>

      <t>
        ASPAs are digitally signed objects that bind, for a selected AFI, a Set of Provider AS numbers to a Customer AS number (in terms of BGP announcements not business), and are signed by the holder of the Customer AS.
        An ASPA  attests that a Customer AS holder (CAS) has authorized Set of Provider ASes (SPAS) to propagate the Customer's IPv4/IPv6 announcements onward, e.g. to the Provider's upstream providers or peers.
        The ASPA record profile is described in <xref target="I-D.ietf-sidrops-aspa-profile"/>.
      </t>

    </section>

    <section title="Customer-Provider Verification Procedure" anchor="pair-verification">
      <t>
        This section describes an abstract procedure that checks that a pair of ASNs (AS1, AS2) is included in the set of signed ASPAs.
        The semantics of its use is defined in next section.
        The procedure takes (AS1, AS2, ROUTE_AFI) as input parameters and returns one of three results: "valid", "invalid" and "unknown".
      </t>
      <t>
        A relying party (RP) must have access to a local cache of the complete set of cryptographically valid ASPAs when performing customer-provider verification procedure.
      </t>

      <t>
        <list style="numbers">
          <t>
            Retrieve all cryptographically valid ASPAs in a selected AFI with a customer value of AS1.
            The union of SPAS forms the set of "Candidate Providers."
          </t>
          <t>
            If the set of Candidate Providers is empty, then the procedure exits with an outcome of "unknown."
          </t>
          <t>
            If AS2 is included in the set of Candidate Providers, then the procedure exits with an outcome of "valid."
          </t>
          <t>
            Otherwise, the procedure exits with an outcome of "invalid."
          </t>
        </list>

      </t>
      <t>
        Since an AS1 may have different set providers in different AFI, it should also have different PCAS in corresponding ASPAs.
        In this case, the output of this procedure with input (AS1, AS2, ROUTE_AFI) may have different output for different ROUTE_AFI values.
      </t>
    </section>

    <section title="AS_PATH Verification">
      <t>
        The AS_PATH attribute identifies the autonomous systems through which an UPDATE message has passed.
        AS_PATH may contain two types of components: ordered AS_SEQes and unordered AS_SETs, as defined in <xref target="RFC4271" />.
      </t>
      <t>
        The value of each concatenated value of AS_SEQ components can be described as set of pairs {(AS(I), prepend(I)), (AS(I-1), prepend(I-1))...}, where AS(0) stands for originating AS.
        In this case, the sequence {AS(I), AS(I-1),...} represents different ASNs, that packet should pass towards the destination.
			</t>
			<t>
				The bellow procedure is applicable only for 32-bit AS number compatible BGP speakers.
			</t>

			<section title="Upstream Paths">
				<t>
					When a route is received from a customer, literal peer or by RS at IX, each pair (AS(I-1), AS(I)) MUST belong to customer-provider or sibling relationship.
					If there are other types of relationships, it means that the route was leaked or the AS_PATH attribute was malformed.
					The goal of the described bellow procedure is to check the correctness of this statement.
				</t>

				<t>
          The following diagram and procedure describes the procedure that MUST be applied on routes with ROUTE_AFI received from a customer, peer or RS-client:
          <figure>
            <artwork>
(AS(I-1),AS(I))=Valid
    +-----+
    |     |
    v     |
  +---------+
  |         |  (AS(I-1),AS(I))=Invalid
  |  Valid  +----------------------------+
  |         |                            |
  +---------+                            |
       |                            +----v----+
       |                            |         |
       |(AS(I-1),AS(I))=Unknown     | Invalid |
       |                            |         |
       |                            +---------+
  +----v----+                            ^
  |         |                            |
  | Unknown +----------------------------+
  |         |  (AS(I-1),(AS(I))=Invalid
  +---------+
    ^     |
    |     |
    +-----+
(AS(I-1),AS(I))!=Invalid

            </artwork>
          </figure>
					<list style="numbers">
						<t>
							If the closest AS in the AS_PATH is not the receiver's neighbor ASN then procedure halts with the outcome "invalid";
						</t>
						<t>
							If there is a pair (AS(I-1), AS(I)), and customer-provider verification procedure (<xref target="pair-verification"/>) with parameters (AS(I-1), AS(I), ROUTE_AFI) returns "invalid" then the procedure also halts with the outcome "invalid";
						</t>
						<t>
							If the AS_PATH has at least one AS_SET segment then procedure halts with the outcome "unverifiable";
						</t>
            <t>
							If there is a pair (AS(I-1), AS(I)), and customer-provider verification procedure (<xref target="pair-verification"/>) with parameters (AS(I-1), AS(I), ROUTE_AFI) returns "unknown" then the procedure also halts with the outcome "unknown";
            </t>
						<t>
							Otherwise, the procedure halts with an outcome of "valid".
						</t>
					</list>
				</t>
			</section>

			<section title="Downstream Paths">
				<t>
					When route is received from provider or RS it may have both Upstream and Downstream paths, where Downstream follows Upstream path.
          If the path differs from this rule, e.g. the Downstream path is followed by Upstream path it means that the route was leaked or the AS_PATH attribute was malformed.
					The first pair (AS(I-1), AS(I)) that has "invalid" outcome of customer-provider verification procedure indicates the end of Upstream path.
					All subsequent reverse pairs (AS(I), AS(I-1)) MUST belong to customer-provider or sibling relationship, thus can be also verified with ASPA objects.
				</t>
				<t>
					Additional caution should be done while processing prefixes that are received from transparent IXes since they don't add their ASN in the ASPATH.
				</t>
				<t>
          The following diagram and procedure describes the procedure that MUST be applied on routes with ROUTE_AFI received from a provider or RS:
          <figure>
            <artwork>
(AS(I-1),AS(I))=Valid            (AS(I),AS(I-1))=Valid
    +-----+                           +-----+
    |     |                           |     |
    v     |                           v     |
  +-+-----+-+                       +-+-----+-+
  |         |(AS(I-1),AS(I))=Invalid|         |(AS(I),AS(I-1))=Invalid
  |  Valid  +----------------------->  Valid  +---------+
  |         |                       |         |         |
  +----+----+                       +----+----+         |
       |                                 |          +---v-----+
       |(AS(I-1),AS(I))=Unknown          |          |         |
       |                                 |          | Invalid |
       |           (AS(I),AS(I-1)=Unknown|          |         |
       |                                 |          +---+-----+
  +----v----+                       +----v----+         ^
  |         |                       |         |         |
  | Unknown +-----------------------> Unknown +---------+
  |         |(AS(I-1),AS(I))=Invalid|         |(AS(I),AS(I-1))=Invalid
  +-+-----+-+                       +-+-----+-+
    ^     |                           ^     |
    |     |                           |     |
    +-----+                           +-----+
(AS(I-1),AS(I))!=Invalid         (AS(I),AS(I-1))!=Invalid

            </artwork>
          </figure>
					<list style="numbers">
						<t>
							If route is received from provider and the closest AS in the AS_PATH is not the receiver's neighbor ASN then procedure halts with the outcome "invalid";
						</t>
						<t>
	            If there are two pairs (AS(I-1), AS(I)), (AS(J-1), AS(J)) with J > I, and customer-provider verification procedure (<xref target="pair-verification"/>) returns "invalid" for both (AS(I-1), AS(I), ROUTE_AFI) and (AS(J), AS(J-1), ROUTE_AFI), then the procedure also halts with the outcome "invalid";
						</t>
						<t>
							If the AS_PATH has at least one AS_SET segment then procedure halts with the outcome "unverifiable";
						</t>
            <t>
	            If there are two pairs (AS(I-1), AS(I)), (AS(J-1), AS(J)) with J > I, and customer-provider verification procedure (<xref target="pair-verification"/>) returns "invalid" for (AS(I-1), AS(I), ROUTE_AFI) and "unknown" for (AS(J), AS(J-1), ROUTE_AFI), then the procedure also halts with the outcome "unknown";
            </t>
            <t>
	            If customer-provider verification procedure (<xref target="pair-verification"/>) doesn't return "invalid" for any (AS(I-1), AS(I)), but at least for one (AS(I-1), AS(I)) returns "unknown", then the procedure also halts with the outcome "unknown";
            </t>
						<t>
							Otherwise, the procedure halts with an outcome of "valid".
						</t>
					</list>
				</t>

			</section>
			<section title="Mitigation">
				<t>
					If the output of the AS_PATH verification procedure is "invalid" the route MUST be rejected.
				</t>
				<t>
					If the output of the AS_PATH verification procedure is 'unverifiable' it means that AS_PATH can't be fully checked.
					Such routes should be treated with caution and SHOULD be processed the same way as "invalid" routes.
					This policy goes with full correspondence to <xref target="I-D.kumari-deprecate-as-set-confed-set"/>.
				</t>
				<t>
					The above AS_PATH verification procedure is able to check routes received from customers and peers.
					The ASPA mechanism combined with BGP Roles <xref target="I-D.ietf-idr-bgp-open-policy" /> and ROA-based Origin Validation <xref target="RFC6483" /> provide a fully automated solution to detect and filter hijacks and route leaks, including malicious ones.
				</t>
			</section>
    </section>

    <section title="Disavowal of Provider Authorizaion">
      <t>
        An ASPA is a positive attestation that an AS holder has authorized its providers to redistribute received routes to the provider's providers and peers.
        This does not preclude the provider ASes from redistribution to its other customers.
        By creating an ASPA with providers set of {0}, the customer indicates that no provider should further announce its routes.
        Specifically, AS 0 is reserved to identify provider-free networks, Internet exchange meshes, etc.
      </t>

      <t>
        An ASPA with a providers set of {0} is a statement by the customer AS that its routes should not be received by any relying party AS from any of its customers or peers.
      </t>

      <t>
        By convention, an ASPA with providers set of {0} should be the only ASPA issued by a given AS holder; although this is not a strict requirement.

        A provider AS 0 may coexist with other provider ASes in the same ASPA (or other ASPA records); though in such cases, the presence or absence of the provider AS 0 in ASPA does not alter the AS_PATH verification procedure.
      </t>
    </section>

    <section title="Siblings (Complex Relations)" anchor="Siblings">
      <t>
        There are peering relationships which can not be described as strictly simple peer-peer or customer-provider; e.g. when both parties are intentionally sending prefixes received from each other to their peers and/or upstreams.
      </t>

      <t>
        In this case, two corresponding ASPA records (AS1, {AS2, ...}), (AS2, {AS1, ...}) must be created by AS1 and AS2 respectively.
      </t>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>
        The proposed mechanism is compatible only with BGP implementations that can process 32-bit ASNs in the ASPATH.
        This limitation should not have a real effect on operations - such legacy BGP routers a rare and it's highly unlikely that they do support integration with RPKI.
      </t>

      <t>
        ASPA issuers should be aware of the verification implication in issuing an ASPA - an ASPA implicitly invalidates all routes passed to upstream providers other than the provider ASs listed in the collection of ASPAs.
        It is the Customer AS's duty to maintain a correct set of providers in ASPA.
      </t>

      <t>
        While it's not restricted, but it's highly recommended maintaining for selected Customer AS a single ASPA object that covers all its providers.
        Such policy should prevent race conditions during ASPA updates that might affect prefix propagation.
      </t>

      <t>
        While the ASPA is capable to detect both mistake and malicious activity for routes received from customers, RS-clients or peers, it provides only detection of mistakes for routes that are received from upstream providers and RS(s).
      </t>

      <t>
				Since upstream provider becomes a trusted point, it will be able to send hijacked prefixes of its customers or send hijacked prefixes with malformed AS_PATHs back.
        While it may happen in theory, it's doesn't seem to be a real scenario: normally customer and provider have a signed agreement and such policy violation should have legal consequences or customer can just drop relation with such provider and remove corresponding ASPA record.
      </t>
    </section>

    <section anchor="Acknowledgments" title="Acknowledgments">
      <t>
        The authors wish to thank authors of <xref target="RFC6483" /> since its text was used as an example while writing this document.
				The also authors wish to thank Iljitsch van Beijnum for giving a hint about Downstream paths.
      </t>
    </section>

  </middle>
  <back>
    <references title="Normative References">
      &RFC2119;
      &RFC8174;
    </references>

    <references title="Informative References">
      &RFC7908;
      &RFC8205;
      &RFC6483;
      &RFC6480;
      &RFC5280;
      &RFC4271;
      &RFC3779;
      &I-D.ietf-grow-route-leak-detection-mitigation;
      &I-D.ietf-idr-bgp-open-policy;
      &I-D.white-sobgp-architecture;
      &I-D.ietf-sidrops-aspa-profile;
      &I-D.draft-kumari-deprecate-as-set-confed-set;
    </references>
  </back>
</rfc>


