SECURITY ENGINEERING · PART 2 · NETWORKING FOR SECURITY · ATTACKS · 35 OF 229

BGP Hijacking and Routing Attacks Explained

How the internet decides where packets go, and how that can be subverted: autonomous systems and BGP announcements, why a false or more specific announcement pulls traffic toward the wrong network, route leaks versus deliberate hijacks, two real incidents, what RPKI and route filtering fix, and what an ordinary company can do about a problem it does not control.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 9
  9. 10
  10. 11
  11. 12
  12. 13
  13. 14
  14. 15
  15. 16
  16. 17
  17. 18
  18. 19
  19. 20
  20. 21
  21. 22
  22. 23
  23. 24
  24. 25
  25. 26
  26. 27
  27. 28
  28. 29
  29. 30
  30. 31
  31. 32
  32. 33
  33. 34
  34. 35
  35. 36
  36. 37
  37. 38
  38. 39
  39. 40
  40. 41
  41. 42
  42. 43
  43. 44
  44. 45
  45. 46
  46. 47
  47. 48
  48. 49
  49. 50
  50. 51
  51. 52
  52. 53
  53. 54
  54. 55
  55. 56
  56. 57
  57. 58
  58. 59
  59. 60
  60. 61
  61. 62
  62. 63
  63. 64
  64. 106
  65. 107
  66. 108
  67. 109
  68. 110
  69. 111
  70. 112
  71. 113
  72. 114
  73. 115
  74. 116
  75. 117
  76. 118
  77. 119
  78. 120
  79. 121
  80. 122
  81. 123
  82. 124
  83. 125
  84. 126
  85. 127
  86. 128
  87. 129
  88. 130
  89. 131
  90. 132
  91. 133
  92. 134
  93. 135
  94. 136
  95. 137
  96. 138
  97. 139
  98. 140
  99. 141
  100. 142
  101. 143
  102. 144
1 / 13

Press play to hear the narration, or step through at your own pace.

Key takeaways

  • Announcements are trusted
  • the more specific route wins
  • leaks and hijacks
  • RPKI validates origin
  • TLS is the backstop

Notes

How routing works

The internet is made of tens of thousands of independent networks, called autonomous systems: internet providers, cloud companies, universities. Each one announces to its neighbours which address ranges can be reached through it, and the neighbours pass that on. Every router builds a table of the best path to every range. The protocol carrying those announcements is BGP, the border gateway protocol. Nothing in the original design checks that an announcement is true.

BGP in one picture
  • the internet is ~75,000 networks (autonomous systems), each with a number
  • each announces: "these address ranges are reachable through me"
  • neighbours pass it on every router builds a table of the best path to every range
  • the announcements are trusted

The hijack

So a network can announce address ranges that belong to someone else. Neighbours that do not filter accept the announcement and pass it along, and part of the internet starts sending that traffic toward the hijacker. Once it arrives they have three choices. Drop it, which is an outage. Read it and answer it themselves, which is impersonation. Or read it and quietly forward it to the real owner, which is interception nobody may notice for hours.

A BGP hijack
  • a network announces address ranges it does not own
  • neighbours that do not filter accept it and pass it on part of the internet now sends that traffic to the hijacker
  • the hijacker can drop it, read it, or pass it on to the real owner

Why it works so well

One rule makes hijacks very effective. When a router has two routes covering an address, it always prefers the more specific one, the one describing the smaller range. So if the real owner announces a block of a thousand addresses and the hijacker announces a quarter of that block on its own, every router that hears both chooses the hijacker's route for those addresses. No tie, no competition. The more specific announcement simply wins.

More specific wins
  • real owner announces 203.0.112.0/22 (1,024 addresses)
  • hijacker announces 203.0.113.0/24 (256 of them)
  • routers always prefer the longest, most specific match
  • so the hijacker wins everywhere the announcement reaches

Mistake or attack

Not every routing incident is an attack. A route leak happens when a network passes on routes it was supposed to keep to itself, almost always through a configuration mistake. Suddenly a large share of traffic tries to squeeze through a small network and everything slows or fails. A hijack is a false claim of origin, sometimes by mistake and sometimes deliberate. From the user's side the two look the same: a site that is unreachable, or reached through the wrong place.

Leaks and hijacks
  • route leak: a network passes on routes it should have kept to itself, usually a configuration mistake
  • traffic takes a strange detour and overloads a small network
  • hijack: a false origin, by mistake or on purpose
  • the effect on users is the same either way

Two real cases

Two cases show the range. In two thousand eight a national telecom provider, ordered to block YouTube inside its own country, announced the route in a way that leaked to the world, and YouTube was unreachable globally for about two hours. An accident. In two thousand eighteen attackers hijacked the addresses of a cloud DNS service, answered DNS questions for a cryptocurrency site with their own server's address, and stole from the users who logged in. A theft.

What has happened
  • 2008: a national provider tried to block YouTube inside its country and announced the route to the world. YouTube went dark globally for about 2 hours
  • 2018: attackers hijacked a cloud DNS service's addresses, answered DNS with lies, and emptied cryptocurrency wallets

What saves you

Here is what protects ordinary traffic. A hijacker can receive your packets, but cannot produce a valid certificate for the real site, so browsers show a warning and API clients refuse to connect. In the cryptocurrency theft, the victims were the people who clicked through that warning. HSTS removes the option to click through, and DNSSEC protects the name lookup. Once again, end-to-end encryption with verification turns a network disaster into an error message.

