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

DDoS Attacks Explained: Types and Protection

Denial of service is the attack on availability: what a DDoS is and where the traffic comes from, the three families (volumetric floods, protocol attacks and application-layer floods), why each needs a different defense, how CDNs, scrubbing and anycast absorb volume, rate limiting and caching at layer 7, and the runbook to prepare before the day it happens.

  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 / 12

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

Key takeaways

  • Volumetric fills the pipe
  • protocol fills the tables
  • layer 7 exhausts the app
  • absorb upstream, limit, cache, prepare

Notes

Where it comes from

The first D stands for distributed. The traffic comes from thousands of sources at once: botnets of hacked routers, cameras and servers, or open servers tricked into replying to a spoofed address, as you saw in the TCP/IP episode. Attacks are rented cheaply by the hour. The motives are extortion, competition, protest, and sometimes distraction, with the flood keeping the security team busy while something quieter happens elsewhere.

The first D
  • botnets: hacked routers, cameras, servers, phones
  • reflection: open servers reply to a spoofed victim address
  • rented cheaply as "stresser" services
  • motives: extortion, rivals, protest, a distraction from another attack

Type 1 · Volumetric

The first family is volumetric: fill the pipe. UDP floods and amplification attacks send more bits per second than your connection can carry. The crucial point is that nothing inside your network can stop this. By the time traffic reaches your firewall, the link is already full and real users are already being dropped. A volumetric flood has to be absorbed upstream, by a network far larger than yours.

Volumetric floods
  • goal: saturate the network link itself
  • UDP floods, DNS and NTP amplification
  • measured in gigabits per second
  • your firewall cannot help: the pipe is full before traffic reaches it
  • must be absorbed upstream

Type 2 · Protocol

The second family attacks protocol state rather than bandwidth. SYN floods and similar tricks fill the connection tables in servers, and often in the firewalls and load balancers in front of them, which fall over first. These are measured in packets per second. Defenses are SYN cookies, generous but bounded state tables, and above all an edge proxy that completes connections on your behalf, so only real, finished connections ever reach you.

Protocol attacks
  • goal: use up connection state
  • SYN floods, fragmented packets, connection floods
  • measured in packets per second
  • targets stateful devices: firewalls and load balancers often fall before the server
  • defense: SYN cookies, edge proxies that hold the state

Type 3 · Application

The third family is the hardest: application-layer floods. Each request is a perfectly valid HTTP request. The attacker simply aims them at your most expensive pages, such as search, login or a report that hits the database, until the application runs out of CPU or connections. The volume can be small. A variant called Slowloris just opens connections and sends data very slowly to hold them. Telling these apart from real users is the whole problem.

Layer 7 floods
  • goal: exhaust the app: CPU, database, threads
  • valid-looking HTTP requests to the costly pages: search, login, reports
  • low volume, hard to tell from real users
  • Slowloris: hold connections open with slow requests
  • measured in requests/second

Defense · Absorb

For volume and protocol attacks the defense is size. You put a CDN or DDoS protection provider in front of everything public. Their network uses anycast, so the flood is spread over many data centres instead of landing on one, and scrubbing centres filter the junk and pass on clean traffic. Every cloud has its version. One detail matters a lot: keep your origin server's real address secret, or attackers simply go around the shield.

For volume and protocol
  • CDN and DDoS provider in front of everything public
  • anycast: the flood is spread across many data centres
  • scrubbing: filter the junk, forward the clean traffic
  • cloud: AWS Shield, Azure DDoS Protection, Cloud Armor
  • hide the origin address

Defense · Layer 7

Application floods need different tools. Rate limit per address, per account and per endpoint, tighter on the expensive ones. Cache everything that can be cached, so most requests never touch the application. Use a WAF and bot detection, with a challenge for suspicious clients. Set timeouts and connection limits, which defeats slow attacks. Require login for costly operations. And autoscale, but with a ceiling, because an attack can also be aimed at your cloud bill.

For application floods
  • rate limit per IP, per account, per endpoint
  • cache whatever can be cached
  • WAF and bot detection; challenges for suspects
  • timeouts and connection limits (stops Slowloris)
  • make expensive calls need login; queue heavy work
  • autoscale, with a cost cap

Design for it

