DDoS Mitigation Strategies
Implementing DDoS protection and mitigation — from volumetric and protocol attacks through application-layer mitigation, scrubbing centers, and incident response.
When to Use
- Protecting web applications and APIs from DDoS attacks
- Building DDoS response playbooks
- Selecting DDoS mitigation services
- Implementing rate limiting and traffic filtering
- Designing resilient infrastructure against volumetric attacks
Attack Types and Mitigations
DDoS_VECTORS = {
'volumetric': {
'example': 'UDP amplification, ICMP flood, DNS reflection',
'scale': 'Hundreds of Gbps to Tbps',
'mitigation': 'Cloud scrubbing centers, BGP black-hole, rate limiting',
},
'protocol': {
'example': 'SYN flood, ACK flood, fragmented packet attack',
'scale': 'Millions of packets per second',
'mitigation': 'SYN cookies, connection tracking, TCP stack hardening',
},
'application': {
'example': 'HTTP flood, slow loris, API abuse, query flooding',
'scale': 'Hundreds of thousands of requests per second',
'mitigation': 'WAF rate limiting, CAPTCHA, challenge pages, bot detection',
},
}
class DDoSResponder:
"""Automated DDoS detection and mitigation response."""
def __init__(self, threshold_pps: int = 500000):
self.threshold = threshold_pps
self.mitigations = []
def analyze_traffic(self, current_pps: int, current_bps: int) -> str:
if current_pps > self.threshold:
return self._trigger_mitigation('volumetric')
return 'normal'
def _trigger_mitigation(self, attack_type: str):
actions = {
'volumetric': 'Enable BGP blackhole, activate cloud scrubber',
'protocol': 'Enable SYN cookies, rate-limit new connections',
'application': 'Enable WAF challenge, rate-limit per-IP',
}
return actions.get(attack_type, 'Monitor')
Common Pitfalls
- No baseline — don't know what normal traffic looks like; establish baseline
- Mitigation false positives — rate-limiting too aggressively blocks legitimate users
- Single mitigation layer — only cloud or only on-premise; defense in depth
- Late detection — by the time you detect, impact has occurred; use always-on monitoring
- No testing — mitigation mechanisms fail when needed if not tested regularly
Verification Checklist
- Normal traffic baseline established
- Cloud-based scrubbing service (Cloudflare, AWS Shield, Akamai, etc.)
- On-premise rate limiting and filtering
- BGP blackhole / RTBH configured
- WAF with DDoS rules enabled
- Auto-scaling for legitimate traffic increase
- DDoS response playbook documented and tested
- Tabletop exercises conducted quarterly