Every UDP packet carries a return address the sender writes himself. For three decades the Domain Name System took that address on faith — and the bill for that faith was paid by strangers, the unlucky third parties whose addresses got stamped onto floods of queries they never sent.

RFC 7873 is the correction, and it is almost insultingly small. It is a cookie.

DNS Cookies, standardised in RFC 7873 in May 2016 by Donald Eastlake 3rd and Mark Andrews, and sharpened for interoperability by RFC 9018 in 2021, are the cheapest proof-of-address primitive the Internet has ever shipped. A client must echo a token it could only have received at the address it claims. That single round trip turns source-address spoofing from free into a cost — and it does it without a registry, a certificate, a membership fee or a new architecture.

The defence is not identity. It is arithmetic: receiving something at an address is expensive if you do not own the address.

The Mechanism: A Receipt, Not a Passport

DNS Cookies ride inside the EDNS(0) OPT pseudo-record defined by RFC 6891, as option code 10. The specification is short enough to read on a train:

  • Client Cookie, 8 bytes. A nonce the client generates. RFC 7873 recommends deriving it from the client's own address plus a secret, so it changes whenever the address changes.
  • Server Cookie, 8 to 32 bytes. Computed from a server secret and the client's address, and optionally the client cookie. The server hands it back; the client echoes it on the next query.
  • BADCOOKIE, extended RCODE 23. The server's way of saying "stale — here is a fresh one, try again." One extra round trip, then silence.
  • No state. The server remembers nothing. The cookie is computed, not stored, which is the only reason the mechanism survives contact with a root server answering queries at a rate no per-client table could bear.

That last bullet is the engineering trick, and it is why the thing works at all. A root server cannot afford a table. It can afford a hash.

If the source address is forged, the reply lands somewhere else. The forger never learns the server cookie. Without it, the forger never gets the big answer.

Why a Forged Address Suddenly Costs Something

Reflection attacks are a postage scam. The attacker writes the victim's address on the envelope, mails a small query, and the server mails back something tens of times larger — to the victim. The attacker pays one packet. The victim pays the bandwidth, the CPU and, if the flood is big enough, the outage.

Cookies move the invoice. A server that has not yet validated an address answers small: a cookie, not a payload. The full response goes only to an address that has proved it can receive.

Which produces the sentence that explains the whole design: a round trip is the one thing a forged address cannot buy.

Everything else follows. No certificate authority, no key exchange, no trust anchor, no policy development process. Just a challenge that costs an honest client nothing and a liar one address it does not have.

Delegation Is a Claim. The Cookie Is the Evidence.

Delegation is the most consequential thing a zone file does, and it is also the least verified. A parent publishes a name server and a glue address. Whether anyone is actually home at that address is discovered later, by asking.

The record is a claim on a map. The cookie is a knock on the door.

Lu Heng put the general rule plainly in his Note on uniqueness coordination: "A registry record describes reality. It does not create it." DNS is the same discipline in a different namespace. The delegation describes where the answer lives. It does not guarantee that anything lives there. The evidence is a response, from the address, carrying a token that only that address could have received.

This is why cookies matter beyond the denial-of-service arithmetic. They are a working example of the smallest sufficient primitive: proof of control at an address, cheap enough to demand on every query, small enough to fit in an option field, and verifiable locally by the party that needs to know.

NAT, Anycast, and the Unglamorous Reasons It Survived

Most elegant protocol ideas die on two rocks: middleboxes and geography. RFC 7873 was designed with both in view, which is why it is deployed rather than merely admired.

NAT breaks the cookie, and the cookie expects it

A client behind a NAT gets its source address rewritten. Its client cookie changes with the address, the server cookie it is holding becomes invalid, and the server answers BADCOOKIE. The client retries with a fresh one. Nobody files a bug.

The mechanism tolerates address churn because it never assumed address stability. It assumed change, and made recovery cost exactly one round trip. That is the difference between a protocol designed for the Internet and a protocol designed for a diagram.

Anycast means the secret has to travel

A query to a root server can land on any node in the cluster. If every node kept its own secret, cookies would break on every reroute and the mechanism would fail precisely where it is most needed.

RFC 7873 requires the server cookie to remain valid across the anycast set. RFC 9018 turned that requirement into an interoperable construction: a 16-byte server cookie — one version byte, three reserved, a four-byte timestamp, and eight bytes of SipHash-2-4 output over the client cookie, the timestamp and the client's address, keyed by a 128-bit secret.

Sixteen bytes. That is the entire shared state of a global anti-spoofing system.

What DNS Cookies Do Not Do

The RFC is honest about its own ceiling. RFC 7873 offers "limited protection," and the word is doing real work.

  • They are not encryption. Nothing is hidden. The cookie is a receipt, not a seal.
  • They are not DNSSEC. DNSSEC proves the data. Cookies prove the far end of the pipe.
  • They do not stop on-path attackers. Anyone who can watch your traffic can watch your cookie go by.
  • They do not authenticate the answer. A validated cookie says the reply reached the right address. It says nothing about whether the reply is true.

What they do is remove an entire class of cheap attack from the economics of the network. That is a smaller claim than most security marketing makes, and a far more durable one.

The Deployment Ledger: Where RFC 7873 Actually Lives

An RFC is a document. Lu Heng's Note on Minimum Initial Specification puts the boundary exactly where it belongs: "A proposal is not reality. A recommendation is not reality. A document is not reality."

What made RFC 7873 real was implementation. The mainstream open-source nameservers and resolvers — BIND 9, Knot DNS, NSD, Unbound and PowerDNS — ship cookie support. The option was small enough that vendors added it as a feature rather than a project, and the fallback is graceful: a server configured to answer only cookie-bearing queries in full sets the truncated bit, and the resolver retries over TCP. Slower, correct, and no cliff.

That fallback is the design detail worth stealing. The mechanism does not invalidate a client that has not adopted it. It prices the difference and lets the client decide.

Lu Heng's formulation of the test is the right one — "A system that cannot be forked, locally verified, or selectively accepted without destroying valid operation has probably hidden governance power inside its recordkeeping function." DNS Cookies pass that test without trying. You can verify a cookie yourself, in your own resolver, with no committee's permission. You can accept it or not. Nothing breaks either way.

Why This Is a Governance Story Wearing a Protocol Header

Count what RFC 7873 added to the world. One option code. One extended RCODE. Sixteen bytes of server cookie. A shared secret per anycast set. No authority, no register, no membership class, no compliance regime, no dispute resolution procedure for a stale cookie.

It is what thin coordination looks like when it is done properly: a deterministic rule, locally verifiable, voluntarily adopted, with a replacement path for anyone who declines.

Compare the alternative. A thick-governance version of this problem would have produced a Cookie Authority, a policy development process for cookie lifetimes, a compliance programme, a fee schedule and a dispute panel — and the amplification attacks would have continued throughout the consultation period.

Instead the IETF shipped an option code and a hash, and let deployment settle the argument. "The Internet was not built by permission. It was built by coordination."

The Bill, Finally, Goes to the Right Address

RFC 7873 never asks who you are. It asks whether the answer arrives.

That is the whole test, and it is the only one the Internet has ever been able to enforce. Eight bytes out, sixteen bytes back, one round trip — and the stranger whose address got used as a return envelope stops paying for somebody else's postage.

The forger does not get a verdict. The forger gets silence, which is the most honest answer the network has.