Some protection is plain good design. Remove single points of failure. Have the CDN serve a static fallback when the application is struggling. Shed load deliberately, turning off expensive features so the core keeps working. Separate critical paths, so a flood against search cannot take checkout down with it. And remember DNS: if your DNS provider falls over, your whole site disappears, however well the servers are defended.

Resilience by design
  • no single point of failure
  • static fallback page from the CDN when the app is down shed load: serve fewer features, not zero
  • separate critical paths: checkout apart from search
  • protect DNS too: use a provider built for attacks

Be ready

Finally, be ready before it happens. Know what normal traffic looks like, so a spike is obvious. Alert on it. Write a runbook that says who decides, who calls the provider and which protections get switched on, and keep the contact details where you can find them. Run the drill once. And if a demand for money arrives with the attack, do not pay. Payment marks you as a customer who pays, and the attacks continue.

Before it happens
  • know normal traffic: baseline requests and bandwidth
  • alerts on unusual spikes
  • a runbook: who decides, who calls the provider, what to switch on contacts for ISP, CDN, cloud
  • test it once, in a drill
  • never pay an extortion demand

Common mistakes

Mistakes. Buying protection only after the first attack. Leaving the origin server's address discoverable, so the attacker goes around the CDN. Trying to stop a volumetric flood on your own firewall, behind an already full link. No rate limits on login and search. Autoscaling with no ceiling, turning an outage into an invoice. And having no traffic baseline and no runbook, so the first hour is spent working out what is happening.

Avoid these
  • no DDoS protection until the first attack
  • origin IP exposed, so the shield is bypassed
  • trying to block volume at your own firewall
  • no rate limits on login or search
  • unlimited autoscaling
  • no baseline, no runbook

Say it like this

In the interview: there are three kinds and each needs its own answer. Volumetric and protocol floods must be absorbed upstream by a CDN or scrubbing provider using anycast, with the origin address hidden. Application-layer floods need rate limiting, caching, a WAF and bot detection, plus timeouts. Around that I want graceful degradation in the design, a traffic baseline with alerts, and a tested runbook.

In the interview
  • "Three kinds need three
  • answers. Volumetric and protocol floods are absorbed
  • upstream by a CDN or scrubbing
  • provider with anycast, origin
  • hidden. Layer 7 floods need
  • rate limits, caching, a WAF
  • and bot checks. Plus a baseline, alerts and a runbook."

Interview questions

Q1What is a DDoS attack?

A distributed denial-of-service attack floods a target with traffic from many sources, such as a botnet or reflectors, to exhaust bandwidth, connection state or application resources so legitimate users cannot reach the service.

Q2What are the three main types of DDoS attack?

Volumetric attacks saturate bandwidth (UDP floods, amplification), protocol attacks exhaust connection state in servers and network devices (SYN floods), and application-layer attacks send valid-looking requests to expensive endpoints to exhaust the application.

Q3Why can you not stop a volumetric attack at your own firewall?

The attack saturates the network link before traffic reaches your equipment, so legitimate packets are already dropped upstream. It must be absorbed by a provider with far more capacity, using anycast and scrubbing.

Q4How does a CDN or DDoS protection service help?

It sits in front of the origin, spreads traffic across a large anycast network, filters malicious traffic in scrubbing centres, terminates connections so floods never reach the origin, and caches content, provided the origin address is not exposed.

Q5How do you defend against application-layer (layer 7) floods?

Rate limit per client, account and endpoint; cache aggressively; use a WAF and bot detection with challenges; set timeouts and connection limits; require authentication for expensive operations; and scale with a cost ceiling.

Q6What is a Slowloris attack?

An attack that opens many connections and sends request data very slowly so each connection stays open and occupies a worker. It needs little bandwidth and is mitigated by timeouts, connection limits and a reverse proxy that buffers requests.

Q7Why hide the origin server’s IP address?

If attackers learn the origin address they can send traffic directly to it, bypassing the CDN or scrubbing service. The origin should accept traffic only from the protection provider and never appear in DNS history or headers.

Q8What should a DDoS response runbook contain?

A traffic baseline and alert thresholds, roles and decision makers, provider and ISP contacts, the protections to enable in order, communication templates, and a note not to pay extortion demands. It should be rehearsed.