[Docs] [txt|pdf] [Tracker] [WG] [Email] [Diff1] [Diff2] [Nits]

Versions: (draft-eastlake-dnsext-cookies) 00 01 02 03 04 05 06 07 08 09 10 RFC 7873

INTERNET-DRAFT                                           Donald Eastlake
Intended Status: Proposed Standard                                Huawei
                                                            Mark Andrews
                                                                     ISC
Expires: December 15, 2015                                 June 16, 2015


                    Domain Name System (DNS) Cookies
                   <draft-ietf-dnsop-cookies-02.txt>



Abstract

   DNS cookies are a lightweight DNS transaction security mechanism that
   provides limited protection to DNS servers and clients against a
   variety of increasingly common denial-of-service and amplification /
   forgery or cache poisoning attacks by off-path attackers. DNS Cookies
   are tolerant of NAT, NAT-PT, and anycast and can be incrementally
   deployed.


Status of This Document

   This Internet-Draft is submitted to IETF in full conformance with the
   provisions of BCP 78 and BCP 79.

   Distribution of this document is unlimited. Comments should be sent
   to the author or the DNSEXT mailing list <dnsext@ietf.org>.

   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/1id-abstracts.html. The list of Internet-Draft
   Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html.











Donald Eastlake & Mark Andrews                                  [Page 1]


INTERNET-DRAFT                                               DNS Cookies


Table of Contents

      1. Introduction............................................4
      1.1 Contents of This Document..............................4
      1.2 Definitions............................................5

      2. Threats Considered......................................6
      2.1 Denial-of-Service Attacks..............................6
      2.1.1 DNS Amplification Attacks............................6
      2.1.2 DNS Server Denial-of-Service.........................6
      2.2 Cache Poisoning and Answer Forgery Attacks.............7

      3. Comments on Existing DNS Security.......................8
      3.1 Existing DNS Data Security.............................8
      3.2 DNS Message/Transaction Security.......................8
      3.3 Conclusions on Existing DNS Security...................8

      4. DNS Cookie Option.......................................9
      4.1 Client Cookie.........................................10
      4.2 Server Cookie.........................................10

      5. DNS Cookies Protocol Description.......................11
      5.1 Originating Requests..................................11
      5.2 Responding to Request.................................11
      5.2.1 No Opt RR or No COOKIE OPT option...................12
      5.2.2 Malformed COOKIE OPT option.........................12
      5.2.3 Only a Client Cookie................................12
      5.2.4 A Client Cookie and Server Cookie...................13
      5.2.4.1 A Client Cookie and Invalid Server Cookie.........13
      5.2.4.2 A Client Cookie and Valid Server Cookie...........13
      5.3 Processing Responses..................................13
      5.4 Client and Server Secret Rollover.....................14
      5.5 Implementation Requirement............................15

      6. NAT Considerations and AnyCast Server Considerations...16
      7. Deployment.............................................18
      8. IANA Considerations....................................19

      9. Security Considerations................................20
      9.1 Cookie Algorithm Considerations.......................20

      10. Implementation Considerations.........................21

      Normative References......................................22
      Informative References....................................22

      Acknowledgements..........................................24

      Appendix A: Example Client Cookie Algorithms..............25
      A.1 A Simple Algorithm....................................25
      A.2 A More Complex Algorithm..............................25

Donald Eastlake & Mark Andrews                                  [Page 2]


INTERNET-DRAFT                                               DNS Cookies


Table of Contents (continued)

      Appendix B: Example Server Cookie Algorithms..............26
      B.1 A Simple Algorithm....................................26
      B.2 A More Complex Algorithm..............................26

      Author's Address..........................................28













































Donald Eastlake & Mark Andrews                                  [Page 3]


INTERNET-DRAFT                                               DNS Cookies


1. Introduction

   As with many core Internet protocols, the Domain Name System (DNS)
   was originally designed at a time when the Internet had only a small
   pool of trusted users. As the Internet has grown exponentially to a
   global information utility, the DNS has increasingly been subject to
   abuse.

   This document describes DNS cookies, a lightweight DNS transaction
   security mechanism specified as an OPT [RFC6891] option.  The DNS
   cookies mechanism provides limited protection to DNS servers and
   clients against a variety of increasingly common abuses by off-path
   attackers. It is compatible with and can be used in conjunction with
   other DNS transaction forgery resistance measures such as those in
   [RFC5452].

   The protection provided by DNS cookies bears some resemblance to that
   provided by using TCP for DNS transactions. To bypass the weak
   protection provided by using TCP requires an off-path attacker
   guessing the 32-bit TCP sequence number in use. To bypass the weak
   protection provided by DNS Cookies requires such an attacker to guess
   a 64-bit pseudo-random quantity. Where DNS Cookies are not available
   but TCP is, a fall back to using TCP is a reasonable strategy.

   If only one party to a DNS transaction supports DNS cookies, the
   mechanism does not provide a benefit or significantly interfere; but,
   if both support it, the additional security provided is automatically
   available.

   The DNS cookies mechanism is designed to work in the presence of NAT
   and NAT-PT boxes and guidance is provided herein on supporting the
   DNS cookies mechanism in anycast servers.



