The idea behind QNAME minimisation is to minimise the amount of privacy-sensitive data sent from the DNS resolver to the authoritative name server. This section describes how to do QNAME minimisation. The algorithm is summarised in
Section 3.
When a resolver is not able to answer a query from cache, it has to send a query to an authoritative name server. Traditionally, these queries would contain the full QNAME and the original QTYPE as received in the client query.
The full QNAME and original QTYPE are only needed at the name server that is authoritative for the record requested by the client. All other name servers queried while resolving the query only need to receive enough of the QNAME to be able to answer with a delegation. The QTYPE in these queries is not relevant, as the name server is not able to authoritatively answer the records the client is looking for. Sending the full QNAME and original QTYPE to these name servers therefore exposes more privacy-sensitive data than necessary to resolve the client's request.
A resolver that implements QNAME minimisation obscures the QNAME and QTYPE in queries directed to an authoritative name server that is not known to be responsible for the original QNAME. These queries contain:
-
a QTYPE selected by the resolver to possibly obscure the original QTYPE
-
the QNAME that is the original QNAME, stripped to just one label more than the longest matching domain name for which the name server is known to be authoritative
Note that this document relaxes the recommendation in [
RFC 7816] to use the NS QTYPE to hide the original QTYPE. Using the NS QTYPE is still allowed. The authority of NS records lies at the child side. The parent side of the delegation will answer using a referral, like it will do for queries with other QTYPEs. Using the NS QTYPE therefore has no added value over other QTYPEs.
The QTYPE to use while minimising queries can be any possible data type (as defined in
Section 3.1 of
RFC 6895) for which the authority always lies below the zone cut (i.e., not DS, NSEC, NSEC3, OPT, TSIG, TKEY, ANY, MAILA, MAILB, AXFR, and IXFR), as long as there is no relation between the incoming QTYPE and the selection of the QTYPE to use while minimising. The A or AAAA QTYPEs are always good candidates to use because these are the least likely to raise issues in DNS software and middleboxes that do not properly support all QTYPEs. QTYPE=A or QTYPE=AAAA queries will also blend into traffic from nonminimising resolvers, making it in some cases harder to observe that the resolver is using QNAME minimisation. Using a QTYPE that occurs most in incoming queries will slightly reduce the number of queries, as there is no extra check needed for delegations on non-apex records.
The minimising resolver works perfectly when it knows the zone cut (zone cuts are described in
Section 6 of
RFC 2181). But zone cuts do not necessarily exist at every label boundary. In the name www.foo.bar.example, it is possible that there is a zone cut between "foo" and "bar" but not between "bar" and "example". So, assuming that the resolver already knows the name servers of example, when it receives the query "What is the AAAA record of www.foo.bar.example?", it does not always know where the zone cut will be. To find the zone cut, it will query the example name servers for a record for bar.example. It will get a non-referral answer, so it has to query the example name servers again with one more label, and so on. (
Section 3 describes this algorithm in deeper detail.)
When using QNAME minimisation, the number of labels in the received QNAME can influence the number of queries sent from the resolver. This opens an attack vector and can decrease performance. Resolvers supporting QNAME minimisation
MUST implement a mechanism to limit the number of outgoing queries per user request.
Take for example an incoming QNAME with many labels, like www.host.group.department.example.com, where host.group.department.example.com is hosted on example.com's name servers. (Such deep domains are especially common under ip6.arpa.) Assume a resolver that knows only the name servers of example.com. Without QNAME minimisation, it would send these example.com name servers a query for www.host.group.department.example.com and immediately get a specific referral or an answer, without the need for more queries to probe for the zone cut. For such a name, a cold resolver with QNAME minimisation will send more queries, one per label. Once the cache is warm, there will be less difference with a traditional resolver. Testing of this is described in [
Huque-QNAME-Min].
The behaviour of sending multiple queries can be exploited by sending queries with a large number of labels in the QNAME that will be answered using a wildcard record. Take for example a record for *.example.com, hosted on example.com's name servers. An incoming query containing a QNAME with more than 100 labels, ending in example.com, will result in a query per label. By using random labels, the attacker can bypass the cache and always require the resolver to send many queries upstream. Note that [
RFC 8198] can limit this attack in some cases.
One mechanism that
MAY be used to reduce this attack vector is by appending more than one label per iteration for QNAMEs with a large number of labels. To do this, a maximum number of QNAME minimisation iterations
MUST be selected (MAX_MINIMISE_COUNT); a
RECOMMENDED value is 10. Optionally, a value for the number of queries that should only have one label appended
MAY be selected (MINIMISE_ONE_LAB); a good value is 4. The assumption here is that the number of labels on delegations higher in the hierarchy are rather small; therefore, not exposing too many labels early on has the most privacy benefit.
Another potential, optional mechanism for limiting the number of queries is to assume that labels that begin with an underscore (_) character do not represent privacy-relevant administrative boundaries. For example, if the QNAME is "_25._tcp.mail.example.org" and the algorithm has already searched for "mail.example.org", the next query can be for all the underscore-prefixed names together, namely "_25._tcp.mail.example.org".
When a resolver needs to send out a query, it will look for the closest-known delegation point in its cache. The number of not-yet-exposed labels is the difference between this closest name server and the incoming QNAME. The first MINIMISE_ONE_LAB labels will be handled as described in
Section 2. The number of labels that are still not exposed now need to be divided proportionally over the remaining iterations (MAX_MINIMISE_COUNT - MINIMISE_ONE_LAB). If the not-yet-exposed labels cannot be equally divided over the remaining iterations, the remainder of the division should be added to the last iterations. For example, when resolving a QNAME with 18 labels with MAX_MINIMISE_COUNT set to 10 and MINIMISE_ONE_LAB set to 4, the number of labels added per iteration are: 1,1,1,1,2,2,2,2,3,3.
Stub and forwarding resolvers
MAY implement QNAME minimisation. Minimising queries that will be sent to an upstream resolver does not help in hiding data from the upstream resolver because all information will end up there anyway. It might however limit the data exposure between the upstream resolver and the authoritative name server in the situation where the upstream resolver does not support QNAME minimisation. Using QNAME minimisation in a stub or forwarding resolver that does not have a mechanism to find and cache zone cuts will drastically increase the number of outgoing queries.