On this page
After this lesson you can
- Explain what DDoS (Distributed Denial of Service) Attacks is in your own words.
- Describe how the attack or technique works.
- Recognise it using the detection techniques in this lesson.
- Apply the prevention methods described here.
- Read and run the 4 Python scripts in a lab you control.
Description
A Distributed Denial of Service (DDoS) attack attempts to make an online service unavailable by overwhelming it with traffic from multiple sources. Attackers use botnets—networks of compromised devices—to generate massive amounts of requests.
Attack Types
1. Volume-Based Attacks
- UDP Flood: Overwhelms with UDP packets
- ICMP Flood: Ping of death, smurf attacks
- Amplification: DNS, NTP, SSDP amplification
2. Protocol Attacks
- SYN Flood: Exploits TCP handshake
- Ping of Death: Oversized packets
- Smurf Attack: Spoofed broadcast requests
3. Application Layer Attacks
- HTTP Flood: Legitimate-looking HTTP requests
- Slowloris: Slow connections exhausting resources
- DNS Query Flood: Overwhelming DNS servers
Detection Methods
Key Indicators
- Unusual traffic patterns
- Spike in traffic from single IP/geography
- Sudden increase in specific protocol types
- Incomplete connections (SYN floods)
- Slow network performance
Detection Scripts
- ddos_detection.py - Real-time DDoS detection
- traffic_analyzer.py - Traffic pattern analysis
Prevention Strategies
Infrastructure Level
- Rate Limiting: Control request rates
- Traffic Filtering: Block malicious patterns
- Load Balancing: Distribute traffic
- Anycast Networks: Distribute across multiple nodes
Service Level
- Web Application Firewall (WAF)
- CDN Services (Cloudflare, Akamai)
- Auto-scaling resources
- CAPTCHA for suspicious requests
Prevention Scripts
- rate_limiting.py - Implement rate limiting
- firewall_rules.txt - Firewall configuration examples
Detection Logic
Network Traffic → Traffic Analysis → Pattern Recognition →Threshold Checking → Anomaly Detection → Alert Generation
Best Practices
- Defense in Depth: Multiple layers of protection
- Regular Testing: Simulate attacks in controlled environments
- Incident Response Plan: Have clear procedures
- Monitoring: 24/7 traffic monitoring
- Collaboration: Work with ISP for upstream filtering
Tools & Resources
- Detection: Snort, Suricata, Wireshark
- Prevention: mod_evasive (Apache), fail2ban
- Cloud Services: AWS Shield, Cloudflare, Akamai
- Testing: hping3, LOIC, Slowloris (educational only!)
Warning
Only test these techniques on your own infrastructure or with explicit written permission. Unauthorized DDoS testing is illegal.
Practical Python labs
Open a script to read its source and copy the run commands. Run security tools only on systems you own or have written permission to test.
Check what you have covered
These questions are generated from this lesson's category, standards mapping and scripts. They test where things live in the guide, not how well you understand the concepts. Nothing is saved or tracked.