1.1 Contents of This Document

   In Section 2, we discuss the threats against which the DNS cookie
   mechanism provides some protection.

   Section 3 describes existing DNS security mechanisms and why they are
   not adequate substitutes for DNS cookies.

   Section 4 describes the COOKIE OPT option.

   Section 5 provides a protocol description.

   Section 6 discusses some NAT and anycast related DNS Cookies design
   considerations.



Donald Eastlake & Mark Andrews                                  [Page 4]


INTERNET-DRAFT                                               DNS Cookies


   Section 7 discusses incremental deployment considerations.

   Sections 8 and 9 describe IANA and Security Considerations.



1.2 Definitions

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described in [RFC2119].

   An "off-path attacker", for a particular DNS client and server, is
   defined as an attacker who cannot observe the DNS request and
   response messages between that client and server.

   "Soft state" indicates information learned or derived by a host which
   may be discarded when indicated by the policies of that host but can
   be later re-instantiated if needed.  For example, it could be
   discarded after a period of time or when storage for caching such
   data becomes full. If operations requiring that soft state continue
   after it has been discarded, it will be automatically re-generated,
   albeit at some cost.

   "Silently discarded" indicates that there are no DNS protocol message
   consequences; however, it is RECOMMENDED that appropriate network
   management facilities be included in implementations, such as a
   counter of the occurrences of each such event type.

   "IP address" is used herein as a length independent term and includes
   both IPv4 and IPv6 addresses.





















Donald Eastlake & Mark Andrews                                  [Page 5]


INTERNET-DRAFT                                               DNS Cookies


2. Threats Considered

   DNS cookies are intended to provide significant but limited
   protection against certain attacks by off-path attackers as described
   below. These attacks include denial-of-service, cache poisoning and
   answer forgery.



2.1 Denial-of-Service Attacks

   The typical form of the denial-of-service attacks considered herein
   is to send DNS requests with forged source IP addresses to a server.
   The intent can be to attack that server or some other selected host
   as described below.



2.1.1 DNS Amplification Attacks

   A request with a forged IP address generally causes a response to be
   sent to that forged IP address. Thus the forging of many such
   requests with a particular source IP address can result in enough
   traffic being sent to the forged IP address to interfere with service
   to the host at the IP address. Furthermore, it is generally easy in
   the DNS to create short requests that produce much longer responses,
   thus amplifying the attack.

   The DNS Cookies mechanism can severely limit the traffic
   amplification obtained by attackers off path for the server and the
   attacked host. Enforced DNS cookies would make it hard for an off
   path attacker to cause any more than rate-limited short error
   responses to be sent to a forged IP address so the attack would be
   attenuated rather than amplified.  DNS cookies make it more effective
   to implement a rate limiting scheme for error responses from the
   server.  Such a scheme would further restrict selected host denial-
   of-service traffic from that server.



2.1.2 DNS Server Denial-of-Service

   DNS requests that are accepted cause work on the part of DNS servers.
   This is particularly true for recursive servers that may issue one or
   more requests and process the responses thereto, in order to
   determine their response to the initial request. And the situation
   can be even worse for recursive servers implementing DNSSEC
   ([RFC4033] [RFC4034] [RFC4035]) because they may be induced to
   perform burdensome cryptographic computations in attempts to verify
   the authenticity of data they retrieve in trying to answer the


Donald Eastlake & Mark Andrews                                  [Page 6]


INTERNET-DRAFT                                               DNS Cookies


   request.

   The computational or communications burden caused by such requests
   may not dependent on a forged IP source address, but the use of such
   addresses makes
      + the source of the requests causing the denial-of-service attack
        harder to find and
      + restriction of the IP addresses from which such requests should
        be honored hard or impossible to specify or verify.

   Use of DNS cookies should enables a server to reject forged queries
   from an off path attacker with relative ease and before any recursive
   queries or public key cryptographic operations are performed.



2.2 Cache Poisoning and Answer Forgery Attacks

   The form of the cache poisoning attacks considered is to send forged
   replies to a resolver. Modern network speeds for well-connected hosts
   are such that, by forging replies from the IP addresses of a DNS
   server to a resolver for common names or names that resolver has been
   induced to resolve, there can be an unacceptably high probability of
   randomly coming up with a reply that will be accepted and cause false
   DNS information to be cached by that resolver (the Dan Kaminsky
   attack). This can be used to facilitate phishing attacks and other
   diversion of legitimate traffic to a compromised or malicious host
   such as a web server.

   With the use of DNS cookies, a resolver can generally reject such
   forged replies.





















