BGP AS_PATH の最初の AS を強制する仕組みの導入
Cloudflare は、Spamhaus が報告した BGP ルートハイジャック事件を分析し、不正な AS_PATH の作成を防ぐための「First AS」検証という具体的な対策の重要性と実装状況を明らかにした。
キーポイント
未使用 ASN を悪用した偽造 AS_PATH の実態
攻撃者が未使用の自律システム番号(ASN)を流用し、不自然な経路順序を含む偽の AS_PATH を作成してトラフィックを誘導する手口が確認された。
First AS 検証による防御策の有効性
BGP ピアが広告するルートに自社の ASN を必ず「最初の要素(First AS)」として含めることを義務付ける単純かつ強力な検証手法が提案されている。
主要ネットワークのセキュリティ実装状況調査
Cloudflare は複数の大手ネットワークをテストし、この First AS 検証という基本的な防御策がどの程度実装されているかを評価した結果を示している。
偽装された BGP パスとハッカーの戦略
攻撃者は Cloudflare の ASN を含む偽の AS_PATH を作成し、Gcore が検証をスキップしたことで不正な経路が伝播しました。
First AS 検証の重要性と ASPA の限界
ASPA は有効化された経路でも攻撃者が回避できるため、BGP に組み込まれた First AS チェックと強制の実施が必須です。
Gcore における検証スキップの疑い
Gcore (AS199524) は顧客 ASN と期待される最初の AS の一致を確認・強制するステップを省略している可能性が示唆されています。
AS_PATH の改ざんによるハッキングのリスク
攻撃者が AS_PATH から自身の ASN を削除することで、RPKI や ASPA の検証をすり抜け、本来の所有者に成りすましてトラフィックを乗っ取る可能性があります。
重要な引用
In many of these hijack attempts, an apparent bad actor took advantage of unused autonomous system numbers, or ASNs.
There is a simple solution for these cases: basic verification that a BGP peer autonomous system (AS) always includes their network as the 'First AS' in an advertised route.
We believe what is happening here is the result of a specific strategy by the hijacker... Forge the AS_PATH completely, without including the hijacker's own local ASN
While Autonomous System Provider Authorization (ASPA) will help invalidate these forged paths, attackers may bypass it... To stop these specific hijacks, we must rely on a different protection mechanism already built into BGP: First AS checking and enforcement.
The correct way of preventing this hijack with existing tools is to enforce the First AS in the AS_PATH.
AS64505 by way of not even including their own ASN in the AS_PATH is able to pretend they are AS64506 with no intermediate AS hop.
影響分析・編集コメントを表示
影響分析
この記事は、BGP プロトコルの脆弱性を突いた高度な攻撃手法に対する具体的な防御策を提示しており、インターネットインフラ全体のセキュリティ強化に直結する重要な知見を提供します。特に、複雑な対策ではなく「First AS」の検証という実装コストが低い手段で重大なリスクを軽減できる点は、ネットワーク運用者にとって即座に適用可能な実践的な指針となります。
編集コメント
BGP のセキュリティは長年の課題ですが、今回のように具体的な攻撃事例と即座に導入可能な対策をセットで提示する記事は極めて貴重です。ネットワーク管理者は、この「First AS」検証の導入を検討すべき重要なタイミングと言えます。
Spamhaus が最近報告したいくつかのルートハイジャック事件に、私たちは注意を向けました。これらのハイジャック試みの多くにおいて、明らかに悪意のあるアクターが未使用の自律システム番号(ASN)を利用していました。特筆すべきは、これらのハイジャックにおいて、アクターが宛先への偽の AS_PATH を作成し、トラフィックを予期しない経路へ誤誘導している点です。
偽造された AS_PATH を作成することで、ハイジャッカーはトラフィックを通常とは異なる場所へ誘導しようとしつつ、同時に自身の身元を隠そうとしています。ハイジャッカーはネットワーク経路から十分な情報を削ぎ落とし、Border Gateway Protocol (BGP) プレフィックスのオリジンであるかのように振る舞うことが可能です。攻撃者はこのハイジャックされたルートを利用してトラフィックを傍受し、他の悪意のある目的に利用します。
これらのケースに対する簡単な解決策があります:BGP ピア自律システム(AS)が、広告されるルートにおいて常に自社のネットワークを「最初の AS」として含めていることを基本的な検証で確認することです。これらの保護措置がどの程度実装されているかを把握するため、私たちは主要ないくつかのネットワークに対して負荷テストを行い、それらの BGP 実装について調査を行いました。以下に私たちが得た知見をご覧ください。
偽造された経路を伴うルートハイジャックの検証
AS_PATH に偽の経路を作成しているという考え方は、パス内の非現実的な AS 関係に詳しく目を向けることで裏付けられます。例えば、Spamhaus が報告したハイジャック事例の一つで、フランスの通信会社である Orange S.A. の所有するプレフィックスが関与しているものを検討してみましょう。monocle ツールを使用すれば、このハイジャックに関連する BGP UPDATE メッセージを容易に見つけることができます:
➜ ~ monocle search --start-ts 2026-04-13T00:20:00Z --end-ts 2026-04-13T00:23:59Z --prefix 90.98.0.0/15 --collector rrc26 --json
{
"aggr_asn": null,
"aggr_ip": null,
"as_path": "48237 1299 199524 270118 17072 41128",
"atomic": false,
"collector": "rrc26",
"communities": null,
"local_pref": 0,
"med": 0,
"next_hop": "185.1.8.3",
"origin": "IGP",
"peer_asn": 48237,
"peer_ip": "185.1.8.3",
"prefix": "90.98.0.0/15",
"timestamp": 1776039612.0,
"type": "ANNOUNCE"
}
AS1299 (Arelion) は Tier 1 ネットワークであることが知られており、これはパスの右側にあるすべての AS が上流(顧客からプロバイダへの)関係を記述していることを意味します。これにより、AS17072 が AS41128 のトランジットプロバイダであり、AS270118 が AS17072 のトランジットプロバイダであり、AS199524 が AS270118 のトランジットプロバイダであることが示唆されます。これらのネットワークを詳しく見てみましょう:
AS41128 は Orange France に属する未使用の ASN です。
AS17072 は主にメキシコに拠点を置く ISP です。
AS270118 はメキシコに拠点を置くホスティングプロバイダです。
AS199524 は Gcore で、グローバルなピアリングプレゼンスを持つプロバイダです。
上記のメッセージにおける AS の順序は、使用されていない Orange France の AS がメキシコの ISP からトランジットを購入し、それが Gcore および Tier 1 プロバイダへ上流に転送されていることを示唆しており、これは非常に不自然です。
別の事例では、オリジン AS36429 からのプレフィックス 47.1.0.0/16 および 47.2.0.0/16 に対するハイジャックの報告に、Cloudflare の主要な ASN(AS Number)である 13335 が AS_PATH に含まれていました。「199524 270118 17072 13335 36429」というパスです。これらの BGP UPDATE メッセージの例は、Cloudflare Radar の MRT Explorer で確認できます:
image
私たちは権威ある立場から、私ども(Cloudflare、AS13335)が現在使用されていない Charter 所有の AS36429 と隣接関係を持っていないことを確認しています。つまり、これはハイジャッカーによって作成された偽造パスであり、Gcore(AS199524)に向けて伝播される広告において、Cloudflare の ASN が偽の上流ネットワークの一つとして含まれていました。さらに、Spamhaus は正しく指摘しました。すべてのハイジャックルートはシカゴで Gcore とピアリングしているネットワークの背後に到達するものであり、転送パス上で実際にメキシコの ISP や Cloudflare のネットワークを通過することはなかったと。
このため、これらのパスは左端の共通 AS までが偽造されていると合理的に結論付けられます。この場合の共通 AS は AS199524 です。残りのパス部分は非現実的であるように思われるからです。ここで起こっていることは、ハイジャッカーによる特定の戦略の結果であると私たちは考えており、その手順は以下の通りです:
「保留中」のプレフィックスに対する BGP アウンスンスメントをオリジネートする
ハイジャッカー自身のローカル ASN を含めずに、AS_PATH を完全に偽造する
これらのルートを Gcore (AS199524) にアドバタイズする
これらのハイジャックにおいて、Gcore (AS199524) は期待される顧客の ASN と一致する最初の AS の検証と強制をスキップしているように見える。(なぜそのステップをスキップするのかについては、本稿の後半で検討する。)その結果、偽造されたパスが受け入れられ、ハイジャックされたプレフィックスが上位プロバイダやピアに伝播される。
Autonomous System Provider Authorization (ASPA) はこれらの偽造パスの無効化に役立つが、攻撃者は RPKI-ROV 有効なオリジン AS または正当な ASPA 上位 AS を含めることのみでこれを回避する可能性がある。これらの特定のハイジャックを阻止するには、BGP に既に組み込まれている別の保護メカニズム、すなわち最初の AS のチェックと強制に頼る必要がある。
最初の AS チェックの重要性
インターネット上でトラフィックをルーティングすることは、荷物を配送するのと少し似ている。荷物が発送されると、それを扱うすべての宅配業者のログが記録される。BGP ではこれを AS_PATH (Autonomous System Path) と呼び、そのルートのパス上にある各ネットワークを追跡する。
BGP の AS_PATH 属性は経路選択に使用されます。この選択アルゴリズムは、どの宛先へのルートが最も良いホップのリストを通過するかを決定します。ここで「最も良い」とは、複数の変数によって定義されます。また、ループ防止にも使用され、ネットワークはすでに自社のネットワークを通過したパスを受信しないことを決定できます。BGP UPDATE(およびしたがってルート)が通過するネットワークの記録を保持することに加え、AS_PATH はオペレーターが設定したルーティングポリシーによって検査され、特定の AS を回避したり、意図的に経由させたりするために使用されます。例えば、予期せぬ影響を与える BGP の異常を避けるためです。
BGP は信頼に基づいて構築されており、AS_PATH は容易に操作可能です。これは、トラフィックを移動させるための AS プレペンディングのように一見正当な理由によるものでもあれば、人工的にトラフィックを引き寄せたりオリジン攻撃を行ったりするために短縮するなど、悪意のある目的によるものでもあります。
これら 2 つの種類の悪意ある BGP 操作がどのように行われるかを見てみましょう。
例 1: 偽造されたオリジン攻撃
AS64506 は、ルートオリジンのハイジャックを防ぐために、RPKI ROA(Route Origin Authorization)レコードを使用して経路を暗号署名します。
AS64506 はまた、ASPA オブジェクトを作成し、有効なプロバイダーとして AS64503 のみを指定します。
AS64505 は、AS_PATH を操作して AS64505 を削除し、AS64506 としてオリジネートします。
AS64502 は First AS(最初の AS)の強制を行いません。
画像:https://cf-assets.www.cloudflare.com/zkvhlag99gkb/xVIAFtmdXnloqo4xn6ZHj/d487ff2260925946987795bf0648d9e6/BLOG-3306_image4.png
このルートは RPKI-ROV(RPKI 経路検証)で有効と判定され、最短パスであるため、このルートを用いてトラフィックを効果的に乗っ取られています。AS64506 はプレフィックス広告に対して有効な ROA を指定し、さらに唯一のプロバイダーである AS64503 からなる ASPA オブジェクトを設定するなど、すべて正しく実施しています。
残念ながら、AS64505 を実行している乗っ取り犯は、依然として本来 AS64506 宛てのトラフィックを引きつけることに成功しています。たとえ顧客である AS64501 と、そのプロバイダーである AS64502 が ASPA 検証を実行していたとしても、パス「64502 64506」に谷(valley)が存在しないため、無効な経路とは検出されません。つまり、AS64505 は自身の ASN を AS_PATH に含めることさえせず、中間の AS ホップを介さずにあたかも AS64506 であるかのように振る舞うことが可能なのです。
既存のツールを用いてこの乗っ取りを防ぐ正しい方法は、AS_PATH の最初の AS(Autonomous System)を検証することです。このルールを適用すれば、AS64502 は AS64505 から来たルートを適切にドロップします。
例 2:トラフィックを引きつけるための AS_PATH の短縮
AS64506 には 2 つのトランジットプロバイダーがあります:AS64503 と AS64505 です。
AS64505 は、トラフィック使用量比率に基づいて顧客である AS64506 に請求を行っています。
AS64505 はパスから自身を除去し、そのピアである AS64504 は最初の AS の検証を実行していません。

