INTERNET-DRAFT DonaldE.Eastlake3rdIntended Status: Proposed StandardMotorola LaboratoriesHuawei Expires:August 2008 February 25, 2008July 21, 2014 January 22, 2014 Domain Name System (DNS) Cookies<draft-eastlake-dnsext-cookies-03.txt> Status<draft-eastlake-dnsext-cookies-04.txt> Abstract DNS cookies are a lightweight DNS transaction security mechanism designed for incremental deployment. They provide limited protection to DNS servers and resolvers against a variety ofThis Document By submitting this Internet-Draft, each author represents that any applicable patentincreasingly common denial-of-service and amplification/forgery orother IPR claimscache poisoning attacks by off-path attackers. DNS Cookies are tolerant ofwhich he or she is aware have been or will be disclosed,NAT, NAT- PT, andanyanycast. Status ofwhich he or she becomes aware will be disclosed,This Document This Internet-Draft is submitted to IETF inaccordancefull conformance withSection 6the provisions of BCP 78 and BCP 79.This draft is intended to be become a Proposed Standard RFC.Distribution of this document is unlimited. Comments should be sent to the author or the DNSEXTworking groupmailing list<namedroppers@ops.ietf.org>.<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 athttp://www.ietf.org/1id-abstracts.htmlhttp://www.ietf.org/1id-abstracts.html. The list of Internet-Draft Shadow Directories can be accessed athttp://www.ietf.org/shadow.html Abstract DNS cookies are a light-weight DNS transaction security mechanism designed for incremental deployment. They provide limited protection to DNS servers and resolvers against a variety of increasingly common denial-of-service and cache poisoning or forgery attacks by off-path attackers. DNS Cookies are tolerant of NAT, NAT-PT, and Anycast.http://www.ietf.org/shadow.html. INTERNET-DRAFT DNS Cookies Table of ContentsStatus of This Document....................................1 Abstract...................................................1 Table of Contents..........................................21. Introduction............................................3 1.1 Contents of This Document..............................3 1.2 Definitions............................................4 2. Threats Considered......................................5 2.1 Denial-of-Service Attacks..............................5 2.1.1 DNS Amplification Attacks............................5 2.1.2 DNS Server Denial-of-Service.........................52.1.2 Selected Host Denial-of-Service......................52.2 Cache Poisoning and Answer Forgery Attacks.............6 3. Comments on Existing DNSSecurity.......................6Security.......................7 3.1 Existing DNS DataSecurity.............................6Security.............................7 3.2 DNSMessage or Transaction Security....................7Message/Transaction Security.......................7 3.3 Conclusions on Existing DNS Security...................7 4. The COOKIE OPToption...................................8Option...................................8 4.1 ResolverCookies.......................................8Cookie........................................8 4.2 ServerCookies.........................................9Cookie..........................................9 4.3 Error Code.............................................9 5. DNS Cookies Protocol Description.......................11 5.1 Originating Requests..................................11 5.2 Responding to Requests................................11 5.3 Processing Responses..................................11 6. DNS Cookie Policies andImplementation Requirements.....9 5.1Implementation.................13 6.1 Resolver Policies andImplementation..................10 5.2Implementation..................13 6.2 Server Policies andImplementation....................11 5.3Implementation....................14 6.3 Resolver and Server Secret Rollover...................15 6.4 ImplementationRequirements...........................11 6.Requirement............................15 7. NAT Considerations and AnyCast ServerConsiderations...12 7. Incremental Deployment.................................14Considerations...17 8.IANA Considerations....................................15Deployment.............................................19 9.Security Considerations................................15IANA Considerations....................................20 10. Security Considerations...............................21 10.1 Cookie Algorithm Considerations......................21 Acknowledgements..........................................22 NormativeReferences..................................16 11.References......................................23 InformativeReferences................................16References....................................23 Author'sAddress..........................................18 Copyright and Disclaimer..................................18 Additional IPR Provisions.................................18 Expiration and File Name..................................19Address..........................................25 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 hasexplodedgrown exponentially to a global information utility, the DNS has increasingly been subject toabuse and been used as a vector forabuse. This document describes DNS cookies, alight-weightlightweight DNS transaction security mechanism specified as an OPT[RFC2671][RFC6891] option. This mechanism provides limited protection to DNS servers and resolvers against a variety of increasingly commondenial-of-service and cache poisoning forgery attacksabuses by off-path attackers. The DNS cookies mechanismis designed withhas a default modewhichthat supports incremental deployment. If only one party to a DNS transaction supports the mechanism, it does notinterfere orprovide abenefit,benefit or significantly interfere, but, if both support it, the additional security provided is automaticallyavailable for that and subsequent transactions.available. The DNS cookies mechanism is compatible with and can be used in conjunction with other DNS transaction forgery resistance measures such as those in[forgery].[RFC5452]. 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 and Section 5 provides a protocol description includingrecommendationssuggestions for calculating Resolver and Server Cookies. Section5 describes6 gives further details on the processing of COOKIE OPT options by resolvers and server and policies for such processing. Section67 discusses some NAT and anycast related DNS Cookies design considerations. Section78 discusses incremental deployment considerations. INTERNET-DRAFT DNS Cookies Sections8 and9 and 10 describe IANA and Security Considerations.INTERNET-DRAFT DNS Cookies1.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 resolver and server, is defined as an attackerwhichwho cannot observe thelegitimateplain text of DNS requests and responses between that resolver 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 appropriatedebuggingnetwork management facilities be included in implementations, such as a counter of the occurrences of each type of such events. The term "IP address" is used herein in a length independent manner and refers toaddress formats includingboth IPv4 and IPv6. INTERNET-DRAFT DNS Cookies 2. Threats Considered DNS cookies are intended to provide significant but limited protection against certaindenial-of-service and cache poisoning or answer forgeryattacks by off-path attackers as described below. These attacks include denial-of-service, cache poisoning and answer forgery. 2.1 Denial-of-Service Attacks Thecanonicaltypical 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 orasome 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 reduced rather than amplified. DNS cookies make it more effective to implement a rate limiting scheme for bad DNS cookie 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 serverswhichthat may issue one or more requests and process the responsestheretothereto, in order to determine their response to the initialquery.request. And the situationiscan be even worse for recursive servers implementing DNSSEC[RFC4033], [RFC4034], [RFC4035]([RFC4033] [RFC4034] [RFC4035]) because they may be induced to perform burdensome public key cryptographic computations in attempts to verify the authenticity of data they retrievewhilein trying to answer INTERNET-DRAFT DNS Cookies the 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 attackto beharder to find and +administrativerestriction of the IP addresses from which such requests should be honoredharderhard or impossible tospecify.specify or verify. Use of DNS cookiesalmost alwaysshould enables a server to reject forged queries from an off path attacker with relativeease, certainlyease and before any recursive queries or public key cryptographic operations are performed.2.1.2 Selected Host Denial-of-Service 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 INTERNET-DRAFT DNS Cookies 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 a DNS server can be used as not only a way to obscure the true source of an attack but as a traffic amplifier to make the attack more effective. Use of the DNS Cookies mechanism severely limits the traffic amplification that can be 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 a brief error response to be sent to a forged IP address. Furthermore, DNS cookies make it more effective to implement a rate limiting scheme for bad DNS cookie error responses from the server. Such a scheme would further restrict selected host denial-of-service traffic from that server.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 forwell connectedwell-connected hosts are such that, by forging replies from the IP addresses of heavily used DNS servers for popular names to a heavily used resolver, 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 thatresolver.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. INTERNET-DRAFT DNS Cookies 3. Comments on Existing DNS Security Two forms of security have been added to DNS, data security andmessage or transactionmessage/transaction security. 3.1 Existing DNS Data Security DNS data security is one part of DNSSEC and is described in [RFC4033], [RFC4034], and[RFC4035].[RFC4035] and updates thereto. It provides data origin authentication and authenticated denial of existence.ItDNSSEC is being deployedslowly and, in any case,and canmakeprovide strong protection against forged data; however, it has the unintended effect of making some denial-of-service attacks worse because of thehighcryptographic computational load it can require and the increased size in DNS packets that it tends to produce.INTERNET-DRAFT DNS Cookies3.2 DNSMessage or TransactionMessage/Transaction Security The second form of securitywhichthat has been added to DNS provides "transaction" security through TSIG [RFC2845] or SIG(0) [RFC2931]. TSIG could providenear perfectstrong protection against the attacks for which the DNS Cookies mechanism provide weakand incompleteprotection; however, TSIG ishardnon-trivial to deploy in the general Internet because of the burden it imposes of pre-agreement and key distribution betweenpairsresolver- server pairs, the burden ofresolvers and serversserver side key state, and because it requires time synchronization between resolver 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 ofDNSSEC.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 ofDNSSECDNS data security and requires computationally burdensome public key cryptographic operations. 3.3 Conclusions on Existing DNS SecurityThus, none of the previous forms ofThe existing DNS securityare a suitable substitute formechanisms do not provide the services provided by the DNS Cookiesmechanism, which provide light weightmechanism: lightweight message authentication of DNS requests and responses with no requirement forpre-configuration.pre-configuration or server side state. INTERNET-DRAFT DNS Cookies 4. The COOKIE OPToptionOption COOKIE is an OPT RR[RFC2671][RFC6891] option that can be included no more than once in the RDATA portion of an OPT RR in DNS requests and responses. The option is encoded into 22 bytes as shown below. 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | OPTION-CODE = {TBD} | OPTION-LENGTH = 18 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +- Resolver Cookie -+ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |+--+- Server Cookie -+ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Error Code | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ The 64-bit Resolver and Server Cookies are stored innetwork bytelittle endian order and are determined as described below.The Error Code field MUST be zero in requests and in responses unless the response is communicating a DNS cookie error. Three values are specified in this document for Error Code: NOCOOKIE and BADCOOKIE which occur with a Refused RCODE in the DNS response header, and MANYCOOKIE which occurs with a FormErr RCODE in the DNS header. More information on the generation of error responses appears in Section 5 below.4.1 ResolverCookies The Resolver Cookie, when it occurs in an OPT in a DNS response, is intended to weakly assure the resolver that the response came from a server at the indicated source IP address. Servers remember the ResolverCookiethat appears in a query long enough to use it in the construction of the COOKIE OPT option in the corresponding response if such a COOKIE OPT option is included in that response.The Resolver Cookie SHOULD be a pseudo-random function of the server IP address and a secret quantity known only to the resolver. ThisINTERNET-DRAFT DNS Cookiesresolver secret SHOULD have at least 64 bits of entropy[RFC4086][RFC4086bis] andMAYbe changedperiodically.periodically (see Section 6.3). TheRECOMMENDEDselection of the pseudo-random function is a private matter to the resolver as only the resolver needs to recognize its own DNS cookies. An example method is theHMAC-SHA1-64 [RFC1321] [RFC2104]FNV-64 [FNV] of the server IP address and the resolver secret. That is Resolver Cookie =Truncate-64 ( HMAC-SHA1FNV-64 (Server IP Address,Resolver Secret)| Server IP Address ) whereTruncate-64 takes the first 64 bits."|" indicates concatenation. A resolver MUST NOT use the same Resolver Cookie value for queries to all servers.4.2 Server Cookies The Server Cookie, when it occurs in a COOKIE OPT option in a query, is intended to weakly assure the server that the query legitimately came from a resolver at the indicated source IP address that is using that Resolver Cookie. Resolvers learn ServerINTERNET-DRAFT DNS Cookiesand retain them as soft state associated with the server IP address. They learn them from the4.2 Server Cookiethat appears in the COOKIE OPT option of a reply if that reply has the correct Resolver Cookie, even if that reply is an error message.The Server Cookie SHOULD be a pseudo-random function of the request source IP address, the request Resolver Cookie, and a secret quantity known only to the server. (See Section 7 for a discussion of why the Resolver Cookie is used as input to the Server Cookie but the Server Cookie is not used as an input to the Resolver Cookie.) This server secret SHOULD have 64 bits of entropy[RFC4086][RFC4086bis] andSHOULDbe changed periodicallysuch as daily.(see Section 6.3). TheRECOMMENDEDselection of the pseudo-random function is a private matter to the server as only the server needs to recognize its own DNS cookies. An example method is theHMAC-SHA1-64 [RFC1321], [RFC2104]FNV-64 [FNV] of the request IP address, the Resolver Cookie, and the server secret. That is Server Cookie =Truncate-64 ( HMAC-SHA1FNV-64 ((RequestServer Secret | Request IP Address | ResolverCookie), Server Secret )Cookie ) whereTruncate-64 takes the first 64 bits and"|" represents concatenation. A server MUST NOT use the same Server Cookie value for responses to all resolvers. 4.3 Error Code The Error Code field MUST have one of the values listed below. Requests have a COOKIE OPT Error Code equal to one of the following two values: Zero, if the resolver believes the Server Cookie field is correct, or CKPING (Cookie PING), if the resolver does not know the correct value for the Server Cookie field. (In all cases, the RCODE in a DNS request header is zero.) Replies have a COOKIE OPT with an Error Code equal to one of the following five values: Zero, if the request they respond to had one COOKIE OPT with a correct Server Cookie. NOCOOKIE, in which case the DNS reply header RCODE field is Refused. BADCOOKIE, in which case the DNS reply header RCODE field is Refused. INTERNET-DRAFT DNS Cookies MANYCOOKIE, in which case the DNS reply header RCODE field is FormErr. CKPINGR (Cookie PING Response), which case the DNS reply RCODE field might be any value (see Section 5.2). For more information on errors in replies see Section 6. For further discussion of the Resolver Cookie field, see Section 5.1. For further discussion of the Server Cookie field see Section 5.2. INTERNET-DRAFT DNS Cookies 5. DNS Cookies Protocol Description The sections provide a general discussion of using DNS Cookies in the DNS Protocol. More details are provided in Section 6. 5.1 Originating Requests A DNS resolver that implements DNS cookies includes a DNS Cookie option in every DNS request it sends unless DNS cookies are disabled in that resolver. The DNS Cookie in a request includes a Resolver Cookie as discussed in Section 4.1, a Server Cookie cached as soft state associated with that server IP address from a previous DNS response, and a zero Error Code field. If the resolver has no cached Server Cookie for the server, then it sets the Server Cookie field to any value and sets the Error Code field to CKPING (Cookie Ping); this is the only case in which the Error Code field in a COOKIE OPT in a request is non-zero. 5.2 Responding to Requests 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 resolver at the source IP address used because the Server Cookie value is the value that server would send to that resolver in a response. A DNS server that implements DNS cookies and for which DNS cookies are not disabled always includes a DNS cookie in the response to a DNS request that includes such a cookie. If the request did not include a DNS cookie, inclusion of a DNS cookies in the response depends on the server mode for that resolved (see Section 6.2). In the DNS Cookie that the server includes, the Resolver Cookie field is copied from that field in the request. If there was no cookie in the request, it may be set to any value. The Server Cookie field is set as discussed in Section 4.2 and the Error Code field is set as specified in Section 6. 5.3 Processing Responses The Resolver Cookie, when it occurs in a COOKIE OPT option in a DNS reply, is intended to weakly assure the resolver that the reply came from a server at the source IP address use in the response packet because the Resolver Cookie value is the value that resolver would INTERNET-DRAFT DNS Cookies send to that server in a request. A DNS resolver that implements DNS cookies and for which DNS cookies are not disabled examines response for DNS cookies and will discard the response if it contains an incorrect Resolver Cookie or has multiple cookies. If the COOKIE OPT option Resolver Cookie is correct and the Error Code field is not NOCOOKIE, MANYCOOKIES, it caches the Server Cookie provided even if the response is an error response. The rest of the response is then processed normally. INTERNET-DRAFT DNS Cookies 6. DNS Cookie Policies and ImplementationRequirementsObviously, DNS resolvers that do not implement DNS cookies do not include them in requests and ignore them in replies and DNS servers that do not implement DNS cookies ignore them in requests and do not include the in replies. DNS resolvers and servers that implement DNS cookies will adopt one of various policies regarding cookies. These policies SHOULD be logically settable on a per server IP address basisforin resolvers and on a per resolver ( IPINTERNET-DRAFT DNS Cookiesaddress, Resolver Cookie ) pairforin servers. Thus a resolver can have different policies for different servers, based on the server IP address. And a server can have different policies for different resolvers, based on the resolver IP address and Resolver Cookie. Of course, the actual implementation ofsettingthe configuration of these policies may be for blocks or classes of values or use sparse array techniques or the like. The policyforin eachvaluecase is either "Disabled", "Enabled", or "Enforced" as described below.5.16.1 Resolver Policies and Implementation A resolver will logically have one of the following three modes of operation or "policies" for each DNS server as distinguished by server IP Address. Disabled: Never include a COOKIE OPT option in requests. Ignore COOKIE OPT options inresponses.replies. Enabled: Always include a COOKIE OPT option in requests. If a cached Server Cookie for the server is not available, the Server Cookie field can be set to anyvalue.value and the COOKIE OPT Error Code field is set to CKPING (Cookie Ping); otherwise, the Error Code field is set to zero. Normally processresponsesreplies without a COOKIE OPT option. Silently ignoreresponsesreplies with more than one COOKIE OPT option. Silently ignoreresponsesreplies with one COOKIE OPT option if it has an incorrect Resolver Cookie value. On receipt of aresponsereply with one COOKIE OPT option carrying the correct Resolver Cookie value (even if it is aBADCOOKIEDNS error response), the DNS client performs normal response processing, including caching the received ServerCookie,Cookie as soft state, and it MUST change to the Enforced policy for DNS requests to that DNS server IP address. This policy changeSHOULD beto Enforced is treated as soft state with the sametimeoutretention strategy as the INTERNET-DRAFT DNS Cookies Server Cookie value for that server. Ontimeoutdiscard of that state information, the policy for that DNS server IP address reverts to Enabled. Enforced: Always include a COOKIE OPT option in requests. Silently ignore allresponsesreplies that do not include exactly one COOKIE OPT option having the correct Resolver Cookie value.INTERNET-DRAFTOn receipt of a reply with one COOKIE OPT option carrying the correct Resolver Cookie value (even if it is a DNSCookies 5.2error response), the DNS client performs normal response processing, including caching the received Server Cookie. If a copy of the same Server Cookie value is already cached for that server, then its retention probability should be increased. For example, if a time out is being used for the discard to cached Server Cookies, that time out should be extended. 6.2 Server Policies and Implementation A server will logically have one of the following three modes of operation or "policies" for each DNS resolver asdistinguished by resolver IP Address and Resolver Cookie.discussed below. Disabled: Ignore COOKIE OPT options in requests. Never include a COOKIE OPT option inresponses.replies. Enabled:Always includeInclude a COOKIE OPT option inresponses.replies to requests that include a COOKIE OPT. Normally process requests without a COOKIE OPToption.option except that it is RECOMMENDED that the processing of burdensome requests and requests producing replies substantially longer than the request be significantly rate limited. Ignore, other than sending aMANYCOOKIEFormErr/MANYCOOKIE errorresponse,reply, any request with more than one COOKIE OPT option. Such replies MAY be rate limited and SHOULD be as short as practical. Ignore, other than sending a BADCOOKIE errorresponse,reply, anyqueryrequest with one COOKIE OPT option if it has an incorrect ServerCookie.Cookie unless the request COOKIE has an Error Code of CKPING (Cookie Ping) in which case the response has an Error Code of CKPINGR (Cookie Ping Response). Such replies MAY be rate limited and SHOULD be as short as practical. On receipt of a request withaone COOKIE OPT option carrying the correct Server Cookievalue,value and an Error Code of zero, the DNS server performs normal request processing and it SHOULD switch to the Enforced policy for DNS requests from that resolver IP address with that Resolver Cookie in the request. This policy changefor that resolver SHOULD beto Enforced is treated as soft state. Ontiming outdiscard of that INTERNET-DRAFT DNS Cookies state information, the policy for that resolver IP and Resolver Cookie pair reverts to Enabled. Enforced: Always include a COOKIE OPT option inresponses.replies. Ignore requests without a COOKIE OPT option or with more than one COOKIE OPT option, other than returning a NOCOOKIE or MANYCOOKIE DNS error respectively. Such replies MAY be rate limited to any particular IP address and SHOULD be as short as practical. Ignore requests with one COOKIE OPT option if they have an incorrect Server Cookie, other than returning a BADCOOKIE errormessage.message, unless the request has an Error Code of CKPING in which case the response has an Error Code of CKPINGR. Such replies MAY be rate limited and SHOULD be as short as practical. If a request has one COOKIE OPT option with a correct ServerCookie,Cookie and an Error Code of zero, perform normal processing of the request.5.36.3 Resolver and Server Secret Rollover Resolvers and servers MUST NOT continue to use the same secret in new queries and responses, respectively, for more than 14 days and SHOULD NOT continue to do so for more than 1 day. It is RECOMMENDED that a resolver keep the Resolver Cookie it is expecting in a reply associated with the outstanding query to avoid rejection of replies due to a bad Resolver Cookie right after a change in the Resolver 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 suddenly increased level of requests with bad Server Cookies or replies with bad Resolver Cookies would be a good reason to believe a server or resolver likely to be under attack and should consider more frequent rollover of its secret. 6.4 ImplementationRequirementsRequirement DNS resolvers and servers SHOULD implement DNS cookies. DNS resolvers SHOULD operate in and be shipped so as to default to the Enabled or Enforced mode for all servers. INTERNET-DRAFT DNS Cookies DNS servers SHOULD operate in and be shipped so as to default to the Enabled or Enforced mode for all resolvers they are willing to service. INTERNET-DRAFT DNS Cookies6.7. NAT Considerations and AnyCast Server Considerations In the Classic Internet, DNS Cookies could simply be a pseudo-random function of the resolver IP address and a sever secret or the server IP address and a resolver secret. You would want to compute the Server Cookie that way, so a resolver 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 Resolver Cookie to be a weak resolver signature over the server IP addresswhichthat the resolver checks inresponsesreplies and you could extend this weak signature to cover the request ID, forexample.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 [RFC2766],NAT-PT, Network Address and Protocol Translation, which has been declared Historic [RFC4966]). There is no problem with DNS transactions between resolvers 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 resolver being mapped toa particular external IP addresschange occasionally, the disruption isnolittle more than when a resolver 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 besimultaneouslymapped to a smaller number of external IP addresses,frequently one. Theresuch as one address. Thus there could be many resolvers 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 COOKIERROPT of requests to the server with the forged local IP address of some other host and/or resolver 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 Resolver Cookie.) To fix this potential defect, it is necessary to distinguish different resolvers 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 Resolver Cookie. From this inclusion of the Resolver Cookie in the calculation of the Server Cookie, it follows that a stable Resolver Cookie, for any particular server, is needed. If, for example, the request ID was included in the calculation of the INTERNET-DRAFT DNS Cookies Resolver Cookie, it would normally change with eachqueryrequest to a particular server. This would mean that eachqueryrequest would have to be sent twice: first to learn the new Server Cookie based on this new Resolver Cookie based on the new ID and then again using this new Resolver Cookie to actually get an answer. Thus the input to the Resolver Cookie computation must be limited to the server IP address and one or more things that change slowly such as the resolver secret. In principle, there could be a similar problem for servers, notparticularlydue 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 resolvers; if the Server Cookie was included in the calculation of the Resolver Cookie the same way the Resolver Cookie is included in the Server Cookie, you would just get an almost infinite series ofBADCOOKIEerrors as aqueryrequest 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 resolver 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(When such anycast accessed servers act as recursive servers or otherwise act as resolvers they normally use a different unique address to source their queriesandto avoid confusion in the delivery ofresponses.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 6.3). INTERNET-DRAFT DNS Cookies7. Incremental8. Deployment The DNS cookies mechanism is designed for incremental deployment and to complement the orthogonal techniques in[forgery].[RFC5452]. Either or both techniques can be deployed independently at each DNS server and resolver. In particular, a DNS server or resolver that implements the DNScookiesCOOKIE mechanism and is in the Enabled mode will interoperate successfully with a DNS resolver or server that does not implement this mechanism although, of course, in this case it will not get the benefit of the mechanism. When such a server or resolver interoperates with a resolver or server which also implements the DNS cookiesmechanism,mechanism and is in Enabled or Enforced mode, this is recognized and, for that transaction partner, itenterslatches up into the Enforced mode and gets the full benefit of the DNS cookies mechanism until this soft statetimes outlapses and it reverts toEnabled.Enabled mode. INTERNET-DRAFT DNS Cookies8.9. IANA Considerations IANA willallocateassign the following code points: The OPT option value for COOKIE is <TBD>. Three newRCODESDNS error codes are assigned values in the range above 15 and below 3841 as listed below: NOCOOKIE is assigned the value({TBD}, 23TBD (23 suggested). BADCOOKIE is assigned the value({TBD}, 24TBD (24 suggested). MANYCOOKIE is assigned the value({TBD}, 25TBD (25 suggested).9.Two new DNS error codes are assigned in the range above 4095 and below 65535: CKPING (Cookie PING) is assigned the value TBD (4096 suggested). CKPINGR (Cookie PING Response) is assigned the value RBD (4097 suggested). INTERNET-DRAFT DNS Cookies 10. Security Considerations DNS Cookies provide a weak form of authentication of DNS requests and responses. In particular, they provide no protection at all against "on-path" adversaries; that is, they provide no protection against any adversarywhichthat 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 isappropriatelyencrypted). For example, if a host is connected via an unsecured IEEE 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". Despite these limitations, use 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.The recommended cryptographic algorithms forShould 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 useinDNS Cookiesis HMAC-SHA1-64, that is, the HMAC scheme [RFC2104] using the SHA1 hash function [RFC3174] [RFC4634]in conjunction with these features. In particular, DNS Cookies could screen out many DNS messages before theHMAC output truncated to 64-bits. MD5cryptographic computations of TSIG or SIG(0) are required and, if SIG(0) isnow considered to be susceptible to collisions attacks. Although thisin use, DNS Cookies could usefully screen out many requests given that SIG(0) does noteffectscreen requests but only authenticates thesecurityresponse ofHMAC-MD5, HMAC-SHA1 is believed tocomplete transactions. 10.1 Cookie Algorithm Considerations The cookie computation algorithm for use in DNS Cookies SHOULD bestronger. InFNV-64 [FNV] or some stronger algorithm 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,strongera strong cryptography hash algorithm is probably not warrantedandin manycases itcases, and wouldbe acceptable to use the weaker MD5 hash function [RFC1321]. However,cause an increased computational burden. Nevertheless there is nothing wrong with using something stronger, for example, HMAC-SHA256-64[RFC4634],[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 moreINTERNET-DRAFT DNS Cookiesfrequent changes in their resolver and/or server secret; however, this does require more frequent generation of a cryptographically strong random number[RFC4086] and a change in a server secret will result in a number[RFC4086bis]. INTERNET-DRAFT DNS Cookies Acknowledgements The contributions ofinitial BADCOOKIE rejected requests from resolvers caching their old Server Cookie. 10.the following are gratefully acknowledged: Tim Wicinski INTERNET-DRAFT DNS Cookies Normative References[RFC1321][FNV] -Rivest, R.,G. Fowler, L. C. Noll, K.-P. Vo, D. Eastlake, "TheMD5 Message-DigestFNV Non- Cryptographic Hash Algorithm",RFC 1321, April 1992. [RFC2104] - Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- Hashing for Message Authentication", RFC 2104, February 1997.draft-eastlake-fnv, work in progress. [RFC2119] - Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.[RFC2671][RFC6891] - Damas, J., Graff, M., and P. Vixie,P.,"Extension Mechanisms for DNS(EDNS0)", August 1999. [RFC4086](EDNS(0))", STD 75, RFC 6891, April 2013. [RFC4086bis] - Eastlake, D., 3rd, Schiller, J., and S. Crocker, "Randomness Requirements for Security",BCP 106, RFC 4086, June 2005. 11. Informative References [forgery] - "Measures for making DNS more resilient against forged answers", Hubert, A. , R. van Mook, draft-ietf-dnsext-forgery- resilience-01.txt,draft-eastlake- randomness3, work inprogress, July 2007. [RFC2766] - Tsirtsis, G., P. Srisuresh, "Network Address Translation - Protocol Translation (NAT-PT)", February 2000.progress. Informative References [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.[RFC3174] - Eastlake 3rd, D. and P. Jones, "US Secure Hash Algorithm INTERNET-DRAFT DNS Cookies 1 (SHA1)", RFC 3174, September 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.[RFC4634] - Eastlake, D. and T. Hansen, "US Secure Hash Algorithms (SHA)", RFC 4634, July 2006.[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 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. INTERNET-DRAFT DNS Cookies Author's Address Donald E. Eastlake 3rdMotorola Laboratories 111 Locke Drive Marlborough,Huawei Technologies 155 Beaver Street Milford, MA0175201757 USA Telephone:+1-508-786-7554 (w)+1-508-333-2270 EMail:Donald.Eastlake@motorola.com Copyrightd3e3e3@gmail.com Copyright, Disclaimer, andDisclaimerAdditional IPR Provisions Copyright(C) The(c) 2014 IETF Trust(2008).and the persons identified as the document authors. All rights reserved. This document is subject tothe rights, licenses and restrictions contained inBCP78, and except as set forth therein, the authors retain all their rights. This document78 and theinformation contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THEIETFTRUST AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Additional IPRTrust's Legal ProvisionsTheRelating to IETFtakes no position regardingDocuments (http://trustee.ietf.org/license-info) in effect on thevalidity or scopedate ofany Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or usepublication ofthe technology described inthisdocument or the extent to which any license under suchdocument. Please review these documents carefully, as they describe your rightsmight or might not be available; nor does it represent that it has made any independent effort to identify any such rights. Information on the proceduresand restrictions with respect torights in RFC documents can be found in BCP 78 and BCP 79. Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users ofthisspecification can be obtaineddocument. Code Components extracted fromthe IETF on-line IPR repository at http://www.ietf.org/ipr. INTERNET-DRAFT DNS Cookies The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implementthisstandard. Please address the information todocument must include Simplified BSD License text as described in Section 4.e of theIETF at ietf- ipr@ietf.org. ExpirationTrust Legal Provisions andFile Name This draft expiresare provided without warranty as described inAugust 2008. Its file name is draft-eastlake-dnsext-cookies-03.txtthe Simplified BSD License.