<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="std" docName="draft-chen-grow-enhanced-as-loop-detection-08"
     ipr="trust200902">
  <front>
    <title abbrev="Enhanced AS-Loop Detection">Enhanced AS-Loop Detection for
    BGP</title>

    <author fullname="Huanan Chen" initials="H. " surname="Chen">
      <organization>China Telecom</organization>

      <address>
        <postal>
          <street>109, West Zhongshan Road, Tianhe District</street>

          <city>Guangzhou</city>

          <code>510000</code>

          <country>China</country>
        </postal>

        <email>chenhuan6@chinatelecom.cn</email>
      </address>
    </author>

    <author fullname="Di Ma" initials="D." surname="Ma">
      <organization>ZDNS</organization>

      <address>
        <postal>
          <street>4 South 4th St. Zhongguancun</street>

          <city>Beijing</city>

          <region>Haidian</region>

          <code/>

          <country>China</country>
        </postal>

        <phone/>

        <facsimile/>

        <email>madi@zdns.cn</email>

        <uri/>
      </address>
    </author>

    <author fullname="Nan Geng" initials="N. " surname="Geng">
      <organization>Huawei</organization>

      <address>
        <postal>
          <street>Huawei Bld., No.156 Beiqing Rd.</street>

          <city>Beijing</city>

          <code>100095</code>

          <country>China</country>
        </postal>

        <email>gengnan@huawei.com</email>
      </address>
    </author>

    <author fullname="Shunwan Zhuang" initials="S. " surname="Zhuang">
      <organization>Huawei</organization>

      <address>
        <postal>
          <street>Huawei Bld., No.156 Beiqing Rd.</street>

          <city>Beijing</city>

          <code>100095</code>

          <country>China</country>
        </postal>

        <email>zhuangshunwan@huawei.com</email>
      </address>
    </author>

    <author fullname="Haibo Wang" initials="H. " surname="Wang">
      <organization>Huawei</organization>

      <address>
        <postal>
          <street>Huawei Bld., No.156 Beiqing Rd.</street>

          <city>Beijing</city>

          <code>100095</code>

          <country>China</country>
        </postal>

        <email>rainsword.wang@huawei.com</email>
      </address>
    </author>

    <date day="26" month="November" year="2025"/>

    <area>General</area>
    <workgroup>Global Routing Operations</workgroup>

    <abstract>
      <t>Misconfiguration and malicious manipulation of BGP AS_Path may lead
      to route hijack. This document proposes to enhance the BGP <xref
      target="RFC4271"/> Inbound/ Outbound route processing in the case of
      detecting an AS loop. It is an enhancement to the current BGP's
      Inbound/Outbound processing and can be implemented directly on the
      device, and this document also proposes a centralized usecase. This
      could empower networks to quickly and accurately figure out they're
      being victimized.</t>

      <t>Two options are proposed for the enhancement, a) a local check at the
      device; b) data collection/analysis at the remote network controller/
      server. Both approaches are beneficial for route hijack detection.</t>
    </abstract>

    <note title="Requirements Language">
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
      document are to be interpreted as described in <xref
      target="RFC2119">RFC 2119</xref>.</t>
    </note>
  </front>

  <middle>
    <section title="Introduction">
      <t>The Border Gateway Protocol (BGP) <xref target="RFC4271"/>, as an
      inter-autonomous (AS) routing protocol, is used to exchange network
      reachability information between BGP systems. BGP is widely used by
      Internet Service Providers (ISPs) and large organizations.</t>

      <t>As a distance-vector based protocol, BGP is used to exchange
      reachable inter-AS routes, establish inter-AS paths, avoid routing
      loops, and apply routing policies between ASs. BGP loop detection
      mechanism is defined in section 9.1.2. of RFC4271:</t>

      <t><list style="empty">
          <t>...</t>

          <t>If the AS_PATH attribute of a BGP route contains an AS loop, the
          BGP route should be excluded from the Phase 2 decision function. AS
          loop detection is done by scanning the full AS path (as specified in
          the AS_PATH attribute), and checking that the autonomous system
          number of the local system does not appear in the AS path.
          Operations of a BGP speaker that is configured to accept routes with
          its own autonomous system number in the AS path are outside the
          scope of this document.</t>

          <t>...</t>
        </list></t>

      <t>In ordinary BGP, every AS announces its route information with
      different prefixes. However, its neighboring ASes cannot validate this
      route information, but rather directly propagate it across the Internet
      or simply discard AS-Loop routes directly. Obviously, this weak trust
      model allows forged route announcement propagations and rarely been
      found, which is a fundamental security weakness of BGP. Forged routes,
      which can be generated by configuration errors or malicious attacks, can
      lead to large-scale network connectivity issues.</t>

      <t>Some cases can be worse, hackers exploit this property of BGP to
      achieve their ulterior motives. They can add some providers' AS number
      into the forged AS-Path and attempt to make it look like the route had
      passed through these ASNs, or perhaps they are there to prevent those
      providers from carrying the route. These cases are also being known
      As-Path Poisoning Attacks.</t>

      <t>ASPA <xref target="I-D.ietf-sidrops-aspa-verification"/> can be used
      to verify the AS_PATH attribute of routes advertised in the Border
      Gateway Protocol, and it is a systematic deployment based on RPKI
      system. This mechanism requires a series of infrastructure
      implementations.</t>

      <t>This document proposes to enhance AS-Loop Detection for BGP
      Inbound/Outbound Route Processing when detecting AS loop in order to
      identify possible BGP hijacks. It is an enhancement to the current BGP's
      Inbound/Outbound processing and can be implemented directly on the
      device, and this document also proposes a centralized usecase. This
      could empower networks to quickly and accurately figure out they're
      being victimized.</t>

      <t/>
    </section>

    <section title="Terminology">
      <t>The following terminology is used in this document.</t>

      <t>AS: Autonomous System</t>

      <t>ASPA: Autonomous System Provider Authorization</t>

      <t>BGP: Border Gateway Protocol</t>

      <t>BGP hijacking : is the illegitimate takeover of groups of IP
      addresses by corrupting Internet routing tables maintained using the
      Border Gateway Protocol (BGP). (Sometimes referred to as prefix
      hijacking, route hijacking or IP hijacking)</t>

      <t>EBGP: External BGP</t>

      <t>ISP: Internet Service Provider</t>

      <t>BMP: BGP Monitoring Protocol</t>

      <t>ROA: Route Origin Authorization</t>

      <t/>
    </section>

    <section title="Forged AS_PATH Examples">
      <t/>

      <section title="AS Loop Detected at Inbound Processing">
        <t/>

        <t><list style="symbols">
            <t>Forged Case 1: AS shown in Figure 1, an upstream AS of AS64596
            forged a route with the ASN 64596 as the origin ASN in the AS-
            Path.</t>

            <t>Forged Case 2: AS shown in Figure 1, an upstream AS of AS64596
            forged a route with the ASN 64596 as the transit ASN in the AS-
            Path.</t>
          </list><figure align="left">
            <artwork><![CDATA[
   AS-Loop-Detecting at this point
   Discard AS-Loop Routes directly that contains AS64596
                 |
                 |                                 x.y.z.0/24 
                 v                                 Origin AS 64600
AS64595---AS64596---AS64597---AS64598---AS64599----AS64600
                    From AS64597, To AS64596:
                    Normal Case:
                    <-- x.y.z.0/24, AS-Path: 64597 64598 64599 64600
                      
                    Forged Case 1:
                    <-- x.y.z.0/24, AS-Path: 64597 64596
                                        (Or: 64597 64598 64596 etc.)
                    
                    Forged Case 2:
                    <-- x.y.z.0/24, AS-Path: 64597 64596 64600
                                        (Or: 64597 64596 64599 64600 etc.)

    Figure 1: BGP Inbound Route Processing in AS64596

]]></artwork>
          </figure>After receiving the above routes, AS64596 treats them as
        normal loop routes during the loop detecting phase and discards them
        directly. In most NOSes (Network Operation Systems), such rejected
        routes are not logged and only visible by putting the router into
        debugging mode. If the AS64596 is slightly enhanced, it can find that
        someone has faked himself, which may cause unnecessary trouble for
        himself.</t>

        <t/>
      </section>

      <section title="AS Loop Detected at Outbound Processing">
        <t>Split-Horizon for EBGP is an optional function that a BGP sender
        will not advertise any routes that were previously received from that
        same AS. In some current implementation, the BGP outbound route
        processing step will simply discard the route if AS-Loop being
        detected.</t>

        <t><list style="symbols">
            <t>Forged Case 3: AS shown in Figure 2, an upstream AS of AS64597
            forged a route with the ASN 64596 as the origin ASN in the AS-
            Path.</t>

            <t>Forged Case 4: AS shown in Figure 2, an upstream AS of AS64597
            forged a route with the ASN 64596 as the transit ASN in the AS-
            Path.</t>
          </list><figure align="left">
            <artwork><![CDATA[
    Split-Horizon Enable & AS-Loop-Detecting at this point
    Discard AS-Loop Routes directly if sending AS-Path contains AS64596
                   |
                   |                               x.y.z.0/24
                   v                               Origin AS 64600
AS64595---AS64596---AS64597---AS64598---AS64599----AS64600
                    From AS64597, To AS64596:
                    Normal Case:
                    <-- x.y.z.0/24, AS-Path: 64597 64598 64599 64600
                      
                    Forged Case 3:
                    <-- x.y.z.0/24, AS-Path: 64597 64596
                                            (Or: 64597 64598 64596 etc.)
                    
                    Forged Case 4:
                    <-- x.y.z.0/24, AS-Path: 64597 64596 64600
                                        (Or: 64597 64596 64599 64600 etc.)

    Figure 2: BGP Outbound Route Processing in AS64597

]]></artwork>
          </figure>When sending the above routes, AS64597 treats them as
        normal loop routes and discards them directly. If AS64597 is slightly
        enhanced, it can find that someone has faked AS64596, which may cause
        large-scale network connectivity problems.</t>

        <t/>
      </section>
    </section>

    <section title="Enhancement to BGP Inbound/Outbound Processing">
      <t/>

      <section title="Enhancement for AS Loop Detected at Inbound Process">
        <t>Currently, ROV <xref target="RFC6811"/> and ASPA verification <xref
        target="I-D.ietf-sidrops-aspa-verification"/> can be adopted for BGP
        leak/ hijack detection. However, for the forged case 1&amp;2, the
        conventional BGP inbound process would simply discard the routes with
        AS loop before any further leak/hajack detection.</t>

        <t>This document suggests further analysis of such routes. The
        analysis may include mechanisms that apply to normal routes for hijack
        detection, such as ROV, ASPA and so on. The detailed analyzing
        mechanisms as well as the corresponding actions w.r.t. the analysis
        are outside the scope of this document. Two options of where the
        analysis of the inbound processing enhancement takes place is
        proposed.</t>

        <t><list style="symbols">
            <t>Option 1: Analyze the routes with AS loop based on local
            database.</t>

            <t>Option 2: Collect the routes with AS loop with BMP and analyze
            them at the remote controller/server.</t>
          </list></t>

        <t/>
      </section>

      <section title="Enhancement for AS Loop Detected at Outbound Process">
        <t>Currently, the egress ROV can be adopted for BGP hijack detection.
        However, for forged case 3&amp;4, when eBGP Split-Horizon is enabled,
        the routes with AS loop could possibly be discarded before any hijack
        detection.</t>

        <t>This document suggests further analysis of such routes. The
        analysis may include mechanisms that apply to normal routes for hijack
        detection, such as egress ROV, ASPA and so on. The detailed analyzing
        mechanisms as well as the corresponding actions w.r.t. the analysis
        are outside the scope of this document.</t>

        <t>Two options of where the analysis of the outbound processing
        enhancement takes place is proposed.</t>

        <t><list style="symbols">
            <t>Option 1: Analyze the routes with AS loop based on local
            database.</t>

            <t>Option 2: Collect the routes with AS loop with BMP and analyze
            them at the remote controller/server.</t>
          </list></t>

        <t/>
      </section>
    </section>

    <section title="Centralized AS-Loop Detection for BGP ">
      <t>Considering the challenges facing the existing approaches, this
      section proposes a centralized method. It utilizes the BGP Monitoring
      Protocol (BMP) to convey the AS Path Looped Update message from the
      monitored device to the BMP server to realize centralized attack
      detection.</t>

      <t>BMP is currently deployed by OTT and Carriers to monitor the BGP
      routes, such as monitoring BGP Adj-RIB-In using the process defined in
      RFC7854 <xref target="RFC7854"/>, and monitoring BGP Adj-RIB-Out using
      the process defined in RFC8761 <xref target="RFC8671"/>. This document
      extends Route Mirroring message to mirror AS Path Looped update message
      to the BMP Server.</t>

      <t/>

      <section title="BMP Support for Monitoring AS Path Looped Update Message">
        <t>Per RFC7854, Route Mirroring messages can be used to mirror the
        messages that have been treated-as-withdraw <xref target="RFC7606"/>,
        for debugging purposes. This document extends Route Mirroring message
        to mirror AS Path Looped update message to the BMP Server.</t>

        <t>This document adds a new code for Type 1 Information TLV:</t>

        <t><list style="symbols">
            <t>Code = TBD: AS Path Looped. The BGP Message TLV occurs in the
            Route Mirroring message and whose loop includes the local AS.</t>
          </list></t>

        <t>Following the common BMP header and per-peer header is an
        Information TLV (Type = 1) with Code = TBD: AS Path Looped, and then a
        BGP Message TLV (Type = 0) contain an AS Path Looped Update
        Message.</t>

        <t><figure align="left">
            <artwork><![CDATA[ 
+---------------------------------------------------------------+
|         Common BMP Header (Message Type = 6)                  |
+---------------------------------------------------------------+
|                    Per peer Header                            |
+---------------------------------------------------------------+
| Information TLV (Type = 1) with Code = TBD: AS Path Looped    |
+---------------------------------------------------------------+
|         BGP Message TLV (Type = 0)                            |
+---------------------------------------------------------------+

Figure 3: AS Path Looped Update Message Carrying in the Route 
Mirroring Message  

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

      <section title="Application Example">
        <t>This section describe a centralized application example. As shown
        in Figure 4, when receiving the routes from AS64597, AS64596 should
        check whether its own AS number is already in the AS-Path, If yes, it
        further encapsulate the AS Path Looped Update Message in the Route
        Mirroring message and sends the Route Mirroring message to the BMP
        Server.</t>

        <t>The Analyzer gets the AS Path Looped Update Messages from the BMP
        Server and further processes them.</t>

        <t/>

        <t><figure align="left">
            <artwork><![CDATA[ 
                        +------------+                                    
                        | BMP server |                                    
                        |     +      |                                    
                        |  Analyzer  |                                    
                        +------+-----+                                    
   BMP Mirroring Message:      \                                          
   AS Path Looped Update Message\to BMP Server                                       
                                 \                                       
                                  \                                       
               ********************|****                                  
               *                   |   *                                  
               *          AS64596  |   *        "AS64597 Send Routes      
               *                   |   *  <----- to AS64596"              
  +-------+    *  +---+         +---+  *  +-------+                       
  +AS64595+-------+ R1+---------+ R2|-----+AS64597+---64598 64599 64600
  +-------+    *  +-+-+\        +---+  *  +-------+                       
               *    |   \\    //  |\   *                                  
               *    |     \\//    | \  *                                  
               *    |     //\     |  \ *      +-------+                   
               *    |   //   \\   |   \+------+AS64593+                   
               *    |  /       \  |    *      +-------+                   
  +-------+    *  +-+-+         +-+-+  *      +-------+                   
  +AS64594+----+--+ R3+---------+ R4+---------+AS64592+                   
  +-------+    *  +---+         +---+  *      +-------+                   
               *                       *                                  
               *************************                                  


Figure 4: Centralized AS-Loop Detection  

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

        <t>From the perspective of the local AS, it can manage/hold the
        AS-relationship database between the local AS and each of its
        neighboring ASs (such as C2P, P2P, P2C, etc.).</t>

        <t><figure align="left">
            <artwork><![CDATA[ 
+--------------------------------------------------+
|   Neighboring AS  |  AS-relationship to AS64596  |
+--------------------------------------------------+
|   64592           |  P2P                         |
+--------------------------------------------------+
|   64593           |  S2S                         |
+--------------------------------------------------+
|   64594           |  C2P                         |
+--------------------------------------------------+
|   64595           |  P2C                         |
+--------------------------------------------------+
|   64597           |  P2P                         |
+--------------------------------------------------+
 
Figure 5: AS64596's AS-Relationship Database

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

        <t>When AS 64596 is listed as transit AS in the AS-Path, for example,
        AS-Path looks like the following form AS64596's perspective:</t>

        <t>(possible other ASes), left AS, local AS(64596), right AS,
        (possible other ASes)</t>

        <t>At this point, AS64596's Analyzer can lookup the local resource
        database and check whether there is a real AS relationship between the
        local AS and the left AS and the right AS.</t>

        <t/>
      </section>
    </section>

    <section title="Benefits">
      <t>After the enhancements of the AS Loop Detection for BGP
      Inbound/Outbound Route Processing are added, the stability and security
      of the network can be improved.</t>

      <t/>
    </section>

    <section title="Acknowledgements">
      <t>The authors would like to acknowledge the review and inputs from Gang
      Yan, Zhenbin Li, Aijun Wang, Jeff Haas, Robert Raszuk, Chris Morrow,
      Alexander Asimov, Ruediger Volk, Jescia Chen and the working group.</t>

      <t/>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t>This document defines one type for information carried in the Route
      Mirroring Information (Section 4.7 of RFC7854) code:</t>

      <t><list style="symbols">
          <t>Code = TBD: AS Path Looped.</t>
        </list></t>

      <t/>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>This document does not change the underlying security issues in the
      BGP protocol. It however, does provide an additional mechanism to
      protect against attacks based on the forged AS-Path in the BGP
      routes.</t>

      <t/>
    </section>

    <section title="Contributors">
      <t>The following people made significant contributions to this
      document:</t>

      <t>Yunan Gu</t>

      <t>Huawei Email: guyunan@huawei.com</t>

      <t/>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119"?>

      <?rfc include='reference.RFC.4271'?>

      <?rfc include='reference.RFC.4760'?>

      <?rfc include='reference.RFC.6811'?>

      <?rfc include='reference.RFC.7606'?>

      <?rfc include='reference.RFC.7854'?>

      <?rfc include='reference.RFC.8671'?>

      <?rfc include='reference.I-D.ietf-sidrops-aspa-verification'?>
    </references>
  </back>
</rfc>
