rfc-9018

Interoperable Domain Name System (DNS) Server Cookies

O. Sury, W. Toorop, D. Eastlake 3rd, M. Andrews
date2021-04 streamIETF areaops wgdnsop statusPROPOSED STANDARD pages16 canonicalhttps://www.rfc-editor.org/rfc/rfc9018 doi10.17487/RFC9018
DNS Cookies, as specified in RFC 7873, are a lightweight DNS transaction security mechanism that provide limited protection to DNS servers and clients against a variety of denial-of-service amplification, forgery, or cache-poisoning attacks by off-path attackers. This document updates RFC 7873 with precise directions for creating Server Cookies so that an anycast server set including diverse implementations will interoperate with standard clients, with suggestions for constructing Client Cookies in a privacy-preserving fashion, and with suggestions on how to update a Server Secret. An IANA registry listing the methods and associated pseudorandom function suitable for creating DNS Server Cookies has been created with the method described in this document as the first and, as of the time of publication, only entry.

updates

Extracted elements (24)

design-rationale §1

RFC 7873 left the precise Server Cookie construction algorithm to implementations, resulting in incompatible implementations across vendors that made DNS Cookies impractical on multi-vendor anycast networks. This document standardizes an exact algorithm so diverse implementations sharing a secret will interoperate.

dns, security

design-rationale §3

The original RFC 7873 recommendation included the Client IP address as input to Client Cookie construction to prevent cross-link tracking. Multiple DNS vendors found this impractical because the Client Cookie is typically computed before the Client IP address is known, so the IP input requirement was removed and replaced with mandatory cookie invalidation on IP change.

dns, privacy

design-rationale §4.2

The Reserved Sub-Field in the Server Cookie structure is intentionally not enforced to be zero on verification; this allows future versions to use those bits while remaining backward-compatible, as long as the Hash is computed over the received Reserved value.

dns

interoperability-note §1

Client Cookies do not need to be interoperable across different implementations because each client need only recognize its own cookies; the interoperability requirement applies only to Server Cookies in anycast deployments.

dns

interoperability-note §4.4

Enforcing the received COOKIE option to be exactly 24 bytes for version 1 ensures the SipHash-2-4 input is an injective function of its elements, specifically preventing a 36-byte COOKIE option from an IPv4 client from being mistakenly validated as if it came from an IPv6 client (data substitution attack).

dns, security

normative-requirement §3 MUST

A client MUST use a different Client Cookie for each different Server IP address to provide minimal authentication of the targeted server and complicate spoofing. The Client Cookie SHOULD have 64 bits of entropy.

dns, security

normative-requirement §4.3 MUST

All comparisons involving Timestamp fields MUST use serial number arithmetic as defined in RFC 1982, which handles relative time windows less than 68 years at any future date.

dns

normative-requirement §3 MUST NOT

Clients MUST NOT reuse a Client or Server Cookie after the Client IP address has changed, in order to prevent tracking of devices across links and avoid circumventing IPv6 Privacy Extensions.

dns, privacy

normative-requirement §4.2 MUST

On construction, the Reserved Sub-Field MUST be set to zero octets. On Server Cookie verification, the server MUST NOT enforce those fields to be zero; the Hash must be computed with the received Reserved value as-is.

dns

normative-requirement §6 REQUIRED

SipHash-2-4 is REQUIRED as the mandatory and default algorithm for DNS Cookies in a compliant DNS server to ensure interoperability between DNS implementations.

dns, crypto, security

normative-requirement §2 MUST

The interoperable Server Cookie algorithm specified in Section 4 of this document MUST be used by all Server Cookie implementations, replacing the example algorithm from Appendix B.2 of RFC 7873.

dns, security

normative-requirement §4.4 MUST

The Server Secret MUST be configurable to ensure that servers in an anycast network return consistent, mutually verifiable Server Cookies.

dns, security

normative-requirement §2 MUST NOT

The simple Client Cookie and Server Cookie algorithms in Appendices A.1 and B.1 of RFC 7873 MUST NOT be used, as the resulting cookies are too weak against modern security standards.

dns, security

normative-requirement §4.3 MUST

The Timestamp value MUST be checked by the server to be within a defined period; servers SHOULD allow cookies within a 1-hour window in the past and a 5-minute window into the future to accommodate low-volume clients and clock skew in anycast sets.

dns, security

normative-requirement §4.4 MUST

When a DNS server receives a version 1 Server Cookie for validation, the length of the received COOKIE option MUST be precisely 24 bytes (8-byte Client Cookie plus 16-byte Server Cookie); this length verification is REQUIRED to guarantee correct SipHash-2-4 input lengths.

dns, security

normative-requirement §3 MUST NOT

When a server does not support DNS Cookies, the client MUST NOT send the same Client Cookie to that same server again; it is recommended to wait a period (e.g., five minutes) before retrying with a new Client Cookie.

dns, privacy

privacy-consideration §8.1

To prevent client tracking when the client IP changes, a new Client Cookie MUST be created on IP address change, and a client MUST NOT send a previously sent Client Cookie to a server that has not been observed to support DNS Cookies. Tracking of the public IP of a NAT device is explicitly out of scope.

dns, privacy

registry §7

IANA created the 'DNS Server Cookie Methods' registry under 'Domain Name System (DNS) Parameters', with Expert Review assignment policy. The registry maps (Version, Size) pairs to construction methods; Version 1 / 16 bytes is assigned to SipHash-2-4 per RFC 9018 Section 4.

dns, registry

security-consideration §8

DNS Cookies provide no protection against on-path adversaries who can observe plaintext DNS traffic. An on-path attacker observing a Server Cookie can use it for denial-of-service amplification, forgery, or cache-poisoning attacks against the observed client for the full lifetime of that Server Cookie.

dns, security

security-consideration §8.2

Servers validating version 1 Server Cookies require access to a reliable, attacker-unalterable time value. All servers in an anycast set must have their clocks synchronized to correctly validate Timestamp Sub-Fields.

dns, security

security-consideration §8.2

The cleartext Timestamp Sub-Field in version 1 Server Cookies is visible to on-path observers and reveals the exact time window during which the observed Server Cookie remains valid for use in attacks against the client.

dns, security

state-machine §5

Deploying a new Server Secret MUST be done in three stages: Stage 1 — distribute new secret, keep generating with old, accept both; Stage 2 — begin generating with new secret, still accept both; Stage 3 — remove old secret. The operator SHOULD wait at least the longest zone TTL plus 1 hour between Stage 2 and Stage 3.

dns, security

wire-format §4

The 128-bit Server Cookie consists of four Sub-Fields: a 1-octet Version, a 3-octet Reserved, a 4-octet Timestamp (Unix epoch, unsigned, network byte order), and an 8-octet Hash. The total COOKIE option for version 1 is exactly 24 bytes (8-byte Client Cookie plus 16-byte Server Cookie).

dns

wire-format §4.4

The Version 1 Hash Sub-Field is computed as SipHash-2-4(Client Cookie | Version | Reserved | Timestamp | Client-IP, Server Secret), where Client-IP is 4 bytes for IPv4 or 16 bytes for IPv6, yielding a total input of exactly 20 bytes (IPv4) or 32 bytes (IPv6).

dns, crypto