NXDOMAIN: There Really Is Nothing Underneath
If a domain name does not exist, nothing underneath it exists either, and a resolver should cache it that way.
Bortzmeyer, S. and S. Huque, "NXDOMAIN: There Really Is Nothing Underneath", RFC 8020, DOI 10.17487/RFC8020, November 2016, <https://www.rfc-editor.org/info/rfc8020>.
@misc{rfc8020,
series = {Request for Comments},
number = 8020,
howpublished = {RFC 8020},
publisher = {RFC Editor},
doi = {10.17487/RFC8020},
url = {https://www.rfc-editor.org/info/rfc8020},
author = {S. Bortzmeyer and S. Huque},
title = {{NXDOMAIN: There Really Is Nothing Underneath}},
pagetotal = 10,
year = 2016,
month = nov,
} RFC text
Contents
Internet Engineering Task Force (IETF) S. Bortzmeyer
Request for Comments: 8020 AFNIC
Updates: 1034, 2308 S. Huque
Category: Standards Track Verisign Labs
ISSN: 2070-1721 November 2016
NXDOMAIN: There Really Is Nothing Underneath
Abstract
This document states clearly that when a DNS resolver receives a
response with a response code of NXDOMAIN, it means that the domain
name which is thus denied AND ALL THE NAMES UNDER IT do not exist.
This document clarifies RFC 1034 and modifies a portion of RFC 2308:
it updates both of them.
Status of This Memo
This is an Internet Standards Track document.
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by the
Internet Engineering Steering Group (IESG). Further information on
Internet Standards is available in Section 2 of RFC 7841.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
http://www.rfc-editor.org/info/rfc8020.
Copyright Notice
Copyright (c) 2016 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
Table of Contents
1. Introduction and Background .....................................2
1.1. Terminology ................................................3
2. Rules ...........................................................3
3. Updates to RFCs .................................................5
3.1. Updates to RFC 1034 ........................................5
3.2. Updates to RFC 2308 ........................................5
4. Benefits ........................................................5
5. Possible Issues .................................................6
6. Implementation Considerations ...................................6
7. Security Considerations .........................................7
8. References ......................................................7
8.1. Normative References .......................................7
8.2. Informative References .....................................8
Appendix A. Why can't we just use the owner name of the returned
SOA? ...................................................9
Appendix B. Related Approaches .....................................9
Acknowledgments ....................................................9
Authors' Addresses ................................................10
1. Introduction and Background
The DNS protocol [RFC1035] defines response code 3 as "Name Error",
or "NXDOMAIN" [RFC2308], which means that the queried domain name
does not exist in the DNS. Since domain names are represented as a
tree of labels ([RFC1034], Section 3.1), nonexistence of a node
implies nonexistence of the entire subtree rooted at this node.
The DNS iterative resolution algorithm precisely interprets the
NXDOMAIN signal in this manner. If it encounters an NXDOMAIN
response code from an authoritative server, it immediately stops
iteration and returns the NXDOMAIN response to the querier.
However, in most known existing resolvers today, a cached
nonexistence for a domain is not considered "proof" that there can be
no child domains underneath. This is due to an ambiguity in
[RFC1034] that failed to distinguish Empty Non-Terminal (ENT) names
([RFC7719]) from nonexistent names (Section 3.1). The distinction
became especially important for the development of DNSSEC, which
provides proof of nonexistence. [RFC4035], Section 3.1.3.2,
describes how security-aware authoritative name servers make the
distinction, but no existing RFCs describe the behavior for recursive
name servers.
This document specifies that an NXDOMAIN response for a domain name
means that no child domains underneath the queried name exist either;
furthermore, it means that DNS resolvers should interpret cached
nonexistence in this manner. Since the domain names are organized in
a tree, it is a simple consequence of the tree structure:
nonexistence of a node implies nonexistence of the entire subtree
rooted at this node.
1.1. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [RFC2119].
"QNAME": defined in [RFC1034] and in [RFC1035], Section 4.1.2, but,
because [RFC2308] provides a different definition, we repeat the
original one here: the QNAME is the domain name in the question
section.
"Denied name": the domain name whose existence has been denied by a
response RCODE of NXDOMAIN. In most cases, it is the QNAME but,
because of [RFC6604], it is not always the case.
Other terms are defined in [RFC1034], [RFC1035], and (like NXDOMAIN
itself) in the more recent [RFC7719].
The domain name space is conceptually defined in terms of a tree
structure. The implementation of a DNS resolver/cache MAY use a tree
or other data structures. The cache being a subset of the data in
the domain name space, it is much easier to reason about it in terms
of that tree structure and to describe things in those terms (names
under/above, descendant names, subtrees, etc.). In fact, the DNS
algorithm description in [RFC1034] even states an assumption that the
cache is a tree structure, so the precedent is already well
established: see its Section 4.3.2, which says "The following
algorithm assumes that the RRs are organized in several tree
structures, one for each zone, and another for the cache..." So, in
this document, each time we talk about a tree or tree operations,
we're referring to the model, not to the actual implementation.
2. Rules
When an iterative caching DNS resolver receives an NXDOMAIN response,
it SHOULD store it in its cache and then all names and resource
record sets (RRsets) at or below that node SHOULD be considered
unreachable. Subsequent queries for such names SHOULD elicit an
NXDOMAIN response.
But, if a resolver has cached data under the NXDOMAIN cut, it MAY
continue to send it as a reply (until the TTL of this cached data
expires), since this may avoid additional processing when a query is
received. Section 6 provides more information about this.
Another exception is that a validating resolver MAY decide to
implement the "NXDOMAIN cut" behavior (described in the first
paragraph of this section) only when the NXDOMAIN response has been
validated with DNSSEC. See Section 7 for the rationale.
The fact that a subtree does not exist is not forever: [RFC2308],
Section 3, already describes the amount of time that an NXDOMAIN
response may be cached (the "negative TTL").
If the NXDOMAIN response due to a cached nonexistence is from a
DNSSEC-signed zone, then it will have accompanying NSEC or NSEC3
records that authenticate the nonexistence of the name. For a
descendant name of the original NXDOMAIN name, the same set of NSEC
or NSEC3 records proves the nonexistence of the descendant name. The
iterative, caching resolver MUST return these NSEC or NSEC3 records
in the response to the triggering query if the query had the DNSSEC
OK (DO) bit set.
Warning: if there is a chain of CNAME (or DNAME), the name that does
not exist is the last of the chain ([RFC6604]) and not the QNAME.
The NXDOMAIN stored in the cache is for the denied name, not always
for the QNAME.
As an example of the consequence of these rules, consider two
successive queries to a resolver with a nonexisting domain
'foo.example': the first is for 'foo.example' (which results in an
NXDOMAIN) and the second for 'bar.foo.example' (which also results in
an NXDOMAIN). Many resolvers today will forward both queries.
However, following the rules in this document ("NXDOMAIN cut"), a
resolver would cache the first NXDOMAIN response, as a sign of
nonexistence, and then immediately return an NXDOMAIN response for
the second query, without transmitting it to an authoritative server.
If the first request is for 'bar.foo.example' and the second for
'baz.foo.example', then the first NXDOMAIN response won't tell
anything about 'baz.foo.example'; therefore, the second query will be
transmitted as it was before the use of "NXDOMAIN cut" optimization
(see Appendix A).
3. Updates to RFCs
3.1. Updates to RFC 1034
This document clarifies possible ambiguities in [RFC1034] that did
not clearly distinguish Empty Non-Terminal (ENT) names ([RFC7719])
from nonexistent names, and it refers to subsequent documents that
do. ENTs are nodes in the DNS that do not have resource record sets
associated with them but have descendant nodes that do. The correct
response to ENTs is NODATA (i.e., a response code of NOERROR and an
empty answer section). Additional clarifying language on these
points is provided in Section 7.16 of [RFC2136] and in Sections 2.2.2
and 2.2.3 of [RFC4592].
3.2. Updates to RFC 2308
The second paragraph of Section 5 in [RFC2308] states the following:
A negative answer that resulted from a name error (NXDOMAIN)
should be cached such that it can be retrieved and returned in
response to another query for the same <QNAME, QCLASS> that
resulted in the cached negative response.
This document revises that paragraph to the following:
A negative answer that resulted from a name error (NXDOMAIN)
should be cached such that it can be retrieved and returned in
response to another query for the same <QNAME, QCLASS> that
resulted in the cached negative response, or where the QNAME is a
descendant of the original QNAME and the QCLASS is the same.
Section 2 above elaborates on the revised rule and specifies when it
may be reasonable to relax or ignore it.
4. Benefits
The main benefit is a better efficiency of the caches. In the
example above, the resolver sends only one query instead of two, the
second one being answered from the cache. This will benefit the
entire DNS ecosystem, since the authoritative name servers will have
less unnecessary traffic to process.
The correct behavior (in [RFC1034] and made clearer in this document)
is especially useful when combined with QNAME minimization [RFC7816]
since it will allow a resolver to stop searching as soon as an
NXDOMAIN is encountered.
"NXDOMAIN cut" may also help mitigate certain types of random QNAME
attacks [joost-dnsterror] and [balakrichenan-dafa888], where there is
a fixed suffix that does not exist. In these attacks against the
authoritative name server, queries are sent to resolvers for a QNAME
composed of a fixed suffix ("dafa888.wf" in one of the articles
above), which is typically nonexistent, and a random prefix,
different for each request. A resolver receiving these requests has
to forward them to the authoritative servers. With "NXDOMAIN cut", a
system administrator would just have to send to the resolver a query
for the fixed suffix, the resolver would get a NXDOMAIN and then
would stop forwarding the queries. (It would be better if the SOA
record in the NXDOMAIN response were sufficient to find the
nonexisting domain, but this is not the case, see Appendix A.)
5. Possible Issues
Let's assume that the Top-Level Domain (TLD) example exists, but
foobar.example is not delegated (so the example's name servers will
reply NXDOMAIN for a query about anything.foobar.example). A system
administrator decides to name the internal machines of his
organization under office.foobar.example and uses a trick of his
resolver to forward requests about this zone to his local
authoritative name servers. "NXDOMAIN cut" would create problems
here; depending on the order of requests to the resolver, it may have
cached the nonexistence from example and therefore "deleted"
everything under it. This document assumes that such a setup is rare
and does not need to be supported.
Today, another possible issue exists; we see authoritative name
servers that reply to ENT ([RFC7719], Section 6) with NXDOMAIN
instead of the normal NODATA ([RFC7719], Section 3).
Such name servers are definitely wrong and have always been. Their
behaviour is incompatible with DNSSEC. Given the advantages of
"NXDOMAIN cut", there is little reason to support this behavior.
6. Implementation Considerations
This section is non-normative and is composed only of various things
that may be useful for implementors. A recursive resolver may
implement its cache in many ways. The most obvious one is a tree
data structure, because it fits the data model of domain names. But,
in practice, other implementations are possible, as well as various
optimizations (such as a tree, augmented by an index of some common
domain names).
If a resolver implements its cache as a tree (without any
optimization), one way to follow the rules in Section 2 is as
follows: when receiving the NXDOMAIN, prune the subtree of positive
cache entries at that node or delete all individual cache entries for
names below that node. Then, when searching downward in its cache,
this iterative caching DNS resolver will stop searching if it
encounters a cached nonexistence.
Some resolvers may have a cache that is NOT organized as a tree (but,
for instance, as a dictionary); therefore, they have a reason to
ignore the rules of Section 2. So these rules use SHOULD and not
MUST.
7. Security Considerations
The technique described in this document may help against a denial-
of-service attack named "random qnames" described in Section 4.
If a resolver does not validate the answers with DNSSEC, or if the
zone is not signed, the resolver can of course be poisoned with a
false NXDOMAIN, thus, "deleting" a part of the domain name tree.
This denial-of-service attack is already possible without the rules
of this document (but "NXDOMAIN cut" may increase its effects). The
only solution is to use DNSSEC.
8. References
8.1. Normative References
[RFC1034] Mockapetris, P., "Domain names - concepts and facilities",
STD 13, RFC 1034, DOI 10.17487/RFC1034, November 1987,
<http://www.rfc-editor.org/info/rfc1034>.
[RFC1035] Mockapetris, P., "Domain names - implementation and
specification", STD 13, RFC 1035, DOI 10.17487/RFC1035,
November 1987, <http://www.rfc-editor.org/info/rfc1035>.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997,
<http://www.rfc-editor.org/info/rfc2119>.
[RFC2136] Vixie, P., Ed., Thomson, S., Rekhter, Y., and J. Bound,
"Dynamic Updates in the Domain Name System (DNS UPDATE)",
RFC 2136, DOI 10.17487/RFC2136, April 1997,
<http://www.rfc-editor.org/info/rfc2136>.
[RFC2308] Andrews, M., "Negative Caching of DNS Queries (DNS
NCACHE)", RFC 2308, DOI 10.17487/RFC2308, March 1998,
<http://www.rfc-editor.org/info/rfc2308>.
[RFC4592] Lewis, E., "The Role of Wildcards in the Domain Name
System", RFC 4592, DOI 10.17487/RFC4592, July 2006,
<http://www.rfc-editor.org/info/rfc4592>.
[RFC6604] Eastlake 3rd, D., "xNAME RCODE and Status Bits
Clarification", RFC 6604, DOI 10.17487/RFC6604, April
2012, <http://www.rfc-editor.org/info/rfc6604>.
8.2. Informative References
[RFC4035] Arends, R., Austein, R., Larson, M., Massey, D., and S.
Rose, "Protocol Modifications for the DNS Security
Extensions", RFC 4035, DOI 10.17487/RFC4035, March 2005,
<http://www.rfc-editor.org/info/rfc4035>.
[RFC7719] Hoffman, P., Sullivan, A., and K. Fujiwara, "DNS
Terminology", RFC 7719, DOI 10.17487/RFC7719, December
2015, <http://www.rfc-editor.org/info/rfc7719>.
[RFC7816] Bortzmeyer, S., "DNS Query Name Minimisation to Improve
Privacy", RFC 7816, DOI 10.17487/RFC7816, March 2016,
<http://www.rfc-editor.org/info/rfc7816>.
[DNSRRR] Vixie, P., Joffe, R., and F. Neves, "Improvements to DNS
Resolvers for Resiliency, Robustness, and Responsiveness",
Work in Progress, draft-vixie-dnsext-resimprove-00, June
2010.
[NSEC] Fujiwara, K., Kato, A., and W. Kumari, "Aggressive use of
NSEC/NSEC3", Work in Progress, draft-ietf-dnsop-nsec-
aggressiveuse-04, September 2016.
[joost-dnsterror]
Joost, M., "About DNS Attacks and ICMP Destination
Unreachable Reports", December 2014,
<http://www.michael-joost.de/dnsterror.html>.
[balakrichenan-dafa888]
Balakrichenan, S., "Disturbance in the DNS - "Random
qnames", the dafa888 DoS attack"", October 2014,
<https://indico.dns-oarc.net/event/20/session/3/
contribution/3>.
Appendix A. Why can't we just use the owner name of the returned SOA?
In this document, we deduce the nonexistence of a domain only for
NXDOMAIN answers where the denied name was the exact domain. If a
resolver sends a query to the name servers of the TLD example, asking
for the mail exchange (MX) record for www.foobar.example, and
subsequently receives a NXDOMAIN, it can only register the fact that
www.foobar.example (and everything underneath) does not exist. This
is true regardless of whether or not the accompanying SOA record is
for the domain example only. One cannot infer that foobar.example is
nonexistent. The accompanying SOA record indicates the apex of the
zone, not the closest existing domain name. So, using the owner name
of the SOA record in the authority section to deduce "NXDOMAIN cuts"
is currently definitely not OK.
Deducing the nonexistence of a node from the SOA in the NXDOMAIN
reply may certainly help with random qnames attacks, but this is out-
of-scope for this document. It would require addressing the problems
mentioned in the first paragraph of this section. A possible
solution is, when receiving a NXDOMAIN with a SOA that is more than
one label up in the tree, to send requests for the domains that are
between the QNAME and the owner name of the SOA. (A resolver that
does DNSSEC validation or QNAME minimization will need to do it
anyway.)
Appendix B. Related Approaches
The document [NSEC] describes another way to address some of the same
concerns (decreasing the traffic for nonexisting domain names).
Unlike "NXDOMAIN cut", it requires DNSSEC, but it is more powerful
since it can synthesize NXDOMAINs for domains that were not queried.
Acknowledgments
The main idea in this document is taken from [DNSRRR], Section 3,
"Stopping Downward Cache Search on NXDOMAIN". Thanks to its authors,
Paul Vixie, Rodney Joffe, and Frederico Neves. Additionally, Tony
Finch, Ted Lemon, John Levine, Jinmei Tatuya, Bob Harold, and Duane
Wessels provided valuable feedback and suggestions.
Authors' Addresses
Stephane Bortzmeyer
AFNIC
1, rue Stephenson
Montigny-le-Bretonneux 78180
France
Phone: +33 1 39 30 83 46
Email: bortzmeyer+ietf@nic.fr
URI: https://www.afnic.fr/
Shumon Huque
Verisign Labs
12061 Bluemont Way
Reston, VA 20190
United States of America
Email: shuque@verisign.com
URI: http://www.verisignlabs.com/
ISO Plain Language
On this page
§1What an NXDOMAIN Answer Denies
The DNS protocol defines response code 3 as Name Error, or NXDOMAIN, which means the queried domain name does not exist in the DNS. Since domain names are represented as a tree of labels, nonexistence of a node implies nonexistence of the entire subtree rooted at that node. The DNS iterative resolution algorithm already interprets the signal in this way: on an NXDOMAIN response from an authoritative server it stops iterating immediately and returns NXDOMAIN to the querier.
Most existing resolvers, however, do not treat a cached nonexistence as proof that no child domains can exist underneath. That comes from an ambiguity in RFC 1034, which failed to distinguish Empty Non-Terminal names, as described in RFC 7719, from nonexistent names. The distinction became especially important with DNSSEC, which can prove nonexistence: RFC 4035 describes how security-aware authoritative servers make the distinction, but no existing RFC described the behaviour for recursive servers.
RFC 8020 specifies that an NXDOMAIN response for a domain name means that no child domains underneath the queried name exist either, and that DNS resolvers should interpret cached nonexistence in that way. The document also defines the term denied name, the domain name whose existence has been denied by an NXDOMAIN response. In most cases that is the QNAME, but because of RFC 6604 it is not always.
Domain names sit in a tree, with dots separating the levels. If a name in that tree is missing, everything below it must be missing as well, because a child name cannot exist without its parent. The RFC makes this explicit and applies it to what resolvers store in their caches.
§2The Rules for a Caching Resolver
When an iterative caching DNS resolver receives an NXDOMAIN response it should store it in its cache, and then all names and resource record sets at or below that node should be considered unreachable. Subsequent queries for such names should elicit an NXDOMAIN response.
There are two exceptions. A resolver that already has cached data under the cut may continue to send it as a reply, until the TTL of that cached data expires, since this may avoid additional processing. And a validating resolver may decide to implement the NXDOMAIN cut only when the NXDOMAIN response has been validated with DNSSEC.
The fact that a subtree does not exist is not forever. RFC 2308 already describes how long an NXDOMAIN response may be cached, as the negative TTL. If the NXDOMAIN response comes from a DNSSEC-signed zone, it carries NSEC or NSEC3 records that authenticate the nonexistence, and the same records prove the nonexistence of any descendant name, so the resolver must return those NSEC or NSEC3 records in the response to the triggering query if the query had the DNSSEC OK bit set.
There is a warning about aliases. If there is a chain of CNAME or DNAME records, the name that does not exist is the last of the chain, not the QNAME, so the NXDOMAIN stored in the cache is for the denied name and not always for the QNAME.
The RFC's example makes the saving concrete. Consider two successive queries to a resolver for a nonexistent domain 'foo.example': the first for 'foo.example', which returns NXDOMAIN, and the second for 'bar.foo.example', which also returns NXDOMAIN. Many resolvers forward both queries. Following the rules in this document, the resolver caches the first NXDOMAIN as a sign of nonexistence and immediately returns NXDOMAIN for the second query without transmitting it to an authoritative server. The order matters: if the first request is for 'bar.foo.example' and the second for 'baz.foo.example', then the first answer says nothing about 'baz.foo.example', so the second query is transmitted as before.
The rule is short: when a resolver gets NXDOMAIN, it should remember that the whole branch below that name is gone, and answer later questions about that branch from what it remembers. Two exceptions are allowed, one for data already cached below the cut and one for resolvers that want DNSSEC validation first.
- example The tree of domain names
- foo NXDOMAIN cached at this node
- bar Answered from the cache, not forwarded
- other Still queried normally
- foo NXDOMAIN cached at this node
| Step | Without the NXDOMAIN cut | With the NXDOMAIN cut |
|---|---|---|
| Query for foo.example | Forwarded, answer is NXDOMAIN | Forwarded, answer is NXDOMAIN and cached as nonexistence |
| Later query for bar.foo.example | Forwarded to an authoritative server | Answered NXDOMAIN from the cache |
| Later query for bar.example | Forwarded | Still forwarded |
§3Updates to RFC 1034 and RFC 2308
The document clarifies ambiguities in RFC 1034 that did not clearly distinguish Empty Non-Terminal names from nonexistent names, and it points to later documents that do. An ENT is a node in the DNS that has no resource record sets associated with it but has descendant nodes that do. The correct response to an ENT is NODATA, a response code of NOERROR with an empty answer section. More clarifying language on these points is in Section 7.16 of RFC 2136 and in Sections 2.2.2 and 2.2.3 of RFC 4592.
It also revises a paragraph of Section 5 in RFC 2308. The original text said that a negative answer resulting from a name error should be cached so that it could be returned for another query for the same QNAME and QCLASS. The revised text adds the case where the QNAME is a descendant of the original QNAME and the QCLASS is the same.
Two earlier documents are adjusted. RFC 1034 did not clearly separate a name that exists only as a parent from a name that does not exist at all, and RFC 2308 described caching a negative answer too narrowly. This RFC widens the caching rule to cover names below the one that was denied.
§4The Benefit
The main benefit is better efficiency of the caches. In the example above the resolver sends one query instead of two, the second being answered from the cache. This benefits the whole DNS ecosystem, since authoritative name servers have less unnecessary traffic to process.
The behaviour is especially useful when combined with QNAME minimisation, as described in RFC 7816, because it lets a resolver stop searching as soon as an NXDOMAIN is encountered.
The NXDOMAIN cut may also help mitigate certain kinds of random QNAME attack, where there is a fixed suffix that does not exist. In those attacks, queries are sent to resolvers for a QNAME made of a fixed suffix, typically nonexistent, and a random prefix that differs for each request, and the resolver has to forward them to the authoritative servers. With the NXDOMAIN cut, an administrator only has to send the resolver one query for the fixed suffix; the resolver gets an NXDOMAIN and stops forwarding the rest. The RFC notes that it would be better if the SOA record in the NXDOMAIN response were sufficient to find the nonexistent domain, but it is not, as Appendix A explains.
The point of the rule is fewer queries. A resolver that knows a whole branch is missing answers from its cache instead of asking again, and the servers that own the domain stop receiving pointless traffic. It also blunts a known attack that floods a server with lookups under a fixed nonexistent name.
§5Known Problems
The RFC considers a case where the rule causes trouble. Suppose the top-level domain example exists but foobar.example is not delegated, so the name servers for example answer NXDOMAIN for anything under foobar.example. A system administrator who names internal machines under office.foobar.example, and who uses a trick of the resolver to forward requests about that zone to local authoritative servers, would be affected: depending on the order of requests, the resolver may have cached the nonexistence of example and therefore deleted everything under it. The document assumes such a setup is rare and does not need to be supported.
A second problem exists today: some authoritative name servers answer an ENT with NXDOMAIN instead of the normal NODATA. Such name servers are wrong and always have been, and their behaviour is incompatible with DNSSEC. Given the advantages of the NXDOMAIN cut, the RFC sees little reason to support it.
Two cases break the rule. The first is a resolver that is tricked into treating a whole domain as missing when part of it exists privately. The second is a server that wrongly claims a parent name does not exist when it does, which the RFC says has always been a bug.
§6Implementing the Rule in a Cache
This section is non-normative. A recursive resolver may implement its cache in many ways. The most obvious one is a tree data structure, because it fits the data model of domain names, but other implementations and optimisations are possible, such as a tree augmented with an index of common domain names.
For a resolver whose cache is a tree, one way of following the rules is this. On receiving the NXDOMAIN, prune the subtree of positive cache entries at that node, or delete all individual cache entries for names below that node. Then, when searching downward in its cache, the resolver stops searching when it encounters a cached nonexistence.
Some resolvers have a cache that is not organised as a tree, for instance a dictionary. They therefore have a reason to ignore the rules of Section 2, which is why those rules use SHOULD and not MUST.
How a resolver stores its cache is up to the implementation. If it keeps entries in a tree, the rule is easy to apply: mark the node as missing and drop the entries below it. If the cache is a flat list, applying the rule is awkward, which is why the RFC asks rather than commands.
§7Security Considerations
The technique described in the document may help against the denial-of-service attack named random qnames described in Section 4.
If a resolver does not validate answers with DNSSEC, or if the zone is not signed, the resolver can of course be poisoned with a false NXDOMAIN, and a part of the domain name tree is then removed from its view. This denial-of-service attack is already possible without the rules of this document, though the NXDOMAIN cut may increase its effects. The only solution is to use DNSSEC.
Caching a negative answer makes a lie more damaging: a forged NXDOMAIN can now erase a whole branch from the resolver's view, not just one name. The RFC is direct about this, and says the fix is DNSSEC validation rather than anything the resolver can do on its own.
- Store the answerCache the NXDOMAIN as proof that the subtree below the denied name does not exist.
- Answer from the cacheNames at or below the cut are unreachable, so later queries are answered without asking an authoritative server.
- Carry the proofFor a signed zone, return the NSEC or NSEC3 records when the query had the DNSSEC OK bit set.
- Watch for poisoningWithout DNSSEC validation, a forged NXDOMAIN can remove a whole branch from the cache. The RFC calls DNSSEC the only solution.