Network Working Group Ben Laurie Internet-Draft Nominet Geoffrey Sisson Nominet Expires: ??? 18 May, 2004 DNSSEC NSEC2 Owner and RDATA Format (or; avoiding zone traversal using NSEC) draft-laurie-dnsext-nsec2-00 Status of this Memo This document is an Internet-Draft and is in full conformance with all provisions of Section 10 of RFC2026. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt. The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. This Internet-Draft will expire on ??. Copyright Notice Copyright (C) The Internet Society (2004). All Rights Reserved. Abstract The DNS Security (DNSSEC) NSEC resource record (RR) is intended to be used to provide authenticated denial of existence of DNS owner names and types; however, it also permits any user to obtain a listing of all DNS owner names in a zone. This can accomplished via successive DNS queries for all NSEC RRs in that zone. A complete zone file can be used either directly as a source of probable e-mail addresses for spam, or indirectly as a key for multiple WHOIS queries to reveal registrant data which many registries (particularly in Europe) may be under strict legal Laurie Expires ??? [Page 1] Internet-Draft The NSEC2 Record 18 May, 2004 obligations to protect. Many registries therefore prohibit copying of their zone file; however the use of NSEC RRs makes renders policies unenforceable. This document proposes an alternate scheme which hides owner names while permitting authenticated denial of existence of non-existent names. The scheme uses three new RR types: NSECINFO, NSEC2 and EXIST. 1. Terminology Because the owner name must be modified (by hashing), the unmodified owner name is referred to as the "actual owner name" in this draft. 2. The NSECINFO Resource Record Some parameters for hashing are per-zone rather than per-record. These are the hash algorithm used, the number of iterations, and the salt. [Note: this is somewhat ugly, and we might prefer to make these global somehow; that introduces its own issues, such as who is the global authority for these values, and how do they get updated? Another option would be to roll NSECINFO into NSEC2, though that would introduce considerable redundancy] 2.1 NSECINFO Wire Format The RDATA for a NSECINFO RR consists of a one octet Hash Type field, a three octet Iterations field, and a four octet Salt field: 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Hash | Iterations | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Salt | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 2.1.1 The Hash Type field The Hash Type field identifies the hash algorithm used to hash the owner name. Currently only one value is defined, 1, for the SHA-1 algorithm. All other values are reserved. 2.1.2 The Iterations field Laurie Expires ??? [Page 2] Internet-Draft The NSEC2 Record 18 May, 2004 The Iterations field defines the number of times the hash has been iterated. More iterations results in greater resiliency of the hash value to dictionary attacks, but at a higher cost. 2.1.3 The Salt field The salt is prepended to the value to be hashed in order to defend against precalculated dictionary attacks. 2.2 The NSECINFO Presentation Format The Hash Type field is presented as a decimal number. The Iterations field is presented as a decimal number. The Salt field is presented as a hexadecimal number. 2.3 NSECINFO Example example.com NSECINFO 1 256 01234567890abcdeffedcba9876543210 2.4 NSECINFO Rollover When the hash, iterations or salt are changed, there will be a tran- sition period during which cached records may exist using the old parameters. During the transition period, the old NSECINFO RR(s) SHOULD be returned as well as the new one, and a resolver MUST check for nonexistence of all possible hashes, using each NSECINFO RR retrieved. 3. The NSEC2 Resource Record The NSEC2 resource record lists two separate things: the SHA-1 hash of the owner name of the next RRset in the canonical ordering of the zone, and the set of RR types present at the NSEC2 RR's actual owner name. The complete set of NSEC2 RRs in a zone both indicate which RRsets exist in a zone and also form a chain of hashed owner names in the zone. This information is used to provide authenticated denial of existence for DNS data, as described in RFC 2535 [RFC2535], except that the range covered by the returned RR will span consist of two hashed owner names between which the hash of the queried record would lie in canonical order. The type value for the NSEC2 RR is ??. The NSEC2 RR RDATA format is class independent and defined for all classes. Laurie Expires ??? [Page 3] Internet-Draft The NSEC2 Record 18 May, 2004 The NSEC2 RR SHOULD have the same TTL value as the SOA minimum TTL field. This is in the spirit of negative caching [RFC2308]. 3.1 NSEC2 RDATA Wire Format The RDATA of the NSEC2 RR is as shown below: 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / Hash of Next Domain Name / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / List of Type Bit Map(s) / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 3.1.1 The Hash of Next Domain Name Field The Hash of Next Domain Name field contains the hash, represented in hexadecimal [Note: not entirely sure if this is really required], of the owner name of the next RR in the canonical ordering of the hashed names of the zone. The value of the Hash of Next Domain Name field in the last NSEC2 record in the zone is the hash of the owner of the first NSEC2 RR in the zone. A sender MUST NOT use DNS name compression on the Next Domain Name field when transmitting an NSEC2 RR. [Not sure if this is still required] Hashed owner names of RRsets not authoritative for the given zone (such as glue records) MUST NOT be listed in the Hash of Next Domain Name unless at least one authoritative RRset exists at the same owner name. 3.1.2 The list of Type Bit Map(s) Field The RR type space is split into 256 window blocks, each representing the low-order 8 bits of the 16-bit RR type space. Each block that has at least one active RR type is encoded using a single octet window number (from 0 to 255), a single octet bitmap length (from 1 to 32) indicating the number of octets used for the window block's bitmap, and up to 32 octets (256 bits) of bitmap. Blocks are present in the NSEC2 RR RDATA in increasing numerical order. "|" denotes concatenation Laurie Expires ??? [Page 4] Internet-Draft The NSEC2 Record 18 May, 2004 Type Bit Map(s) Field = ( Window Block # | Bitmap Length | Bitmap ) + Each bitmap encodes the low-order 8 bits of RR types within the win- dow block, in network bit order. The first bit is bit 0. For window block 0, bit 1 corresponds to RR type 1 (A), bit 2 corresponds to RR type 2 (NS), and so forth. For window block 1, bit 1 corresponds to RR type 257, bit 2 to RR type 258. If a bit is set to 1, it indi- cates that an RRset of that type is present for the NSEC2 RR's owner name. If a bit is set to 0, it indicates that no RRset of that type is present for the NSEC2 RR's owner name. Since bit 0 in window block 0 refers to the non-existing RR type 0, it MUST be set to 0. After verification, the validator MUST ignore the value of bit 0 in window block 0. Bits representing Meta-TYPEs or QTYPEs as specified in RFC 2929 [4] (section 3.1) or within the range reserved for assignment only to QTYPEs and Meta-TYPEs MUST be set to 0, since they do not appear in zone data. If encountered, they must be ignored upon reading. Blocks with no types present MUST NOT be included. Trailing zero octets in the bitmap MUST be omitted. The length of each block's bitmap is determined by the type code with the largest numerical value, within that block, among the set of RR types present at the NSEC2 RR's owner name. Trailing zero octets not specified MUST be interpretted as zero octets. 3.2 Owner Name Wire Format The owner name of the NSEC2 RR will be the SHA-1 hash represented in hexadecimal of the owner's full domain name instead of the name itself. There is no conflict if this happens to coincide with a real domain name, since these hashed names will only appear in NSEC2 RRs. 3.3 The NSEC2 RR Presentation Format The presentation format of the RDATA portion is as follows: The Hash of Next Domain Name field is represented as a domain name. The List of Type Bit Map(s) Field is represented as a sequence of RR type mnemonics. When the mnemonic is not known, the TYPE representa- tion as described in RFC 3597 [5] (section 5) MUST be used. 3.5 NSEC2 RR Example The following NSEC2 RRs identify the RRsets associated with alfa.example.com. (SHA-1=f487e108a2a2ea3f4e81838c2f70cac7e760e6c7) Laurie Expires ??? [Page 5] Internet-Draft The NSEC2 Record 18 May, 2004 and host.example.com. (SHA-1=efd2a1b79ce69182f436e04ca1a15bf326b1c8a8), where these are the only two name defined in the example.com domain efd2a1b79ce69182f436e04ca1a15bf326b1c8a8.example.com. 86400 IN NSEC2 f487e108a2a2ea3f4e81838c2f70cac7e760e6c7.example.com. A RRSIG NSEC2 f487e108a2a2ea3f4e81838c2f70cac7e760e6c7.example.com. 86400 IN NSEC2 efd2a1b79ce69182f436e04ca1a15bf326b1c8a8.example.com. A MX RRSIG NSEC2 TYPE1234 The first four text fields specify the SHA-1 hash of the full name in hexadecimal, TTL, Class, and RR type (NSEC2). The entry host.exam- ple.com. is the next authoritative name after alfa.example.com. in canonical order. The A, MX, RRSIG, NSEC2 and TYPE1234 mnemonics indi- cate there are A, MX, RRSIG, NSEC2 and TYPE1234 RRsets associated with the name alfa.example.com. Assuming that the resolver can authenticate these NSEC2 records, they could be used to prove that beta.example.com. (SHA-1=3a4a055ddcbaec72468168236ae9d4469c9e0d59) does not exist, or could be used to prove, for instance, that there is no AAAA record associated with alfa.example.com. Authenticated denial of existence is discussed in RFC 2535 [3]. 4. The EXIST Resource Record In order to prove the nonexistence of a record that might be covered by a wildcard, it is necessary to prove the existence of its closest encloser. This record does that. Its owner is the closest encloser. It has no RDATA. If there is another RR that proves the existence of the closest encloser, this SHOULD be used instead of an EXIST record. EXIST records SHOULD NOT be returned in response to ANY queries (but note that returning them does not do any real harm, since a query for a domain within the existing domain will reveal it in any case). 5. Complications Caused by Wildcards If a wildcard owner name appears in a zone, the wildcard label ("*") is treated as a literal symbol and is treated in the same way as any other owner name for purposes of generating NSEC2 RRs. RFC 2535 [RFC2525] describes the impact of wildcards on authenticated denial of existence. In order to prove there are no wildcards for a domain, as well as no RRs that match directly, an RR must be shown for the closest encloser, and nonexistence must be shown for all enclosers that could Laurie Expires ??? [Page 6] Internet-Draft The NSEC2 Record 18 May, 2004 be closer. If there is no other RR for the closest encloser, the EXIST RR MUST be used. To illustrate, suppose a.b.c.d.e. does not exist in the d.e. zone, and c.d.e. is the closest encloser, the proof would consist of: a) Nonexistence of a.b.c.d.e (NSEC2) b) Nonexistence of b.c.d.e (NSEC2) c) Existence of c.d.e (EXIST or other RR) d) Nonexistence of *.c.d.e (NSEC2) 6. Performance Considerations Iterated hashes will obviously impose a performance penalty on both servers and clients. However, servers already have to do public key signatures for every record, which is far more costly than an iter- ated hash (unless impractically large values are chosen for itera- tions). Although checking a public key signature is significantly cheaper than signing, at least for RSA, individual clients should not be frequently required to check nonexistence of RRs, and in any case values for iterations can still be chosen to make the cost small com- pared to the cost of the signature checking. [Note: clients may want limit the number of iterations (and fail if too high) to avoid apparently hanging] [Example: on a Pentium using OpenSSL, at least 1000 iterations of SHA-1 can be done in the time it takes to check a 2048 bit RSA signa- ture] 7. IANA Considerations Type values for NSEC2, NSECINFO and EXIST will have to be assigned. Value(s) for hash algorithm(s) will have to be assigned. 8. Security Considerations The NSEC2 records are still susceptible to dictionary attacks (i.e. the attacker retrieves all the NSEC2 records, then calculates the hashes of all likely domain names, comparing against the hashes found in the NSEC2 records, and thus enumerating the zone). These are sub- stantially more expensive than traversing the original NSEC2 records would have been, and in any case, such an attack could also be used directly against the name server itself by performing queries for all likely names. The expense of this attack can be chosen by setting the Laurie Expires ??? [Page 7] Internet-Draft The NSEC2 Record 18 May, 2004 iterations in the NSECINFO RR. High-value domains are also susceptible to a precalculated dictionary attack - that is, a list of hashes for all likely names is computed once, then NSEC2 is scanned periodically and compared against the precomputed hashes. This attack is prevented by changing the salt in NSECINFO on a regular basis. EXIST records may leak information. If a.b.c.d.e exists and f.b.c.d.e does not, then a query for f.b.c.d.e will reveal the fact that b.c.d.e exists, even if there is no RR for it. In practice, this rarely matters, since usually b.c.d.e will be a delegated domain and hence have at least an SOA record. Walking the NSEC2 RRs will reveal the total number of records in the zone, and also what types they are. Hash collisions may occur. If they do, it will be impossible to prove the nonexistence of the colliding domain - however, this is fantasti- cally unlikely, and, in any case, DNSSEC already relies on SHA-1 to not collide. 9. Normative References [TCR] Weiler, S., "Legacy Resolver Compatibility for Delegation Signer", draft-ietf-dnsext-dnssec-2535typecode-change-05 (work in progress), October 2003. [RFC2535] Eastlake, D., "Domain Name System Security Extensions", RFC 2535, March 1999. [RFC2038] Andrews, M., "Negative Caching of DNS Queries (DNS NCACHE)", RFC 2308, March 1998. 9. Acknowledgements Portions of this document are based on draft-ietf-dnsext-not-exist- ing-rr-00 by S.A. Joseffson. and draft-ietf-dnsext-nsec-rdata-05.txt by J. Schlyter, Ed. Author's Address Ben Laurie 17 Perryn Road London W3 7LR England Phone: +44 20 8735 0686 EMail: ben@algroup.co.uk Laurie Expires ??? [Page 8] Internet-Draft The NSEC2 Record 18 May, 2004 Full Copyright Statement Copyright (C) The Internet Society (2004). All Rights Reserved. This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this docu- ment itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of develop- ing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English. The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns. This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MER- CHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Acknowledgement Funding for the RFC editor function is currently provided by the Internet Society. Laurie Expires ??? [Page 9]