Donald Eastlake & Mark Andrews                                  [Page 7]


INTERNET-DRAFT                                               DNS Cookies


3. Comments on Existing DNS Security

   Two forms of security have been added to DNS, data security and
   message/transaction security.



3.1 Existing DNS Data Security

   DNS data security is one part of DNSSEC and is described in
   [RFC4033], [RFC4034], and [RFC4035] and updates thereto. It provides
   data origin authentication and authenticated denial of existence.
   DNSSEC is being deployed and can provide strong protection against
   forged data; however, it has the unintended effect of making some
   denial-of-service attacks worse because of the cryptographic
   computational load it can require and the increased size in DNS
   response packets that it tends to produce.



3.2 DNS Message/Transaction Security

   The second form of security that has been added to DNS provides
   "transaction" security through TSIG [RFC2845] or SIG(0) [RFC2931].
   TSIG could provide strong protection against the attacks for which
   the DNS Cookies mechanism provide weak protection; however, TSIG is
   non-trivial to deploy in the general Internet because of the burden
   it imposes of pre-agreement and key distribution between client-
   server pairs, the burden of server side key state, and because it
   requires time synchronization between client and server.

   TKEY [RFC2930] can solve the problem of key distribution for TSIG but
   some modes of TKEY impose a substantial cryptographic computation
   loads and can be dependent on the deployment of DNS data security
   (see Section 3.1).

   SIG(0) [RFC2931] provides less denial of service protection than TSIG
   or, in one way, even DNS cookies, because it does not authenticate
   requests, only complete transactions.  In any case, it also depends
   on the deployment of DNS data security and requires computationally
   burdensome public key cryptographic operations.



3.3 Conclusions on Existing DNS Security

   The existing DNS security mechanisms do not provide the services
   provided by the DNS Cookies mechanism: lightweight message
   authentication of DNS requests and responses with no requirement for
   pre-configuration or per client server side state.


Donald Eastlake & Mark Andrews                                  [Page 8]


INTERNET-DRAFT                                               DNS Cookies


4. DNS Cookie Option

   The DNS Cookie Option is an OPT RR [RFC6891] option that can be
   included in the RDATA portion of an OPT RR in DNS requests and
   responses.  The option length varies depending on the circumstances
   in which it is being used.  There are two cases as described below.
   Both use the same OPTION-CODE; they are distinguished by their
   length.

   In a request sent by a client to a server when the client does not
   know the server cookie, its length is 8, consisting an 8 byte Client
   Cookie as shown in Figure 1.

                           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
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |       OPTION-CODE = TBD1     |       OPTION-LENGTH = 8        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                                                               |
      +-+-    Client Cookie (fixed size, 8 bytes)              -+-+-+-+
      |                                                               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

              Figure 1. COOKIE Option, Unknown Server Cookie

   In a request sent by a client when a server cookie is known and in
   all responses, the length is variable from 16 to 40 bytes, consisting
   of an 8 bytes Client Cookie followed by the variable 8 to 32 bytes
   Server Cookie as shown in Figure 2.  The variability of the option
   length stems from the variable length Server Cookie.  The Server
   Cookie is an integer number of bytes with a minimum size of 8 bytes
   for security and a maximum size of 32 bytes for implementation
   convenience.

                         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
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |       OPTION-CODE = TBD1     |   OPTION-LENGTH >= 16, <= 40   |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                                                               |
    +-+-    Client Cookie (fixed size, 8 bytes)              -+-+-+-+
    |                                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                                                               |
    /       Server Cookie  (variable size, 8 to 32 bytes)           /
    /                                                               /
    +-+-+-+-...

               Figure 2. COOKIE Option, Known Server Cookie



Donald Eastlake & Mark Andrews                                  [Page 9]


INTERNET-DRAFT                                               DNS Cookies


4.1 Client Cookie

   The Client Cookie SHOULD be a pseudo-random function of the server IP
   address and a secret quantity known only to the client. This client
   secret SHOULD have at least 64 bits of entropy [RFC4086] and be
   changed periodically (see Section 5.4). The selection of the pseudo-
   random function is a matter private to the client as only the client
   needs to recognize its own DNS cookies.

   For further discussion of the Client Cookie field, see Section 5.1.
   For example methods of determining a Client Cookie, see Appendix A.

   A client MUST NOT use the same Client Cookie value for queries to all
   servers.



