SYN Flood: How a Single Packet Handshake Can Cripple Your Entire Network (And How to Stop It) + Video

Listen to this Post

Featured Image

Introduction:

A Distributed Denial of Service (DDoS) attack doesn’t require advanced exploits—it often weaponizes the very protocols designed to enable communication. The TCP SYN flood, for instance, abuses the standard three-way handshake by leaving connections half-open, exhausting server resources until legitimate traffic can no longer get through.

Learning Objectives:

  • Understand the mechanics of a TCP SYN flood attack and how it differs from normal traffic.
  • Execute simulated SYN flood tests in a lab environment using Linux and Windows tools.
  • Implement multi-layered defenses including SYN cookies, rate limiting, WAF rules, and cloud-based mitigation.

You Should Know:

  1. Understanding the TCP Three-Way Handshake and SYN Flood Exploit

Every TCP connection starts with a three-way handshake: the client sends a SYN packet, the server replies with SYN-ACK, and the client returns an ACK. In a SYN flood, the attacker sends a torrent of SYN requests but never completes the handshake. The server keeps each “half-open” connection in a backlog queue, consuming memory and CPU. Once the queue fills, the server rejects legitimate SYNs, causing a denial of service.

Step‑by‑step breakdown of the attack:

  1. Attacker spoofs or uses a botnet to generate thousands of SYN packets per second.
  2. Server allocates a control block for each incoming SYN and responds with SYN-ACK.
  3. Attacker never sends the final ACK; connections remain in `SYN_RECEIVED` state.
  4. Timeout values (e.g., 60–120 seconds) keep these entries alive, overwhelming resources.
  5. New legitimate connections are dropped, and the service becomes unavailable.

Check current half‑open connections on Linux:

ss -tan state syn-recv | wc -l
netstat -an | grep SYN_RECV | wc -l

On Windows (PowerShell as Admin):

Get-NetTCPConnection -State SynReceived | Measure-Object | Select-Object -ExpandProperty Count
  1. Simulating a SYN Flood Attack for Testing (Lab Only)

Before defending, you must understand the attacker’s perspective. Use controlled environments (isolated VMs) and never target production systems.

Using hping3 on Linux (install: sudo apt install hping3):

 Flood target IP 192.168.1.10 on port 80 with random source IPs
sudo hping3 -S --flood --rand-source -p 80 192.168.1.10

-S: SYN flag
--flood: send packets as fast as possible
--rand-source: spoof source IP addresses

Using `scapy` (Python script) for more control:

from scapy.all import 
target = "192.168.1.10"
for _ in range(5000):
send(IP(dst=target)/TCP(dport=80, flags="S"), verbose=False)

On Windows (with Npcap and nping):

nping --tcp --flags syn --rate 1000 -c 10000 --source-ip random 192.168.1.10 -p 80

Lab setup verification: Monitor server resources before, during, and after the flood using top, htop, or Windows Performance Monitor. Observe the spike in `SYN_RECV` connections and CPU usage.

3. Hardening Linux Against SYN Floods

Linux offers built-in mechanisms to mitigate SYN floods without additional software.

Enable SYN Cookies (protects against backlog exhaustion):

 Check current status
sysctl net.ipv4.tcp_syncookies

Enable permanently (add to /etc/sysctl.conf)
echo "net.ipv4.tcp_syncookies=1" >> /etc/sysctl.conf
sysctl -p

SYN cookies encode connection state in the SYN-ACK sequence number, eliminating the need to store half‑open connections.

Tune the SYN backlog and retries:

 Increase backlog size
sysctl -w net.ipv4.tcp_max_syn_backlog=4096

Reduce SYN-ACK retries (default 5 → 3)
sysctl -w net.ipv4.tcp_synack_retries=3

Lower timeout for half‑open connections
sysctl -w net.ipv4.tcp_syn_retries=2

Rate limit incoming SYNs with iptables:

 Limit to 15 SYNs per second per source IP
iptables -A INPUT -p tcp --syn -m limit --limit 15/s --limit-burst 30 -j ACCEPT
iptables -A INPUT -p tcp --syn -j DROP

4. Hardening Windows Servers

Windows Server uses a similar backlog and dynamic backlog feature to resist SYN floods.

View current TCP parameters (PowerShell):

Get-NetTCPSetting | Select SettingName, SynAttackProtect, EnableDynamicBacklog

Enable SynAttackProtect (optimizes SYN handling under attack):

Set-NetTCPSetting -SettingName InternetCustom -SynAttackProtect Enabled

Configure dynamic backlog (Windows 2012+):

Set-NetTCPSetting -SettingName InternetCustom -EnableDynamicBacklog Enabled -MinSynBacklog 500 -MaxSynBacklog 5000

Reduce SYN-ACK retransmissions via registry (reboot required):

Key: HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
Value: TcpMaxConnectResponseRetransmissions (DWORD, default 3, set to 1)
Value: SynAttackProtect (DWORD, default 0, set to 1)

