skip to content

State You Never Allocate

Under a connection flood the cheapest defence is to allocate nothing for a client that has not proved itself, and every way of demanding proof bills somebody real.

on this pageshow

explore

questions

8

When SYN cookies engage under a spoofed SYN flood, what does the server stop storing, and what does it lose by holding nothing?

level: juniorimportance: must knowfreq 52%

answer

  1. the queue is what the flood fills
  2. answer without writing anything down
  3. the proof travels in the reply
  4. nothing stored means nothing to resend
  5. a forged sender never returns it

basics

~20 s

It stops creating a half-open record for each arriving SYN, encoding what it needs into the reply instead, so spoofed senders cost it nothing. Holding no record, it cannot resend that reply or remember the options the client offered.

solid answer

~40 s

Normally every arriving SYN makes the server allocate a half-open entry and wait for the third packet; a flood of SYNs from forged source addresses fills that queue and real clients are refused. When the queue overflows, stateless admission engages: the server answers with a SYN-ACK whose value it can re-derive later, allocates nothing, and forgets the peer entirely. Only a peer that returns that value gets a socket built, and a forged source never does. The price is that `forgets` is literal. There is no timer, so a lost SYN-ACK is never retransmitted and the client must wait out its own timeout and resend. There is no memory of what the client offered, so the connection is admitted with degraded parameters. And the value is only honoured back for a limited window.

go deeper

for a junior

Be ready to say plainly what is not allocated and why a forged source never comes back for it. Naming the queue that overflows and the threshold that engages the degraded path is enough at this level.

for a middle

Expect to explain the mechanics: what the reply has to carry so the server can verify it later without a lookup, why no retransmission timer exists, and why the behaviour only appears under pressure.

for a senior

Show you can predict the collateral: which connections were admitted degraded, how long that lasts, and how you would establish after the fact that it happened at all when nothing failed.

for a principal

Own the framing that this is a trade, not protection: it converts a bounded memory cost into per-packet work and a silent quality cost, and someone has to accept both in writing.

## The allocation this removes A TCP server cannot complete a connection in one packet. It receives a SYN, replies with a SYN-ACK, and then has to wait — possibly for seconds — for the client's ACK. In the ordinary implementation the server writes down a half-open record for that pending connection: the peer's address and port, the sequence numbers, the options the client asked for, and a retransmission timer so it can resend the SYN-ACK if the reply is lost. That record occupies a slot in a bounded queue of half-completed handshakes, and it is held until the handshake finishes or the timer gives up. That bounded queue is the resource the attack aims at. Because a sender that forges its source address never has to receive anything, a flood of SYNs from addresses that do not answer costs the sender one small packet each while costing the server a record and a timer that live for tens of seconds. The queue fills, and from then on a genuine client's SYN arrives at a server with nowhere to put it. ## What engages, and what the reply has to do Stateless admission is the refusal to make that allocation. When the queue of half-completed handshakes overflows, the server stops writing records and instead answers the SYN with a reply it can verify later without having stored anything. Everything it will need at the third packet has to be carried in the reply itself and returned by the peer; when an ACK arrives that matches no known connection, the server recomputes the expected value from the connection's identifying fields and a coarse clock and compares. If it matches, the socket is built at that moment. If it does not, the packet is discarded. Nothing is ever looked up, because nothing was ever written. The consequence for the attack is direct. A forged source never sees the reply and so can never return it, and the server has committed no memory on its behalf. The flood's cost to the server collapses to the packet it had to process anyway. Note that this is a threshold behaviour, not a mode someone turns on for the day: below the overflow point the server negotiates normally, so most connections in the estate are untouched — which is exactly why the harm it does is hard to notice afterwards. ## What holding nothing costs Four things follow from having no record, and a candidate who only knows the benefit will miss all four. **No retransmission.** A record carried the timer. Without it, a SYN-ACK lost on a lossy path is simply gone; the server will never resend it, and the client must wait out its own retransmission timeout — often a second or more — and resend its SYN. On a mobile path during a flood, that is added connect latency that shows up as slowness, not as failure. **No memory of what the client offered.** The options a client proposes in its SYN are negotiated once, and the server has to remember the client's side of that negotiation to honour it later. With no record, the reply can carry only a very small amount back, so several negotiated features are dropped and the connection is admitted with degraded parameters that persist for its whole life. **A limited validity window.** Because the check depends on a coarse clock, a returning ACK is only accepted for a bounded period; a peer that answers long afterwards is not admitted. **A new cost, in a different currency.** Verification is per-packet arithmetic rather than a memory lookup. An attacker who floods ACK packets that will never verify still makes the host do that work. This is usually an excellent trade — a bounded queue is the thing that failed, and CPU is elastic where a fixed queue is not — but it is a trade, not a free win. ## What it does not claim The control has exactly one job: do not commit resources to a client that has not proved it can receive. A peer that does complete the exchange is admitted like any other client and consumes a real socket and real work behind it. Anyone recording the host as protected against connection floods on the strength of this has confused the half-open case with the general one. ## How you would know it happened Nothing fails, so nothing alerts. The evidence is a record of when the degraded path engaged, and the fact that connections established during those windows carry different parameters from ones established either side of them. If you are not capturing that, the only report you will ever get is a customer saying the service feels slower, weeks later.

  • If the server keeps no record, how does it decide a returning ACK is legitimate?
    It recomputes. The value it put in the reply is a keyed function of the connection's identifying fields and a coarse clock, so when an ACK arrives that matches no connection the server derives the expected value again and compares. Nothing is looked up, and anything that does not recompute correctly is dropped. The check costs a little CPU per candidate packet rather than memory.
  • Does stateless admission engage all the time, or only under pressure?
    Only when the queue of half-completed handshakes overflows. Below that threshold the server negotiates normally, so the great majority of connections are unaffected. That is precisely why the collateral is hard to see: it applies to the subset of connections admitted while the queue was full, and it lasts for the life of each of them.
  • What happens to a client whose SYN-ACK is lost while the server holds no state?
    Nothing happens on the server side, because there is no record and therefore no retransmission timer to fire. The client waits out its own timeout and resends its SYN, adding a second or more to connection setup. On a lossy mobile path during a flood, that delay is the visible cost of the defence.