4.2 Server Cookie

   The Server Cookie SHOULD consist of or include a 64-bit or larger
   pseudo-random function of the request source IP address, the request
   Client Cookie, and a secret quantity known only to the server. (See
   Section 6 for a discussion of why the Client Cookie is used as input
   to the Server Cookie but the Server Cookie is not used as an input to
   the Client Cookie.)  This server secret SHOULD have at least 64 bits
   of entropy [RFC4086] and be changed periodically (see Section 5.4).
   The selection of the pseudo-random function is a matter private to
   the server as only the server needs to recognize its own DNS cookies.

   For further discussion of the Server Cookie field see Section 5.2.
   For example methods of determining a Server Cookie, see Appendix B.

   A server MUST NOT use the same Server Cookie value for responses to
   all clients.


















Donald Eastlake & Mark Andrews                                 [Page 10]


INTERNET-DRAFT                                               DNS Cookies


5. DNS Cookies Protocol Description

   This section discusses using DNS Cookies in the DNS Protocol.



5.1 Originating Requests

   A DNS client that implements DNS includes one DNS COOKIE OPT option
   containing a Client Cookie in every DNS request it sends unless DNS
   cookies are disabled.

   If the client has a cached server cookie for the server against its
   IP address it uses the longer cookie form and includes that server
   cookie in the option along with the client cookie (Figure 2)
   otherwise it just sends the shorter form option with a client cookie
   (Figure 1).



5.2 Responding to Request

   The Server Cookie, when it occurs in a COOKIE OPT option in a
   request, is intended to weakly assure the server that the request
   came from a client that is both at the source IP address of the
   request and using the Client Cookie included in the option. This weak
   assurance is provided by the Server Cookie that server would send to
   that client in an earlier response appearing as the Server Cookie
   field in the request.

   At a server where DNS Cookies are not implemented and enabled,
   presence of a COOKIE OPT option is ignored and the server responds as
   before.

   When DNS Cookies are implemented and enabled, there are four
   possibilities: (1) there is no OPT RR at all in the request; (2)
   there is no valid Client Cookie in the request because the COOKIE OPT
   option in absent from the request or one is present but not a legal
   length; (3) there is a valid length cookie option in the request with
   no Server Cookie or an incorrect Server Cookie; or (4) there is a
   cookie option in the request with a correct Server Cookie. The four
   possibilities are discussed in the subsections below.

   In all cases of multiple COOKIE OPT options in a request, only the
   first (the one closest to the DNS header) is considered. All others
   are ignored.






Donald Eastlake & Mark Andrews                                 [Page 11]


INTERNET-DRAFT                                               DNS Cookies


5.2.1 No Opt RR or No COOKIE OPT option

   If there is no OPT record or on COOKIE OPT option present in the
   request then the server responds to the request as if the server
   doesn't understand the COOKIE OPT.



5.2.2 Malformed COOKIE OPT option

   If the COOKIE OPT is too short to contain a Client Cookie then
   FORMERR is generated.  If the COOKIE OPT is longer than that required
   to hold a COOKIE OPT with just a Client Cookie (8) but is shorter
   that the minimum COOKIE OPT with both a Client and Server Cookie (16)
   then FORMERR is generated.  If the COOKIE OPT is longer than the
   maximum valid COOKIE OPT (40) then a FORMERR is generated.

   In summary, valid cookie lengths are 8 and 16 to 40 inclusive.



5.2.3 Only a Client Cookie

   Based on server policy, including rate limiting, the server chooses
   one of the following:

   (1) Silently discard the request.

   (2) Send a BADCOOKIE error response.

   (3) Process the request and provide a normal response. The RCODE is
       zero unless some non-cookie error occurs in processing the
       request.

   If the server responds, choosing 2 or 3 above, it SHALL generate its
   own COOKIE OPT containing both the client cookie copied from the
   request and a server cookie it has generated and adds this COOKIE OPT
   to the response's OPT record. Servers MUST, at least occasionally,
   respond to such requests to inform the client of the correct server
   cookie. This is necessary so that such a client can bootstrap to the
   weakly secure state where requests and responses have recognized
   server cookies and client cookies. If the request was received over
   TCP, the server SHOULD take the weak authentication provided by the
   use of TCP into account, increasing the probability of choice 3








Donald Eastlake & Mark Andrews                                 [Page 12]


INTERNET-DRAFT                                               DNS Cookies


5.2.4 A Client Cookie and Server Cookie

   The server examines the server cookie to determine if it is a valid
   server cookie it has generated.  This examination will result in a
   determination of whether the server cookie is valid or not.  These
   cases are discussed below.



5.2.4.1 A Client Cookie and Invalid Server Cookie

   This can occur due to a stale server Cookie being returned, a
   client's IP address or client cookie changing without the DNS server
   being aware, or an attempt to spoof the client.

   The server SHALL process the query as if the invalid server cookie
   was not present as described in Section 5.2.3.



