Part II: Vulnerability Study Chapter 7

Denial of Service Attacks

DDoS attack patterns, amplification vectors, botnet architectures, and comprehensive DoS defense strategies

Chapter 7: Denial of Service Attacks

The 2.3 Tbps Attack on AWS

In February 2020, Amazon Web Services reported mitigating the largest DDoS attack ever recorded at that time: 2.3 terabits per second (disclosed in the AWS Shield Threat Landscape Report Q1 2020). To put that in perspective, that’s enough bandwidth to download the entire Netflix library every few seconds.

The attack used CLDAP (Connection-less Lightweight Directory Access Protocol) reflectionβ€”a technique where small queries to misconfigured servers generate massive responses directed at the victim. AWS Shield, Amazon’s DDoS protection service, absorbed the traffic and kept customer services online.

But not everyone has AWS-scale resources. In October 2016, the Mirai botnet took down Dyn DNS and, with it, major websites including Twitter, Netflix, and Reddit. The attack peaked at 1.2 Tbps using a botnet of compromised IoT devicesβ€”cameras, DVRs, routers.

These incidents illustrate the modern DDoS landscape: massive botnets, powerful amplification techniques, and attacks that can overwhelm even large infrastructure providers. This chapter explores how DoS attacks work and how to defend against them.


Understanding Denial of Service

Denial of Service attacks aim to make systems or networks unavailable to legitimate users. They target the CIA triad’s Availability component.

DoS Attack Categories

DoS Attack Categories:
═══════════════════════════════════════════════════════════════════

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     VOLUMETRIC ATTACKS                          β”‚
β”‚  Overwhelm bandwidth capacity                                   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  β€’ UDP Floods            β€’ DNS Amplification                    β”‚
β”‚  β€’ ICMP Floods           β€’ NTP Amplification                    β”‚
β”‚  β€’ Memcached Attacks     β€’ SSDP Amplification                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     PROTOCOL ATTACKS                            β”‚
β”‚  Exhaust server/infrastructure resources                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  β€’ SYN Floods            β€’ Ping of Death                        β”‚
β”‚  β€’ ACK Floods            β€’ Smurf Attack                         β”‚
β”‚  β€’ Fragmented Packets    β€’ Connection Floods                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    APPLICATION ATTACKS                          β”‚
β”‚  Target application-layer resources                             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  β€’ HTTP Floods           β€’ Slowloris                            β”‚
β”‚  β€’ GET/POST Floods       β€’ R-U-Dead-Yet (RUDY)                  β”‚
β”‚  β€’ API Abuse             β€’ HashDoS                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

DoS vs DDoS

FeatureDoSDDoS
SourcesSingleMultiple (botnet)
ScaleLimitedMassive
BlockingBlock one IPMust filter traffic patterns
SophisticationUsually simpleOften coordinated
CostFree toolsBotnet rental ($50-$500/hour)

MITRE ATT&CK Reference

DoS attacks map to:

  • T1498 - Network Denial of Service
  • T1498.001 - Direct Network Flood
  • T1498.002 - Reflection Amplification
  • T1499 - Endpoint Denial of Service
  • T1499.002 - Service Exhaustion Flood

Volumetric Attacks

UDP Flood

Simple attack flooding target with UDP packets to consume bandwidth.

UDP Flood

UDP Flood:
═══════════════════════════════════════════════════════════════════

Attacker ─── UDP packets ───────────────────────────────► Victim
         ─── UDP packets ───────────────────────────────►
         ─── UDP packets ───────────────────────────────►
         ─── (millions per second) ─────────────────────►
         
Target: Saturate victim's network bandwidth
Result: Legitimate traffic can't get through

Characteristics:
- Simple to execute
- Easy to detect (random ports, no application data)
- Relatively easy to filter

Amplification Attacks

Amplification multiplies attack traffic by exploiting UDP services that send larger responses than requests.

Amplification Attack Concept

Amplification Attack Concept:
═══════════════════════════════════════════════════════════════════

                    Attacker
                       β”‚
     Spoofed request   β”‚   Request: 64 bytes
     (src=victim_ip)   β”‚
                       β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚   Amplifier     β”‚
              β”‚   (Open DNS,    β”‚
              β”‚    NTP, etc.)   β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚
                       β”‚   Response: 3,000+ bytes
                       β–Ό
                    Victim
                    
Amplification Factor = Response Size / Request Size
                     = 3000 / 64 = ~47x

With 1 Gbps attack bandwidth, attacker achieves 47 Gbps at victim!

Amplification Vectors Comparison

ProtocolPortAmplification FactorNotes
memcached1121110,000-51,000xHighest known, mostly patched
NTP monlist123556xLegacy servers still vulnerable
DNS ANY5328-54xOpen resolvers
SSDP190030xUPnP devices
CLDAP38956-70xWindows domain controllers
Chargen19VariableObsolete, rare
SNMP1616.3xNetwork devices
RIPv1520131xLegacy routing