Monitor SYN attacks with netsh:

netsh int tcp show global
netsh int tcp show statistics | find "SYN"
  1. Deploying Web Application Firewall (WAF) and Rate Limiting

WAFs inspect traffic at layer 7, but can also enforce SYN flood rules at the edge.

ModSecurity (open-source WAF) rule to limit SYN rate per client:

SecAction "id:900100,phase:1,initcol:ip=%{REMOTE_ADDR},setvar:ip.syn_rate=+1"
SecRule IP:SYN_RATE "@gt 50" "id:900101,phase:1,deny,status:429,msg:'SYN flood detected'"

NGINX rate limiting for new connections (syntax in nginx.conf):

limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m;
limit_conn conn_limit_per_ip 10;
limit_req_zone $binary_remote_addr zone=req_limit_per_ip:10m rate=5r/s;

HAProxy stick-table to drop excessive SYN floods:

stick-table type ip size 100k expire 30s store conn_cur,conn_rate(10s)
tcp-request connection reject if { src_conn_cur ge 100 } or { src_conn_rate ge 50 }

6. Traffic Monitoring and Anomaly Detection

Detect SYN floods early with baseline monitoring.

Linux: Monitor /proc/net/netstat for syncookie successes:

watch -n 1 'grep "syncookies" /proc/net/netstat'

Use tcpdump to capture SYNs and analyze rate:

sudo tcpdump -i eth0 'tcp[bash] & tcp-syn != 0 and tcp[bash] & tcp-ack == 0' -c 1000 -w syns.pcap

Windows: Enable SYN attack logging (Event ID 4227):

New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -Name "EnableICMPRedirect" -Value 0 -Force
 Then monitor: Get-EventLog -LogName System -InstanceId 4227

Prometheus + Grafana alert for high SYN_RECV rate:

Export metrics from `node_exporter` (Linux) or `windows_exporter` and set alert if `node_netstat_Tcp_CurrEstab` grows unusually fast.

7. Cloud and CDN-Based Mitigation (Production‑Ready)

On-premise defenses have capacity limits. For internet‑facing services, leverage DDoS scrubbing services.

Cloudflare example:

  • Enable “I’m Under Attack” mode (JS challenge) during a flood.
  • Set rate limiting rules: Block IPs exceeding 500 SYNs per 10 seconds.
  • Use Spectrum (L4 proxy) to filter spoofed SYNs.

AWS Shield Advanced + AWS WAF:

{
"Name": "SYN-Flood-Rule",
"Priority": 10,
"Statement": {
"RateBasedStatement": {
"Limit": 1000,
"AggregateKeyType": "IP",
"ScopeDownStatement": {
"ByteMatchStatement": {
"FieldToMatch": { "TransportLayer": { "Protocol": "TCP" } },
"PositionalConstraint": "EXACTLY",
"SearchString": "SYN"
}
}
}
},
"Action": { "Block": {} }
}

Azure DDoS Protection: Enable Standard tier on your VNet; it automatically detects SYN floods and scrubs traffic at the edge.

What Undercode Say:

  • Key Takeaway 1: A SYN flood doesn’t need a botnet of thousands; a single laptop with hping3 can cripple a misconfigured server in seconds.
  • Key Takeaway 2: Defense is multi‑layer: OS hardening (SYN cookies, backlog tuning) buys you seconds, while cloud WAF/DDoS services buy you uptime.

Analysis: The TCP protocol’s elegance is also its vulnerability. Most organizations still rely solely on firewall ACLs, which are useless against distributed spoofed SYNs. SYN cookies—available in every modern OS—are criminally underutilized. Meanwhile, attackers have moved to low‑and‑slow SYN floods that evade static rate limits. Real‑time anomaly detection with machine learning (e.g., analyzing entropy of source IPs) is becoming necessary. Expect future mitigations to embed SYN flood resilience directly into NIC hardware (SmartNICs) and eBPF‑based XDP filters that drop malicious SYNs at line rate. If you haven’t stress‑tested your own stack with a controlled SYN flood, you’re running blind.

Prediction:

As IoT botnets grow and 5G enables massive packet volumes, SYN floods will shift from volumetric to “asymmetric” attacks—small numbers of high‑rate sources using protocol amplification. Defenders will adopt programmable data planes (P4, eBPF) that classify and drop malicious SYNs within the switch, before they ever hit the server’s TCP stack. Regulatory bodies may eventually mandate SYN cookie enablement for public‑facing services. The real future, however, lies in moving the handshake burden to the client with proof‑of‑work challenges (like cryptographic puzzles) before a SYN is even processed—turning the attacker’s own resource against them.

▶️ Related Video (74% Match):

🎯Let’s Practice For Free:

IT/Security Reporter URL:

Reported By: Cybersecurity Ddos – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow UndercodeTesting & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin | 🦋BlueSky