5.2.4.2 A Client Cookie and Valid Server Cookie

   When this occurs the server can assume that it is talking to a client
   that it has talked to before and defensive measures for spoofed UDP
   queries, if any, are no longer required.

   The server SHALL process the query and include a COOKIE OPT in the
   response by (a) copying the complete COOKIE OPT from the request or
   (b) generating a new COOKIE OPT containing both the client cookie
   copied from the request and a valid server cookie it has generated.



5.3 Processing Responses

   The client cookie, when it occurs in a COOKIE OPT option in a DNS
   reply, is intended to weakly assure the client that the reply came
   from a server at the source IP address use in the response packet
   because the client cookie value is the value that client would send
   to that server in a request. In a DNS reply with multiple COOKIE OPT
   options, all but the first (the one closest to the DNS Header) are
   ignored.

   A DNS client where DNS cookies are implemented and enabled examines
   response for DNS cookies and MUST discard the response if it contains
   an illegal COOKIE OPT option length or an incorrect client cookie
   value. If the COOKIE OPT option client cookie is correct, the client
   caches the server cookie provided even if the response is an error
   response (RCODE non-zero).



Donald Eastlake & Mark Andrews                                 [Page 13]


INTERNET-DRAFT                                               DNS Cookies


   If the reply extended RCDOE is BADCOOKIE, it means that the server
   was unwilling to process the request because it did not have the
   correct server cookie in it. The client should retry the request
   using the new server cookie from the response.

   If the reply extended RCODE is BADCOOKIE and the client cookie
   matches what was sent, it means that the server was unwilling to
   process the request because it did not have the correct server cookie
   in it. The client SHOULD retry the request using the new server
   cookie from the response. Multiple BADCOOKIE responses may be an
   indication that the shared secrets / secret generation method in an
   anycast cluster of servers are not consistent. If the reply to a
   retried query with a fresh server cookie is BADCOOKIE, the client
   SHOULD retry using TCP as the transport since the server will be more
   likely to process the query normally based on the weak security
   provided by TCP.

   If the RCODE is some value other than BADCOOKIE, including zero, the
   further processing of the response proceedes normally.



5.4 Client and Server Secret Rollover

   Clients and servers MUST NOT continue to use the same secret in new
   queries and responses, respectively, for more than 35 days and SHOULD
   NOT continue to do so for more than 25 hours. Many clients rolling
   over their secret at the same time could briefly increase server
   traffic and exactly predictable rollover times for clients or servers
   might facilitate guessing attacks. For example, an attacker might
   increase the priority of attacking secrets they believe will be in
   effect for an extended period of time.  To avoid rollover
   synchronization and predictability, it is RECOMMENDED that
   pseudorandom jitter in the range of plus zero to minus at least 40%
   be applied to the time until a scheduled rollover of a DNS cookie
   secret.

   It is RECOMMENDED that a client keep the client cookie it is
   expecting in a reply associated with the outstanding query to avoid
   rejection of replies due to a bad client cookie right after a change
   in the client secret. It is RECOMMENDED that a server retain its
   previous secret for a period of time not less than 1 second or more
   than 3 minutes, after a change in its secret, and consider queries
   with server cookies based on its previous secret to have a correct
   server cookie during that time.

   Receiving a sudden increased level of requests with bad server
   cookies or replies with bad client cookies would be reason to believe
   a server or client is likely to be under attack and should consider
   more frequent rollover of its secret.


Donald Eastlake & Mark Andrews                                 [Page 14]


INTERNET-DRAFT                                               DNS Cookies


5.5 Implementation Requirement

   DNS clients and servers SHOULD implement DNS cookies to decrease
   their vulnerability to the threats discussed in Section 2.
















































Donald Eastlake & Mark Andrews                                 [Page 15]


INTERNET-DRAFT                                               DNS Cookies


