40. DoS and DDoS – Availability Attacks
40.3 Protocol Attacks – SYN Flood and Handshake Abuse
TCP three-way handshake: SYN → SYN-ACK → ACK. SYN flood = many SYNs, incomplete handshakes, fill half-open connection table → new legitimate clients wait / fail.
Blue classics:
- SYN cookies – encode state in SYN-ACK so huge half-open table not needed the same way
- Conntrack / backlog tuning on Linux (careful; document changes)
- Firewall / load-balancer rate limits on new SYNs per IP
- Prefer cloud LB that already handles common floods
# Concepts on a lab Linux YOU own – see SYN cookie sysctl (read-only first)
sysctl net.ipv4.tcp_syncookies
# Enable on YOUR lab VM only after you understand impact (Amazon Linux style awareness):
# sudo sysctl -w net.ipv4.tcp_syncookies=1
| Red team (attacker) does | Blue team (defender) detects / stops |
|---|---|
| High-rate SYN without completing handshake | SYN cookies; SYN rate limits; border ACL |
| Mix SYN with ACK/RST junk to confuse filters | Stateful firewall + vendor DDoS profiles |
| Targets small appliance with tiny conn table | Move critical VIP behind cloud scrub / larger LB |
Ravindra Bagale's Tip
Students copy-paste hping3 flags and try them on office Wi-Fi – that is a criminal risk. Only host-only lab IPs. In interviews, talk about SYN cookies + rate limiting, not "how I flooded GitHub". Don't worry – discipline = career.
Ravindra Bagale's Tip – मराठी
Students hping3 flags copy-paste करून office Wi-Fi वर try करतात – criminal risk. फक्त lab host-only IP. Interview मध्ये SYN cookie + rate limit बोला, "how I flooded GitHub" नको. घाबरू नका – discipline = career.
Ravindra Bagale's Tip – हिंदी
Students hping3 flags copy-paste करके office Wi-Fi पर try करते हैं – criminal risk. सिर्फ़ lab host-only IP. Interview में SYN cookie + rate limit बोलो, "how I flooded GitHub" नहीं. घबराओ मत – discipline = career.
Lab
On Metasploitable / your lab Linux at 192.168.56.20 (or a disposable nginx VM): note ss -s or netstat -s before. From Kali 192.168.56.10 run a short, low-rate SYN probe only to that host-only IP (trainer-approved count, e.g. few hundred, then stop). Observe half-open growth if any. Enable syncookies / firewall rate rule. Re-test gently. Document. No bridged LAN, no public IP.
Extended teaching notes
Why this lesson matters
Availability attacks try to exhaust bandwidth, connections or app workers. Learning them is about detection and defence — never about stressing networks you do not own (that can be illegal and harmful).
- Rate limits and WAF/CDN at the edge.
- SYN cookies / tuning on servers.
- Autoscaling with care (cost controls).
- Keep IoT devices off default passwords (Mirai lesson).
- Lab simulations only on isolated networks you own.
Mini case study
Suppose we are on a purple-team exercise for an Indian mid-size company (sample data). Red notes a technique from this lesson against a lab clone. Blue must show the control that stops it, the log that would have fired, and the ticket that hardens production. That is the standard this course trains you for.
Defender's worksheet (do this today)
- Write the lesson title, date and the exact lab target you are allowed to use.
- List three owned systems (VMs, apps, or cloud accounts) where this lesson applies.
- Run one safe check from the lesson on a lab system only. Paste the command and output.
- Write a two-sentence fix you would give a teammate.
- Name one related public advisory (CERT-In, CISA, NVD, or a vendor bulletin) with its date.
Indian workplace (sample data)
Suppose we are a junior analyst at Infosys, TCS, Wipro or a fintech SOC in Bengaluru/Pune. Turn this lesson into one checklist item with an owner, a due date and a place to store evidence (ticket + screenshot).
Global practice
Compare your notes with OWASP, CIS Benchmarks, NIST CSF/IR guidance or a cloud Well-Architected security question. Write five lines on what overlaps.
Everyday analogy
Explain the risk and the fix to a family member without jargon. If they can repeat the warning, you understand it well enough to teach juniors.
Key terms
- Control: a safeguard (patch, config, process, detection).
- Finding: a weakness backed by evidence.
- Remediation: the fix plus how you verified it.
- Scope: systems you have written permission to touch.
- Least privilege: only the access the task needs.
- Defence in depth: several layers so one failure does not end the story.
Common mistakes
- Skipping written permission "just for a quick scan".
- Practising on hostel, office or public targets without authorisation.
- Collecting tool output without writing the fix.
- Copying attack steps onto production to "verify". Defenders verify with versions, configs and patches.
- Publishing screenshots that contain secrets, cookies or internal hostnames.
Recap
- Evidence, fix, owner, date.
- Own lab only.
- Fix > spectacle.