DNS Amplification

DNS Amplification Attack

DNS Amplification Attack:
═══════════════════════════════════════════════════════════════════

REQUEST (64 bytes):
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ DNS Query: ANY dnsamplificationtest.com                         β”‚
β”‚ Source IP: 192.0.2.1 (VICTIM - SPOOFED)                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

RESPONSE (3,000+ bytes):
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ DNS Response to: 192.0.2.1 (victim)                             β”‚
β”‚                                                                 β”‚
β”‚ A records, AAAA records, MX records, TXT records,               β”‚
β”‚ NS records, SOA records, DNSSEC signatures...                   β”‚
β”‚                                                                 β”‚
β”‚ All sent to victim!                                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Using hping3 (Demonstration):

# DO NOT use without authorization
# Demonstrates concept only

# Spoofed DNS request
# Real attacks use many reflectors simultaneously
sudo hping3 --udp -p 53 --spoof VICTIM_IP DNS_SERVER_IP --data 64

NTP Amplification

NTP’s monlist command returns addresses of last 600 clientsβ€”huge amplification.

# Check if NTP server has monlist enabled
ntpdc -n -c monlist NTP_SERVER_IP

# If returns list of IPs, server is vulnerable
# Modern NTP servers have monlist disabled

# Detection in traffic:
# Large UDP port 123 responses
# monlist response format identifiable

Memcached Amplification (2018 Record)

Memcached Attack Record Breaking

Memcached Attack - Record Breaking:
═══════════════════════════════════════════════════════════════════

February 2018: GitHub attacked with 1.35 Tbps
February 2018: Record 1.7 Tbps attack detected

How it works:
1. Attacker stores large value in open memcached server:
   set key 0 0 1000000
   [1MB of data]

2. Attacker sends spoofed request:
   get key (src=victim)
   Request: ~15 bytes

3. Memcached responds to victim:
   Response: 1,000,000 bytes (1MB!)
   
Amplification: ~51,000x

Why so effective:
- memcached default: listen on 0.0.0.0 (all interfaces)
- No authentication required
- UDP support enabled by default (older versions)

Mitigation:

# Bind memcached to localhost only
memcached -l 127.0.0.1

# Or disable UDP entirely
memcached -U 0

# Firewall memcached port
iptables -A INPUT -p udp --dport 11211 -j DROP
iptables -A INPUT -p tcp --dport 11211 -s 127.0.0.1 -j ACCEPT
iptables -A INPUT -p tcp --dport 11211 -j DROP

Botnet Architectures

Traditional Command & Control

Centralized C2

Centralized C2:
═══════════════════════════════════════════════════════════════════

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   C2 Server     β”‚
                    β”‚ (IRC, HTTP, etc)β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚                   β”‚                   β”‚
    β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”
    β”‚   Bot   β”‚         β”‚   Bot   β”‚         β”‚   Bot   β”‚
    β”‚ (Host 1)β”‚         β”‚ (Host 2)β”‚         β”‚ (Host n)β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Pros: Simple, direct control
Cons: Single point of failure, easy to takedown

P2P Botnet Architecture

PeertoPeer Botnet

Peer-to-Peer Botnet:
═══════════════════════════════════════════════════════════════════

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  Bot A  │◄─────►│  Bot B  │◄─────►│  Bot C  β”‚
    β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜
         β”‚                 β”‚                 β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Ίβ”‚β—„β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
                      β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”
                      β”‚  Bot D  β”‚
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Commands propagate through peer network
No single point of failure
Harder to takedown

Examples: GameOver Zeus, TDL-4

Mirai Botnet Architecture

Mirai Architecture (IoT Botnet)

Mirai Architecture (IoT Botnet):
═══════════════════════════════════════════════════════════════════

SCANNING COMPONENT:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Infected devices scan for:                                      β”‚
β”‚ - Open Telnet (23)                                              β”‚
β”‚ - SSH (22)                                                      β”‚
β”‚ Using hardcoded credential list (admin/admin, root/root, etc.)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                              β–Ό
C2 INFRASTRUCTURE:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Report Server - Receives vulnerable targets                     β”‚
β”‚ Load Server - Delivers malware payload                          β”‚
β”‚ C2 Server - Sends attack commands                               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                              β–Ό
ATTACK CAPABILITIES:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ - UDP floods                                                    β”‚
β”‚ - SYN floods                                                    β”‚
β”‚ - ACK floods                                                    β”‚
β”‚ - GRE floods                                                    β”‚
β”‚ - DNS water torture                                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Peak: 600,000+ infected devices
Record attack: 1.2 Tbps against Dyn DNS

