idnits 2.17.1 draft-eastlake-dnsext-cookies-05.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (October 11, 2014) is 3484 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '23' on line 711 -- Looks like a reference, but probably isn't: '24' on line 712 -- Looks like a reference, but probably isn't: '25' on line 713 -- Obsolete informational reference (is this intentional?): RFC 2845 (Obsoleted by RFC 8945) Summary: 0 errors (**), 0 flaws (~~), 1 warning (==), 6 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 INTERNET-DRAFT Donald Eastlake 3 Intended Status: Proposed Standard Huawei 4 Mark Andrews 5 ISC 6 Expires: April 10, 2015 October 11, 2014 8 Domain Name System (DNS) Cookies 9 11 Abstract 13 DNS cookies are a lightweight DNS transaction security mechanism that 14 provides limited protection to DNS servers and clients against a 15 variety of increasingly common denial-of-service and amplification / 16 forgery or cache poisoning attacks by off-path attackers. DNS Cookies 17 are tolerant of NAT, NAT-PT, and anycast and can be incrementally 18 deployed. 20 Status of This Document 22 This Internet-Draft is submitted to IETF in full conformance with the 23 provisions of BCP 78 and BCP 79. 25 Distribution of this document is unlimited. Comments should be sent 26 to the author or the DNSEXT mailing list . 28 Internet-Drafts are working documents of the Internet Engineering 29 Task Force (IETF), its areas, and its working groups. Note that 30 other groups may also distribute working documents as Internet- 31 Drafts. 33 Internet-Drafts are draft documents valid for a maximum of six months 34 and may be updated, replaced, or obsoleted by other documents at any 35 time. It is inappropriate to use Internet-Drafts as reference 36 material or to cite them other than as "work in progress." 38 The list of current Internet-Drafts can be accessed at 39 http://www.ietf.org/1id-abstracts.html. The list of Internet-Draft 40 Shadow Directories can be accessed at 41 http://www.ietf.org/shadow.html. 43 Table of Contents 45 1. Introduction............................................3 46 1.1 Contents of This Document..............................3 47 1.2 Definitions............................................4 49 2. Threats Considered......................................5 50 2.1 Denial-of-Service Attacks..............................5 51 2.1.1 DNS Amplification Attacks............................5 52 2.1.2 DNS Server Denial-of-Service.........................5 53 2.2 Cache Poisoning and Answer Forgery Attacks.............6 55 3. Comments on Existing DNS Security.......................7 56 3.1 Existing DNS Data Security.............................7 57 3.2 DNS Message/Transaction Security.......................7 58 3.3 Conclusions on Existing DNS Security...................7 60 4. The COOKIE OPT Option...................................8 61 4.1 Client Cookie..........................................9 62 4.2 Server Cookie..........................................9 63 4.3 Error Code............................................10 65 5. DNS Cookies Protocol Description.......................11 66 5.1 Originating Requests..................................11 67 5.2 Responding to Requests................................11 68 5.2.1 No OPT RR...........................................12 69 5.2.2 No Valid Client Cookie..............................12 70 5.2.3 Bad or Absent Server Cookie.........................13 71 5.2.4 A Correct Server Cookie.............................13 72 5.3 Processing Responses..................................14 73 5.4 Client and Server Secret Rollover.....................14 74 5.5 Implementation Requirement............................15 76 6. NAT Considerations and AnyCast Server Considerations...16 77 7. Deployment.............................................18 78 8. IANA Considerations....................................19 80 9. Security Considerations................................20 81 9.1 Cookie Algorithm Considerations.......................20 83 Acknowledgements..........................................21 84 Normative References......................................22 85 Informative References....................................22 87 Appendix A: Example Client Cookie Algorithms..............24 88 A.1 A Simple Algorithm....................................24 89 A.2 A More Complex Algorithm..............................24 91 Appendix B: Example Server Cookie Algorithms..............25 92 B.1 A Simple Algorithm....................................25 93 B.2 A More Complex Algorithm..............................25 95 1. Introduction 97 As with many core Internet protocols, the Domain Name System (DNS) 98 was originally designed at a time when the Internet had only a small 99 pool of trusted users. As the Internet has grown exponentially to a 100 global information utility, the DNS has increasingly been subject to 101 abuse. 103 This document describes DNS cookies, a lightweight DNS transaction 104 security mechanism specified as an OPT [RFC6891] option. This 105 mechanism provides limited protection to DNS servers and clients 106 against a variety of increasingly common abuses by off-path 107 attackers. It is compatible with and can be used in conjunction with 108 other DNS transaction forgery resistance measures such as those in 109 [RFC5452]. 111 The protection provided by DNS cookies bears some resemblance to that 112 provided by using TCP for DNS transactions. To bypass the weak 113 protection provided by using TCP requires an off-path attacker 114 guessing the 32-bit TCP sequence number in use. To bypass the weak 115 protection provided by DNS Cookies requires such an attacker to guess 116 a 64-bit pseudo-random quantity. Where DNS Cookies are not available 117 but TCP is, a fall back to using TCP is a reasonable strategy. 119 If only one party to a DNS transaction supports DNS cookies, the 120 mechanism does not provide a benefit or significantly interfere; but, 121 if both support it, the additional security provided is automatically 122 available. 124 The DNS cookies mechanism is designed to work in the presence of NAT 125 and NAT-PT boxes and guidance is provided herein on supporting the 126 DNS cookies mechanism in anycast servers. 128 1.1 Contents of This Document 130 In Section 2, we discuss the threats against which the DNS cookie 131 mechanism provides some protection. 133 Section 3 describes existing DNS security mechanisms and why they are 134 not adequate substitutes for DNS cookies. 136 Section 4 describes the COOKIE OPT option. 138 Section 5 provides a protocol description. 140 Section 6 discusses some NAT and anycast related DNS Cookies design 141 considerations. 143 Section 7 discusses incremental deployment considerations. 145 Sections 8 and 9 describe IANA and Security Considerations. 147 1.2 Definitions 149 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 150 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 151 document are to be interpreted as described in [RFC2119]. 153 An "off-path attacker", for a particular DNS client and server, is 154 defined as an attacker who cannot observe the DNS request and 155 response messages between that client and server. 157 "Soft state" indicates information learned or derived by a host which 158 may be discarded when indicated by the policies of that host but can 159 be later re-instantiated if needed. For example, it could be 160 discarded after a period of time or when storage for caching such 161 data becomes full. If operations requiring that soft state continue 162 after it has been discarded, it will be automatically re-generated, 163 albeit at some cost. 165 "Silently discarded" indicates that there are no DNS protocol message 166 consequences; however, it is RECOMMENDED that appropriate network 167 management facilities be included in implementations, such as a 168 counter of the occurrences of each such event type. 170 "IP address" is used herein as a length independent term and includes 171 both IPv4 and IPv6 addresses. 173 2. Threats Considered 175 DNS cookies are intended to provide significant but limited 176 protection against certain attacks by off-path attackers as described 177 below. These attacks include denial-of-service, cache poisoning and 178 answer forgery. 180 2.1 Denial-of-Service Attacks 182 The typical form of the denial-of-service attacks considered herein 183 is to send DNS requests with forged source IP addresses to a server. 184 The intent can be to attack that server or some other selected host 185 as described below. 187 2.1.1 DNS Amplification Attacks 189 A request with a forged IP address generally causes a response to be 190 sent to that forged IP address. Thus the forging of many such 191 requests with a particular source IP address can result in enough 192 traffic being sent to the forged IP address to interfere with service 193 to the host at the IP address. Furthermore, it is generally easy in 194 the DNS to create short requests that produce much longer responses, 195 thus amplifying the attack. 197 The DNS Cookies mechanism can severely limit the traffic 198 amplification obtained by attackers off path for the server and the 199 attacked host. Enforced DNS cookies would make it hard for an off 200 path attacker to cause any more than rate-limited short error 201 responses to be sent to a forged IP address so the attack would be 202 attenuated rather than amplified. DNS cookies make it more effective 203 to implement a rate limiting scheme for error responses from the 204 server. Such a scheme would further restrict selected host denial- 205 of-service traffic from that server. 207 2.1.2 DNS Server Denial-of-Service 209 DNS requests that are accepted cause work on the part of DNS servers. 210 This is particularly true for recursive servers that may issue one or 211 more requests and process the responses thereto, in order to 212 determine their response to the initial request. And the situation 213 can be even worse for recursive servers implementing DNSSEC 214 ([RFC4033] [RFC4034] [RFC4035]) because they may be induced to 215 perform burdensome cryptographic computations in attempts to verify 216 the authenticity of data they retrieve in trying to answer the 217 request. 219 The computational or communications burden caused by such requests 220 may not dependent on a forged IP source address, but the use of such 221 addresses makes 222 + the source of the requests causing the denial-of-service attack 223 harder to find and 224 + restriction of the IP addresses from which such requests should 225 be honored hard or impossible to specify or verify. 227 Use of DNS cookies should enables a server to reject forged queries 228 from an off path attacker with relative ease and before any recursive 229 queries or public key cryptographic operations are performed. 231 2.2 Cache Poisoning and Answer Forgery Attacks 233 The form of the cache poisoning attacks considered is to send forged 234 replies to a resolver. Modern network speeds for well-connected hosts 235 are such that, by forging replies from the IP addresses of a DNS 236 server to a resolver for common names or names that resolver has been 237 induced to resolve, there can be an unacceptably high probability of 238 randomly coming up with a reply that will be accepted and cause false 239 DNS information to be cached by that resolver (the Dan Kaminsky 240 attack). This can be used to facilitate phishing attacks and other 241 diversion of legitimate traffic to a compromised or malicious host 242 such as a web server. 244 With the use of DNS cookies, a resolver can generally reject such 245 forged replies. 247 3. Comments on Existing DNS Security 249 Two forms of security have been added to DNS, data security and 250 message/transaction security. 252 3.1 Existing DNS Data Security 254 DNS data security is one part of DNSSEC and is described in 255 [RFC4033], [RFC4034], and [RFC4035] and updates thereto. It provides 256 data origin authentication and authenticated denial of existence. 257 DNSSEC is being deployed and can provide strong protection against 258 forged data; however, it has the unintended effect of making some 259 denial-of-service attacks worse because of the cryptographic 260 computational load it can require and the increased size in DNS 261 response packets that it tends to produce. 263 3.2 DNS Message/Transaction Security 265 The second form of security that has been added to DNS provides 266 "transaction" security through TSIG [RFC2845] or SIG(0) [RFC2931]. 267 TSIG could provide strong protection against the attacks for which 268 the DNS Cookies mechanism provide weak protection; however, TSIG is 269 non-trivial to deploy in the general Internet because of the burden 270 it imposes of pre-agreement and key distribution between client- 271 server pairs, the burden of server side key state, and because it 272 requires time synchronization between client and server. 274 TKEY [RFC2930] can solve the problem of key distribution for TSIG but 275 some modes of TKEY impose a substantial cryptographic computation 276 loads and can be dependent on the deployment of DNS data security 277 (see Section 3.1). 279 SIG(0) [RFC2931] provides less denial of service protection than TSIG 280 or, in one way, even DNS cookies, because it does not authenticate 281 requests, only complete transactions. In any case, it also depends 282 on the deployment of DNS data security and requires computationally 283 burdensome public key cryptographic operations. 285 3.3 Conclusions on Existing DNS Security 287 The existing DNS security mechanisms do not provide the services 288 provided by the DNS Cookies mechanism: lightweight message 289 authentication of DNS requests and responses with no requirement for 290 pre-configuration or per client server side state. 292 4. The COOKIE OPT Option 294 COOKIE is an OPT RR [RFC6891] option that can be included in the 295 RDATA portion of an OPT RR in DNS requests and responses. The option 296 length varies depending on the circumstance in which it is being 297 used. There are two cases as described below. Both use the same 298 OPTION-CODE; they are distinguished by their length. 300 In a request sent by a client to a server when the client does not 301 know the server cookie, its length is 10, consisting of a 2 bytes DNS 302 error code field followed by the 8 byte Client Cookie as shown in 303 Figure 1. 305 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 306 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 307 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 308 | OPTION-CODE = {TBD} | OPTION-LENGTH = 10 | 309 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 310 | Error Code (2 bytes) | 311 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 312 | | 313 +-+- Client Cookie (fixed size, 8 bytes) -+-+-+-+ 314 | | 315 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 317 Figure 1. COOKIE Option, Unknown Server Cookie 319 In a request sent by a client when a server cookie is known and in 320 all responses, the length is variable from 18 to 42 bytes, consisting 321 of a 2 byte DNS error field followed by the 8 bytes Client Cookie and 322 then the variable 8 to 32 bytes Server Cookie as shown in Figure 2. 323 The variability of the option length stems from the variable length 324 Server Cookie. The Server Cookie is an integer number of bytes with a 325 minimum size of 64 bits for security and a maximum size of 256 bits 326 for implementation convenience. 328 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 329 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 330 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 331 | OPTION-CODE = {TBD} | OPTION-LENGTH >= 18, <= 42 | 332 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 333 | Error Code (2 bytes) | 334 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 335 | | 336 +-+- Client Cookie (fixed size, 8 bytes) -+-+-+-+ 337 | | 338 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 339 | | 340 / Server Cookie (variable size, 8 to 32 bytes) / 341 / / 342 +-+-+-+-... 344 Figure 2. COOKIE Option, Known Server Cookie 346 4.1 Client Cookie 348 The Client Cookie SHOULD be a pseudo-random function of the server IP 349 address and a secret quantity known only to the client. This client 350 secret SHOULD have at least 64 bits of entropy [RFC4086] and be 351 changed periodically (see Section 5.4). The selection of the pseudo- 352 random function is a matter private to the client as only the client 353 needs to recognize its own DNS cookies. 355 For further discussion of the Client Cookie field, see Section 5.1. 356 For example methods of determining a Client Cookie, see Appendix A. 358 A client MUST NOT use the same Client Cookie value for queries to all 359 servers. 361 4.2 Server Cookie 363 The Server Cookie SHOULD consist of or include a 64-bit or larger 364 pseudo-random function of the request source IP address, the request 365 Client Cookie, and a secret quantity known only to the server. (See 366 Section 6 for a discussion of why the Client Cookie is used as input 367 to the Server Cookie but the Server Cookie is not used as an input to 368 the Client Cookie.) This server secret SHOULD have at least 64 bits 369 of entropy [RFC4086] and be changed periodically (see Section 5.4). 370 The selection of the pseudo-random function is a matter private to 371 the server as only the server needs to recognize its own DNS cookies. 373 For further discussion of the Server Cookie field see Section 5.2. 374 For example methods of determining a Server Cookie, see Appendix B. 376 A server MUST NOT use the same Server Cookie value for responses to 377 all clients. 379 4.3 Error Code 381 In requests, the Error Code field MUST be zero and is ignored on 382 receipt. Replies have a COOKIE OPT with an Error Code equal to one of 383 the following four values: Zero (if the request they respond to had a 384 COOKIE OPT with a correct Server Cookie), NOCOOKIE, MFCOOKIE, or 385 BADCOOKIE. 387 NOCOOKIE and MFCOOKIE indicate that the server did not receive a 388 Client Cookie, either because there was no COOKIE OPT option in the 389 request (NOCOOKIE) or one was present but the COOKIE OPT option was 390 malformed as not being a valid length (MFCOOKIE). BADCOOKIE indicates 391 that the server did receive a Client Cookie but did not receive the 392 correct Server Cookie either because there was no Server Cookie 393 present or because it was not a valid value. 395 A server may choose to normally process a request, for example 396 returning the normal answer information for a QUERY, notwithstanding 397 a cookie error condition. For more information on error processing, 398 see Section 5. 400 5. DNS Cookies Protocol Description 402 This section discusses using DNS Cookies in the DNS Protocol. 404 5.1 Originating Requests 406 A DNS client that implements DNS cookies includes one DNS Cookie 407 option in every DNS request it sends unless DNS cookies are disabled. 408 The COOKIE OPT option in a request always includes a zero Error Code 409 field and a Client Cookie as discussed in Section 4.1. 411 If the client has no Server Cookie obtained from a previous DNS 412 response and cached under the server's IP address, it uses the 413 shorter form of COOKIE OPT shown in Figure 1. If the client does have 414 such a cached Server Cookie, it uses the form of COOKIE OPT shown in 415 Figure 2 and also includes that cached Server Cookie in the DNS 416 option it sends. 418 5.2 Responding to Requests 420 The Server Cookie, when it occurs in a COOKIE OPT option in a 421 request, is intended to weakly assure the server that the request 422 came from a client that is both at the source IP address of the 423 request and using the Client Cookie included in the option. This weak 424 assurance is provided by the Server Cookie that server would send to 425 that client in an earlier response appearing as the Server Cookie 426 field in the request. 428 At a server where DNS Cookies are not implemented and enabled, the 429 presence of a COOKIE OPT option is ignored and the server responds as 430 before. 432 When DNS Cookies are implemented and enabled, there are four 433 possibilities: (1) there is no OPT RR at all in the request; (2) 434 there is no valid Client Cookie in the request because the COOKIE OPT 435 option in absent from the request or one is present but not a legal 436 length; (3) there is a valid length cookie option in the request with 437 no Server Cookie or an incorrect Server Cookie; or (4) there is a 438 cookie option in the request with a correct Server Cookie. The four 439 possibilities are discussed in the subsections below. 441 In the case of multiple COOKIE OPT options in a request, only the 442 first (the one closest to the DNS header) is considered. All others 443 are ignored. 445 5.2.1 No OPT RR 447 If there is no OPT RR in the request, the client does not support 448 EDNS since [RFC6891] requires that an OPT RR be included in a request 449 if the requester supports that feature. Under these circumstances, 450 the server cannot expect to ever receive a correct COOKIE OPT option 451 from the client as in Section 5.2.4. 453 The situation and server options available are the same as those in 454 Section 5.2.2 except that no OPT RR can be included in any response. 456 5.2.2 No Valid Client Cookie 458 A request with an OPT RR but no COOKIE OPT option or with a COOKIE 459 that is not a valid length (10 or 18 through 42) could be from a 460 client that does not implement DNS cookies or on which they are 461 disabled or it could be some form of abuse or broken client 462 implementation. A server on which DNS cookies are enabled has the 463 following three choices in responding to such a request: 465 (1) Silently discard the request. 467 (2) Not process the request other than returning a minimal length 468 error response. Because of the absence of a validly formatted 469 COOKIE OPT option in the request, it cannot be assumed that the 470 client would understand any new RCODE values. An RCODE of Refused 471 is returned and the Error Field of the returned COOKIE OPT option 472 is set to NOCOOKIE if there was no COOKIE OPT option in the 473 request and set to MFCOOKIE if such an option was present but not 474 a valid length. 476 (3) Process the request normally and provide a normal response except 477 that a COOKIE OPT option with a non-zero Error Field is included 478 as in point 2 above. The RCODE in the DNS Header is zero unless 479 some non-cookie error occurs in processing the request. 481 Server policy determines how often the server selects each of the 482 above response choices; however, if the request was received over 483 TCP, the server may wish to take the weak authentication provided by 484 the use of TCP into account, increasing the probability of choice 3 485 and decreasing the probability of choice 1 perhaps to the extent of 486 never choosing 1. For both response choices 2 and 3, the server 487 should consider setting TC=1 in the response so that future requests 488 from the client are more likely to be received with the weak 489 authentication that can be provided by TCP. 491 5.2.3 Bad or Absent Server Cookie 493 If a request is received with the COOKIE OPT option having no Server 494 Cookie value (length 10) or a bad Server Cookie value (length 18 to 495 42), it could be some attempted abuse or it could just be that the 496 client does not know a currently valid Server Cookie for the server 497 to which the request was sent. For example, the client might have an 498 old, no longer recognized Server Cookie 500 Servers MUST, at least occasionally, respond to such requests to 501 inform the client of the correct Server Cookie. This is necessary so 502 that such a client can bootstrap to the weakly secure state where 503 requests and responses have recognized Server Cookies and Client 504 Cookies. 506 In responding to such a request, the server has the following three 507 choices: 509 (1) Silently discard the request. 511 (2) Not process the request other than returning a minimal length 512 error response. Because of the correct length COOKIE OPT option 513 in the request, the client can be assume to understand the new 514 error codes assigned in this document. Both the Error Field in 515 the returned COOKIE OPT option and the extended RCODE are set to 516 BADCOOKIE. 518 (3) Processes the request normally and sends its usual response 519 including a COOKIE OPT option with an Error field of BADCOOKIE 520 and a zero RCODE (unless there was also a non-cookie error in 521 processing the request). 523 Server policy determines how often the server selects each of the 524 above response choices; however, if the request was received over 525 TCP, the server may wish to take the weak authentication provided by 526 the use of TCP into account, increasing the probability of choice 3 527 and decreasing the probability of choice 1 perhaps to the extent of 528 never choosing 1. 530 5.2.4 A Correct Server Cookie 532 If a server with enabled DNS cookies receives a request where the 533 COOKIE OPT option has a valid length and correct Server Cookie, it 534 processes the request normally and includes a COOKIE OPT option with 535 a zero Error Field in the response. Such a response might have a 536 non-zero RCODE if a non-cookie error occurs in processing the 537 request. 539 5.3 Processing Responses 541 The Client Cookie, when it occurs in a COOKIE OPT option in a DNS 542 reply, is intended to weakly assure the client that the reply came 543 from a server at the source IP address use in the response packet 544 because the Client Cookie value is the value that client would send 545 to that server in a request. If there are multiple COOKIE OPT options 546 in a DNS reply, all but the first (the one closest to the DNS Header) 547 are ignored. 549 A DNS client where DNS cookies are implemented and enabled examines 550 response for DNS cookies and MUST discard the response if it contains 551 an illegal COOKIE OPT option length or an incorrect Client Cookie 552 value. If the COOKIE OPT option Client Cookie is correct, the client 553 caches the Server Cookie provided even if the response is an error 554 response (RCODE non-zero). 556 If the reply extended RCDOE is BADCOOKIE, it means that the server 557 was unwilling to process the request because it did not have the 558 correct Server Cookie in it. The client should retry the request 559 using the new Server Cookie from the response. 561 If the RCODE is some value other than BADCOOKIE, including zero, the 562 response is then processed normally. 564 5.4 Client and Server Secret Rollover 566 Clients and servers MUST NOT continue to use the same secret in new 567 queries and responses, respectively, for more than 14 days and SHOULD 568 NOT continue to do so for more than 1 day. Many clients rolling over 569 their secret at the same time could briefly increase server traffic 570 and exactly predictable rollover times for clients or servers might 571 facilitate guessing attacks. For example, an attacker might increase 572 the priority of attacking secrets they believe will be in effect for 573 an extended period of time. To avoid rollover synchronization and 574 predictability, it is RECOMMENDED that pseudorandom jitter of at 575 least 30% be applied to the time of a scheduled rollover of a DNS 576 cookie secret. 578 It is RECOMMENDED that a client keep the Client Cookie it is 579 expecting in a reply associated with the outstanding query to avoid 580 rejection of replies due to a bad Client Cookie right after a change 581 in the Client Secret. It is RECOMMENDED that a server retain its 582 previous secret for a period of time not less than 1 second or more 583 than 3 minutes, after a change in its secret, and consider queries 584 with Server Cookies based on its previous secret to have a correct 585 Server Cookie during that time. 587 Receiving a sudden increased level of requests with bad Server 588 Cookies or replies with bad Client Cookies would be a good reason to 589 believe a server or client is likely to be under attack and should 590 consider more frequent rollover of its secret. 592 5.5 Implementation Requirement 594 DNS clients and servers SHOULD implement DNS cookies to decrease 595 their vulnerability to the threats discussed in Section 2. 597 6. NAT Considerations and AnyCast Server Considerations 599 In the Classic Internet, DNS Cookies could simply be a pseudo-random 600 function of the client IP address and a sever secret or the server IP 601 address and a client secret. You would want to compute the Server 602 Cookie that way, so a client could cache its Server Cookie for a 603 particular server for an indefinitely amount of time and the server 604 could easily regenerate and check it. You could consider the Client 605 Cookie to be a weak client signature over the server IP address that 606 the client checks in replies and you could extend this weak signature 607 to cover the request ID, for example, or any other information that 608 is returned unchanged in the reply. 610 But we have this reality called NAT [RFC3022], Network Address 611 Translation (including, for the purposes of this document, NAT-PT, 612 Network Address and Protocol Translation, which has been declared 613 Historic [RFC4966]). There is no problem with DNS transactions 614 between clients and servers behind a NAT box using local IP 615 addresses. Nor is there a problem with NAT translation of internal 616 addresses to external addresses or translations between IPv4 and IPv6 617 addresses, as long as the address mapping is relatively stable. 618 Should the external IP address an internal client is being mapped to 619 change occasionally, the disruption is little more than when a client 620 rolls-over its DNS COOKIE secret. And normally external access to a 621 DNS server behind a NAT box is handled by a fixed mapping which 622 forwards externally received DNS requests to a specific host. 624 However, NAT devices sometimes also map ports. This can cause 625 multiple DNS requests and responses from multiple internal hosts to 626 be mapped to a smaller number of external IP addresses, such as one 627 address. Thus there could be many clients behind a NAT box that 628 appear to come from the same source IP address to a server outside 629 that NAT box. If one of these were an attacker (think Zombie or 630 Botnet), that behind-NAT attacker could get the Server Cookie for 631 some server for the outgoing IP address by just making some random 632 request to that server. It could then include that Server Cookie in 633 the COOKIE OPT of requests to the server with the forged local IP 634 address of some other host and/or client behind the NAT box. 635 (Attacker possession of this Server Cookie will not help in forging 636 responses to cause cache poisoning as such responses are protected by 637 the required Client Cookie.) 639 To fix this potential defect, it is necessary to distinguish 640 different clients behind a NAT box from the point of view of the 641 server. It is for this reason that the Server Cookie is specified as 642 a pseudo-random function of both the request source IP address and 643 the Client Cookie. From this inclusion of the Client Cookie in the 644 calculation of the Server Cookie, it follows that a stable Client 645 Cookie, for any particular server, is needed. If, for example, the 646 request ID was included in the calculation of the Client Cookie, it 647 would normally change with each request to a particular server. This 648 would mean that each request would have to be sent twice: first to 649 learn the new Server Cookie based on this new Client Cookie based on 650 the new ID and then again using this new Client Cookie to actually 651 get an answer. Thus the input to the Client Cookie computation must 652 be limited to the server IP address and one or more things that 653 change slowly such as the client secret. 655 In principle, there could be a similar problem for servers, not due 656 to NAT but due to mechanisms like anycast which may cause queries to 657 a DNS server at an IP address to be delivered to any one of several 658 machines. (External queries to a DNS server behind a NAT box usually 659 occur via port forwarding such that all such queries go to one host.) 660 However, it is impossible to solve this the way the similar problem 661 was solved for NATed clients; if the Server Cookie was included in 662 the calculation of the Client Cookie the same way the Client Cookie 663 is included in the Server Cookie, you would just get an almost 664 infinite series of errors as a request was repeatedly retried. 666 For servers accessed via anycast to successfully support DNS COOKIES, 667 the server clones must either all use the same server secret or the 668 mechanism that distributes queries to them must cause the queries 669 from a particular client to go to a particular server for a 670 sufficiently long period of time that extra queries due to changes in 671 Server Cookie resulting from accessing different server machines are 672 not unduly burdensome. (When such anycast-accessed servers act as 673 recursive servers or otherwise act as clients they normally use a 674 different unique address to source their queries to avoid confusion 675 in the delivery of responses.) 677 For simplicity, it is RECOMMENDED that the same server secret be used 678 by each DNS server in a set of anycast servers. If there is limited 679 time skew in updating this secret in different anycast servers, this 680 can be handled by a server accepting requests containing a Server 681 Cookie based on either its old or new secret for the maximum likely 682 time period of such time skew (see also Section 5.4). 684 7. Deployment 686 The DNS cookies mechanism is designed for incremental deployment and 687 to complement the orthogonal techniques in [RFC5452]. Either or both 688 techniques can be deployed independently at each DNS server and 689 client. 691 In particular, a DNS server or client that implements the DNS COOKIE 692 mechanism can interoperate successfully with a DNS client or server 693 that does not implement this mechanism although, of course, in this 694 case it will not get the benefit of the mechanism and the server 695 involved might choose to severely rate limit responses. When such a 696 server or client interoperates with a client or server which also 697 implements the DNS cookies mechanism, they get the weak security 698 benefits of the DNS Cookies mechanism. 700 8. IANA Considerations 702 IANA is requested to assign the following four code points: 704 The OPT option value for COOKIE is [10 suggested]. 706 Three new DNS error codes in the range above 16 and below 3,840 as 707 shown below: 709 RCODE Name Description Reference 710 -------- --------- ----------------- --------------- 711 TBD1[23] NOCOOKIE No client cookie. [this document] 712 TBD2[24] MFCOOKIE Malformed cookie. [this document] 713 TBD3[25] BADCOOKIE Bad/missing server cookie. [this document] 715 9. Security Considerations 717 DNS Cookies provide a weak form of authentication of DNS requests and 718 responses. In particular, they provide no protection against "on- 719 path" adversaries; that is, they provide no protection against any 720 adversary that can observe the plain text DNS traffic, such as an on- 721 path router, bridge, or any device on an on-path shared link (unless 722 the DNS traffic in question on that path is encrypted). 724 For example, if a host is connected via an unsecured IEEE 802.11 link 725 (Wi-Fi), any device in the vicinity that could receive and decode the 726 802.11 transmissions must be considered "on-path". On the other hand, 727 in a similar situation but one where 802.11 Robust Security (WPAv2) 728 is appropriately deployed on the Wi-Fi network nodes, only the Access 729 Point via which the host is connecting is "on-path" as far as the 730 802.11 link is concerned. 732 Despite these limitations, deployment of DNS Cookies on the global 733 Internet is expected to provide a substantial reduction in the 734 available launch points for the traffic amplification and denial of 735 service forgery attacks described in Section 2 above. 737 Should stronger message/transaction security be desired, it is 738 suggested that TSIG or SIG(0) security be used (see Section 3.2); 739 however, it may be useful to use DNS Cookies in conjunction with 740 these features. In particular, DNS Cookies could screen out many DNS 741 messages before the cryptographic computations of TSIG or SIG(0) are 742 required and, if SIG(0) is in use, DNS Cookies could usefully screen 743 out many requests given that SIG(0) does not screen requests but only 744 authenticates the response of complete transactions. 746 9.1 Cookie Algorithm Considerations 748 The cookie computation algorithm for use in DNS Cookies SHOULD be 749 based on a pseudo-random function at least as strong as [FNV] because 750 an excessively weak or trivial algorithm could enable adversaries to 751 guess cookies. However, in light of the weak plain-text token 752 security provided by DNS Cookies, a strong cryptography hash 753 algorithm may not be warranted in many cases, and would cause an 754 increased computational burden. Nevertheless there is nothing wrong 755 with using something stronger, for example, HMAC-SHA256-64 [RFC6234], 756 assuming a DNS processor has adequate computational resources 757 available. DNS processors that feel the need for somewhat stronger 758 security without a significant increase in computational load should 759 consider more frequent changes in their client and/or server secret; 760 however, this does require more frequent generation of a 761 cryptographically strong random number [RFC4086]. See Appendices A 762 and B for specific examples of cookie computation algorithms. 764 Acknowledgements 766 The contributions of the following are gratefully acknowledged: 768 Tim Wicinski 770 Normative References 772 [RFC2119] - Bradner, S., "Key words for use in RFCs to Indicate 773 Requirement Levels", BCP 14, RFC 2119, March 1997. 775 [RFC4086] - Eastlake 3rd, D., Schiller, J., and S. Crocker, 776 "Randomness Requirements for Security", BCP 106, RFC 4086, June 777 2005. 779 [RFC6891] - Damas, J., Graff, M., and P. Vixie, "Extension Mechanisms 780 for DNS (EDNS(0))", STD 75, RFC 6891, April 2013. 782 Informative References 784 [FNV] - G. Fowler, L. C. Noll, K.-P. Vo, D. Eastlake, "The FNV Non- 785 Cryptographic Hash Algorithm", draft-eastlake-fnv, work in 786 progress. 788 [RFC2845] - Vixie, P., Gudmundsson, O., Eastlake 3rd, D., and B. 789 Wellington, "Secret Key Transaction Authentication for DNS 790 (TSIG)", RFC 2845, May 2000. 792 [RFC2930] - Eastlake 3rd, D., "Secret Key Establishment for DNS (TKEY 793 RR)", RFC 2930, September 2000. 795 [RFC2931] - Eastlake 3rd, D., "DNS Request and Transaction Signatures 796 ( SIG(0)s )", RFC 2931, September 2000. 798 [RFC3022] - Srisuresh, P. and K. Egevang, "Traditional IP Network 799 Address Translator (Traditional NAT)", RFC 3022, January 2001. 801 [RFC4033] - Arends, R., Austein, R., Larson, M., Massey, D., and S. 802 Rose, "DNS Security Introduction and Requirements", RFC 4033, 803 March 2005. 805 [RFC4034] - Arends, R., Austein, R., Larson, M., Massey, D., and S. 806 Rose, "Resource Records for the DNS Security Extensions", RFC 807 4034, March 2005. 809 [RFC4035] - Arends, R., Austein, R., Larson, M., Massey, D., and S. 810 Rose, "Protocol Modifications for the DNS Security Extensions", 811 RFC 4035, March 2005. 813 [RFC4966] - Aoun, C. and E. Davies, "Reasons to Move the Network 814 Address Translator - Protocol Translator (NAT-PT) to Historic 815 Status", RFC 4966, July 2007. 817 [RFC5452] - Hubert, A. and R. van Mook, "Measures for Making DNS More 818 Resilient against Forged Answers", RFC 5452, January 2009. 820 [RFC6234] - Eastlake 3rd, D. and T. Hansen, "US Secure Hash 821 Algorithms (SHA and SHA-based HMAC and HKDF)", RFC 6234, May 822 2011. 824 Appendix A: Example Client Cookie Algorithms 826 A.1 A Simple Algorithm 828 An simple example method to compute Client Cookies is the FNV-64 829 [FNV] of the server IP address and the client secret. That is 831 Client Cookie = FNV-64 ( Client Secret | Server IP Address ) 833 where "|" indicates concatenation. 835 A.2 A More Complex Algorithm 837 A more complex algorithm to calculate Client Cookies is give below. 838 It uses more computational resources than the simpler algorithm shown 839 in A.1. 841 Client Cookie = HMAC-SHA256-64 ( Client Secret, Server IP Address 842 ) 844 Appendix B: Example Server Cookie Algorithms 846 B.1 A Simple Algorithm 848 An example simple method producing a 64-bit Server Cookie is the 849 FNV-64 [FNV] of the request IP address, the Client Cookie, and the 850 server secret. That is 852 Server Cookie = 853 FNV-64 ( Server Secret | Request IP Address | Client Cookie ) 855 where "|" represents concatenation. 857 B.2 A More Complex Algorithm 859 Since the Server Cookie is variable size, the server can store 860 various information in that field as long as it is hard for an 861 adversary to guess the entire quantity used for weak authentication. 862 There should be 64 bits of entropy in the Server Cookie; for example 863 it could have a sub-field of 64-bits computed pseudo-randomly with 864 the server secret as one of the inputs to the pseudo-random function. 865 Types of additional information that could be stored include a time 866 stamp and/or a nonce. 868 The example below is one variation for the Server Cookie that has 869 been implemented in a beta release of BIND where the Server Cookie is 870 128 bits composed as follows: 872 Sub-field Size 873 --------- --------- 874 Nonce 32 bits 875 Time 32 bits 876 Hash 64 bits 878 With this algorithm, the server sends a new 128-bit cookie back with 879 every request. The Nonce field assures a low probability that there 880 would be a duplicate. 882 The Time field gives the server time and makes it easy to reject old 883 cookies. 885 The Hash part of the Server Cookie is the hard-to-guess part. In the 886 beta release of BIND, its computation can be configured to use AES, 887 HMAC-SHA1, or, as shown below, HMAC-SHA256: 889 hash = 890 HMAC-SHA256-64 ( Server Secret, 891 (Client Cookie | nonce | time | client IP Address) ) 893 where "|" represents concatenation. 895 Author's Address 897 Donald E. Eastlake 3rd 898 Huawei Technologies 899 155 Beaver Street 900 Milford, MA 01757 USA 902 Telephone: +1-508-333-2270 903 EMail: d3e3e3@gmail.com 905 Mark Andrews 906 Internet Systems Consortium 907 950 Charter Street 908 Redwood City, CA 94063 USA 910 Email: marka@isc.org 912 Copyright, Disclaimer, and Additional IPR Provisions 914 Copyright (c) 2014 IETF Trust and the persons identified as the 915 document authors. All rights reserved. 917 This document is subject to BCP 78 and the IETF Trust's Legal 918 Provisions Relating to IETF Documents 919 (http://trustee.ietf.org/license-info) in effect on the date of 920 publication of this document. Please review these documents 921 carefully, as they describe your rights and restrictions with respect 922 to this document. Code Components extracted from this document must 923 include Simplified BSD License text as described in Section 4.e of 924 the Trust Legal Provisions and are provided without warranty as 925 described in the Simplified BSD License.