A SYN flood keeps a server so busy holding half-open TCP connections that real clients cannot connect, even when bandwidth and CPU look fine. It remains a routine part of multi-vector DDoS attacks because every TCP listener has a finite queue for unfinished handshakes. This guide explains the mechanics for network and platform engineers, then sets out layered defences: SYN cookies and backlog tuning on the host, SYN proxies on firewalls and load balancers, and upstream scrubbing and remotely triggered blackholing when the flood exceeds what you can absorb. It finishes with the detection signals and metrics that tell you a flood is under way and that your mitigations are working. For the wider DDoS programme (scrubbing contracts, CDN, DNS resilience and the response runbook) see the DDoS Protection Guide; this page goes deeper on the TCP layer only.
Key takeaways
- The target is state, not bandwidth. Each unanswered SYN occupies an entry in the listener's SYN backlog until it times out; fill the backlog and new legitimate connections are refused on that port.
- SYN cookies are the host's safety net. On Linux,
net.ipv4.tcp_syncookies=1(the kernel default) sends stateless cookies only when the backlog overflows, at the cost of some TCP options during the attack. - Tuning buys headroom, not immunity. Raising
tcp_max_syn_backlogandsomaxconnand loweringtcp_synack_retrieshelps, but RFC 4987 notes an attacker simply sends proportionally more SYNs. - Volumetric floods must be stopped upstream. Once a flood saturates your links, only your provider's scrubbing service, RTBH or Flowspec can help, so those contracts and triggers must be in place before the attack.
- Measure the queue, not just the pipe. SYN-RECV counts, listen overflows, cookies sent and the SYN to ACK ratio reveal a flood earlier and more precisely than link utilisation.
How a TCP handshake is abused
A normal TCP connection opens with three packets: the client sends SYN, the server replies SYN-ACK, the client completes with ACK. Between the second and third packets the server holds a record of the pending connection. RFC 4987 (an Informational RFC from the IETF, published August 2007) describes this record as a Transmission Control Block (TCB) created when a SYN arrives on a port in the LISTEN state, with the connection sitting in the SYN-RECEIVED state. The number of these half-open connections a listener will hold is bounded by its backlog.
A SYN flood sends SYNs whose source addresses are spoofed or belong to hosts that never answer. The server sends SYN-ACKs that are never acknowledged, retransmits them, and keeps each entry until the timer expires. If the attacker sends SYNs faster than the entries expire, the backlog stays full and legitimate SYNs are dropped. RFC 4987 stresses two points that drive the defence design:
- Per-port effect: the attack exhausts the queue of a specific listening port, so a host can look healthy while one service is unreachable.
- Low cost to the attacker: the volume needed depends on the backlog size and the time an entry lives, not on the victim's bandwidth. On Linux the default
tcp_synack_retriesof 5 gives a final passive timeout of about 63 seconds, per the kernel documentation, so every bogus SYN can hold state for about a minute.
Spoofing has a side effect: the SYN-ACKs go to the forged addresses, so innocent third parties receive unsolicited traffic. BCP 38 (RFC 2827) uses exactly this SYN flood example to argue for ingress filtering of spoofed source addresses.
In MITRE ATT&CK the host-level effect maps to T1499.001 OS Exhaustion Flood under T1499 Endpoint Denial of Service, and a flood large enough to saturate links maps to T1498.001 Direct Network Flood under T1498 Network Denial of Service. See the MITRE ATT&CK T1499 Endpoint Denial of Service and the MITRE ATT&CK T1498 Network Denial of Service pages.
Variants
Defenders see several forms in practice. Knowing which one you face decides whether host tuning, a SYN proxy or upstream filtering is the right lever.
| Variant | What the target experiences | Main pressure point | Most effective layer |
|---|---|---|---|
| Spoofed direct SYN flood | Many SYNs from random or forged sources, almost no final ACKs | Listener SYN backlog, firewall state table | SYN cookies, SYN proxy, upstream scrubbing; ingress filtering at source networks |
| Botnet SYN flood (real sources) | SYNs from real, routable hosts; some may complete the handshake | Backlog plus accept queue and application connection limits | Per-source rate limits, SYN proxy, scrubbing with reputation and behavioural filtering |
| High-rate volumetric SYN flood | Links or provider edge saturated, packet rate rather than bit rate is the problem | Router and firewall packets per second, uplink capacity | Provider scrubbing, RTBH or Flowspec; host defences cannot help once the pipe is full |
| SYN-ACK or ACK flood | Unsolicited SYN-ACK or ACK packets that match no connection | Stateful firewalls and connection tracking lookups | Stateless filtering upstream, drop out-of-state packets early |
| SYN-ACK reflection | Third-party servers send SYN-ACKs to you because the attacker spoofed your address in SYNs to them | Inbound bandwidth and state on your edge devices | Upstream filtering of unsolicited SYN-ACKs; your own networks should never be the reflector target source |
| Spread or "carpet" floods | Lower rates spread across many addresses in a prefix, each below per-host thresholds | Aggregate edge capacity; per-IP thresholds miss it | Prefix-level detection and scrubbing |
Most real attacks are multi-vector: a SYN flood alongside UDP reflection or HTTP floods. Treat SYN handling as one layer of the plan in the DDoS Response Playbook, not the whole response.
Detection signals
A SYN flood shows up first in TCP state and kernel counters, often before link graphs move. Collect these continuously so you have a baseline; a spike is only meaningful against normal values for the same hour and day.
| Signal | Where to read it | What a flood looks like |
|---|---|---|
| Half-open connections | Linux ss -n state syn-recv count per listening port; load balancer half-open or embryonic connection counters | Count jumps from tens to thousands and stays at the backlog limit |
| Kernel flood warning | Kernel log message "TCP: Possible SYN flooding on port", followed by the listening address and port and the action taken (for example "Sending cookies") | Appears at the start of the attack (rate limited) and names the affected address and port |
| Cookie and overflow counters | nstat or /proc/net/netstat: TcpExtSyncookiesSent, TcpExtSyncookiesRecv, TcpExtSyncookiesFailed, TcpExtListenOverflows, TcpExtListenDrops | SyncookiesSent climbs steeply while SyncookiesRecv stays low (few clients complete); ListenOverflows rises if the accept queue fills |
| SYN to ACK ratio | Flow telemetry (NetFlow, IPFIX, sFlow) or packet counters with TCP flag breakdown at the edge | Inbound SYNs far exceed completed handshakes towards a single destination and port |
| Source distribution | Flow records grouped by source address and TTL | Very large number of unique sources each sending few packets, or odd TTL patterns suggesting spoofing |
| Firewall state table | Firewall connection table utilisation and new sessions per second | Table near capacity, session setup rate many times normal |
| Service symptoms | Synthetic checks and client-side connect times from outside your network | TCP connect timeouts while the server CPU and application look idle |
The Linux kernel documentation adds a useful warning: if SYN flood messages appear under legitimate load, the listener is misconfigured, not attacked. For flow collection design see the NetFlow and IPFIX Flow Telemetry Guide.
Mitigations: host
Host and load balancer defences protect against floods that reach the server without saturating the link. RFC 4987 surveys the options and is candid about their limits.
| Technique | How it helps | Trade-off stated in RFC 4987 or kernel docs |
|---|---|---|
| SYN cookies | No state is kept for the SYN; the connection details are encoded in the SYN-ACK sequence number and checked when the ACK arrives | Hard to encode TCP options: MSS limited to a few values, window scaling and SACK restricted unless timestamps carry the extra state; data on the SYN is not kept. The kernel calls cookies a fallback that violates TCP norms |
| SYN cache | Keeps a small partial entry in a keyed hash table with per-bucket limits; full state only after the handshake | Bounded memory and CPU; RFC 4987 cites about a 15% rise in legitimate connection time under attack in Lemon's tests |
| Larger backlog | More room for half-open entries before overflow | Needs efficient data structures; scaling problems were seen in older stacks |
| Shorter SYN-RECEIVED timer | Entries expire faster | Slow legitimate clients may fail; attacker compensates by sending more SYNs |
| Hybrid cache plus cookies | Cache under normal load, cookies when the cache is full | The approach most modern stacks take |
On Linux the relevant settings, as described in the kernel's ip-sysctl documentation, are:
- net.ipv4.tcp_syncookies: default 1, which sends cookies only when a listener's SYN backlog overflows. Value 2 sends cookies unconditionally and the documentation suggests it only for testing the effect of cookies. Leave it at 1 in production and confirm no build or hardening baseline has set it to 0.
- net.ipv4.tcp_max_syn_backlog: the per-listener maximum of remembered connection requests in SYN_RECV not yet acknowledged by the client. The minimum is 128 on low-memory machines and it scales with memory; raise it on internet-facing servers that see overload.
- net.core.somaxconn: the cap on the
listen()backlog, default 4096 (128 before Linux 5.4). The application's own backlog argument must also be raised, or the kernel limit is never used. - net.ipv4.tcp_synack_retries: default 5, giving about 63 seconds before a passive half-open connection is abandoned. Reducing it to 2 or 3 frees entries sooner; test with slow and mobile clients first.
- net.ipv4.tcp_abort_on_overflow: default off. The documentation advises enabling it only if the listener genuinely cannot be tuned to accept faster, because it resets clients during bursts.
A SYN proxy moves the handshake in front of the server. On Linux, netfilter's synproxy answers the handshake with SYN cookies and only passes connections that complete it to the backend. The nftables documentation lists the prerequisites: tcp_syncookies=1, tcp_timestamps=1 and nf_conntrack_tcp_loose=0, untracked SYNs via a raw-priority rule, and MSS and window scale values that match the backend server. Firewalls and load balancers offer the same idea under names such as SYN proxy, TCP intercept or SYN protection; RFC 4987 notes this shifts the load to that device, so size its connection setup rate and state table for attack volumes. See the Load Balancer Security Guide.
Mitigations: network and upstream
When the flood carries more packets per second than your edge routers, firewalls or links can handle, nothing on the host matters. Defences must sit in networks with more capacity than the attacker.
| Layer | What it does | When to use it | Watch out for |
|---|---|---|---|
| Edge ACLs and rate limits | Drop SYNs to ports you do not serve; cap SYN rate per destination on edge routers | Always; cheap and stateless | Rate limits drop good and bad SYNs alike once triggered |
| Cloud or provider scrubbing (always-on or on-demand) | Traffic is diverted by BGP or DNS through a scrubbing centre that validates handshakes and forwards clean traffic | Floods larger than your links; services that must stay up | On-demand diversion takes minutes; test it, and keep origin IPs private so attackers cannot bypass it |
| CDN or reverse proxy | Terminates TCP at the edge so floods hit the provider, not your origin | HTTP and HTTPS services | Non-web ports and exposed origin addresses stay vulnerable |
| Destination RTBH | Your provider discards all traffic to the attacked address | To protect the rest of your network when one address is drowning | Completes the attack for that address; use as a last resort and for the shortest time |
| BGP Flowspec | Distributes match and action rules (for example TCP SYN to destination X, port 443, rate limit) to upstream routers | Precise filtering of a known signature without blackholing | Bad rules cause self-inflicted outages; validate and expire them |
| Source address validation | Drops packets with spoofed sources at the network edge, per BCP 38 | Your own networks, so they cannot originate spoofed floods | Protects the internet more than it protects you; still a good citizen control |
RTBH and Flowspec mechanics, guard rails and trigger security are covered in the RTBH and BGP Flowspec DDoS Mitigation Guide, and anti-spoofing in the Source Address Validation and Anti-Spoofing Guide.
Choosing the right layer
- Small organisation, single site: keep host defaults (cookies on), put public services behind a CDN or provider with built-in DDoS protection, and agree an emergency RTBH contact with your ISP.
- Mid-size, several public services: add SYN proxy on the edge firewall or load balancer, flow telemetry with SYN ratio alerts, and an on-demand scrubbing contract tested at least yearly.
- Large or availability-critical (finance, gaming, public sector): always-on scrubbing for critical prefixes, Flowspec with pre-approved templates, and automated detection that triggers diversion within minutes.
Rolling out and testing SYN flood defences
- Inventory listeners: list every internet-facing IP and TCP port, which device terminates the handshake (server, load balancer, CDN), and which ports need not be exposed. Close the latter.
- Baseline: collect half-open counts, cookie counters and SYN rates per service for at least two weeks to set thresholds.
- Host hardening: confirm
tcp_syncookies=1, raisetcp_max_syn_backlog,somaxconnand application backlogs on one pilot server pool, and reducetcp_synack_retriescautiously. Monitor client connect times for a week before wider rollout. Roll back by restoring the previous sysctl file and reloading. - Edge SYN proxy: enable in monitor or alert-only mode where the platform supports it, then enforce on one virtual service, checking MSS, window scaling and timestamp behaviour against backends.
- Upstream: agree scrubbing diversion procedures, RTBH communities and Flowspec acceptance with providers; document who can trigger each and how to withdraw.
- Test: run an authorised DDoS simulation through a provider that coordinates with your ISP and scrubbing service. Never generate test floods across third-party networks without written agreement.
- Review: after every test or real event, record time to detect, time to mitigate and any legitimate traffic lost, and adjust thresholds.
Metrics and framework mapping
- Time to detect: minutes from flood start to alert, from flow or counter data.
- Time to mitigate: minutes from alert to effective filtering (cookies, proxy, diversion or Flowspec).
- Handshake completion rate during attack: share of legitimate connections completing, measured by external synthetic checks.
- Coverage: percentage of internet-facing services behind a SYN proxy, CDN or scrubbing path.
- Test frequency: date of last successful diversion and RTBH test per provider.
| Framework | Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev 5 | SC-5 Denial-of-service Protection; SC-7 Boundary Protection; SI-4 System Monitoring; CP-8 Telecommunications Services | Protection, edge filtering, detection and provider arrangements |
| NIST CSF 2.0 | PR.IR-04 Adequate resource capacity; PR.IR-03 Resilience mechanisms; DE.CM-01 Network monitoring; RS.MI-01 Incidents are contained | Capacity, resilience, detection and containment |
| ISO/IEC 27001:2022 Annex A | A.8.6 Capacity management; A.8.16 Monitoring activities; A.8.20 Networks security | Capacity planning, monitoring and network controls |
| MITRE ATT&CK | T1499.001 OS Exhaustion Flood; T1498.001 Direct Network Flood; T1498.002 Reflection Amplification | Host-level, link-level and reflection variants |
| MITRE D3FEND | D3-ITF Inbound Traffic Filtering; D3-NTA Network Traffic Analysis | Filtering and detection countermeasures |
Common failure patterns
- Cookies disabled by a hardening baseline: an old template sets
tcp_syncookies=0and the first flood empties the backlog. Audit sysctl values in configuration management. - Kernel backlog raised, application backlog not: the server's
listen()call still passes a small value, sosomaxconnchanges have no effect. - Origin addresses exposed: services sit behind a CDN or scrubbing service, but DNS history or a forgotten record reveals the origin, and the flood goes straight to it.
- Stateful firewall as the bottleneck: the state table fills before the servers notice. Put stateless filtering or a SYN proxy ahead of it, or size it for attack rates.
- Untested diversion: the scrubbing contract exists but no one has run the BGP or DNS change, and the first attempt during an attack takes hours.
- Alerting on bandwidth only: a moderate-rate SYN flood exhausts a port without moving link graphs; nobody alerts on half-open counts.
Practitioner checklist
- Confirm
net.ipv4.tcp_syncookies=1on every internet-facing Linux host and equivalent SYN protection on load balancers and firewalls. - Raise
tcp_max_syn_backlog,somaxconnand application listen backlogs on public services, after a pilot. - Test a reduced
tcp_synack_retriesvalue against slow and mobile clients before adopting it. - Enable SYN proxy or TCP intercept on the edge device that terminates public TCP, with MSS and window scale matched to backends.
- Alert on half-open counts, SyncookiesSent, ListenOverflows and inbound SYN to ACK ratio per service.
- Keep origin addresses private and restrict origin access to the CDN or scrubbing provider ranges.
- Agree and test scrubbing diversion, RTBH and Flowspec procedures with each upstream provider at least yearly.
- Apply source address validation on your own networks so they cannot originate spoofed traffic.
- Record time to detect and time to mitigate after every test and real event.
Standards and references
- IETF: RFC 4987 TCP SYN Flooding Attacks and Common Mitigations
- IETF: RFC 2827 (BCP 38) Network Ingress Filtering
- Linux kernel documentation: IP Sysctl
- nftables wiki: Synproxy
- NCSC: Denial of Service (DoS) guidance
- MITRE ATT&CK: T1499.001 OS Exhaustion Flood
Related NHI Mgmt Group resources: DDoS Protection Guide · DDoS Response Playbook · RTBH and BGP Flowspec DDoS Mitigation Guide · DDoS Readiness Checklist