DDoS-for-Hire (Booter Services)

DDoSasaService

DDoS-as-a-Service:
═══════════════════════════════════════════════════════════════════

Cost: $10-500+ per attack
Access: Tor hidden services, clear web (disguised as "stress testing")
Power: Up to hundreds of Gbps

Customer ─── Orders attack ───► Booter Service
                                     β”‚
                                     β–Ό
                              Botnet Controller
                                     β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β–Ό                β–Ό                β–Ό
                  Bot 1            Bot 2            Bot n
                    β”‚                β”‚                β”‚
                    └───── Attack Traffic ───────────►│ Victim

Application Layer Attacks

HTTP Flood

Legitimate-looking HTTP requests overwhelming web application.

HTTP Flood Characteristics

HTTP Flood Characteristics:
═══════════════════════════════════════════════════════════════════

SIMPLE GET FLOOD:
GET / HTTP/1.1
Host: target.com
(thousands per second)

SOPHISTICATED HTTP FLOOD:
- Rotates User-Agents
- Uses real browser headers
- Varies request patterns
- Targets expensive endpoints (search, login)
- Uses HTTPS (encrypted, harder to inspect)

Detection Challenge:
Each request looks legitimate individually
Volume/pattern analysis required

Slowloris and Slow Attacks

(Covered in detail in Chapter 5)

Slow Attack Variants

Slow Attack Variants:
═══════════════════════════════════════════════════════════════════

SLOWLORIS:
- Sends partial HTTP headers slowly
- Keeps connections open indefinitely
- Exhausts connection pool

SLOW POST (R-U-Dead-Yet):
- Sends POST with large Content-Length
- Sends body 1 byte at a time
- Server waits for complete body

SLOW READ:
- Completes request normally
- Sets tiny window size
- Reads response very slowly
- Server buffers response in memory

API-Based DDoS

API Abuse Patterns

API Abuse Patterns:
═══════════════════════════════════════════════════════════════════

EXPENSIVE ENDPOINT TARGETING:
- Search endpoints with complex queries
- Report generation
- Data export functions
- Authentication endpoints (hashing cost)

EXAMPLE - Search DoS:
GET /api/search?q=a*&sort=relevance&filter=all&page=1
GET /api/search?q=b*&sort=relevance&filter=all&page=1
(thousands per second)

Each request triggers:
- Database query
- Full-text search
- Result sorting
- Response formatting
CPU exhaustion without massive bandwidth

DDoS Mitigation Strategies

Architectural Defenses

DDoSResilient Architecture

DDoS-Resilient Architecture:
═══════════════════════════════════════════════════════════════════

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚         CDN / ANYCAST               β”‚
                    β”‚   (Geographic distribution)         β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚      DDoS MITIGATION SERVICE        β”‚
                    β”‚   (Cloudflare, AWS Shield, Akamai)  β”‚
                    β”‚   - Traffic scrubbing               β”‚
                    β”‚   - Rate limiting                   β”‚
                    β”‚   - Challenge pages                 β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚          LOAD BALANCER              β”‚
                    β”‚   (Connection limits, health checks)β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                       β”‚                       β”‚
         β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”            β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”            β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”
         β”‚ Server 1 β”‚            β”‚ Server 2 β”‚            β”‚ Server n β”‚
         β”‚(Hardened)β”‚            β”‚(Hardened)β”‚            β”‚(Hardened)β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Network-Level Defenses

Rate Limiting:

# iptables - Rate limit by source
iptables -A INPUT -p tcp --dport 80 -m limit --limit 25/minute --limit-burst 100 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j DROP

# Nginx - Connection limits
limit_conn_zone $binary_remote_addr zone=perip:10m;
limit_conn perip 100;  # Max 100 connections per IP

limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s;
limit_req zone=one burst=20 nodelay;

BGP Blackhole/Flowspec:

BGP Blackhole Routing

BGP Blackhole Routing:
═══════════════════════════════════════════════════════════════════

When under attack:
1. Identify victim IP (e.g., 192.0.2.100)
2. Announce to upstream: "Route 192.0.2.100/32 to null"
3. Attack traffic dropped at network edge

RTBH (Remotely Triggered Black Hole):
router bgp 65001
  neighbor 10.0.0.1 remote-as 65002
  neighbor 10.0.0.1 route-map RTBH out

route-map RTBH permit 10
  match tag 666
  set community 65002:666

ip route 192.0.2.100 255.255.255.255 Null0 tag 666

Cons: Victim IP unreachable (attacker wins?)
Pros: Protects rest of infrastructure

BGP Flowspec (More Granular):

Flowspec Granular Traffic Filtering

Flowspec - Granular Traffic Filtering:
═══════════════════════════════════════════════════════════════════

Instead of black-holing destination, filter specific traffic:

