SkillSprout
Chapter 33 · Lesson 3
Advanced
4 min read

DDoS Protection and Defence in Depth

Overview

A Distributed Denial-of-Service (DDoS) attack floods a service with traffic from thousands of hijacked devices (a botnet) so real users cannot get through. It attacks availability, not secrecy.

An encrypted, well-authenticated system is useless if it is offline, so you also need protection against floods.

Detailed Notes

What is a DDoS attack

A DoS attack tries to make a service unavailable by overwhelming it. When the traffic comes from many sources it is distributed, and blocking one address no longer helps.

The problem it solves

A ticket seller launches a popular sale. A botnet of 200,000 devices floods the network and hammers the expensive search page. Genuine fans see timeouts and the sale collapses. Attacks are cheap to launch, so a public service must expect them.

How it works

Types of DDoS

TypeHow it worksMain defence
VolumetricSaturate bandwidth, e.g. UDP floods or DNS amplification (a small request triggers a large reply sent to the victim)Large networks, anycast CDN, scrubbing
Protocol / state exhaustionUse up connection tables, e.g. SYN flood (many half-open TCP connections)SYN cookies, connection limits, load balancers
Application layerMany legitimate-looking requests to costly endpoints, e.g. HTTP flood on searchWAF, rate limiting, caching, bot detection

Defence building blocks

  • CDN with anycast: many edge locations share one IP address, so attack traffic is spread across a huge network and cached content is served without touching your servers.
  • Scrubbing centres: upstream facilities that drop attack packets and forward clean traffic.
  • Web application firewall (WAF): blocks malicious HTTP patterns and bad bots.
  • Rate limiting: cap requests per IP, account or API key and return HTTP 429. Limit by more than IP, because botnets use many IPs.
  • Hide the origin: accept traffic only from the CDN or load balancer.
  • Caching, load shedding and graceful degradation: serve cheap static pages, drop excess load early and switch off non-essential features.
  • Autoscaling helps but is not a defence alone: bottlenecks may not scale, and attackers can force a huge bill.
  • Monitoring and a runbook (a short guide of first steps) so attacks are noticed fast and the response is rehearsed.

Defence in depth means layering independent controls so that if one fails, others still protect you:

  • Edge: CDN, scrubbing, WAF, rate limits
  • Network: firewalls, private subnets
  • Identity: strong authentication, MFA, least privilege
  • Application: input validation, parameterised queries, authorization checks
  • Data: encryption and backups
  • Monitoring and response: logs, alerts, incident response

Zero trust extends this: never trust, always verify. Authenticate and authorize every call, including service-to-service, even inside the network.

A simple example

A medieval castle has a moat, outer wall, gatehouse and a locked treasury. A DDoS is a mob blocking the gate; a CDN is many extra gates that share the pressure.

System design example

Users reach the site through DNS pointing at an anycast CDN edge. The edge absorbs floods and serves cached pages. A WAF and rate limits filter what remains. The load balancer accepts traffic only from the CDN. App servers authenticate and authorize each request. The cheapest defence is doing less work per request: cache aggressively and make expensive operations asynchronous. The trade-off is cost and false positives: strict rules can block real users.

Summary

  • DDoS attacks target availability: volumetric, protocol, or application layer.
  • Main defences: anycast CDN, scrubbing, WAF, rate limiting, hidden origin, caching and graceful degradation.
  • Autoscaling alone is not enough.
  • Defence in depth layers independent controls from edge to data.
  • Zero trust means verifying every request, even inside the network.

Architecture Diagram

DDoS protection layers in front of an application
Architecture
Users and attackers
Anycast CDNabsorb, cache
WAF + rate limits
Load balancerCDN-only origin
App servers

Attack traffic is absorbed and filtered before it reaches the origin.

  1. 1DNS sends users to the nearest anycast CDN edge.
  2. 2The edge absorbs floods and serves cached content.
  3. 3The WAF and rate limits drop abusive requests.
  4. 4Only clean traffic reaches the hidden origin servers.

Common Interview Questions

Chapter quiz

Security · 3 questions

  1. 1.A user is logged in but changes an order ID in the URL and sees someone else's order. Which check is missing?

  2. 2.How should a system store user passwords?

  3. 3.A SYN flood is an example of which DDoS type?

0 of 3 answered

Finished this lesson?

0 of 91 lessons done · 0% of the course