6. NAT Considerations and AnyCast Server Considerations

   In the Classic Internet, DNS Cookies could simply be a pseudo-random
   function of the client IP address and a sever secret or the server IP
   address and a client secret. You would want to compute the Server
   Cookie that way, so a client could cache its Server Cookie for a
   particular server for an indefinitely amount of time and the server
   could easily regenerate and check it. You could consider the Client
   Cookie to be a weak client signature over the server IP address that
   the client checks in replies and you could extend this weak signature
   to cover the request ID, for example, or any other information that
   is returned unchanged in the reply.

   But we have this reality called NAT [RFC3022], Network Address
   Translation (including, for the purposes of this document, NAT-PT,
   Network Address and Protocol Translation, which has been declared
   Historic [RFC4966]).  There is no problem with DNS transactions
   between clients and servers behind a NAT box using local IP
   addresses. Nor is there a problem with NAT translation of internal
   addresses to external addresses or translations between IPv4 and IPv6
   addresses, as long as the address mapping is relatively stable.
   Should the external IP address an internal client is being mapped to
   change occasionally, the disruption is little more than when a client
   rolls-over its DNS COOKIE secret. And normally external access to a
   DNS server behind a NAT box is handled by a fixed mapping which
   forwards externally received DNS requests to a specific host.

   However, NAT devices sometimes also map ports. This can cause
   multiple DNS requests and responses from multiple internal hosts to
   be mapped to a smaller number of external IP addresses, such as one
   address.  Thus there could be many clients behind a NAT box that
   appear to come from the same source IP address to a server outside
   that NAT box.  If one of these were an attacker (think Zombie or
   Botnet), that behind-NAT attacker could get the Server Cookie for
   some server for the outgoing IP address by just making some random
   request to that server. It could then include that Server Cookie in
   the COOKIE OPT of requests to the server with the forged local IP
   address of some other host and/or client behind the NAT box.
   (Attacker possession of this server cookie will not help in forging
   responses to cause cache poisoning as such responses are protected by
   the required Client Cookie.)

   To fix this potential defect, it is necessary to distinguish
   different clients behind a NAT box from the point of view of the
   server. It is for this reason that the Server Cookie is specified as
   a pseudo-random function of both the request source IP address and
   the Client Cookie.  From this inclusion of the Client Cookie in the
   calculation of the Server Cookie, it follows that a stable Client
   Cookie, for any particular server, is needed. If, for example, the
   request ID was included in the calculation of the Client Cookie, it


Donald Eastlake & Mark Andrews                                 [Page 16]


INTERNET-DRAFT                                               DNS Cookies


   would normally change with each request to a particular server.  This
   would mean that each request would have to be sent twice: first to
   learn the new Server Cookie based on this new Client Cookie based on
   the new ID and then again using this new Client Cookie to actually
   get an answer. Thus the input to the Client Cookie computation must
   be limited to the server IP address and one or more things that
   change slowly such as the client secret.

   In principle, there could be a similar problem for servers, not due
   to NAT but due to mechanisms like anycast which may cause queries to
   a DNS server at an IP address to be delivered to any one of several
   machines. (External queries to a DNS server behind a NAT box usually
   occur via port forwarding such that all such queries go to one host.)
   However, it is impossible to solve this the way the similar problem
   was solved for NATed clients; if the Server Cookie was included in
   the calculation of the Client Cookie the same way the Client Cookie
   is included in the Server Cookie, you would just get an almost
   infinite series of errors as a request was repeatedly retried.

   For servers accessed via anycast to successfully support DNS COOKIES,
   the server clones must either all use the same server secret or the
   mechanism that distributes queries to them must cause the queries
   from a particular client to go to a particular server for a
   sufficiently long period of time that extra queries due to changes in
   Server Cookie resulting from accessing different server machines are
   not unduly burdensome.  (When such anycast-accessed servers act as
   recursive servers or otherwise act as clients they normally use a
   different unique address to source their queries to avoid confusion
   in the delivery of responses.)

   For simplicity, it is RECOMMENDED that the same server secret be used
   by each DNS server in a set of anycast servers. If there is limited
   time skew in updating this secret in different anycast servers, this
   can be handled by a server accepting requests containing a Server
   Cookie based on either its old or new secret for the maximum likely
   time period of such time skew (see also Section 5.4).
















Donald Eastlake & Mark Andrews                                 [Page 17]


INTERNET-DRAFT                                               DNS Cookies


7. Deployment

   The DNS cookies mechanism is designed for incremental deployment and
   to complement the orthogonal techniques in [RFC5452]. Either or both
   techniques can be deployed independently at each DNS server and
   client.

   In particular, a DNS server or client that implements the DNS COOKIE
   mechanism can interoperate successfully with a DNS client or server
   that does not implement this mechanism although, of course, in this
   case it will not get the benefit of the mechanism and the server
   involved might choose to severely rate limit responses. When such a
   server or client interoperates with a client or server which also
   implements the DNS cookies mechanism, they get the weak security
   benefits of the DNS Cookies mechanism.





































Donald Eastlake & Mark Andrews                                 [Page 18]


INTERNET-DRAFT                                               DNS Cookies


8. IANA Considerations

   IANA is requested to assign the following two code points:

      A new OPT option value as shown below:

         Value       Name      Status        Reference
        --------    ------    --------    ---------------
        TBD1[10]    COOKIE    Standard    [this document]

      A new DNS error code in the range above 16 and below 3,840 as
      shown below:

         RCODE       Name       Description                 Reference
        --------  ---------  -------------------------   ---------------
        TBD2[23]  BADCOOKIE  Bad/missing server cookie   [this document]




