It is a cloakroom that stops keeping a ledger: instead of writing your name in a book, it stamps everything it needs onto the ticket, hands it back, and only honours a ticket that comes home.

saying these in an interview costs you the question

  • Says the mechanism stops all connection floods, spoofed or not
  • Thinks the server still keeps a small entry per arriving SYN
  • Believes it is engaged for every connection, not on overflow
  • Assumes a lost reply is retransmitted as usual
  • Claims the client needs special support for it to work

context

open as a page

Under a spoofed-source flood, what does an address-validation round trip prove, and what does it cost?

level: juniorimportance: must knowfreq 60%

basics

~20 s

It proves only that the source address really receives traffic: a spoofed sender never collects the reply and drops out. It proves nothing about intent, so a botnet host with a real address passes. Every honest client pays one extra round trip.

open as a page

You turn on a browser challenge for all traffic at the front door during a flood — who breaks, and how should you have sequenced it?

level: seniorimportance: must knowfreq 54%

basics

~20 s

Everything that is not an interactive browser breaks: partner server-to-server calls, the payments provider's callback, embedded and no-JavaScript clients, and old mobile builds. Sequence it as observe-only first, exempt the known machine paths before enforcing, then enforce narrowly and keep a way back.

open as a page

SYN cookies admitted a satellite client's long-lived API connections during a flood; a month on they are still slow. Why?

level: middleimportance: should knowfreq 44%

basics

~20 s

The stateless reply carried no window-scale option, so those connections agreed no scaling and are capped at 65,535 bytes in flight. On a 300 ms path that ceiling is under 2 Mbps, and it lasts for the life of the connection.

open as a page

Your front-ends answer with SYN cookies, but a botnet completes every handshake — what does the defence still stop?

level: seniorimportance: should knowfreq 46%

basics

~20 s

Nothing about this attack. Stateless admission only removes the cost of half-open connections from senders that never reply. A peer that completes the exchange is admitted like a customer and consumes a real socket, a worker and the work behind the request.

open as a page

You add a client-side CPU puzzle to price out a botnet flood — who ends up paying more, you or the attacker?

level: seniorimportance: should knowfreq 45%

basics

~20 s

Usually you. Puzzle difficulty is capped by your weakest legitimate device, so the toll stays small, and a botnet pays it in parallel on hardware and electricity that are not the attacker's. You add latency for every real user and barely dent a funded flood.

open as a page

A front door records every challenge token it issues; under a spoofed flood, why does that fail and what does the fix cost?

level: middleimportance: nice to knowfreq 30%

basics

~20 s

Recording issued tokens re-creates the per-client state the challenge existed to avoid, so the flood fills that table instead of the connection queue. Make the token self-validating — a keyed hash over the source address and a timestamp — and verify it by recomputing rather than looking it up.

open as a page

Monthly floods make SYN cookies engage and silently cap distant customers' throughput. How do you decide, and who owns it?

level: principalimportance: nice to knowfreq 28%

basics

~20 s

Frame it as a trade the business owns: refused connections for everyone during floods versus invisible throughput loss for a minority of distant customers. Make the invisible half measurable first, then get a named owner to accept the residual.

open as a page