This article from Cloudflare discusses critical vulnerabilities in Border Gateway Protocol (BGP) routing, specifically focusing on route hijacks facilitated by forged AS_PATHs. It highlights the importance of enforcing the 'First AS' rule in BGP advertisements to prevent attackers from manipulating network paths, redirecting traffic, and concealing their identity. The piece examines real-world hijack examples and Cloudflare's stress-testing of Tier 1 networks to gauge adherence to this essential security measure.
Read original on Cloudflare BlogThe Border Gateway Protocol (BGP) is the de-facto routing protocol that glues the Internet together, dictating how traffic flows between Autonomous Systems (ASNs). A fundamental component of BGP is the AS_PATH attribute, which records the sequence of ASNs a route traverses. This path information is crucial for path selection (determining the 'best' route) and loop prevention. However, as demonstrated by recent route hijacks, the AS_PATH can be manipulated by malicious actors.
Attackers exploit weaknesses in BGP implementations by forging AS_PATHs to misdirect traffic. This can involve:
Impact of BGP Hijacks
BGP hijacks can lead to severe consequences, including traffic interception, redirection to malicious servers (e.g., for phishing or malware distribution), denial of service, and significant financial losses for network operators and their customers. The decentralized nature of BGP and the historical reliance on trust make these attacks particularly challenging to mitigate without proper enforcement mechanisms.
A simple yet powerful defense against these forged AS_PATH attacks is the First AS enforcement rule. This rule mandates that when an external BGP peer advertises a route, the leftmost (first) AS in the AS_PATH attribute MUST match the autonomous system number of the peering network that sent the message. If there's a mismatch, the route is considered malformed and should be dropped (ideally via the `treat-as-withdraw` method as per RFC 7606, to avoid session resets).
RFC 4271 outlines this procedure, and later RFC 7606 refined the error handling. While RPKI ROAs (Route Origin Authorizations) and ASPA (Autonomous System Provider Authorization) help validate route origins and provider relationships, they cannot fully protect against hijacks where the AS_PATH itself is severely manipulated and lacks sufficient information, making First AS enforcement a crucial last line of defense.
Cloudflare conducted a test by intentionally violating the First AS rule when advertising prefixes to Tier 1 networks. Their goal was to assess how widely this fundamental security measure is enforced across the Internet backbone. They advertised prefixes with a deliberately incorrect first AS in the AS_PATH, expecting networks either to drop the route or accept it.
policy-options policy-statement 4-TELIA-ACCEPT-EXPORT term ADV-FIRST-AS-PROBE-CR-1695522 from { community ANYCAST-ROUTE; prefix-list fl_first_as_prober; route-type internal; } then { origin igp; as-path-prepend 402542; next-hop self; accept; }Their findings indicated that while some networks correctly drop the malformed routes, others do not. Worryingly, some older implementations still reset BGP sessions entirely upon receiving such malformed paths, highlighting a need for broader adoption of robust error handling (RFC 7606's `treat-as-withdraw`). The critical takeaway is that despite clear RFC guidance, First AS enforcement is not universally applied, leaving the Internet's routing infrastructure vulnerable to manipulation.