Donald Eastlake & Mark Andrews                                 [Page 19]


INTERNET-DRAFT                                               DNS Cookies


9. Security Considerations

   DNS Cookies provide a weak form of authentication of DNS requests and
   responses. In particular, they provide no protection against "on-
   path" adversaries; that is, they provide no protection against any
   adversary that can observe the plain text DNS traffic, such as an on-
   path router, bridge, or any device on an on-path shared link (unless
   the DNS traffic in question on that path is encrypted).

   For example, if a host is connected via an unsecured IEEE Std 802.11
   link (Wi-Fi), any device in the vicinity that could receive and
   decode the 802.11 transmissions must be considered "on-path". On the
   other hand, in a similar situation but one where 802.11 Robust
   Security (WPAv2) is appropriately deployed on the Wi-Fi network
   nodes, only the Access Point via which the host is connecting is "on-
   path" as far as the 802.11 link is concerned.

   Despite these limitations, deployment of DNS Cookies on the global
   Internet is expected to provide a substantial reduction in the
   available launch points for the traffic amplification and denial of
   service forgery attacks described in Section 2 above.

   Should stronger message/transaction security be desired, it is
   suggested that TSIG or SIG(0) security be used (see Section 3.2);
   however, it may be useful to use DNS Cookies in conjunction with
   these features. In particular, DNS Cookies could screen out many DNS
   messages before the cryptographic computations of TSIG or SIG(0) are
   required and, if SIG(0) is in use, DNS Cookies could usefully screen
   out many requests given that SIG(0) does not screen requests but only
   authenticates the response of complete transactions.



9.1 Cookie Algorithm Considerations

   The cookie computation algorithm for use in DNS Cookies SHOULD be
   based on a pseudo-random function at least as strong as [FNV] because
   an excessively weak or trivial algorithm could enable adversaries to
   guess cookies.  However, in light of the weak plain-text token
   security provided by DNS Cookies, a strong cryptography hash
   algorithm may not be warranted in many cases, and would cause an
   increased computational burden. Nevertheless there is nothing wrong
   with using something stronger, for example, HMAC-SHA256-64 [RFC6234],
   assuming a DNS processor has adequate computational resources
   available. DNS processors that feel the need for somewhat stronger
   security without a significant increase in computational load should
   consider more frequent changes in their client and/or server secret;
   however, this does require more frequent generation of a
   cryptographically strong random number [RFC4086]. See Appendices A
   and B for specific examples of cookie computation algorithms.


Donald Eastlake & Mark Andrews                                 [Page 20]


INTERNET-DRAFT                                               DNS Cookies


10. Implementation Considerations

   The DNS Cookie Option specified herein is implemented in BIND 9.10
   using a experimental option code.
















































Donald Eastlake & Mark Andrews                                 [Page 21]


INTERNET-DRAFT                                               DNS Cookies


Normative References

   [RFC2119] - Bradner, S., "Key words for use in RFCs to Indicate
         Requirement Levels", BCP 14, RFC 2119, March 1997.

   [RFC4086] - Eastlake 3rd, D., Schiller, J., and S. Crocker,
         "Randomness Requirements for Security", BCP 106, RFC 4086, June
         2005.

   [RFC6891] - Damas, J., Graff, M., and P. Vixie, "Extension Mechanisms
         for DNS (EDNS(0))", STD 75, RFC 6891, April 2013.



Informative References

   [FNV] - G. Fowler, L. C. Noll, K.-P. Vo, D. Eastlake, "The FNV Non-
         Cryptographic Hash Algorithm", draft-eastlake-fnv, work in
         progress.

   [RFC2845] - Vixie, P., Gudmundsson, O., Eastlake 3rd, D., and B.
         Wellington, "Secret Key Transaction Authentication for DNS
         (TSIG)", RFC 2845, May 2000.

   [RFC2930] - Eastlake 3rd, D., "Secret Key Establishment for DNS (TKEY
         RR)", RFC 2930, September 2000.

   [RFC2931] - Eastlake 3rd, D., "DNS Request and Transaction Signatures
         ( SIG(0)s )", RFC 2931, September 2000.

   [RFC3022] - Srisuresh, P. and K. Egevang, "Traditional IP Network
         Address Translator (Traditional NAT)", RFC 3022, January 2001.

   [RFC4033] - Arends, R., Austein, R., Larson, M., Massey, D., and S.
         Rose, "DNS Security Introduction and Requirements", RFC 4033,
         March 2005.

   [RFC4034] - Arends, R., Austein, R., Larson, M., Massey, D., and S.
         Rose, "Resource Records for the DNS Security Extensions", RFC
         4034, March 2005.

   [RFC4035] - Arends, R., Austein, R., Larson, M., Massey, D., and S.
         Rose, "Protocol Modifications for the DNS Security Extensions",
         RFC 4035, March 2005.

   [RFC4966] - Aoun, C. and E. Davies, "Reasons to Move the Network
         Address Translator - Protocol Translator (NAT-PT) to Historic
         Status", RFC 4966, July 2007.

   [RFC5452] - Hubert, A. and R. van Mook, "Measures for Making DNS More


