BGP ROUTE HIJACKING
A lie propagates globally in minutes
Networks (autonomous systems, ASes) announce the address blocks they can reach to their neighbours. AS300 has 203.0.112.0/22 via AS100 (path length 1) and 203.0.113.0/24 via AS200 (path length 1). Where does it send a packet for 203.0.113.10?
Autonomous systems (ASes) tell their neighbours which prefixes they can reach, and the neighbours pass that on. Plain BGP never checks that the AS at the end of the path owns the prefix. Every router also forwards by longest-prefix match: if it knows both a /22 and a /24 that contain the destination, the /24 wins. So an attacker who announces a /24 carved out of your /22 pulls that slice of your traffic, even if its path is longer.
RPKI lets the address holder publish a signed ROA: “this prefix, origin AS100, no longer than /22”. Routers doing route origin validation drop announcements the ROA makes INVALID.
! AS300 accepts whatever its customer announces
router bgp 300
neighbor 10.0.0.2 remote-as 200
! no prefix filter, no origin validation
!
! AS200 announces 203.0.113.0/24. AS100 owns 203.0.112.0/22.
! Every router that learns the /24 forwards 203.0.113.x to AS200:
! longest-prefix match prefers /24 over /22, whatever the AS_PATH.! Route origin validation (RPKI ROV) on AS300
router bgp 300
bgp rpki server tcp 192.0.2.10 port 3323 refresh 600
neighbor 10.0.0.2 remote-as 200
neighbor 10.0.0.2 route-map ROV in
!
route-map ROV deny 10
match rpki invalid
route-map ROV permit 20
!
! ROA published by AS100's address holder:
! 203.0.112.0/22 maxLength 22 origin AS100
! 203.0.113.0/24 from AS200 → covered, wrong origin → INVALID
! 203.0.113.0/24 path [200 100] → origin OK, /24 > maxLength → INVALID
! ROV checks the origin only. A forged path with a ROA-legal prefix
! (203.0.112.0/22 via [200 100]) is VALID: that needs BGPsec/ASPA. Watch the forwarding path and the invariant strip. In HIJACK the invariant breaks the moment AS300 learns the /24, before AS400 has even heard of it. In FIX: RPKI ROV the same announcement is rejected at AS300. ROV vs FORGED ORIGIN shows why maxLength matters: the forged path names AS100 as origin, and the /24 is still INVALID.
No AS here validates anything. Inject AS200's /24 announcement at a point where the user's packet for 203.0.113.10 still ends up at AS200.
GOAL: the packet for 203.0.113.10 is delivered to AS200
Implement RPKI route origin validation. Return 'valid' if some ROA covers the announced prefix, names its origin AS, and allows its length (len <= maxLength); 'invalid' if some ROA covers it but none match; 'not-found' if no ROA covers it. A ROA covers a prefix when the prefix is equal to or inside the ROA prefix.
Route servers and transit providers dropping RPKI-invalid routes, RIR portals where you publish ROAs for your address space, and monitoring that alerts on unexpected more-specifics of your prefixes. The symptom of a hijack is reachability loss or odd latency for one slice of your addresses, with your own servers healthy.
“How can someone steal traffic for an IP range they don't own?” Explain announcement, propagation and longest-prefix match. Then explain what RPKI ROV checks (origin AS and maxLength), what it misses (forged paths for an allowed prefix), and why a tight maxLength matters.
USED IN
Chapters that build on this lesson.
- AI in network operations: what to hand overNetwork Engineer
- An addressing planNetwork Engineer
- Network philosophies: simple, observable, and every change with a way backNetwork Engineer
- The map of network roles: enterprise, cloud, provider, data centre, securityNetwork Engineer