An NSEC record (Next Secure record) is a DNSSEC resource record that provides authenticated denial of existence: it proves, with a cryptographic signature, that a queried name or record type does not exist in a zone. Among the DNS records used on the Internet, it is the one that lets a validating resolver trust a negative answer such as NXDOMAIN or NODATA instead of accepting it blindly.
Each NSEC record names the next existing owner name in the zone and lists the record types present at its own name. Because the whole set of NSEC records forms a closed chain, the gap between two names proves that nothing lies between them. Its hashed successor, NSEC3, solves the main weakness of this design, which is that the chain can be walked to list every name in the zone.
How an NSEC record proves that a name does not exist
An NSEC record proves nonexistence by covering an interval in canonical order. DNSSEC sorts all owner names of a zone in a defined canonical ordering (label by label, from the rightmost label, case-insensitive). Each NSEC record at name A points to the next name B, so the signed statement reads: no name exists between A and B.
When a resolver asks for a name that falls inside such a gap, the authoritative server returns the covering NSEC record together with its RRSIG signature. The resolver checks the signature against the zone’s DNSKEY record and confirms that the queried name sorts between the two names. The last NSEC record in the zone points back to the zone apex, which closes the chain.
The record also carries a type bitmap, a compact list of the record types that exist at its owner name. This field proves NODATA responses: if a client asks for an AAAA record at a name whose bitmap lists only A, RRSIG and NSEC, the absence of AAAA is signed and verifiable.
The table below lists the fields of an NSEC record as defined in RFC 4034.
| Field | Content | Purpose |
|---|---|---|
| Owner name | An existing name in the zone | Start of the covered interval |
| Next domain name | The following name in canonical order | End of the covered interval |
| Type bitmap | Record types present at the owner name | Proves which types exist |
| TTL | Usually the SOA minimum TTL | Controls negative caching time |
Negative answers that rely on NSEC records
DNSSEC needs NSEC records because negative answers cannot be signed directly. A server cannot pre-sign an answer for every possible nonexistent name, so it signs the existing intervals instead, and those proofs apply to any name that falls inside them.
Different negative situations require different combinations of NSEC records, as the following table shows.
| Situation | Records returned | What the resolver verifies |
|---|---|---|
| NXDOMAIN | NSEC covering the name, NSEC covering the wildcard | Neither the name nor a matching wildcard exists |
| NODATA | NSEC at the queried name | The name exists but the type is absent from the bitmap |
| Wildcard expansion | NSEC covering the original name | The answer was synthesized from a wildcard |
| Insecure delegation | NSEC at the delegation point | No DS record exists for the child zone |
The insecure delegation proof matters for operators: when a parent zone shows an NS record but no DS record in the NSEC bitmap, the resolver knows the child zone is intentionally unsigned and treats its answers as insecure rather than bogus.
NSEC compared with NSEC3 and compact denial
The main weakness of plain NSEC is zone walking, also called zone enumeration. Because each record reveals the next real name, anyone can follow the chain from the apex and list every name in the zone, which defeats the protection that disabling zone transfers normally provides.
NSEC3, defined in RFC 5155, replaces owner names with salted SHA-1 hashes and links the hashes in hash order. An attacker can still collect the hashes, but must run an offline dictionary attack to recover names. NSEC3 also offers the opt-out flag, which lets large delegation-heavy zones skip unsigned delegations. A third approach, often called compact denial of existence or black lies, generates a minimal NSEC record on the fly for each query.
| Property | NSEC | NSEC3 | Compact denial |
|---|---|---|---|
| Name exposure | Names readable in clear text | Hashed names, crackable offline | No real neighbors revealed |
| Signing mode | Offline or online | Offline or online | Online signing required |
| Resolver cost | Low | Higher, hashing per query | Low |
| Aggressive caching | Fully supported | Supported, less effective with opt-out | Not useful |
| Typical use | Public zones, root zone | TLDs and sensitive zones | Large DNS hosting platforms |
Since RFC 9276, operators who choose NSEC3 are advised to use zero additional iterations and an empty salt, because extra iterations add resolver cost without meaningful protection. Many resolvers treat high iteration counts as insecure.
Aggressive negative caching with NSEC
NSEC records enable aggressive use of DNSSEC-validated cache, standardized in RFC 8198. A validating resolver that has cached a signed NSEC record can answer any query falling into the same interval without contacting the authoritative server, because the proof already covers it.
This behavior reduces load from random subdomain attacks, also known as water torture attacks, where attackers send queries for random nonexistent names. It also reduces junk traffic to the root zone, which uses NSEC rather than NSEC3 partly for this reason.
Deploying NSEC records and avoiding common faults
Operators rarely write NSEC records by hand: the signing software generates the chain whenever the zone is signed, and must rebuild it whenever a name is added or removed. The choice between NSEC and NSEC3 is therefore a zone signing policy decision, not a manual record edit.
The following table maps frequent symptoms to their causes and fixes.
| Symptom | Likely cause | Fix |
|---|---|---|
| SERVFAIL on missing names | Broken or stale NSEC chain | Re-sign the zone after every change |
| Valid names reported missing | Chain not updated after adding a name | Use automatic incremental signing |
| Full zone listed by outsiders | Plain NSEC on a sensitive zone | Switch to NSEC3 or compact denial |
| Validation fails for wildcard answers | Missing wildcard proof in responses | Check server software and zone signer |
- Do not treat NSEC as secrecy: DNS names should never be relied on as hidden information.
- Keep the NSEC TTL aligned with the negative caching TTL to avoid long-lived stale proofs.
- Test with validation tools such as
dig +dnssecordelvafter every signing policy change.
Put simply
Imagine a printed, alphabetical guest list where every line says who comes next. If someone asks whether a certain person is invited, the host points to two neighboring lines and shows that the name would sit between them, yet nobody is written there. The list is stamped and signed, so the answer cannot be faked.
An NSEC record does exactly this for DNS. It turns an empty answer into a signed proof, so a resolver can trust that a name or record truly does not exist. The trade-off is that the same chain lets anyone read the whole list from top to bottom.
In practice
A university IT team signs its public zone with DNSSEC using plain NSEC. A validating resolver at a student residence receives a query for a mistyped name, libary.example.edu. The authoritative server returns NXDOMAIN with the NSEC record at lab.example.edu pointing to library.example.edu, plus the NSEC record that rules out a wildcard. The resolver verifies both signatures and confirms the negative answer, and it caches the proof for 3,600 seconds.
During an exam week, a misconfigured script floods the resolver with thousands of random lookups under the same zone. Thanks to aggressive negative caching, the resolver answers most of them from the cached NSEC intervals, and traffic to the authoritative servers falls sharply. The team later moves its internal staff subdomain to NSEC3 with zero iterations, because that part of the zone contains host names that should not be easy to enumerate.