Donald Eastlake & Mark Andrews                                 [Page 22]


INTERNET-DRAFT                                               DNS Cookies


         Resilient against Forged Answers", RFC 5452, January 2009.

   [RFC6234] - Eastlake 3rd, D. and T. Hansen, "US Secure Hash
         Algorithms (SHA and SHA-based HMAC and HKDF)", RFC 6234, May
         2011.















































Donald Eastlake & Mark Andrews                                 [Page 23]


INTERNET-DRAFT                                               DNS Cookies


Acknowledgements

   The contributions of the following are gratefully acknowledged:

      Tim Wicinski

   The document was prepared in raw nroff. All macros used were defined
   within the source file.












































Donald Eastlake & Mark Andrews                                 [Page 24]


INTERNET-DRAFT                                               DNS Cookies


Appendix A: Example Client Cookie Algorithms



A.1 A Simple Algorithm

   An simple example method to compute Client Cookies is the FNV-64
   [FNV] of the server IP address and the client secret. That is

      Client Cookie = FNV-64 ( Client Secret | Server IP Address )

   where "|" indicates concatenation.



A.2 A More Complex Algorithm

   A more complex algorithm to calculate Client Cookies is give below.
   It uses more computational resources than the simpler algorithm shown
   in A.1.

      Client Cookie = HMAC-SHA256-64 ( Client Secret,
                                       Server IP Address )





























Donald Eastlake & Mark Andrews                                 [Page 25]


INTERNET-DRAFT                                               DNS Cookies


Appendix B: Example Server Cookie Algorithms



B.1 A Simple Algorithm

   An example simple method producing a 64-bit Server Cookie is the
   FNV-64 [FNV] of the request IP address, the Client Cookie, and the
   server secret. That is

      Server Cookie =
         FNV-64 ( Server Secret | Request IP Address | Client Cookie )

   where "|" represents concatenation.



B.2 A More Complex Algorithm

   Since the Server Cookie is variable size, the server can store
   various information in that field as long as it is hard for an
   adversary to guess the entire quantity used for weak authentication.
   There should be 64 bits of entropy in the Server Cookie; for example
   it could have a sub-field of 64-bits computed pseudo-randomly with
   the server secret as one of the inputs to the pseudo-random function.
   Types of additional information that could be stored include a time
   stamp and/or a nonce.

   The example below is one variation for the Server Cookie that has
   been implemented in a beta release of BIND where the Server Cookie is
   128 bits composed as follows:

         Sub-field      Size
         ---------   ---------
           Nonce      32 bits
           Time       32 bits
           Hash       64 bits

   With this algorithm, the server sends a new 128-bit cookie back with
   every request. The Nonce field assures a low probability that there
   would be a duplicate.

   The Time field gives the server time and makes it easy to reject old
   cookies.

   The Hash part of the Server Cookie is the hard-to-guess part. In the
   beta release of BIND, its computation can be configured to use AES,
   HMAC-SHA1, or, as shown below, HMAC-SHA256:




Donald Eastlake & Mark Andrews                                 [Page 26]


INTERNET-DRAFT                                               DNS Cookies


      hash =
          HMAC-SHA256-64 ( Server Secret,
              (Client Cookie | nonce | time | client IP Address) )

   where "|" represents concatenation.















































Donald Eastlake & Mark Andrews                                 [Page 27]


INTERNET-DRAFT                                               DNS Cookies


Author's Address

   Donald E. Eastlake 3rd
   Huawei Technologies
   155 Beaver Street
   Milford, MA 01757 USA

   Telephone:   +1-508-333-2270
   EMail:       d3e3e3@gmail.com


   Mark Andrews
   Internet Systems Consortium
   950 Charter Street
   Redwood City, CA  94063 USA

   Email: marka@isc.org



Copyright, Disclaimer, and Additional IPR Provisions

   Copyright (c) 2015 IETF Trust and the persons identified as the
   document authors. All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of
   publication of this document. Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document. Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.


















Donald Eastlake & Mark Andrews                                 [Page 28]


Html markup produced by rfcmarkup 1.129b, available from https://tools.ietf.org/tools/rfcmarkup/