"Drop UDP traffic to 192.0.2.100:53 from any source"

Preserves legitimate traffic while blocking attack patterns
Requires Flowspec-capable routers

Application-Level Defenses

Challenge Systems:

JavaScript Challenge (Bot Detection)

JavaScript Challenge (Bot Detection):
═══════════════════════════════════════════════════════════════════

Initial request ───► Challenge Page (JavaScript required)
                          β”‚
                          β–Ό
              Browser executes JavaScript
              Computes proof-of-work
              Sends solution
                          β”‚
                          β–Ό
              Server validates ───► Access granted
              
Bots: Can't execute JavaScript, fail challenge
Humans: Minor delay, then normal access

CAPTCHA:

# Trigger CAPTCHA under attack conditions
# After rate limit exceeded or suspicious pattern

if request_rate > threshold:
    show_captcha()

DoS Detection

Traffic Analysis

# Monitor connection states
watch -n 1 'netstat -ant | grep -c SYN_RECV'
watch -n 1 'netstat -ant | grep -c ESTABLISHED | wc -l'

# High SYN_RECV = potential SYN flood
# Excessive ESTABLISHED = potential HTTP flood

# Bandwidth monitoring
iftop -i eth0
nethogs eth0

# Packet capture for pattern analysis
tcpdump -i eth0 -w attack_capture.pcap

Attack Pattern Recognition

PatternLikely Attack
High UDP to single portUDP flood
Many SYN, few ACKSYN flood
Large UDP responses (53, 123)Amplification reflection
Consistent packet sizesBotnet flood
Many HTTP requests, few completeSlowloris
HTTP floods to single endpointApplication DoS

Monitoring Tools

ToolPurpose
Netflow/sFlowTraffic analysis
Prometheus + GrafanaMetrics and alerting
Elastic StackLog analysis
Arbor/NetscoutCommercial DDoS detection
FastNetMonOpen source detection

Lab Exercise: DDoS Analysis

Objective

Understand DDoS traffic patterns through analysis (not execution).

Exercise 1: Traffic Capture Analysis

# Download sample DDoS capture (from public datasets)
# CAIDA DDoS attack datasets: https://www.caida.org/catalog/datasets/ddos/

# Analyze with tshark
tshark -r ddos_sample.pcap -q -z conv,ip
# Shows conversation statistics

tshark -r ddos_sample.pcap -q -z io,phs
# Protocol hierarchy statistics

# Look for:
# - Predominant protocol (UDP for volumetric)
# - Packet size distribution
# - Source IP diversity

Exercise 2: Amplification Factor Measurement

# Safely measure DNS amplification potential
# (Against your OWN server)

# Request size
dig @your-dns-server ANY example.com | wc -c

# Compare request vs response
# Calculate amplification factor

# Response size / Request size = Amplification

Exercise 3: Mitigation Testing

# Test rate limiting effectiveness
# On YOUR test server

# Configure rate limiting
iptables -A INPUT -p tcp --dport 80 -m limit --limit 10/s -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j DROP

# Use Apache Bench to test
ab -n 1000 -c 100 http://localhost/

# Observe that requests beyond 10/s are dropped
# Monitor with iptables -L -v -n

Key Takeaways

  1. Volumetric attacks overwhelm bandwidthβ€”requires upstream filtering or DDoS services

  2. Amplification multiplies attacker’s bandwidth up to 51,000xβ€”close open reflectors

  3. Botnets provide distributed attack sourcesβ€”IoT devices are frequent targets for recruitment

  4. Application attacks are harder to detectβ€”look like legitimate traffic

  5. Defense requires layers: ISP filtering, DDoS services, rate limiting, application hardening

  6. BGP techniques (blackhole, flowspec) provide network-level response capabilities


Self-Assessment

  1. Comprehension: Why can’t simple IP blocking stop a DDoS attack?

  2. Application: Your web server is under a Slowloris attack. How do you identify it, and what’s your immediate mitigation?

  3. What if: An attacker is using HTTPS for their HTTP flood. How does this complicate detection and mitigation?


Review Questions

  1. Explain the difference between volumetric, protocol, and application layer attacks.
  2. How does UDP amplification work, and what makes memcached particularly effective?
  3. Describe the architecture of the Mirai botnet.
  4. Why is HTTP flood detection challenging?
  5. How do BGP blackhole and flowspec differ in their approach to DDoS mitigation?
  6. What role do challenge systems (JavaScript challenges, CAPTCHA) play in DDoS defense?

MITRE ATT&CK Mapping

AttackTechnique IDTactic
UDP FloodT1498.001Impact
SYN FloodT1498.001Impact
Amplification AttackT1498.002Impact
HTTP FloodT1499.002Impact
SlowlorisT1499.002Impact
Botnet C2T1071Command and Control