7Internet Engineering Task Force (IETF)                   D. Eastlake 3rd
 
8Request for Comments: 7873                                        Huawei
 
9Category: Standards Track                                     M. Andrews
 
14                    Domain Name System (DNS) Cookies
 
18   DNS Cookies are a lightweight DNS transaction security mechanism that
 
19   provides limited protection to DNS servers and clients against a
 
20   variety of increasingly common denial-of-service and amplification/
 
21   forgery or cache poisoning attacks by off-path attackers.  DNS
 
22   Cookies are tolerant of NAT, NAT-PT (Network Address Translation -
 
23   Protocol Translation), and anycast and can be incrementally deployed.
 
24   (Since DNS Cookies are only returned to the IP address from which
 
25   they were originally received, they cannot be used to generally track
 
30   This is an Internet Standards Track document.
 
32   This document is a product of the Internet Engineering Task Force
 
33   (IETF).  It represents the consensus of the IETF community.  It has
 
34   received public review and has been approved for publication by the
 
35   Internet Engineering Steering Group (IESG).  Further information on
 
36   Internet Standards is available in Section 2 of RFC 7841.
 
38   Information about the current status of this document, any errata,
 
39   and how to provide feedback on it may be obtained at
 
40   http://www.rfc-editor.org/info/rfc7873.
 
58Eastlake & Andrews           Standards Track                    [Page 1]
 
60RFC 7873                       DNS Cookies                      May 2016
 
65   Copyright (c) 2016 IETF Trust and the persons identified as the
 
66   document authors.  All rights reserved.
 
68   This document is subject to BCP 78 and the IETF Trust's Legal
 
69   Provisions Relating to IETF Documents
 
70   (http://trustee.ietf.org/license-info) in effect on the date of
 
71   publication of this document.  Please review these documents
 
72   carefully, as they describe your rights and restrictions with respect
 
73   to this document.  Code Components extracted from this document must
 
74   include Simplified BSD License text as described in Section 4.e of
 
75   the Trust Legal Provisions and are provided without warranty as
 
76   described in the Simplified BSD License.
 
114Eastlake & Andrews           Standards Track                    [Page 2]
 
116RFC 7873                       DNS Cookies                      May 2016
 
121   1. Introduction ....................................................4
 
122      1.1. Contents of This Document ..................................4
 
123      1.2. Definitions ................................................5
 
124   2. Threats Considered ..............................................5
 
125      2.1. Denial-of-Service Attacks ..................................6
 
126           2.1.1. DNS Amplification Attacks ...........................6
 
127           2.1.2. DNS Server Denial of Service ........................6
 
128      2.2. Cache Poisoning and Answer Forgery Attacks .................7
 
129   3. Comments on Existing DNS Security ...............................7
 
130      3.1. Existing DNS Data Security .................................7
 
131      3.2. DNS Message/Transaction Security ...........................8
 
132      3.3. Conclusions on Existing DNS Security .......................8
 
133   4. DNS COOKIE Option ...............................................8
 
134      4.1. Client Cookie .............................................10
 
135      4.2. Server Cookie .............................................10
 
136   5. DNS Cookies Protocol Specification .............................11
 
137      5.1. Originating a Request .....................................11
 
138      5.2. Responding to a Request ...................................11
 
139           5.2.1. No OPT RR or No COOKIE Option ......................12
 
140           5.2.2. Malformed COOKIE Option ............................12
 
141           5.2.3. Only a Client Cookie ...............................12
 
142           5.2.4. A Client Cookie and an Invalid Server Cookie .......13
 
143           5.2.5. A Client Cookie and a Valid Server Cookie ..........13
 
144      5.3. Processing Responses ......................................14
 
145      5.4. Querying for a Server Cookie ..............................14
 
146   6. NAT Considerations and Anycast Server Considerations ...........15
 
147   7. Operational and Deployment Considerations ......................17
 
148      7.1. Client and Server Secret Rollover .........................17
 
149      7.2. Counters ..................................................18
 
150   8. IANA Considerations ............................................18
 
151   9. Security Considerations ........................................19
 
152      9.1. Cookie Algorithm Considerations ...........................20
 
153   10. Implementation Considerations .................................20
 
154   11. References ....................................................20
 
155      11.1. Normative References .....................................20
 
156      11.2. Informative References ...................................21
 
157   Appendix A. Example Client Cookie Algorithms ......................23
 
158      A.1. A Simple Algorithm ........................................23
 
159      A.2. A More Complex Algorithm ..................................23
 
160   Appendix B. Example Server Cookie Algorithms ......................23
 
161      B.1. A Simple Algorithm ........................................23
 
162      B.2. A More Complex Algorithm ..................................24
 
163   Acknowledgments ...................................................25
 
164   Authors' Addresses ................................................25
 
170Eastlake & Andrews           Standards Track                    [Page 3]
 
172RFC 7873                       DNS Cookies                      May 2016
 
177   As with many core Internet protocols, the Domain Name System (DNS)
 
178   was originally designed at a time when the Internet had only a small
 
179   pool of trusted users.  As the Internet has grown exponentially to a
 
180   global information utility, the DNS has increasingly been subject to
 
183   This document describes DNS Cookies, a lightweight DNS transaction
 
184   security mechanism specified as an OPT [RFC6891] option.  The
 
185   DNS Cookie mechanism provides limited protection to DNS servers and
 
186   clients against a variety of increasingly common abuses by off-path
 
187   attackers.  It is compatible with, and can be used in conjunction
 
188   with, other DNS transaction forgery resistance measures such as those
 
189   in [RFC5452].  (Since DNS Cookies are only returned to the IP address
 
190   from which they were originally received, they cannot be used to
 
191   generally track Internet users.)
 
193   The protection provided by DNS Cookies is similar to that provided by
 
194   using TCP for DNS transactions.  Bypassing the weak protection
 
195   provided by using TCP requires, among other things, that an off-path
 
196   attacker guess the 32-bit TCP sequence number in use.  Bypassing the
 
197   weak protection provided by DNS Cookies requires such an attacker to
 
198   guess a 64-bit pseudorandom "cookie" quantity.  Where DNS Cookies are
 
199   not available but TCP is, falling back to using TCP is reasonable.
 
201   If only one party to a DNS transaction supports DNS Cookies, the
 
202   mechanism does not provide a benefit or significantly interfere, but
 
203   if both support it, the additional security provided is automatically
 
206   The DNS Cookie mechanism is designed to work in the presence of NAT
 
207   and NAT-PT (Network Address Translation - Protocol Translation)
 
208   boxes, and guidance is provided herein on supporting the DNS Cookie
 
209   mechanism in anycast servers.
 
2111.1.  Contents of This Document
 
213   In Section 2, we discuss the threats against which the DNS Cookie
 
214   mechanism provides some protection.
 
216   Section 3 describes existing DNS security mechanisms and why they are
 
217   not adequate substitutes for DNS Cookies.
 
219   Section 4 describes the COOKIE option.
 
221   Section 5 provides a protocol description.
 
226Eastlake & Andrews           Standards Track                    [Page 4]
 
228RFC 7873                       DNS Cookies                      May 2016
 
231   Section 6 discusses some NAT considerations and anycast-related
 
232   DNS Cookies design considerations.
 
234   Section 7 discusses incremental deployment considerations.
 
236   Sections 8 and 9 describe IANA considerations and security
 
237   considerations, respectively.
 
241   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
 
242   "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
 
243   "OPTIONAL" in this document are to be interpreted as described in
 
246   "Off-path attacker", for a particular DNS client and server, is
 
247      defined as an attacker who cannot observe the DNS request and
 
248      response messages between that client and server.
 
250   "Soft state" indicates information that is learned or derived by a
 
251      host and that may be discarded when indicated by the policies of
 
252      that host but can be re-instantiated later if needed.  For
 
253      example, it could be discarded after a period of time or when
 
254      storage for caching such data becomes full.  If operations that
 
255      require soft state continue after the information has been
 
256      discarded, the information will be automatically regenerated,
 
259   "Silently discarded" indicates that there are no DNS protocol message
 
262   "IP address" is used herein as a length-independent term and includes
 
263      both IPv4 and IPv6 addresses.
 
267   DNS Cookies are intended to provide significant but limited
 
268   protection against certain attacks by off-path attackers, as
 
269   described below.  These attacks include denial of service, cache
 
270   poisoning, and answer forgery.
 
282Eastlake & Andrews           Standards Track                    [Page 5]
 
284RFC 7873                       DNS Cookies                      May 2016
 
2872.1.  Denial-of-Service Attacks
 
289   The typical form of the denial-of-service attacks considered herein
 
290   is to send DNS requests with forged source IP addresses to a server.
 
291   The intent can be to attack that server or some other selected host,
 
294   There are also on-path denial-of-service attacks that attempt to
 
295   saturate a server with DNS requests having correct source addresses.
 
296   Cookies do not protect against such attacks, but successful cookie
 
297   validation improves the probability that the correct source IP
 
298   address for the requests is known.  This facilitates contacting the
 
299   managers of the networks from which the requests originate or taking
 
300   other actions for those networks.
 
3022.1.1.  DNS Amplification Attacks
 
304   A request with a forged source IP address generally causes a response
 
305   to be sent to that forged IP address.  Thus, the forging of many such
 
306   requests with a particular source IP address can result in enough
 
307   traffic being sent to the forged IP address to interfere with service
 
308   to the host at the IP address.  Furthermore, it is generally easy in
 
309   the DNS to create short requests that produce much longer responses,
 
310   thus amplifying the attack.
 
312   The DNS Cookie mechanism can severely limit the traffic amplification
 
313   obtained by requests from an attacker that is off the path between
 
314   the server and the request's source address.  Enforced DNS Cookies
 
315   would make it hard for an off-path attacker to cause any more than
 
316   rate-limited short error responses to be sent to a forged IP address,
 
317   so the attack would be attenuated rather than amplified.  DNS Cookies
 
318   make it more effective to implement a rate-limiting scheme for error
 
319   responses from the server.  Such a scheme would further restrict
 
320   selected host denial-of-service traffic from that server.
 
3222.1.2.  DNS Server Denial of Service
 
324   DNS requests that are accepted cause work on the part of DNS servers.
 
325   This is particularly true for recursive servers that may issue one or
 
326   more requests and process the responses thereto, in order to
 
327   determine their response to the initial request; the situation can be
 
328   even worse for recursive servers implementing DNSSEC [RFC4033]
 
329   [RFC4034] [RFC4035], because they may be induced to perform
 
330   burdensome cryptographic computations in attempts to verify the
 
331   authenticity of data they retrieve in trying to answer the request.
 
338Eastlake & Andrews           Standards Track                    [Page 6]
 
340RFC 7873                       DNS Cookies                      May 2016
 
343   The computational or communications burden caused by such requests
 
344   may not depend on a forged source IP address, but the use of such
 
347   + the source of the requests causing the denial-of-service attack
 
350   + restriction of the IP addresses from which such requests should be
 
351     honored hard or impossible to specify or verify.
 
353   The use of DNS Cookies should enable a server to reject forged
 
354   requests from an off-path attacker with relative ease and before any
 
355   recursive queries or public key cryptographic operations are
 
3582.2.  Cache Poisoning and Answer Forgery Attacks
 
360   The form of the cache poisoning attacks considered is to send forged
 
361   replies to a resolver.  Modern network speeds for well-connected
 
362   hosts are such that, by forging replies from the IP addresses of a
 
363   DNS server to a resolver for names that resolver has been induced to
 
364   resolve or for common names whose resource records have short
 
365   time-to-live values, there can be an unacceptably high probability of
 
366   randomly coming up with a reply that will be accepted and cause false
 
367   DNS information to be cached by that resolver (the Dan Kaminsky
 
368   attack [Kaminsky]).  This can be used to facilitate phishing attacks
 
369   and other diversions of legitimate traffic to a compromised or
 
370   malicious host such as a web server.
 
372   With the use of DNS Cookies, a resolver can generally reject such
 
3753.  Comments on Existing DNS Security
 
377   Two forms of security have been added to DNS: data security and
 
378   message/transaction security.
 
3803.1.  Existing DNS Data Security
 
382   DNS data security is one part of DNSSEC and is described in
 
383   [RFC4033], [RFC4034], [RFC4035], and updates thereto.  It provides
 
384   data origin authentication and authenticated denial of existence.
 
385   DNSSEC is being deployed and can provide strong protection against
 
386   forged data and cache poisoning; however, it has the unintended
 
387   effect of making some denial-of-service attacks worse because of the
 
388   cryptographic computational load it can require and the increased
 
389   size in DNS response packets that it tends to produce.
 
394Eastlake & Andrews           Standards Track                    [Page 7]
 
396RFC 7873                       DNS Cookies                      May 2016
 
3993.2.  DNS Message/Transaction Security
 
401   The second form of security that has been added to DNS provides
 
402   "transaction" security through TSIG [RFC2845] or SIG(0) [RFC2931].
 
403   TSIG could provide strong protection against the attacks for which
 
404   the DNS Cookie mechanism provides weaker protection; however, TSIG is
 
405   non-trivial to deploy in the general Internet because of the burdens
 
406   it imposes.  Among these burdens are pre-agreement and key
 
407   distribution between client and server, keeping track of server-side
 
408   key state, and required time synchronization between client and
 
411   TKEY [RFC2930] can solve the problem of key distribution for TSIG,
 
412   but some modes of TKEY impose a substantial cryptographic computation
 
413   load and can be dependent on the deployment of DNS data security (see
 
416   SIG(0) [RFC2931] provides less denial-of-service protection than TSIG
 
417   or, in one way, even DNS Cookies, because it authenticates complete
 
418   transactions but does not authenticate requests.  In any case, it
 
419   also depends on the deployment of DNS data security and requires
 
420   computationally burdensome public key cryptographic operations.
 
4223.3.  Conclusions on Existing DNS Security
 
424   The existing DNS security mechanisms do not provide the services
 
425   provided by the DNS Cookie mechanism: lightweight message
 
426   authentication of DNS requests and responses with no requirement for
 
427   pre-configuration or per-client server-side state.
 
431   The DNS COOKIE option is an OPT RR [RFC6891] option that can be
 
432   included in the RDATA portion of an OPT RR in DNS requests and
 
433   responses.  The option length varies, depending on the circumstances
 
434   in which it is being used.  There are two cases, as described below.
 
435   Both use the same OPTION-CODE; they are distinguished by their
 
450Eastlake & Andrews           Standards Track                    [Page 8]
 
452RFC 7873                       DNS Cookies                      May 2016
 
455   In a request sent by a client to a server when the client does not
 
456   know the server's cookie, its length is 8, consisting of an 8-byte
 
457   Client Cookie, as shown in Figure 1.
 
459                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
 
460     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
 
461    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 
462    |        OPTION-CODE = 10      |       OPTION-LENGTH = 8        |
 
463    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 
465    +-+-    Client Cookie (fixed size, 8 bytes)              -+-+-+-+
 
467    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 
469              Figure 1: COOKIE Option, Unknown Server Cookie
 
471   In a request sent by a client when a Server Cookie is known, and in
 
472   all responses to such a request, the length is variable -- from 16 to
 
473   40 bytes, consisting of an 8-byte Client Cookie followed by the
 
474   variable-length (8 bytes to 32 bytes) Server Cookie, as shown in
 
475   Figure 2.  The variability of the option length stems from the
 
476   variable-length Server Cookie.  The Server Cookie is an integer
 
477   number of bytes, with a minimum size of 8 bytes for security and a
 
478   maximum size of 32 bytes for convenience of implementation.
 
480                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
 
481     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
 
482    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 
483    |        OPTION-CODE = 10      |   OPTION-LENGTH >= 16, <= 40   |
 
484    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 
486    +-+-    Client Cookie (fixed size, 8 bytes)              -+-+-+-+
 
488    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 
490    /       Server Cookie  (variable size, 8 to 32 bytes)           /
 
494               Figure 2: COOKIE Option, Known Server Cookie
 
506Eastlake & Andrews           Standards Track                    [Page 9]
 
508RFC 7873                       DNS Cookies                      May 2016
 
513   The Client Cookie SHOULD be a pseudorandom function of the Client IP
 
514   Address, the Server IP Address, and a secret quantity known only to
 
515   the client.  This Client Secret SHOULD have at least 64 bits of
 
516   entropy [RFC4086] and be changed periodically (see Section 7.1).  The
 
517   selection of the pseudorandom function is a matter private to the
 
518   client, as only the client needs to recognize its own DNS Cookies.
 
520   The Client IP Address is included so that the Client Cookie cannot be
 
521   used to (1) track a client if the Client IP Address changes due to
 
522   privacy mechanisms or (2) impersonate the client by some network
 
523   device that was formerly on path but is no longer on path when the
 
524   Client IP Address changes due to mobility.  However, if the Client IP
 
525   Address is being changed very often, it may be necessary to fix the
 
526   Client Cookie for a particular server for several requests, to avoid
 
527   undue inefficiency due to retries caused by that server not
 
528   recognizing the Client Cookie.
 
530   For further discussion of the Client Cookie field, see Section 5.1.
 
531   For example methods of determining a Client Cookie, see Appendix A.
 
533   In order to provide minimal authentication, a client MUST send
 
534   Client Cookies that will usually be different for any two servers at
 
535   different IP addresses.
 
539   The Server Cookie SHOULD consist of or include a 64-bit or larger
 
540   pseudorandom function of the request source (client) IP address, a
 
541   secret quantity known only to the server, and the request
 
542   Client Cookie.  (See Section 6 for a discussion of why the
 
543   Client Cookie is used as input to the Server Cookie but the
 
544   Server Cookie is not used as an input to the Client Cookie.)  This
 
545   Server Secret SHOULD have at least 64 bits of entropy [RFC4086] and
 
546   be changed periodically (see Section 7.1).  The selection of the
 
547   pseudorandom function is a matter private to the server, as only the
 
548   server needs to recognize its own DNS Cookies.
 
550   For further discussion of the Server Cookie field, see Section 5.2.
 
551   For example methods of determining a Server Cookie, see Appendix B.
 
552   When implemented as recommended, the server need not maintain any
 
553   cookie-related per-client state.
 
555   In order to provide minimal authentication, a server MUST send
 
556   Server Cookies that will usually be different for clients at any two
 
557   different IP addresses or with different Client Cookies.
 
562Eastlake & Andrews           Standards Track                   [Page 10]
 
564RFC 7873                       DNS Cookies                      May 2016
 
5675.  DNS Cookies Protocol Specification
 
569   This section discusses using DNS Cookies in the DNS protocol.  The
 
570   cycle of originating a request, responding to that request, and
 
571   processing responses is covered in Sections 5.1, 5.2, and 5.3.  A
 
572   de facto extension to QUERY to allow the prefetching of a
 
573   Server Cookie is specified in Section 5.4.  Rollover of the Client
 
574   Secrets and Server Secrets, and transient retention of the old cookie
 
575   or secret, are covered in Section 7.1.
 
577   DNS clients and servers SHOULD implement DNS Cookies to decrease
 
578   their vulnerability to the threats discussed in Section 2.
 
5805.1.  Originating a Request
 
582   A DNS client that implements DNS Cookies includes one DNS
 
583   COOKIE option containing a Client Cookie in every DNS request
 
584   it sends, unless DNS Cookies are disabled.
 
586   If the client has a cached Server Cookie for the server against its
 
587   IP address, it uses the longer cookie form and includes that
 
588   Server Cookie in the option along with the Client Cookie (Figure 2).
 
589   Otherwise, it just sends the shorter-form option with a Client Cookie
 
5925.2.  Responding to a Request
 
594   The Server Cookie, when it occurs in a COOKIE option in a request, is
 
595   intended to weakly assure the server that the request came from a
 
596   client that is both at the source IP address of the request and using
 
597   the Client Cookie included in the option.  This assurance is provided
 
598   by the Server Cookie that server sent to that client in an earlier
 
599   response appearing as the Server Cookie field in the request.
 
601   At a server where DNS Cookies are not implemented and enabled, the
 
602   presence of a COOKIE option is ignored and the server responds as if
 
603   no COOKIE option had been included in the request.
 
605   When DNS Cookies are implemented and enabled, there are five
 
608   (1) There is no OPT RR at all in the request, or there is an OPT RR
 
609       but the COOKIE option is absent from the OPT RR.
 
611   (2) A COOKIE option is present but is not a legal length or is
 
618Eastlake & Andrews           Standards Track                   [Page 11]
 
620RFC 7873                       DNS Cookies                      May 2016
 
623   (3) There is a COOKIE option of valid length in the request with no
 
626   (4) There is a COOKIE option of valid length in the request with a
 
627       Server Cookie, but that Server Cookie is invalid.
 
629   (5) There is a COOKIE option of valid length in the request with a
 
630       correct Server Cookie.
 
632   These five possibilities are discussed in the subsections below.
 
634   In all cases of multiple COOKIE options in a request, only the first
 
635   (the one closest to the DNS header) is considered.  All others are
 
6385.2.1.  No OPT RR or No COOKIE Option
 
640   If there is no OPT record or no COOKIE option present in the request,
 
641   then the server responds to the request as if the server doesn't
 
642   implement the COOKIE option.
 
6445.2.2.  Malformed COOKIE Option
 
646   If the COOKIE option is too short to contain a Client Cookie, then
 
647   FORMERR is generated.  If the COOKIE option is longer than that
 
648   required to hold a COOKIE option with just a Client Cookie (8 bytes)
 
649   but is shorter than the minimum COOKIE option with both a
 
650   Client Cookie and a Server Cookie (16 bytes), then FORMERR is
 
651   generated.  If the COOKIE option is longer than the maximum valid
 
652   COOKIE option (40 bytes), then FORMERR is generated.
 
654   In summary, valid cookie lengths are 8 and 16 to 40 inclusive.
 
6565.2.3.  Only a Client Cookie
 
658   Based on server policy, including rate limiting, the server chooses
 
659   one of the following:
 
661   (1) Silently discard the request.
 
663   (2) Send a BADCOOKIE error response.
 
665   (3) Process the request and provide a normal response.  The RCODE is
 
666       NOERROR, unless some non-cookie error occurs in processing the
 
674Eastlake & Andrews           Standards Track                   [Page 12]
 
676RFC 7873                       DNS Cookies                      May 2016
 
679   If the server responds choosing (2) or (3) above, it SHALL generate
 
680   its own COOKIE option containing both the Client Cookie copied from
 
681   the request and a Server Cookie it has generated, and it will add
 
682   this COOKIE option to the response's OPT record.  Servers MUST, at
 
683   least occasionally, respond to such requests to inform the client of
 
684   the correct Server Cookie.  This is necessary so that such a client
 
685   can bootstrap to the more secure state where requests and responses
 
686   have recognized Server Cookies and Client Cookies.  A server is not
 
687   expected to maintain per-client state to achieve this.  For example,
 
688   it could respond to every Nth request across all clients.
 
690   If the request was received over TCP, the server SHOULD take the
 
691   authentication provided by the use of TCP into account and SHOULD
 
692   choose (3).  In this case, if the server is not willing to accept the
 
693   security provided by TCP as a substitute for the security provided by
 
694   DNS Cookies but instead chooses (2), there is some danger of an
 
695   indefinite loop of retries (see Section 5.3).
 
6975.2.4.  A Client Cookie and an Invalid Server Cookie
 
699   The server examines the Server Cookie to determine if it is a valid
 
700   Server Cookie that it had generated previously.  This determination
 
701   normally involves recalculating the Server Cookie (or the Hash part
 
702   thereof) based on the Server Secret (or the previous Server Secret,
 
703   if it has just changed); the received Client Cookie; the Client IP
 
704   Address; and, possibly, other fields.  See Appendix B.2 for an
 
705   example.  If the cookie is invalid, it could be because
 
709   + a client's IP address or Client Cookie changed, and the DNS server
 
710     is not aware of the change
 
712   + an anycast cluster of servers is not consistently configured, or
 
714   + an attempt to spoof the client has occurred
 
716   The server SHALL process the request as if the invalid Server Cookie
 
717   was not present, as described in Section 5.2.3.
 
7195.2.5.  A Client Cookie and a Valid Server Cookie
 
721   When a valid Server Cookie is present in the request, the server can
 
722   assume that the request is from a client that it has talked to before
 
723   and defensive measures for spoofed UDP requests, if any, are no
 
730Eastlake & Andrews           Standards Track                   [Page 13]
 
732RFC 7873                       DNS Cookies                      May 2016
 
735   The server SHALL process the request and include a COOKIE option in
 
736   the response by (a) copying the complete COOKIE option from the
 
737   request or (b) generating a new COOKIE option containing both the
 
738   Client Cookie copied from the request and a valid Server Cookie it
 
7415.3.  Processing Responses
 
743   The Client Cookie, when it occurs in a COOKIE option in a DNS reply,
 
744   is intended to weakly assure the client that the reply came from a
 
745   server at the source IP address used in the response packet, because
 
746   the Client Cookie value is the value that client would send to that
 
747   server in a request.  In a DNS reply with multiple COOKIE options,
 
748   all but the first (the one closest to the DNS header) are ignored.
 
750   A DNS client where DNS Cookies are implemented and enabled examines
 
751   the response for DNS Cookies and MUST discard the response if it
 
752   contains an illegal COOKIE option length or an incorrect
 
753   Client Cookie value.  If the client is expecting the response to
 
754   contain a COOKIE option and it is missing, the response MUST be
 
755   discarded.  If the COOKIE option Client Cookie is correct, the client
 
756   caches the Server Cookie provided, even if the response is an error
 
757   response (RCODE non-zero).
 
759   If the extended RCODE in the reply is BADCOOKIE and the Client Cookie
 
760   in the reply matches what was sent, it means that the server was
 
761   unwilling to process the request because it did not have the correct
 
762   Server Cookie in it.  The client SHOULD retry the request using the
 
763   new Server Cookie from the response.  Repeated BADCOOKIE responses to
 
764   requests that use the Server Cookie provided in the previous response
 
765   may be an indication that either the shared secrets or the method for
 
766   generating secrets in an anycast cluster of servers is inconsistent.
 
767   If the reply to a retried request with a fresh Server Cookie is
 
768   BADCOOKIE, the client SHOULD retry using TCP as the transport, since
 
769   the server will likely process the request normally based on the
 
770   security provided by TCP (see Section 5.2.3).
 
772   If the RCODE is some value other than BADCOOKIE, including zero, the
 
773   further processing of the response proceeds normally.
 
7755.4.  Querying for a Server Cookie
 
777   In many cases, a client will learn the Server Cookie for a server as
 
778   the "side effect" of another transaction; however, there may be times
 
779   when this is not desirable.  Therefore, a means is provided for
 
780   obtaining a Server Cookie through an extension to the QUERY opcode
 
781   for which opcode most existing implementations require that QDCOUNT
 
782   be one (1) (see Section 4.1.2 of [RFC1035]).
 
786Eastlake & Andrews           Standards Track                   [Page 14]
 
788RFC 7873                       DNS Cookies                      May 2016
 
791   For servers with DNS Cookies enabled, the QUERY opcode behavior is
 
792   extended to support queries with an empty Question Section (a QDCOUNT
 
793   of zero (0)), provided that an OPT record is present with a COOKIE
 
794   option.  Such servers will send a reply that has an empty
 
795   Answer Section and has a COOKIE option containing the Client Cookie
 
796   and a valid Server Cookie.
 
798   If such a query provided just a Client Cookie and no Server Cookie,
 
799   the response SHALL have the RCODE NOERROR.
 
801   This mechanism can also be used to confirm/re-establish an existing
 
802   Server Cookie by sending a cached Server Cookie with the
 
803   Client Cookie.  In this case, the response SHALL have the RCODE
 
804   BADCOOKIE if the Server Cookie sent with the query was invalid and
 
805   the RCODE NOERROR if it was valid.
 
807   Servers that don't support the COOKIE option will normally send
 
808   FORMERR in response to such a query, though REFUSED, NOTIMP, and
 
809   NOERROR without a COOKIE option are also possible in such responses.
 
8116.  NAT Considerations and Anycast Server Considerations
 
813   In the classic Internet, DNS Cookies could simply be a pseudorandom
 
814   function of the Client IP Address and a Server Secret or the Server
 
815   IP Address and a Client Secret.  You would want to compute the
 
816   Server Cookie that way, so a client could cache its Server Cookie for
 
817   a particular server for an indefinite amount of time and the server
 
818   could easily regenerate and check it.  You could consider the
 
819   Client Cookie to be a weak client signature over the Server IP
 
820   Address that the client checks in replies, and you could extend this
 
821   signature to cover the request ID, for example, or any other
 
822   information that is returned unchanged in the reply.
 
824   But we have this reality called "NAT" [RFC3022] (including, for the
 
825   purposes of this document, NAT-PT, which has been declared Historic
 
826   [RFC4966]).  There is no problem with DNS transactions between
 
827   clients and servers behind a NAT box using local IP addresses.  Nor
 
828   is there a problem with NAT translation of internal addresses to
 
829   external addresses or translations between IPv4 and IPv6 addresses,
 
830   as long as the address mapping is relatively stable.  Should the
 
831   external IP address to which an internal client is being mapped
 
832   change occasionally, the disruption is little more than when a client
 
833   rolls over its COOKIE secret.  Also, external access to a DNS server
 
834   behind a NAT box is normally handled by a fixed mapping that forwards
 
835   externally received DNS requests to a specific host.
 
842Eastlake & Andrews           Standards Track                   [Page 15]
 
844RFC 7873                       DNS Cookies                      May 2016
 
847   However, NAT devices sometimes also map ports.  This can cause
 
848   multiple DNS requests and responses from multiple internal hosts to
 
849   be mapped to a smaller number of external IP addresses, such as one
 
850   address.  Thus, there could be many clients behind a NAT box that
 
851   appear to come from the same source IP address to a server outside
 
852   that NAT box.  If one of these were an attacker (think "zombie" or
 
853   "botnet") behind a NAT box, that attacker could get the Server Cookie
 
854   for some server for the outgoing IP address by just making some
 
855   random request to that server.  It could then include that
 
856   Server Cookie in the COOKIE option of requests to the server with the
 
857   forged local IP address of some other host and/or client behind the
 
858   NAT box.  (An attacker's possession of this Server Cookie will not
 
859   help in forging responses to cause cache poisoning, as such responses
 
860   are protected by the required Client Cookie.)
 
862   To fix this potential defect, it is necessary to distinguish
 
863   different clients behind a NAT box from the point of view of the
 
864   server.  This is why the Server Cookie is specified as a pseudorandom
 
865   function of both the request source IP address and the Client Cookie.
 
866   From this inclusion of the Client Cookie in the calculation of the
 
867   Server Cookie, it follows that, for any particular server, a stable
 
868   Client Cookie is needed.  If, for example, the request ID was
 
869   included in the calculation of the Client Cookie, it would normally
 
870   change with each request to a particular server.  This would mean
 
871   that each request would have to be sent twice: first, to learn the
 
872   new Server Cookie based on this new Client Cookie based on the new
 
873   ID, and then again using this new Client Cookie to actually get an
 
874   answer.  Thus, the input to the Client Cookie computation must be
 
875   limited to the Server IP Address and one or more things that change
 
876   slowly, such as the Client Secret.
 
878   In principle, there could be a similar problem for servers, not due
 
879   to NAT but due to mechanisms like anycast that may cause requests to
 
880   a DNS server at an IP address to be delivered to any one of several
 
881   machines.  (External requests to a DNS server behind a NAT box
 
882   usually occur via port forwarding such that all such requests go to
 
883   one host.)  However, it is impossible to solve this in the way that
 
884   the similar problem was solved for NATed clients; if the
 
885   Server Cookie was included in the calculation of the Client Cookie in
 
886   the same way that the Client Cookie is included in the Server Cookie,
 
887   you would just get an almost infinite series of errors as a request
 
888   was repeatedly retried.
 
890   For servers accessed via anycast, to successfully support
 
891   DNS Cookies, either (1) the server clones must all use the same
 
892   Server Secret or (2) the mechanism that distributes requests to the
 
893   server clones must cause the requests from a particular client to go
 
894   to a particular server for a sufficiently long period of time that
 
898Eastlake & Andrews           Standards Track                   [Page 16]
 
900RFC 7873                       DNS Cookies                      May 2016
 
903   extra requests due to changes in Server Cookies resulting from
 
904   accessing different server machines are not unduly burdensome.  (When
 
905   such anycast-accessed servers act as recursive servers or otherwise
 
906   act as clients, they normally use a different unique address to
 
907   source their requests, to avoid confusion in the delivery of
 
910   For simplicity, it is RECOMMENDED that the same Server Secret be used
 
911   by each DNS server in a set of anycast servers.  If there is limited
 
912   time skew in updating this secret in different anycast servers, this
 
913   can be handled by a server accepting requests containing a
 
914   Server Cookie based on either its old or new secret for the maximum
 
915   likely time period of such time skew (see also Section 7.1).
 
9177.  Operational and Deployment Considerations
 
919   The DNS Cookie mechanism is designed for incremental deployment and
 
920   to complement the orthogonal techniques in [RFC5452].  Either or both
 
921   techniques can be deployed independently at each DNS server and
 
922   client.  Thus, installation at the client and server end need not be
 
925   In particular, a DNS server or client that implements the DNS Cookie
 
926   mechanism can interoperate successfully with a DNS client or server
 
927   that does not implement this mechanism, although, of course, in this
 
928   case it will not get the benefit of the mechanism and the server
 
929   involved might choose to severely rate-limit responses.  When such a
 
930   server or client interoperates with a client or server that also
 
931   implements the DNS Cookie mechanism, these servers and clients get
 
932   the security benefits of the DNS Cookie mechanism.
 
9347.1.  Client and Server Secret Rollover
 
936   The longer a secret is used, the higher the probability that it has
 
937   been compromised.  Thus, clients and servers are configured with a
 
938   lifetime setting for their secret, and they roll over to a new secret
 
939   when that lifetime expires, or earlier due to deliberate jitter as
 
940   described below.  The default lifetime is one day, and the maximum
 
941   permitted is one month.  To be precise and to make it practical to
 
942   stay within limits despite long holiday weekends, daylight saving
 
943   time shifts, and the like, clients and servers MUST NOT continue to
 
944   use the same secret in new requests and responses for more than
 
945   36 days and SHOULD NOT continue to do so for more than 26 hours.
 
947   Many clients rolling over their secret at the same time could briefly
 
948   increase server traffic, and exactly predictable rollover times for
 
949   clients or servers might facilitate guessing attacks.  For example,
 
950   an attacker might increase the priority of attacking secrets they
 
954Eastlake & Andrews           Standards Track                   [Page 17]
 
956RFC 7873                       DNS Cookies                      May 2016
 
959   believe will be in effect for an extended period of time.  To avoid
 
960   rollover synchronization and predictability, it is RECOMMENDED that
 
961   pseudorandom jitter in the range of plus zero to minus at least 40%
 
962   be applied to the time until a scheduled rollover of a COOKIE secret.
 
964   It is RECOMMENDED that a client keep the Client Cookie it is
 
965   expecting in a reply until there is no longer an outstanding request
 
966   associated with that Client Cookie that the client is tracking.  This
 
967   avoids rejection of replies due to a bad Client Cookie right after a
 
968   change in the Client Secret.
 
970   It is RECOMMENDED that a server retain its previous secret after a
 
971   rollover to a new secret for a configurable period of time not less
 
972   than 1 second or more than 300 seconds, with a default configuration
 
973   of 150 seconds.  Requests with Server Cookies based on its previous
 
974   secret are treated as a correct Server Cookie during that time.  When
 
975   a server responds to a request containing an old Server Cookie that
 
976   the server is treating as correct, the server MUST include a new
 
977   Server Cookie in its response.
 
981   It is RECOMMENDED that implementations include counters of the
 
982   occurrences of the various types of requests and responses described
 
9858.  IANA Considerations
 
987   IANA has assigned the following DNS EDNS0 option code:
 
989       Value       Name      Status        Reference
 
990      --------    ------    --------    ---------------
 
991         10       COOKIE    Standard       RFC 7873
 
993   IANA has assigned the following DNS error code as an early allocation
 
996       RCODE       Name       Description                 Reference
 
997      --------  ---------  -------------------------   ---------------
 
998         23     BADCOOKIE  Bad/missing Server Cookie      RFC 7873
 
1010Eastlake & Andrews           Standards Track                   [Page 18]
 
1012RFC 7873                       DNS Cookies                      May 2016
 
10159.  Security Considerations
 
1017   DNS Cookies provide a weak form of authentication of DNS requests and
 
1018   responses.  In particular, they provide no protection against
 
1019   "on-path" adversaries; that is, they provide no protection against
 
1020   any adversary that can observe the plaintext DNS traffic, such as an
 
1021   on-path router, bridge, or any device on an on-path shared link
 
1022   (unless the DNS traffic in question on that path is encrypted).
 
1024   For example, if a host is connected via an unsecured IEEE Std. 802.11
 
1025   link (Wi-Fi), any device in the vicinity that could receive and
 
1026   decode the 802.11 transmissions must be considered "on path".  On the
 
1027   other hand, in a similar situation but one where 802.11 Robust
 
1028   Security (WPA2, also called "Wi-Fi Protected Access 2") is
 
1029   appropriately deployed on the Wi-Fi network nodes, only the
 
1030   Access Point via which the host is connecting is "on path" as far as
 
1031   the 802.11 link is concerned.
 
1033   Despite these limitations, deployment of DNS Cookies on the global
 
1034   Internet is expected to provide a significant reduction in the
 
1035   available launch points for the traffic amplification and denial-of-
 
1036   service forgery attacks described in Section 2 above.
 
1038   Work is underway in the IETF DPRIVE working group to provide
 
1039   confidentiality for DNS requests and responses that would be
 
1040   compatible with DNS Cookies.
 
1042   Should stronger message/transaction security be desired, it is
 
1043   suggested that TSIG or SIG(0) security be used (see Section 3.2);
 
1044   however, it may be useful to use DNS Cookies in conjunction with
 
1045   these features.  In particular, DNS Cookies could screen out many DNS
 
1046   messages before the cryptographic computations of TSIG or SIG(0) are
 
1047   required, and if SIG(0) is in use, DNS Cookies could usefully screen
 
1048   out many requests given that SIG(0) does not screen requests but only
 
1049   authenticates the response of complete transactions.
 
1051   An attacker that does not know the Server Cookie could do a variety
 
1052   of things, such as omitting the COOKIE option or sending a random
 
1053   Server Cookie.  In general, DNS servers need to take other measures,
 
1054   including rate-limiting responses, to protect from abuse in such
 
1055   cases.  See further information in Section 5.2.
 
1057   When a server or client starts receiving an increased level of
 
1058   requests with bad Server Cookies or replies with bad Client Cookies,
 
1059   it would be reasonable for it to believe that it is likely under
 
1060   attack, and it should consider a more frequent rollover of its
 
1061   secret.  More rapid rollover decreases the benefit to a
 
1062   cookie-guessing attacker if they succeed in guessing a cookie.
 
1066Eastlake & Andrews           Standards Track                   [Page 19]
 
1068RFC 7873                       DNS Cookies                      May 2016
 
10719.1.  Cookie Algorithm Considerations
 
1073   The cookie computation algorithm for use in DNS Cookies SHOULD be
 
1074   based on a pseudorandom function at least as strong as 64-bit FNV
 
1075   (Fowler/Noll/Vo [FNV]), because an excessively weak or trivial
 
1076   algorithm could enable adversaries to guess cookies.  However, in
 
1077   light of the lightweight plaintext token security provided by
 
1078   DNS Cookies, a strong cryptography hash algorithm may not be
 
1079   warranted in many cases and would cause an increased computational
 
1080   burden.  Nevertheless, there is nothing wrong with using something
 
1081   stronger -- for example, HMAC-SHA-256 [RFC6234] truncated to 64 bits,
 
1082   assuming that a DNS processor has adequate computational resources
 
1083   available.  DNS implementations or applications that need somewhat
 
1084   stronger security without a significant increase in computational
 
1085   load should consider more frequent changes in their client and/or
 
1086   Server Secret; however, this does require more frequent generation of
 
1087   a cryptographically strong random number [RFC4086].  See Appendices A
 
1088   and B for specific examples of cookie computation algorithms.
 
109010.  Implementation Considerations
 
1092   The DNS COOKIE option specified herein is implemented in BIND 9.10
 
1093   using an experimental option code.  BIND 9.10.3 (and later) use the
 
1094   allocated option code.
 
109811.1.  Normative References
 
1100   [RFC1035]  Mockapetris, P., "Domain names - implementation and
 
1101              specification", STD 13, RFC 1035, DOI 10.17487/RFC1035,
 
1102              November 1987, <http://www.rfc-editor.org/info/rfc1035>.
 
1104   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
 
1105              Requirement Levels", BCP 14, RFC 2119,
 
1106              DOI 10.17487/RFC2119, March 1997,
 
1107              <http://www.rfc-editor.org/info/rfc2119>.
 
1109   [RFC4086]  Eastlake 3rd, D., Schiller, J., and S. Crocker,
 
1110              "Randomness Requirements for Security", BCP 106, RFC 4086,
 
1111              DOI 10.17487/RFC4086, June 2005,
 
1112              <http://www.rfc-editor.org/info/rfc4086>.
 
1122Eastlake & Andrews           Standards Track                   [Page 20]
 
1124RFC 7873                       DNS Cookies                      May 2016
 
1127   [RFC6891]  Damas, J., Graff, M., and P. Vixie, "Extension Mechanisms
 
1128              for DNS (EDNS(0))", STD 75, RFC 6891,
 
1129              DOI 10.17487/RFC6891, April 2013,
 
1130              <http://www.rfc-editor.org/info/rfc6891>.
 
1132   [RFC7120]  Cotton, M., "Early IANA Allocation of Standards Track Code
 
1133              Points", BCP 100, RFC 7120, DOI 10.17487/RFC7120,
 
1134              January 2014, <http://www.rfc-editor.org/info/rfc7120>.
 
113611.2.  Informative References
 
1138   [FNV]      Fowler, G., Noll, L., Vo, K., and D. Eastlake 3rd, "The
 
1139              FNV Non-Cryptographic Hash Algorithm", Work in Progress,
 
1140              draft-eastlake-fnv-10, October 2015.
 
1142   [Kaminsky] Olney, M., Mullen, P., and K. Miklavcic, "Dan Kaminsky's
 
1143              2008 DNS Vulnerability", July 2008, <https://www.ietf.org/
 
1144              mail-archive/web/dnsop/current/pdf2jgx6rzxN4.pdf>.
 
1146   [RFC2845]  Vixie, P., Gudmundsson, O., Eastlake 3rd, D., and B.
 
1147              Wellington, "Secret Key Transaction Authentication for DNS
 
1148              (TSIG)", RFC 2845, DOI 10.17487/RFC2845, May 2000,
 
1149              <http://www.rfc-editor.org/info/rfc2845>.
 
1151   [RFC2930]  Eastlake 3rd, D., "Secret Key Establishment for DNS
 
1152              (TKEY RR)", RFC 2930, DOI 10.17487/RFC2930,
 
1153              September 2000, <http://www.rfc-editor.org/info/rfc2930>.
 
1155   [RFC2931]  Eastlake 3rd, D., "DNS Request and Transaction Signatures
 
1156              ( SIG(0)s )", RFC 2931, DOI 10.17487/RFC2931,
 
1157              September 2000, <http://www.rfc-editor.org/info/rfc2931>.
 
1159   [RFC3022]  Srisuresh, P. and K. Egevang, "Traditional IP Network
 
1160              Address Translator (Traditional NAT)", RFC 3022,
 
1161              DOI 10.17487/RFC3022, January 2001,
 
1162              <http://www.rfc-editor.org/info/rfc3022>.
 
1164   [RFC4033]  Arends, R., Austein, R., Larson, M., Massey, D., and S.
 
1165              Rose, "DNS Security Introduction and Requirements",
 
1166              RFC 4033, DOI 10.17487/RFC4033, March 2005,
 
1167              <http://www.rfc-editor.org/info/rfc4033>.
 
1169   [RFC4034]  Arends, R., Austein, R., Larson, M., Massey, D., and S.
 
1170              Rose, "Resource Records for the DNS Security Extensions",
 
1171              RFC 4034, DOI 10.17487/RFC4034, March 2005,
 
1172              <http://www.rfc-editor.org/info/rfc4034>.
 
1178Eastlake & Andrews           Standards Track                   [Page 21]
 
1180RFC 7873                       DNS Cookies                      May 2016
 
1183   [RFC4035]  Arends, R., Austein, R., Larson, M., Massey, D., and S.
 
1184              Rose, "Protocol Modifications for the DNS Security
 
1185              Extensions", RFC 4035, DOI 10.17487/RFC4035, March 2005,
 
1186              <http://www.rfc-editor.org/info/rfc4035>.
 
1188   [RFC4966]  Aoun, C. and E. Davies, "Reasons to Move the Network
 
1189              Address Translator - Protocol Translator (NAT-PT) to
 
1190              Historic Status", RFC 4966, DOI 10.17487/RFC4966,
 
1191              July 2007, <http://www.rfc-editor.org/info/rfc4966>.
 
1193   [RFC5452]  Hubert, A. and R. van Mook, "Measures for Making DNS
 
1194              More Resilient against Forged Answers", RFC 5452,
 
1195              DOI 10.17487/RFC5452, January 2009,
 
1196              <http://www.rfc-editor.org/info/rfc5452>.
 
1198   [RFC6234]  Eastlake 3rd, D. and T. Hansen, "US Secure Hash Algorithms
 
1199              (SHA and SHA-based HMAC and HKDF)", RFC 6234,
 
1200              DOI 10.17487/RFC6234, May 2011,
 
1201              <http://www.rfc-editor.org/info/rfc6234>.
 
1234Eastlake & Andrews           Standards Track                   [Page 22]
 
1236RFC 7873                       DNS Cookies                      May 2016
 
1239Appendix A.  Example Client Cookie Algorithms
 
1241A.1.  A Simple Algorithm
 
1243   A simple example method to compute Client Cookies is the FNV64 [FNV]
 
1244   of the Client IP Address, the Server IP Address, and the Client
 
1248         FNV64( Client IP Address | Server IP Address | Client Secret )
 
1250   where "|" indicates concatenation.  Some computational resources may
 
1251   be saved by pre-computing FNV64 through the Client IP Address.  (If
 
1252   the order of the items concatenated above is changed to put the
 
1253   Server IP Address last, it might be possible to further reduce the
 
1254   computational effort by pre-computing FNV64 through the bytes of both
 
1255   the Client IP Address and the Client Secret, but this would reduce
 
1256   the strength of the Client Cookie and is NOT RECOMMENDED.)
 
1258A.2.  A More Complex Algorithm
 
1260   A more complex algorithm to calculate Client Cookies is given below.
 
1261   It uses more computational resources than the simpler algorithm shown
 
1265         HMAC-SHA256-64( Client IP Address | Server IP Address,
 
1268Appendix B.  Example Server Cookie Algorithms
 
1270B.1.  A Simple Algorithm
 
1272   An example of a simple method producing a 64-bit Server Cookie is the
 
1273   FNV64 [FNV] of the request IP address, the Client Cookie, and the
 
1277         FNV64( Client IP Address | Client Cookie | Server Secret )
 
1279   where "|" represents concatenation.  (If the order of the items
 
1280   concatenated was changed, it might be possible to reduce the
 
1281   computational effort by pre-computing FNV64 through the bytes of the
 
1282   Server Secret and Client Cookie, but this would reduce the strength
 
1283   of the Server Cookie and is NOT RECOMMENDED.)
 
1290Eastlake & Andrews           Standards Track                   [Page 23]
 
1292RFC 7873                       DNS Cookies                      May 2016
 
1295B.2.  A More Complex Algorithm
 
1297   Since the Server Cookie has a variable size, the server can store
 
1298   various information in that field as long as it is hard for an
 
1299   adversary to guess the entire quantity used for authentication.
 
1300   There should be 64 bits of entropy in the Server Cookie; for example,
 
1301   it could have a sub-field of 64 bits computed pseudorandomly with the
 
1302   Server Secret as one of the inputs to the pseudorandom function.
 
1303   Types of additional information that could be stored include a
 
1304   timestamp and/or a nonce.
 
1306   The example below is one variation of the Server Cookie that has been
 
1307   implemented in BIND 9.10.3 (and later) releases, where the
 
1308   Server Cookie is 128 bits, composed as follows:
 
1316   With this algorithm, the server sends a new 128-bit cookie back with
 
1317   every request.  The Nonce field assures a low probability that there
 
1318   would be a duplicate.
 
1320   The Time field gives the server time and makes it easy to reject old
 
1323   The Hash part of the Server Cookie is the part that is hard to guess.
 
1324   In BIND 9.10.3 (and later), its computation can be configured to use
 
1325   AES, HMAC-SHA-1, or, as shown below, HMAC-SHA-256:
 
1328           HMAC-SHA256-64( Server Secret,
 
1329               (Client Cookie | Nonce | Time | Client IP Address) )
 
1331   where "|" represents concatenation.
 
1346Eastlake & Andrews           Standards Track                   [Page 24]
 
1348RFC 7873                       DNS Cookies                      May 2016
 
1353   The suggestions and contributions of the following are gratefully
 
1356      Alissa Cooper, Bob Harold, Paul Hoffman, David Malone, Yoav Nir,
 
1357      Gayle Noble, Dan Romascanu, Tim Wicinski, and Peter Yee
 
1361   Donald E. Eastlake 3rd
 
1367   Phone: +1-508-333-2270
 
1368   Email: d3e3e3@gmail.com
 
1372   Internet Systems Consortium
 
1374   Redwood City, CA  94063
 
1377   Email: marka@isc.org
 
1402Eastlake & Andrews           Standards Track                   [Page 25]