1 Internet Engineering Task Force (IETF)                       P. van Dijk   
    2 Request for Comments: 9077                                      PowerDNS   
    3 Updates: 4034, 4035, 5155, 8198                                July 2021   
    4 Category: Standards Track                                                  
    5 ISSN: 2070-1721                                                            
    6                                                                            
    7                                                                            
    8                 NSEC and NSEC3: TTLs and Aggressive Use                    
    9                                                                            
   10 Abstract                                                                   
   11                                                                            
   12    Due to a combination of unfortunate wording in earlier documents,       
   13    aggressive use of NSEC and NSEC3 records may deny the existence of      
   14    names far beyond the intended lifetime of a denial.  This document      
   15    changes the definition of the NSEC and NSEC3 TTL to correct that        
   16    situation.  This document updates RFCs 4034, 4035, 5155, and 8198.      
   17                                                                            
   18 Status of This Memo                                                        
   19                                                                            
   20    This is an Internet Standards Track document.                           
   21                                                                            
   22    This document is a product of the Internet Engineering Task Force       
   23    (IETF).  It represents the consensus of the IETF community.  It has     
   24    received public review and has been approved for publication by the     
   25    Internet Engineering Steering Group (IESG).  Further information on     
   26    Internet Standards is available in Section 2 of RFC 7841.               
   27                                                                            
   28    Information about the current status of this document, any errata,      
   29    and how to provide feedback on it may be obtained at                    
   30    https://www.rfc-editor.org/info/rfc9077.                                
   31                                                                            
   32 Copyright Notice                                                           
   33                                                                            
   34    Copyright (c) 2021 IETF Trust and the persons identified as the         
   35    document authors.  All rights reserved.                                 
   36                                                                            
   37    This document is subject to BCP 78 and the IETF Trust's Legal           
   38    Provisions Relating to IETF Documents                                   
   39    (https://trustee.ietf.org/license-info) in effect on the date of        
   40    publication of this document.  Please review these documents            
   41    carefully, as they describe your rights and restrictions with respect   
   42    to this document.  Code Components extracted from this document must    
   43    include Simplified BSD License text as described in Section 4.e of      
   44    the Trust Legal Provisions and are provided without warranty as         
   45    described in the Simplified BSD License.                                
   46                                                                            
   47 Table of Contents                                                          
   48                                                                            
   49    1.  Introduction                                                        
   50    2.  Conventions and Definitions                                         
   51    3.  NSEC and NSEC3 TTL Changes                                          
   52      3.1.  Updates to RFC 4034                                             
   53      3.2.  Updates to RFC 4035                                             
   54      3.3.  Updates to RFC 5155                                             
   55      3.4.  Updates to RFC 8198                                             
   56    4.  Zone Operator Considerations                                        
   57      4.1.  A Note on Wildcards                                             
   58    5.  Security Considerations                                             
   59    6.  IANA Considerations                                                 
   60    7.  Normative References                                                
   61    Acknowledgements                                                        
   62    Author's Address                                                        
   63                                                                            
   64 1.  Introduction                                                           
   65                                                                            
   66    [RFC2308] defines the TTL of the Start of Authority (SOA) record that   
   67    must be returned in negative answers (NXDOMAIN or NODATA):              
   68                                                                            
   69    |  The TTL of this record is set from the minimum of the MINIMUM        
   70    |  field of the SOA record and the TTL of the SOA itself, and           
   71    |  indicates how long a resolver may cache the negative answer.         
   72                                                                            
   73    Thus, if the TTL of the SOA in the zone is lower than the SOA MINIMUM   
   74    value (the last number in the SOA record), the authoritative server     
   75    sends that lower value as the TTL of the returned SOA record.  The      
   76    resolver always uses the TTL of the returned SOA record when setting    
   77    the negative TTL in its cache.                                          
   78                                                                            
   79    However, [RFC4034], Section 4 has this unfortunate text:                
   80                                                                            
   81    |  The NSEC RR SHOULD have the same TTL value as the SOA minimum TTL    
   82    |  field.  This is in the spirit of negative caching ([RFC2308]).       
   83                                                                            
   84    This text, while referring to [RFC2308], can cause NSEC records to      
   85    have much higher TTLs than the appropriate negative TTL for a zone.     
   86    [RFC5155] contains equivalent text.                                     
   87                                                                            
   88    [RFC8198], Section 5.4 tries to correct this:                           
   89                                                                            
   90    |  Section 5 of [RFC2308] also states that a negative cache entry TTL   
   91    |  is taken from the minimum of the SOA.MINIMUM field and SOA's TTL.    
   92    |  This can be less than the TTL of an NSEC or NSEC3 record, since      
   93    |  their TTL is equal to the SOA.MINIMUM field (see [RFC4035],          
   94    |  Section 2.3 and [RFC5155], Section 3).                               
   95    |                                                                       
   96    |  A resolver that supports aggressive use of NSEC and NSEC3 SHOULD     
   97    |  reduce the TTL of NSEC and NSEC3 records to match the SOA.MINIMUM    
   98    |  field in the authority section of a negative response, if            
   99    |  SOA.MINIMUM is smaller.                                              
  100                                                                            
  101    But the NSEC and NSEC3 RRs should, according to [RFC4034] and           
  102    [RFC5155], already be at the value of the MINIMUM field in the SOA.     
  103    Thus, the advice from [RFC8198] would not actually change the TTL       
  104    used for the NSEC and NSEC3 RRs for authoritative servers that follow   
  105    the RFCs.                                                               
  106                                                                            
  107    As a theoretical exercise, consider a top-level domain (TLD) named      
  108    .example with an SOA record like this:                                  
  109                                                                            
  110    example.    900 IN  SOA primary.example. dnsadmin.example. (            
  111                                             1 1800 900 604800 86400 )      
  112                                                                            
  113    The SOA record has a 900-second TTL and an 86400-second MINIMUM TTL.    
  114    Negative responses from this zone have a 900-second TTL, but the NSEC   
  115    or NSEC3 records in those negative responses have an 86400-second       
  116    TTL.  If a resolver were to use those NSEC or NSEC3 records             
  117    aggressively, they would be considered valid for a day instead of the   
  118    intended 15 minutes.                                                    
  119                                                                            
  120 2.  Conventions and Definitions                                            
  121                                                                            
  122    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",     
  123    "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and    
  124    "OPTIONAL" in this document are to be interpreted as described in       
  125    BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all      
  126    capitals, as shown here.                                                
  127                                                                            
  128 3.  NSEC and NSEC3 TTL Changes                                             
  129                                                                            
  130    [RFC4034], [RFC4035], and [RFC5155] use the SHOULD requirement level,   
  131    but they were written prior to the publication of [RFC8198] when        
  132    [RFC4035] still said:                                                   
  133                                                                            
  134    |  However, it seems prudent for resolvers to avoid blocking new        
  135    |  authoritative data or synthesizing new data on their own.            
  136                                                                            
  137    [RFC8198] updated that text to contain:                                 
  138                                                                            
  139    |  ...DNSSEC-enabled validating resolvers SHOULD use wildcards and      
  140    |  NSEC/NSEC3 resource records to generate positive and negative        
  141    |  responses until the effective TTLs or signatures for those records   
  142    |  expire.                                                              
  143                                                                            
  144    This means that the correctness of NSEC and NSEC3 records and their     
  145    TTLs has become much more important.  Because of that, the updates in   
  146    this document upgrade the requirement level to MUST.                    
  147                                                                            
  148 3.1.  Updates to RFC 4034                                                  
  149                                                                            
  150    [RFC4034] says:                                                         
  151                                                                            
  152    |  The NSEC RR SHOULD have the same TTL value as the SOA minimum TTL    
  153    |  field.  This is in the spirit of negative caching ([RFC2308]).       
  154                                                                            
  155    This is updated to say:                                                 
  156                                                                            
  157    |  The TTL of the NSEC RR that is returned MUST be the lesser of the    
  158    |  MINIMUM field of the SOA record and the TTL of the SOA itself.       
  159    |  This matches the definition of the TTL for negative responses in     
  160    |  [RFC2308].  Because some signers incrementally update the NSEC       
  161    |  chain, a transient inconsistency between the observed and expected   
  162    |  TTL MAY exist.                                                       
  163                                                                            
  164 3.2.  Updates to RFC 4035                                                  
  165                                                                            
  166    [RFC4035] says:                                                         
  167                                                                            
  168    |  The TTL value for any NSEC RR SHOULD be the same as the minimum      
  169    |  TTL value field in the zone SOA RR.                                  
  170                                                                            
  171    This is updated to say:                                                 
  172                                                                            
  173    |  The TTL of the NSEC RR that is returned MUST be the lesser of the    
  174    |  MINIMUM field of the SOA record and the TTL of the SOA itself.       
  175    |  This matches the definition of the TTL for negative responses in     
  176    |  [RFC2308].  Because some signers incrementally update the NSEC       
  177    |  chain, a transient inconsistency between the observed and expected   
  178    |  TTL MAY exist.                                                       
  179                                                                            
  180 3.3.  Updates to RFC 5155                                                  
  181                                                                            
  182    [RFC5155] says:                                                         
  183                                                                            
  184    |  The NSEC3 RR SHOULD have the same TTL value as the SOA minimum TTL   
  185    |  field.  This is in the spirit of negative caching [RFC2308].         
  186                                                                            
  187    This is updated to say:                                                 
  188                                                                            
  189    |  The TTL of the NSEC3 RR that is returned MUST be the lesser of the   
  190    |  MINIMUM field of the SOA record and the TTL of the SOA itself.       
  191    |  This matches the definition of the TTL for negative responses in     
  192    |  [RFC2308].  Because some signers incrementally update the NSEC3      
  193    |  chain, a transient inconsistency between the observed and expected   
  194    |  TTL MAY exist.                                                       
  195                                                                            
  196    Where [RFC5155] says:                                                   
  197                                                                            
  198    |  *  The TTL value for any NSEC3 RR SHOULD be the same as the          
  199    |     minimum TTL value field in the zone SOA RR.                       
  200                                                                            
  201    This is updated to say:                                                 
  202                                                                            
  203    |  *  The TTL value for each NSEC3 RR MUST be the lesser of the         
  204    |     MINIMUM field of the zone SOA RR and the TTL of the zone SOA RR   
  205    |     itself.  Because some signers incrementally update the NSEC3      
  206    |     chain, a transient inconsistency between the observed and         
  207    |     expected TTL MAY exist.                                           
  208                                                                            
  209 3.4.  Updates to RFC 8198                                                  
  210                                                                            
  211    [RFC8198], Section 5.4 ("Consideration on TTL") is completely           
  212    replaced by the following text:                                         
  213                                                                            
  214    |  The TTL value of negative information is especially important,       
  215    |  because newly added domain names cannot be used while the negative   
  216    |  information is effective.                                            
  217    |                                                                       
  218    |  Section 5 of [RFC2308] suggests a maximum default negative cache     
  219    |  TTL value of 3 hours (10800).  It is RECOMMENDED that validating     
  220    |  resolvers limit the maximum effective TTL value of negative          
  221    |  responses (NSEC/NSEC3 RRs) to this same value.                       
  222    |                                                                       
  223    |  A resolver that supports aggressive use of NSEC and NSEC3 MAY        
  224    |  limit the TTL of NSEC and NSEC3 records to the lesser of the         
  225    |  SOA.MINIMUM field and the TTL of the SOA in a response, if           
  226    |  present.  It MAY also use a previously cached SOA for a zone to      
  227    |  find these values.                                                   
  228                                                                            
  229    (The third paragraph of the original is removed, and the fourth         
  230    paragraph is updated to allow resolvers to also take the lesser of      
  231    the SOA TTL and SOA MINIMUM.)                                           
  232                                                                            
  233 4.  Zone Operator Considerations                                           
  234                                                                            
  235    If signers and DNS servers for a zone cannot immediately be updated     
  236    to conform to this document, zone operators are encouraged to           
  237    consider setting their SOA record TTL and the SOA MINIMUM field to      
  238    the same value.  That way, the TTL used for aggressive NSEC and NSEC3   
  239    use matches the SOA TTL for negative responses.                         
  240                                                                            
  241    Note that some signers might use the SOA TTL or MINIMUM as a default    
  242    for other values, such as the TTL for DNSKEY records.  Operators        
  243    should consult documentation before changing values.                    
  244                                                                            
  245 4.1.  A Note on Wildcards                                                  
  246                                                                            
  247    Validating resolvers consider an expanded wildcard valid for the        
  248    wildcard's TTL, capped by the TTLs of the NSEC or NSEC3 proof that      
  249    shows that the wildcard expansion is legal.  Thus, changing the TTL     
  250    of NSEC or NSEC3 records (explicitly, or by implementation of this      
  251    document implicitly) might affect (shorten) the lifetime of             
  252    wildcards.                                                              
  253                                                                            
  254 5.  Security Considerations                                                
  255                                                                            
  256    An attacker can delay future records from appearing in a cache by       
  257    seeding the cache with queries that cause NSEC or NSEC3 responses to    
  258    be cached for aggressive use purposes.  This document reduces the       
  259    impact of that attack in cases where the NSEC or NSEC3 TTL is higher    
  260    than the zone operator intended.                                        
  261                                                                            
  262 6.  IANA Considerations                                                    
  263                                                                            
  264    IANA has added a reference to this document in the "Resource Record     
  265    (RR) TYPEs" subregistry of the "Domain Name System (DNS) Parameters"    
  266    registry for the NSEC and NSEC3 types.                                  
  267                                                                            
  268 7.  Normative References                                                   
  269                                                                            
  270    [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate          
  271               Requirement Levels", BCP 14, RFC 2119,                       
  272               DOI 10.17487/RFC2119, March 1997,                            
  273               <https://www.rfc-editor.org/info/rfc2119>.                   
  274                                                                            
  275    [RFC2308]  Andrews, M., "Negative Caching of DNS Queries (DNS           
  276               NCACHE)", RFC 2308, DOI 10.17487/RFC2308, March 1998,        
  277               <https://www.rfc-editor.org/info/rfc2308>.                   
  278                                                                            
  279    [RFC4034]  Arends, R., Austein, R., Larson, M., Massey, D., and S.      
  280               Rose, "Resource Records for the DNS Security Extensions",    
  281               RFC 4034, DOI 10.17487/RFC4034, March 2005,                  
  282               <https://www.rfc-editor.org/info/rfc4034>.                   
  283                                                                            
  284    [RFC4035]  Arends, R., Austein, R., Larson, M., Massey, D., and S.      
  285               Rose, "Protocol Modifications for the DNS Security           
  286               Extensions", RFC 4035, DOI 10.17487/RFC4035, March 2005,     
  287               <https://www.rfc-editor.org/info/rfc4035>.                   
  288                                                                            
  289    [RFC5155]  Laurie, B., Sisson, G., Arends, R., and D. Blacka, "DNS      
  290               Security (DNSSEC) Hashed Authenticated Denial of             
  291               Existence", RFC 5155, DOI 10.17487/RFC5155, March 2008,      
  292               <https://www.rfc-editor.org/info/rfc5155>.                   
  293                                                                            
  294    [RFC8174]  Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC       
  295               2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,     
  296               May 2017, <https://www.rfc-editor.org/info/rfc8174>.         
  297                                                                            
  298    [RFC8198]  Fujiwara, K., Kato, A., and W. Kumari, "Aggressive Use of    
  299               DNSSEC-Validated Cache", RFC 8198, DOI 10.17487/RFC8198,     
  300               July 2017, <https://www.rfc-editor.org/info/rfc8198>.        
  301                                                                            
  302 Acknowledgements                                                           
  303                                                                            
  304    This document was made possible with the help of the following          
  305    people:                                                                 
  306                                                                            
  307    *  Ralph Dolmans                                                        
  308                                                                            
  309    *  Warren Kumari                                                        
  310                                                                            
  311    *  Matthijs Mekking                                                     
  312                                                                            
  313    *  Vladimir Cunat                                                       
  314                                                                            
  315    *  Matt Nordhoff                                                        
  316                                                                            
  317    *  Josh Soref                                                           
  318                                                                            
  319    *  Tim Wicinski                                                         
  320                                                                            
  321    The author would like to explicitly thank Paul Hoffman for the          
  322    extensive reviews, text contributions, and help in navigating WG        
  323    comments.                                                               
  324                                                                            
  325 Author's Address                                                           
  326                                                                            
  327    Peter van Dijk                                                          
  328    PowerDNS                                                                
  329    Den Haag                                                                
  330    Netherlands                                                             
  331                                                                            
  332    Email: peter.van.dijk@powerdns.com                                      
  333                                                                            

The IETF is responsible for the creation and maintenance of the DNS RFCs. The ICANN DNS RFC annotation project provides a forum for collecting community annotations on these RFCs as an aid to understanding for implementers and any interested parties. The annotations displayed here are not the result of the IETF consensus process.

This RFC is included in the DNS RFCs annotation project whose home page is here.