BGP の経路選択アルゴリズムは、AS64501 から AS64504 を経由する経路を最良の経路として選択します。AS64506 は、インターネットからのトラフィックを配信するために、両方のプロバイダーである AS64503 と AS64505 に支払いを行っています。しかし現在、AS64505 は遠隔地のソースからより短い BGP 経路を提供しているため、AS64505 が AS64506 へのすべてのトラフィックを処理してその対価を受け取り、AS64503 は全く支払われなくなります。
これらの BGP の脆弱性は、受信した AS_PATH(Autonomous System Path)内の最初の AS をピア AS と一致させることで、非常に簡単に解決できます。
オペレーターが BGP ネイバーを構成する際、相互接続するネットワークのリモート AS を設定する必要があります。AS_PATH 内の最初の AS がこの値と一致しない場合、その経路は改ざんされています。最初の AS の強制処理手順は、RFC 4271 のセクション 6.3 で非常に明確に以下のように記述されています。
「外部ピアから UPDATE メッセージが受信された場合、ローカルシステムは、AS_PATH 属性内の左端(プロトコルメッセージ内のオクテットの位置に対する相対的な位置)の AS が、メッセージを送信したピアの自律システムの番号と等しいかどうかを確認してもよい。このチェックにより一致しないことが判明した場合、エラーサブコードを Malformed AS_PATH に設定しなければならない。」
RFC 7606 はその後、ベンダーによるエラーハンドリングの実装方法を改訂し、不正な AS_PATH を含む経路は treat-as-withdraw メソッドを通じてドロップすべきであると提案しています。これにより、ルーターは特定のプレフィックスを不正な属性を持つままドロップでき、BGP セッション全体を混乱させることなく対応できます。
現在の ASPA ドラフトは、First AS の強制が重要であることを明確に指摘しており、ASPA は不正な宣告によって十分な AS_PATH 情報が欠落している経路を処理できないと述べています。Internet ルーティングセキュリティにおいて、AS_PATH 内での First AS の強制は必須です。
First AS ルールを意図的に破ることで測定する
First AS ルールの違反に関する理論的な失敗事例や過去の公的事件に固執するのではなく、これらの AS_PATH 違反がインターネット上でどの程度広く受け入れられているかを自ら測定したいと考えました。そのために、私たちは自らのルールを意図的に破る形で BGP 宣告をネイバーに対して行いました。具体的には以下の通りです:
Tier 1 の外部 BGP(EBGP)ネイバーへ広告するために、IPv4 と IPv6 の各 1 つずつの IP プレフィックスを割り当てました。
テスト用プレフィックスの Tier 1 ネイバーへの宣告において、Cloudflare が所有する非 13335 ASN(AS402542)を 13335 の前に付与して故意に prepended しました。
例えば、Geneva の通常の BGP セッションから AS1299 に対してプレフィックスを宣告しました。私たちのローカル AS は AS13335 ですが、AS_PATH 内では AS402542 を明確に First AS として含めています。
bryton@edge01.gva01> show configuration 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;
}
bryton@edge01.gva01> show route advertising-protocol bgp 162.159.82.0/24 detail | grep "AS path: "
AS path: 402542 [13335] I
この設定により、私たちが期待しているのは以下の通りです:
First-AS を強制するネットワークは、RFC 7606 の撤回(withdrawal)メソッドを通じて静かに経路をドロップします。
First-AS を強制しないネットワークは、この経路を受け入れ、テスト対象のプレフィックスへの転送のためにインストールします。
どちらの結果も、BGP パブリックルートビューで確認可能です。当初の目標は、すべてのピアに対して First AS ルールを意図的に違反するプレフィックスの継続的な発表を実装し、どの ISP が First AS を検証しているか、またどの ISP が検証していないかをチェックするためのツールを全員に提供することでした。しかし、不正な BGP AS_PATH(AS パス)を受信した際に RFC 7606 で公表されたガイダンスを実装していないネットワークがまだ存在し、撤回として扱うのではなく BGP セッションをリセットしてしまうことが判明しました。つまり、Cloudflare への実際のトラフィックに影響を与えることなく、First AS ルールに違反する継続的な発表のセットを安全に実装することはできないということです。もちろん、そのようなことは行えません。
しかし、最も大きな影響を与えるネットワークポリシーを持つネットワーク、すなわち Tier 1 ネットワークに注目してみましょう。これらのネットワークはインターネットのバックボーンを構成しており、他のいかなる相手よりも最大の AS カスタマー・コン(AS customer cone)を持っています。つまり、これらのピアによるハイジャックや不正なパスは最も広範な意味を持ちます。まず、Anycast プレフィックス 1.1.1.0/24 の通常の伝播を Tier 1 ネットワーク間で検証することから始めましょう。