Encryption is the backstop
  • the hijacker gets the traffic
  • but has no valid certificate for the real site
  • browsers show a warning; API clients refuse
  • in the 2018 case, victims clicked through a certificate warning
  • HSTS removes that option
  • DNSSEC protects the name lookup

RPKI

The routing world's own fix is called RPKI. The owner of an address block publishes a signed record stating which network is allowed to announce it. Providers check incoming announcements against those records and drop the invalid ones. That stops false-origin hijacks and a great many accidents. Most large providers now do this, and adoption keeps growing, but it is not universal, and it does not catch every kind of path manipulation.

Fixing the trust
  • RPKI: the owner of an address block publishes a signed record naming the network allowed to announce it
  • providers check announcements against those records and drop invalid ones
  • stops false-origin hijacks and many mistakes
  • adoption keeps growing; it is not yet universal

What you can do

What can an ordinary company do about a problem inside other people's networks? If you own address space, publish RPKI records for it; it takes an afternoon. Choose providers and clouds that validate routes; an industry programme called MANRS lists those that commit to it. Monitor your own address ranges with a free BGP alerting service, so you hear about a hijack in minutes. And keep TLS, HSTS and DNSSEC in place, since those protect you whatever the routing does.

For an ordinary company
  • own address space? publish RPKI records for it
  • choose providers and clouds that validate routes (ask; see MANRS)
  • monitor your prefixes: free BGP alerting services
  • TLS everywhere, HSTS, DNSSEC
  • use more than one DNS and network provider for critical services

Seeing it happen

How would you recognise a routing incident? A service is reachable from some networks and not from others. A traceroute suddenly passes through an unexpected country or provider. Certificate warnings appear on a site that never had them. Public tools let anyone investigate: looking glass servers that show how other networks see a route, and monitoring projects that record every announcement on the internet. During an outage, routing is always one of the suspects worth checking.

Signs and tools
  • reachable from some networks and not others
  • traceroute suddenly passes through an unexpected country or network
  • certificate warnings on a site that never had them
  • public tools: looking glasses, BGP stream monitors, RIPE RIS, route views

Common mistakes

Mistakes. Treating routing as purely the provider's problem. Owning address space and never publishing RPKI records for it. Nobody monitoring your own address ranges, so customers tell you about a hijack before your tools do. Services that still work over plain HTTP, or clients that skip certificate checks, which turns a hijack into a real breach. And a single DNS provider and a single network path for something critical.

Avoid these
  • "routing is the ISP's problem"
  • no RPKI records for your own address space
  • nobody watching your prefixes
  • services that work over plain HTTP or skip certificate checks
  • one DNS provider, one network path

Say it like this

In the interview: BGP has no built-in proof of who owns an address range, so a network can announce prefixes that belong to someone else, and because routers prefer the most specific route, traffic flows to the hijacker, who can drop, intercept or impersonate. RPKI route origin validation and provider filtering reduce it. As a company I publish RPKI records, monitor my prefixes, and rely on TLS with HSTS and DNSSEC so a hijack cannot become a silent compromise.

In the interview
  • "BGP has no built-in proof of ownership, so a network can
  • announce someone else's
  • prefixes, and a more specific
  • route wins. Traffic is then dropped, intercepted or impersonated. RPKI route
  • origin validation and filtering reduce it; TLS and DNSSEC limit the damage."

Interview questions

Q1What is BGP?

The Border Gateway Protocol is how autonomous systems (independently operated networks) exchange information about which IP address ranges they can reach. Routers use those announcements to choose paths, and the protocol historically trusted announcements without verification.

Q2What is BGP hijacking?

A network announcing IP prefixes it does not legitimately originate. Networks that accept the announcement send traffic for those addresses to the hijacker, who can drop it (outage), intercept and forward it, or impersonate the destination.

Q3Why does a more specific prefix win?

Routers use longest-prefix matching: among routes that cover an address they choose the one with the longest (most specific) prefix. A hijacker announcing a smaller sub-range of a legitimate block therefore attracts that traffic wherever the announcement propagates.

Q4What is the difference between a route leak and a hijack?

A route leak is the improper propagation of legitimately learned routes beyond their intended scope, usually a configuration error. A hijack is an announcement with a false origin. Both misdirect traffic and can cause outages or interception.

Q5What is RPKI?

Resource Public Key Infrastructure lets address holders publish signed Route Origin Authorizations stating which autonomous system may originate a prefix. Networks performing route origin validation drop announcements that conflict with those records.

Q6Does HTTPS protect against BGP hijacking?

It does not prevent the rerouting, but the hijacker cannot present a valid certificate for the real site, so clients that validate certificates refuse the connection or show a warning. HSTS prevents users from clicking through, limiting the impact to availability.

Q7What can a company do about BGP hijacking?

Publish RPKI ROAs for any address space it holds, choose transit and cloud providers that validate routes, monitor its prefixes with BGP alerting services, use multiple providers for critical services, and enforce TLS, HSTS and DNSSEC.

Q8How would you recognise a possible routing incident?

Reachability that differs by network or region, traceroutes passing through unexpected networks or countries, unusual latency, or new certificate warnings. Looking glass servers and public BGP monitoring data can confirm changes in route origin or path.