Sub topic 15
DNSSEC: signing DNS data
This chapter assumes you have read the earlier chapters on resource records, the resolution walkthrough, DNS messages, and threats such as cache poisoning. You should also be comfortable reading dig output.
What problem DNSSEC solves
Plain DNS has no way to prove that an answer is genuine. A resolver that receives a response accepts it if the question section, the transaction ID, and the source address and port match. An attacker who can forge a matching response can plant false data in the cache, and every client of that resolver then receives it.
DNSSEC (DNS Security Extensions) adds digital signatures to DNS data. A validating resolver can then check two things:
- Authenticity: the data came from the owner of the zone.
- Integrity: the data was not changed on the way.
DNSSEC does not encrypt anything. Queries and answers are still readable by anyone on the path. Hiding them is the job of DoT and DoH, covered in the next chapter.
New record types
DNSSEC works by adding records to a zone. Existing records such as A and MX are unchanged.
| Record | Purpose |
|---|---|
| RRSIG | A signature over one RRset (all records sharing the same name, class and type) |
| DNSKEY | A public key of the zone, used to verify RRSIG records |
| DS | A hash of a child zone's key-signing DNSKEY, stored in the parent zone |
| NSEC / NSEC3 | Signed proof that a name or type does not exist |
Signatures cover whole RRsets, not single records. If example.com has two NS records, one RRSIG covers both.
Each RRSIG carries an inception time and an expiration time. A signature is valid only between them. Signing is therefore an ongoing process: the zone must be re-signed before signatures expire.
Two keys per zone
Most zones use two kinds of key.
- ZSK (zone-signing key): signs the zone's ordinary RRsets. It is used often, so it is rotated often.
- KSK (key-signing key): signs only the DNSKEY RRset. A hash of it is published as a DS record in the parent zone, so changing it means coordinating with the parent.
Splitting the roles lets operators rotate the ZSK often without involving the parent. Some modern setups use a single combined key instead, which is simpler but ties every rotation to the parent.
The chain of trust
A signature is only useful if you trust the key that made it. DNSSEC takes that trust from the top of the DNS hierarchy. Resolvers ship with a trust anchor, which is the root zone's key (or its hash). Each parent then vouches for its child through a DS record.
A validating resolver checks the chain in this order:
- It fetches the A record and its RRSIG for
example.com. - It fetches the
example.comDNSKEY RRset and checks the RRSIG with the zone's ZSK. It also confirms that the DNSKEY RRset is signed by the KSK. - It fetches the DS record for
example.comfrom thecomservers. It hashes the KSK and compares the result with the DS. - It repeats the same check for
com, using the DS held in the root zone. - It stops when it reaches a DNSKEY that matches its trust anchor.
If every link holds, the answer is secure. If any link is missing, the result depends on why. A zone with no DS in its parent is simply insecure, meaning unsigned, and it resolves as plain DNS. A zone that has a DS but fails validation is bogus.
Looking at DNSSEC with dig
The +dnssec option sets the DO (DNSSEC OK) bit in the query. That asks the server to include RRSIG records in the answer.
dig +dnssec example.com A
dig +noall +answer +multiline example.com DNSKEY
dig +noall +answer example.com DSThe first command returns the A record plus its RRSIG. The second shows the zone's public keys. A flags value of 257 marks a KSK and 256 marks a ZSK. The third asks for the DS record, which is held by the parent zone's servers.
The part of the output to read first is the header.
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1The ad flag means Authenticated Data. It tells you that the resolver validated the answer. Keep two limits in mind:
- You can only trust
adif you trust the path between you and the resolver. The stub-to-resolver hop is not protected by DNSSEC. Anyone on that path could set the flag falsely. - Most stub resolvers do not validate. They rely on the recursive resolver and read this flag.
You can run dig +trace +dnssec example.com to see the DS and RRSIG records at each step of the delegation.
What a validation failure looks like
When validation fails, a validating resolver does not return the data. It returns SERVFAIL, and the client sees a name that does not resolve.
The +cd flag (Checking Disabled) tells the resolver to skip validation and return what it received. Comparing a normal query with a +cd query isolates whether DNSSEC is the cause. The names below are public test domains maintained for this purpose.
dig @1.1.1.1 sigfail.verteiltesysteme.net A
dig @1.1.1.1 +cd sigfail.verteiltesysteme.net A
dig @1.1.1.1 sigok.verteiltesysteme.net AThe first query should return SERVFAIL because the signature is deliberately broken. The second should return an answer, and the third should return an answer with the ad flag set. If the +cd query succeeds and the normal one fails, you have a DNSSEC problem and not a missing record.
Proving that a name does not exist
An attacker could also forge a "name does not exist" response (NXDOMAIN). DNSSEC cannot sign an answer that does not exist, so it signs a statement about gaps instead.
- NSEC records link each name in the zone to the next one in sorted order, with the list of types present at the name. A signed NSEC proves that nothing exists between the two names. A side effect is that anyone can walk the whole zone by following the chain.
- NSEC3 replaces names with hashes, which makes zone walking much harder. It does not make it impossible, because offline guessing of hashed names is still feasible.
Costs and failure modes
DNSSEC trades extra complexity and operational risk for stronger guarantees.
- Larger responses. Signatures and keys make messages much bigger. They often exceed the classic 512-byte UDP limit, so resolvers use EDNS0 to advertise a larger buffer and fall back to TCP when a response is truncated. Firewalls that block TCP/53 or fragmented UDP cause intermittent failures.
- Amplification. Large signed responses make DNS servers more useful for reflection attacks. Servers need rate limiting.
- Expired signatures. If re-signing stops, every record in the zone turns bogus when its RRSIG expires, and validating resolvers return SERVFAIL for the whole zone. Monitor signature expiry.
- DS mismatch. Moving a zone to a new DNS provider without updating or removing the DS at the parent breaks resolution for validating clients. Remove the old DS or add the new one before cutting over.
- Key rollover errors. Rolling a key requires publishing the new key, waiting for cached DNSKEY and RRSIG data to expire (TTLs matter here), and only then retiring the old one.
- Limited scope. DNSSEC does not protect the stub-to-resolver hop on its own. It also does not hide queries, and it does not stop a compromised authoritative server from signing false data.
Exercise
A resolver returns SERVFAIL for example.org. Querying the same name with dig +cd returns a normal A record. What does this tell you, and what are two likely causes?
Show answer
Validation is failing, not the lookup itself, because +cd skips validation and the data comes back. Likely causes are expired RRSIG records (the zone was not re-signed) and a DS record in the parent that does not match any DNSKEY in the zone, for example after a provider change or an incomplete key rollover.
Exercise
Why does DNSSEC need a DS record in the parent zone, and which entity's key does a validating resolver trust without proof?
Show answer
The DS record links the child's key to the parent, which is how trust passes down the hierarchy. Without it, a resolver could not tell a genuine child key from an attacker's. The resolver trusts the root zone's key, its configured trust anchor, without proof.