1.1.1.0/24 の伝播は、予想される通りです。現在 Cloudflare と直接接続(adjacency)しているすべての Tier 1 ネットワークが、このプレフィックスに直接到達可能です。
次に、プレフィックス 162.159.82.0/24 に対する意図的に不正なアウンスメントと比較してみましょう:

注記:AS5511(Orange S.A.)は、パブリック・ルートビューでの限られた存在のため上記には記載されていませんが、テストと測定の一部として含まれていました。
このプレフィックスの伝播は 1.1.1.0/24 とは全く異なり、Cloudflare(この場合は AS13335 に AS402542 を prepended した状態)から直接アウンスメントを受け入れる Tier 1 ネットワークは非常に少ないです。前述のテスト基準に基づくと、以下の結果が得られました。
First AS ルール(無効な発表をドロップすることによって)を適用している Tier 1 ネットワーク:
AS174 (Cogent)
AS1299 (Arelion)
AS3257 (GTT)
AS3491 (PCCW)
AS5511 (Orange S.A.)
AS6453 (Tata)
AS7018 (AT&T)
First AS ルールを適用していない Tier 1 ネットワーク(プレフィックスを受け入れてインストールすることによって):
AS701 (Verizon)
AS2914 (NTT)
AS3356 (Lumen/Colt/Cirion)
AS6461 (Zayo)
AS6762 (Sparkle)
AS6830 (Liberty Global)
AS12956 (Telefonica)
私たちのテストにより、懸念すべき現実が明らかになりました:Tier 1 ネットワークの半数は、First AS ルールに違反するハイジャックに対して脆弱です。
今回の測定調査では Tier 1 ネットワークのみを対象としましたが、First AS ルールを破っている Tier 1 以外のネットワークも多数存在することは疑いの余地がありません。
First AS 違反テストで失敗した Tier 1 ネットワークの大半が、ピアの MAC アドレスによって特定される Juniper Networks のルータを使用していることに注意しました。
これは、ベンダーのデフォルト動作が、「箱出し」状態で First AS 違反ベースの攻撃に対してネットワークがどの程度安全かを定義することを浮き彫りにしています。誰がデフォルトで保護され、誰がされていないかについてよりよく理解するために、いくつかの BGP 実装とそのデフォルト設定を見ていきましょう。
BGP 実装とデフォルト動作
以下のチャートは、主要なルーティング/ネットワークベンダーとそれらの BGP ポリシーをリストアップしています。ここで「Yes」とは、デフォルトで BGP 実装が First AS を強制することを意味し、これは望ましい状態です。「No」とは、BGP 実装がデフォルトで脆弱であることを意味します。
BGP 実装
First AS enforced by default
Documentation
Cisco IOS/XE/XR
Yes
bgp enforce-first-as
Junos OS / Junos OS Evolved
No
enforce-first-as
Arista EOS
Yes
bgp enforce-first-as
Nokia SR OS
No
enforce-first-as
Huawei
Yes
check-first-as
Extreme SLX-OS
No
enforce-first-as
RouterOS
No
Configuration not available
BIRD
No
enforce first as
OpenBGPD
Yes
enforce neighbor-as
FRR
Yes (since October 2023 patch)
bgp enforce-first-as
一部のベンダーでデフォルトの強制が欠如している理由は、外部 BGP(EBGP)セッションにおいて First AS を強制すべきでない唯一の有効なユースケースが存在するためである可能性があります。それはインターネットエクスチェンジ(IX)ルートサーバーです。
ルートサーバーは、ファブリック上のピア間で経路を透過的(AS_PATH に自身の AS を付加することなく)配布する責任を負っています。これにより、ネットワークがファブリックに参加するたびに新しい BGP セッションを設定する必要がなくなり、代わりにピアはルートサーバーとのみピアリングすれば済みます。
実際には、生産環境のネットワークでは、透明性のある IX ルートサーバーとのセッションよりも、そうでないネイバーとのセッションの方がはるかに多く存在します。ネットワーク内のすべてのピアで手動で「enforce-first-as」を有効化するよりも、数件のルートサーバーセッションに対してのみ「no enforce-first-as」を設定する方が、はるかに合理的です。
"デフォルトで安全"というアプローチが First AS 違反に対する保護には最適ですが、ベンダーに長年のデフォルト設定を変更させるよう説得するのは、一般的には非常に困難な課題です。また、IX ルートサーバーの BGP セッション(BGP セッション)において「no enforce-first-as」設定を必要とするセッションに影響を与えずに、これを優雅に行うための方法をベンダーが導入する必要もあります。
あなたの協力によるより安全なインターネットルーティング:First AS の強制
攻撃者は意図的に AS_PATH を不正に形成し、BGP セキュリティメカニズムを回避しようとします。RPKI ベースの ASPA パス検証(ASPA path validation)であっても、パスからオリジン AS 以外のすべての要素が完全に削除された偽装オリジンのハイジャックからは私たちを守ることができません。これでは ASPA が無効化できる対象が残っていません。
幸いなことに、これらのケースに対する緩和策は既に存在します:First AS が BGP ペア AS と一致することを確認し、常にそれを強制することができます。上記の表にある対応する「Documentation」列を参照してください。IX ルートサーバーネイバーと対向しているセッションを除く、すべての外部 BGP(EBGP)セッションにおいて First AS の強制を行うことは安全であると考えられます。
ネットワーク運用者の方へ、今日からルーター上で First AS の強制設定を実施し、自社のネットワークおよび広範なインターネットを保護してください。
お使いのルーターベンダーまたは選択した BGP 実装がデフォルトで First AS の強制機能を備えている場合、あなたはすでに安全であり、First AS の違反はすべて拒否する状態にあるはずです。
皆で協力することで、こうしたハイジャックからインターネットをより安全なものにすることができます。
原文を表示
Some recent route hijacks reported by Spamhaus captured our attention. In many of these hijack attempts, an apparent bad actor took advantage of unused autonomous system numbers, or ASNs. Notably in these hijacks, the actor appears to be creating fake AS_PATHs toward destinations, misdirecting traffic down an unexpected path.
By creating forged AS_PATHs, the hijacker is attempting to lead traffic somewhere it isn’t normally meant to go while also trying to conceal their identity. A hijacker could strip enough information away from a network path that they could pretend to be the origin of a Border Gateway Protocol (BGP) prefix themselves. Attackers can use this hijacked route to intercept traffic and for other nefarious purposes.
There is a simple solution for these cases: basic verification that a BGP peer autonomous system (AS) always includes their network as the “First AS” in an advertised route. To get a sense of how well these safeguards are implemented, we stress-tested several major networks and researched their BGP implementations. Read on to see what we learned.
Examining route hijacks involving forged paths
The idea that an actor is creating fake AS_PATHs is supported when we take a closer look at implausible AS relationships in the path. For example, let’s examine one of the hijacks reported by Spamhaus, involving a prefix belonging to Orange S.A., the French telecom company. Using the monocle tool, we can easily find a BGP UPDATE message related to the hijack:
➜ ~ monocle search --start-ts 2026-04-13T00:20:00Z --end-ts 2026-04-13T00:23:59Z --prefix 90.98.0.0/15 --collector rrc26 --json
{
"aggr_asn": null,
"aggr_ip": null,
"as_path": "48237 1299 199524 270118 17072 41128",
"atomic": false,
"collector": "rrc26",
"communities": null,
"local_pref": 0,
"med": 0,
"next_hop": "185.1.8.3",
"origin": "IGP",
"peer_asn": 48237,
"peer_ip": "185.1.8.3",
"prefix": "90.98.0.0/15",
"timestamp": 1776039612.0,
"type": "ANNOUNCE"
}
We know AS1299 (Arelion) is a Tier 1 network, meaning every AS on the right-hand side in the path is describing an upstream (customer-to-provider) relationship. This implies that AS17072 is a transit provider for AS41128, AS270118 for AS17072, and AS199524 for AS270118. If we take a closer look at these networks:
AS41128 is an unused ASN belonging to Orange France
AS17072 is an ISP primarily based in Mexico
AS270118 is a hosting provider based in Mexico
AS199524 is Gcore, a provider with a global peering presence
The order of the ASes in the message above would suggest that an unused Orange France AS is buying transit from Mexican ISPs, which is then upstreamed to Gcore and Tier 1 providers – which would be quite odd.
In another instance, a reported hijack for prefixes 47.1.0.0/16 and 47.2.0.0/16 from origin AS36429 even included Cloudflare’s main ASN, 13335, in the AS_PATH, “199524 270118 17072 13335 36429”. We can view examples of these BGP UPDATEs in the MRT Explorer from Cloudflare Radar:
image
We can authoritatively confirm that we (Cloudflare, AS13335) have no adjacency with the now-unused AS36429 owned by Charter. This means this was a forged path by the hijacker that included Cloudflare’s ASN as one of the fake upstream networks in advertisements propagated toward Gcore (AS199524). Further, Spamhaus correctly pointed out that all the hijack routes led to a network behind Gcore peering in Chicago, never actually traversing the Mexican ISPs or Cloudflare’s network in the forwarding path.
Because of this, we can reasonably conclude these paths are forged up until the leftmost common AS, which in this case is AS199524, as the rest of the path seems implausible. We believe what is happening here is the result of a specific strategy by the hijacker, involving the following steps:
Originate BGP announcements for “parked” prefixes
Forge the AS_PATH completely, without including the hijacker’s own local ASN
Advertise these routes to Gcore, AS199524
In these hijacks it appears Gcore (AS199524) skips the verification and enforcement of the First AS matching the expected customer’s ASN. (We’ll look at why it might skip those steps later in this post.) As a result, the forged path is accepted and the hijacked prefixes are propagated to upstream providers and peers.
While Autonomous System Provider Authorization (ASPA) will help invalidate these forged paths, attackers may bypass it by only including an RPKI-ROV-valid origin AS, or a legitimate ASPA upstream AS. To stop these specific hijacks, we must rely on a different protection mechanism already built into BGP: First AS checking and enforcement.
The importance of First AS checking
Routing traffic across the Internet is a bit like shipping a package. When the package is shipped, a log is kept of every courier that handles it. In BGP, this is called the AS_PATH (Autonomous System Path) and it tracks each network in the path of that route.
The AS_PATH attribute in BGP is used for path selection. This selection algorithm determines which route to a destination traverses the best list of hops, where “best” is defined by multiple variables. It is also used for loop prevention, where networks can decide not to accept paths that have already traversed their own network. Aside from keeping a record of the networks a BGP UPDATE, and therefore route, will traverse, the AS_PATH can also be examined by operator-configured routing policies to route around or purposely through a given AS – for example to avoid BGP anomalies having unexpected impact.
BGP was built on trust, and the AS_PATH can be easily manipulated – whether for seemingly legitimate reasons such as AS prepending to move traffic around, or nefarious reasons such as shortening it to artificially attract traffic or perform origin attacks.
Let’s look at how these two types of malicious BGP manipulations are carried out.
Example 1: Forged origin attacks
AS64506 cryptographically signs their routes with an RPKI ROA (Route Origin Authorization) record, to prevent route origin hijacks.
AS64506 also creates an ASPA object, specifying only AS64503 as a valid provider
AS64505 manipulates their AS_PATH to strip AS64505 and originate with AS64506
AS64502 does not enforce the First AS
image
The route appears RPKI-ROV valid and is the shortest path, effectively hijacking traffic with the route. AS64506 has done everything correctly by specifying a valid ROA for a prefix advertisement, and has even configured an ASPA object consisting of their sole provider AS64503.
Unfortunately, the hijacker running AS64505 is still able to attract traffic meant for AS64506. Even if AS64501, the customer, and AS64502, their provider, run ASPA validation, they will not find an invalid path, because there is no valley in the path “64502 64506”. In other words, AS64505 by way of not even including their own ASN in the AS_PATH is able to pretend they are AS64506 with no intermediate AS hop.
The correct way of preventing this hijack with existing tools is to enforce the First AS in the AS_PATH. Once enforcing this rule, AS64502 would properly drop the route from AS64505.
Example 2: Shortening the AS_PATH to attract traffic
AS64506 has two transit providers: AS64503 and AS64505.
AS64505 bills their customer AS64506 based on traffic usage ratios.
AS64505 strips itself from the path, and their peer AS64504 does not enforce the First AS.
image
The BGP path selection algorithm now chooses the route via AS64504 as the best path from AS64501. AS64506 pays both of their providers, AS64503 and AS64505, to deliver traffic from the Internet. However, now AS64505 provides a shorter BGP path from far-end sources, meaning AS64505 will process all the traffic toward AS64506 and be paid for doing so, and AS64503 will not be paid at all.
These BGP vulnerabilities can be solved very simply by enforcing the First AS to match the peer AS in a received AS_PATH.
When an operator configures a BGP neighbor, they must set the remote AS of the network they are interconnecting with. If the First AS in the AS_PATH does not match this value, then the path has been manipulated. The First AS enforcement procedure is outlined in Section 6.3 of RFC 4271 very clearly as:
“If the UPDATE message is received from an external peer, the local
system MAY check whether the leftmost (with respect to the position
of octets in the protocol message) AS in the AS_PATH attribute is
equal to the autonomous system number of the peer that sent the
message. If the check determines this is not the case, the Error
Subcode MUST be set to Malformed AS_PATH.”
RFC 7606 later revises how error-handling should be implemented by vendors, suggesting that routes containing malformed AS_PATHs should be dropped via treat-as-withdraw method. This allows routers to drop specific prefixes with malformed attributes without disrupting the entire BGP session.
The current ASPA draft clearly calls out the importance of First AS enforcement, stating that ASPA cannot handle paths where sufficient AS_PATH information is lacking due to malformed announcements. Enforcing First AS in AS_PATHs is a must for Internet routing security.
Measurement by breaking the First AS rule on purpose
Instead of sticking to theoretical failure cases and past public incidents about violations of the First AS rule, we wanted to measure for ourselves how widely these AS_PATH violations could be accepted on the Internet. To do so, we set up BGP announcements to neighbors where we purposely violated the rule ourselves. Here is what we did:
Allocated two IP prefixes, one for IPv4 and one for IPv6, to advertise to Tier 1 External BGP (EBGP) neighbors
Purposely prepended the test prefix advertisements to Tier 1 neighbors with a Cloudflare-owned, non-13335 ASN (AS402542) in front of 13335
For example, we advertised the prefixes to AS1299 from our normal BGP session in Geneva. Our local AS is AS13335, but we include AS402542 clearly as the First AS in the AS_PATH.
bryton@edge01.gva01> show configuration 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;
}
bryton@edge01.gva01> show route advertising-protocol bgp <redacted_1299_ip> 162.159.82.0/24 detail | grep "AS path: "
AS path: 402542 [13335] I
With this configuration, our expectation is that:
Networks that do enforce-first-as will quietly drop the route via RFC 7606 withdrawal method
Networks that do not enforce-first-as will accept the route and install it for forwarding toward our test prefixes
Either result will be visible in BGP public route views. It was initially our goal to implement a continuous announcement of prefixes toward all peers that would purposely violate the First AS rule in announcements, and give everyone a tool to check which ISPs validate First AS and those which do not. However, we found there are still networks that have not implemented the guidance published in RFC 7606 when receiving malformed BGP AS_PATHs, and would reset BGP sessions instead of a treat-as-withdraw behavior. This meant we could not safely implement a continuous set of announcements that violate the First AS rule without impacting real traffic to Cloudflare, which we obviously can’t do.
But we can take a closer look at the networks whose policies make the biggest impact: Tier 1 networks. These networks make up the backbone of the Internet and have the largest AS customer cones of anyone, meaning hijacks or malformed paths by these peers have the broadest significance. Let’s start by examining the normal propagation of an anycast prefix, 1.1.1.0/24, across the Tier 1 networks.
image
The propagation of 1.1.1.0/24 looks how you would expect – it is directly reachable by every Tier 1 network that Cloudflare has a direct adjacency with currently.
Now, let’s compare that with our purposely malformed announcement of the prefix 162.159.82.0/24:
image
Note: AS5511 (Orange S.A.) is not pictured above due to its limited presence in public route views, but it was a part of our testing and measurements.
The prefix is propagated very differently from 1.1.1.0/24 – far fewer Tier 1 networks are accepting the announcement directly from Cloudflare (in this case from AS13335 with AS402542 prepended). Based on the criteria of our test mentioned earlier, these are the results we found.
Tier 1 networks that are enforcing First AS rule (by dropping the invalid announcements):
AS174 (Cogent)
AS1299 (Arelion)
AS3257 (GTT)
AS3491 (PCCW)
AS5511 (Orange S.A.)
AS6453 (Tata)
AS7018 (AT&T)
Tier 1 networks that are not enforcing the First AS rule (by accepting and installing the prefixes):
AS701 (Verizon)
AS2914 (NTT)
AS3356 (Lumen/Colt/Cirion)
AS6461 (Zayo)
AS6762 (Sparkle)
AS6830 (Liberty Global)
AS12956 (Telefonica)
With our testing, we uncovered a troubling reality: Half of the Tier 1 networks are vulnerable to hijacks that violate the First AS rule.
While we only tested Tier 1 networks in this measurement study, there’s no doubt there are many non-Tier 1 networks that also break the First AS rule.
We noted that the majority of the Tier 1 networks failing the First AS violation test are running Juniper Networks routers, identified by the peers’ MAC addresses.
This highlights that the default behavior of vendors defines how secure a network is “out of the box” against First AS violation-based attacks. Let’s go over some of the BGP implementations and their defaults to have a better understanding of who is protected by default, and who isn’t.
BGP implementations and default behaviors
The chart below lists major routing/networking vendors and their BGP policies. Here, “Yes” means the BGP implementation by default enforces First AS, which is good. “No” means the BGP implementation is vulnerable by default.
BGP implementation
First AS enforced by default
Documentation
Cisco IOS/XE/XR
Yes
bgp enforce-first-as
Junos OS / Junos OS Evolved
No
enforce-first-as
Arista EOS
Yes
bgp enforce-first-as
Nokia SR OS
No
enforce-first-as
Huawei
Yes
check-first-as
Extreme SLX-OS
No
enforce-first-as
RouterOS
No
Configuration not available
BIRD
No
enforce first as
OpenBGPD
Yes
enforce neighbor-as
FRR
Yes (since October 2023 patch)
bgp enforce-first-as
The lack of default enforcement from some vendors may stem from the only valid use case where the First AS should not be enforced on External BGP (EBGP) sessions: Internet Exchange (IX) route servers.
A route server is responsible for transparently (without appending its AS to the AS_PATH) distributing routes between peers on the fabric. This ensures peers do not have to configure new BGP sessions every time a network joins the fabric – instead they can peer with just the route server.
In reality, most production networks have far more sessions with neighbors who are not transparent IX route servers than neighbors who are. It makes much more sense to configure “no enforce-first-as” on a handful of route-server sessions than to manually enable “enforce-first-as” on every single peer in your network.
While a “safe by default” approach is best for protecting against First AS violations, it is generally a steep hill to climb trying to convince vendors to change longstanding defaults. Vendors would also need to introduce a method of doing this gracefully, so as to not impact the IX route server BGP sessions that require “no enforce-first-as” settings to successfully receive routes.
Safer Internet routing with your help: enforce the First AS
Attackers will purposely malform AS_PATHs to slide around BGP security mechanisms. Even RPKI-based ASPA path validation will not be able to protect us from forged-origin hijacks where the path has been totally stripped of everything but the origin AS, leaving nothing for ASPA to invalidate.
The good news is we already have a mitigation for these cases: we can verify the First AS matches BGP peer AS and always enforce it. Refer to the corresponding “Documentation” column in the above table we have provided. It should be safe to enforce First AS on any External BGP (EBGP) session besides those facing an IX route server neighbor.
If you are a network operator, please enforce First AS on your routers today to protect your network and the wider Internet.
If your router vendor or choice of BGP implementation has a default of enforcing First AS, you’re already safe and should be rejecting any First AS violations.
By working together, we can make the Internet safer from these kinds of hijacks.
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み