idnits 2.17.1 draft-ietf-dnsop-cookies-04.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 date (July 1, 2015) is 3221 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 718 -- Obsolete informational reference (is this intentional?): RFC 2845 (Obsoleted by RFC 8945) Summary: 0 errors (**), 0 flaws (~~), 1 warning (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 INTERNET-DRAFT Donald Eastlake 2 Intended Status: Proposed Standard Huawei 3 Mark Andrews 4 ISC 5 Expires: December 31, 2015 July 1, 2015 7 Domain Name System (DNS) Cookies 8 10 Abstract 12 DNS cookies are a lightweight DNS transaction security mechanism that 13 provides limited protection to DNS servers and clients against a 14 variety of increasingly common denial-of-service and amplification / 15 forgery or cache poisoning attacks by off-path attackers. DNS Cookies 16 are tolerant of NAT, NAT-PT, and anycast and can be incrementally 17 deployed. 19 Status of This Document 21 This Internet-Draft is submitted to IETF in full conformance with the 22 provisions of BCP 78 and BCP 79. 24 Distribution of this document is unlimited. Comments should be sent 25 to the author or the DNSEXT mailing list . 27 Internet-Drafts are working documents of the Internet Engineering 28 Task Force (IETF), its areas, and its working groups. Note that 29 other groups may also distribute working documents as Internet- 30 Drafts. 32 Internet-Drafts are draft documents valid for a maximum of six months 33 and may be updated, replaced, or obsoleted by other documents at any 34 time. It is inappropriate to use Internet-Drafts as reference 35 material or to cite them other than as "work in progress." 37 The list of current Internet-Drafts can be accessed at 38 http://www.ietf.org/1id-abstracts.html. The list of Internet-Draft 39 Shadow Directories can be accessed at 40 http://www.ietf.org/shadow.html. 42 Table of Contents 44 1. Introduction............................................4 45 1.1 Contents of This Document..............................4 46 1.2 Definitions............................................5 48 2. Threats Considered......................................6 49 2.1 Denial-of-Service Attacks..............................6 50 2.1.1 DNS Amplification Attacks............................6 51 2.1.2 DNS Server Denial-of-Service.........................6 52 2.2 Cache Poisoning and Answer Forgery Attacks.............7 54 3. Comments on Existing DNS Security.......................8 55 3.1 Existing DNS Data Security.............................8 56 3.2 DNS Message/Transaction Security.......................8 57 3.3 Conclusions on Existing DNS Security...................8 59 4. DNS Cookie Option......................................10 60 4.1 Client Cookie.........................................11 61 4.2 Server Cookie.........................................11 63 5. DNS Cookies Protocol Specification.....................12 64 5.1 Originating Requests..................................12 65 5.2 Responding to Request.................................12 66 5.2.1 No Opt RR or No COOKIE OPT option...................13 67 5.2.2 Malformed COOKIE OPT option.........................13 68 5.2.3 Only a Client Cookie................................13 69 5.2.4 A Client Cookie and Server Cookie...................14 70 5.2.4.1 A Client Cookie and Invalid Server Cookie.........14 71 5.2.4.2 A Client Cookie and Valid Server Cookie...........14 72 5.3 Processing Responses..................................14 73 5.4 QUERYing for a Server Cookie..........................15 74 5.5 Client and Server Secret Rollover.....................16 76 6. NAT Considerations and AnyCast Server Considerations...17 77 7. Deployment.............................................19 78 8. IANA Considerations....................................20 80 9. Security Considerations................................21 81 9.1 Cookie Algorithm Considerations.......................21 83 10. Implementation Considerations.........................23 85 Normative References......................................24 86 Informative References....................................24 88 Acknowledgements..........................................26 90 Appendix A: Example Client Cookie Algorithms..............27 91 A.1 A Simple Algorithm....................................27 92 A.2 A More Complex Algorithm..............................27 94 Table of Contents (continued) 96 Appendix B: Example Server Cookie Algorithms..............28 97 B.1 A Simple Algorithm....................................28 98 B.2 A More Complex Algorithm..............................28 100 Author's Address..........................................30 102 1. Introduction 104 As with many core Internet protocols, the Domain Name System (DNS) 105 was originally designed at a time when the Internet had only a small 106 pool of trusted users. As the Internet has grown exponentially to a 107 global information utility, the DNS has increasingly been subject to 108 abuse. 110 This document describes DNS cookies, a lightweight DNS transaction 111 security mechanism specified as an OPT [RFC6891] option. The DNS 112 cookies mechanism provides limited protection to DNS servers and 113 clients against a variety of increasingly common abuses by off-path 114 attackers. It is compatible with and can be used in conjunction with 115 other DNS transaction forgery resistance measures such as those in 116 [RFC5452]. 118 The protection provided by DNS cookies is similar to that provided by 119 using TCP for DNS transactions. To bypass the weak protection 120 provided by using TCP requires, among other things, that an off-path 121 attacker guessing the 32-bit TCP sequence number in use. To bypass 122 the weak protection provided by DNS Cookies requires such an attacker 123 to guess a 64-bit pseudo-random "cookie" quantity. Where DNS Cookies 124 are not available but TCP is, falling back to using TCP is 125 reasonable. 127 If only one party to a DNS transaction supports DNS cookies, the 128 mechanism does not provide a benefit or significantly interfere; but, 129 if both support it, the additional security provided is automatically 130 available. 132 The DNS cookies mechanism is designed to work in the presence of NAT 133 and NAT-PT boxes and guidance is provided herein on supporting the 134 DNS cookies mechanism in anycast servers. 136 1.1 Contents of This Document 138 In Section 2, we discuss the threats against which the DNS cookie 139 mechanism provides some protection. 141 Section 3 describes existing DNS security mechanisms and why they are 142 not adequate substitutes for DNS cookies. 144 Section 4 describes the COOKIE OPT option. 146 Section 5 provides a protocol description. 148 Section 6 discusses some NAT and anycast related DNS Cookies design 149 considerations. 151 Section 7 discusses incremental deployment considerations. 153 Sections 8 and 9 describe IANA and Security Considerations. 155 1.2 Definitions 157 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 158 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 159 document are to be interpreted as described in [RFC2119]. 161 "Off-path attacker", for a particular DNS client and server, is 162 defined as an attacker who cannot observe the DNS request and 163 response messages between that client and server. 165 "Soft state" indicates information learned or derived by a host which 166 may be discarded when indicated by the policies of that host 167 but can be later re-instantiated if needed. For example, it 168 could be discarded after a period of time or when storage for 169 caching such data becomes full. If operations requiring that 170 soft state continue after it has been discarded, it will be 171 automatically re-generated, albeit at some cost. 173 "Silently discarded" indicates that there are no DNS protocol message 174 consequences; however, it is RECOMMENDED that appropriate 175 network management facilities be included in implementations, 176 such as a counter of the occurrences of each such event type. 178 "IP address" is used herein as a length independent term and includes 179 both IPv4 and IPv6 addresses. 181 2. Threats Considered 183 DNS cookies are intended to provide significant but limited 184 protection against certain attacks by off-path attackers as described 185 below. These attacks include denial-of-service, cache poisoning and 186 answer forgery. 188 2.1 Denial-of-Service Attacks 190 The typical form of the denial-of-service attacks considered herein 191 is to send DNS requests with forged source IP addresses to a server. 192 The intent can be to attack that server or some other selected host 193 as described below. 195 2.1.1 DNS Amplification Attacks 197 A request with a forged IP address generally causes a response to be 198 sent to that forged IP address. Thus the forging of many such 199 requests with a particular source IP address can result in enough 200 traffic being sent to the forged IP address to interfere with service 201 to the host at the IP address. Furthermore, it is generally easy in 202 the DNS to create short requests that produce much longer responses, 203 thus amplifying the attack. 205 The DNS Cookies mechanism can severely limit the traffic 206 amplification obtained by attackers off path for the server and the 207 attacked host. Enforced DNS cookies would make it hard for an off 208 path attacker to cause any more than rate-limited short error 209 responses to be sent to a forged IP address so the attack would be 210 attenuated rather than amplified. DNS cookies make it more effective 211 to implement a rate limiting scheme for error responses from the 212 server. Such a scheme would further restrict selected host denial- 213 of-service traffic from that server. 215 2.1.2 DNS Server Denial-of-Service 217 DNS requests that are accepted cause work on the part of DNS servers. 218 This is particularly true for recursive servers that may issue one or 219 more requests and process the responses thereto, in order to 220 determine their response to the initial request. And the situation 221 can be even worse for recursive servers implementing DNSSEC 222 ([RFC4033] [RFC4034] [RFC4035]) because they may be induced to 223 perform burdensome cryptographic computations in attempts to verify 224 the authenticity of data they retrieve in trying to answer the 225 request. 227 The computational or communications burden caused by such requests 228 may not depend on a forged IP source address, but the use of such 229 addresses makes 230 + the source of the requests causing the denial-of-service attack 231 harder to find and 232 + restriction of the IP addresses from which such requests should 233 be honored hard or impossible to specify or verify. 235 Use of DNS cookies should enable a server to reject forged requests 236 from an off path attacker with relative ease and before any recursive 237 queries or public key cryptographic operations are performed. 239 2.2 Cache Poisoning and Answer Forgery Attacks 241 The form of the cache poisoning attacks considered is to send forged 242 replies to a resolver. Modern network speeds for well-connected hosts 243 are such that, by forging replies from the IP addresses of a DNS 244 server to a resolver for names that resolver has been induced to 245 resolve or for common names whose resource records have short time- 246 to-live values, there can be an unacceptably high probability of 247 randomly coming up with a reply that will be accepted and cause false 248 DNS information to be cached by that resolver (the Dan Kaminsky 249 attack). This can be used to facilitate phishing attacks and other 250 diversion of legitimate traffic to a compromised or malicious host 251 such as a web server. 253 With the use of DNS cookies, a resolver can generally reject such 254 forged replies. 256 3. Comments on Existing DNS Security 258 Two forms of security have been added to DNS, data security and 259 message/transaction security. 261 3.1 Existing DNS Data Security 263 DNS data security is one part of DNSSEC and is described in 264 [RFC4033], [RFC4034], [RFC4035], and updates thereto. It provides 265 data origin authentication and authenticated denial of existence. 266 DNSSEC is being deployed and can provide strong protection against 267 forged data; however, it has the unintended effect of making some 268 denial-of-service attacks worse because of the cryptographic 269 computational load it can require and the increased size in DNS 270 response packets that it tends to produce. 272 3.2 DNS Message/Transaction Security 274 The second form of security that has been added to DNS provides 275 "transaction" security through TSIG [RFC2845] or SIG(0) [RFC2931]. 276 TSIG could provide strong protection against the attacks for which 277 the DNS Cookies mechanism provides weak protection; however, TSIG is 278 non-trivial to deploy in the general Internet because of the burdens 279 it imposes. Among these burdens are pre-agreement and key 280 distribution between client and server, keeping track of server side 281 key state, and required time synchronization between client and 282 server. 284 TKEY [RFC2930] can solve the problem of key distribution for TSIG but 285 some modes of TKEY impose a substantial cryptographic computation 286 load and can be dependent on the deployment of DNS data security (see 287 Section 3.1). 289 SIG(0) [RFC2931] provides less denial of service protection than TSIG 290 or, in one way, even DNS cookies, because it does not authenticate 291 requests, only complete transactions. In any case, it also depends 292 on the deployment of DNS data security and requires computationally 293 burdensome public key cryptographic operations. 295 3.3 Conclusions on Existing DNS Security 297 The existing DNS security mechanisms do not provide the services 298 provided by the DNS Cookies mechanism: lightweight message 299 authentication of DNS requests and responses with no requirement for 300 pre-configuration or per client server side state. 302 4. DNS Cookie Option 304 The DNS Cookie Option is an OPT RR [RFC6891] option that can be 305 included in the RDATA portion of an OPT RR in DNS requests and 306 responses. The option length varies depending on the circumstances 307 in which it is being used. There are two cases as described below. 308 Both use the same OPTION-CODE; they are distinguished by their 309 length. 311 In a request sent by a client to a server when the client does not 312 know the server's cookie, its length is 8, consisting of an 8 byte 313 Client Cookie as shown in Figure 1. 315 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 316 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 317 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 318 | OPTION-CODE = 10 | OPTION-LENGTH = 8 | 319 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 320 | | 321 +-+- Client Cookie (fixed size, 8 bytes) -+-+-+-+ 322 | | 323 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 325 Figure 1. COOKIE Option, Unknown Server Cookie 327 In a request sent by a client when a server cookie is known and in 328 all responses, the length is variable from 16 to 40 bytes, consisting 329 of an 8 bytes Client Cookie followed by the variable 8 to 32 bytes 330 Server Cookie as shown in Figure 2. The variability of the option 331 length stems from the variable length Server Cookie. The Server 332 Cookie is an integer number of bytes with a minimum size of 8 bytes 333 for security and a maximum size of 32 bytes for implementation 334 convenience. 336 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 337 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 338 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 339 | OPTION-CODE = 10 | OPTION-LENGTH >= 16, <= 40 | 340 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 341 | | 342 +-+- Client Cookie (fixed size, 8 bytes) -+-+-+-+ 343 | | 344 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 345 | | 346 / Server Cookie (variable size, 8 to 32 bytes) / 347 / / 348 +-+-+-+-... 350 Figure 2. COOKIE Option, Known Server Cookie 352 4.1 Client Cookie 354 The Client Cookie SHOULD be a pseudo-random function of the server IP 355 address and a secret quantity known only to the client. This client 356 secret SHOULD have at least 64 bits of entropy [RFC4086] and be 357 changed periodically (see Section 5.5). The selection of the pseudo- 358 random function is a matter private to the client as only the client 359 needs to recognize its own DNS cookies. 361 For further discussion of the Client Cookie field, see Section 5.1. 362 For example methods of determining a Client Cookie, see Appendix A. 364 A client MUST NOT use the same Client Cookie value for requests to 365 all servers. 367 4.2 Server Cookie 369 The Server Cookie SHOULD consist of or include a 64-bit or larger 370 pseudo-random function of the request source IP address, the request 371 Client Cookie, and a secret quantity known only to the server. (See 372 Section 6 for a discussion of why the Client Cookie is used as input 373 to the Server Cookie but the Server Cookie is not used as an input to 374 the Client Cookie.) This server secret SHOULD have at least 64 bits 375 of entropy [RFC4086] and be changed periodically (see Section 5.5). 376 The selection of the pseudo-random function is a matter private to 377 the server as only the server needs to recognize its own DNS cookies. 379 For further discussion of the Server Cookie field see Section 5.2. 380 For example methods of determining a Server Cookie, see Appendix B. 382 A server MUST NOT use the same Server Cookie value for responses to 383 all clients. 385 5. DNS Cookies Protocol Specification 387 This section discusses using DNS Cookies in the DNS Protocol. The 388 cycle of originating a request, responding to that request, and 389 processing the response are covered in Sections 5.1, 5.2, and 5.3. A 390 de facto extension to QUERY to allow pre-fetching a Server Cookie is 391 specified in Section 5.4. Rollover of the client and server secrets 392 and transient retention of the old coookie or secret is covered in 393 Section 5.5. 395 DNS clients and servers SHOULD implement DNS cookies to decrease 396 their vulnerability to the threats discussed in Section 2. 398 5.1 Originating Requests 400 A DNS client that implements DNS Cookies includes one DNS COOKIE OPT 401 option containing a Client Cookie in every DNS request it sends 402 unless DNS cookies are disabled. 404 If the client has a cached Server Cookie for the server against its 405 IP address it uses the longer cookie form and includes that Server 406 Cookie in the option along with the Client Cookie (Figure 2). 407 Otherwise it just sends the shorter form option with a Client Cookie 408 (Figure 1). 410 5.2 Responding to Request 412 The Server Cookie, when it occurs in a COOKIE OPT option in a 413 request, is intended to weakly assure the server that the request 414 came from a client that is both at the source IP address of the 415 request and using the Client Cookie included in the option. This weak 416 assurance is provided by the Server Cookie that server would send to 417 that client in an earlier response appearing as the Server Cookie 418 field in the request. 420 At a server where DNS Cookies are not implemented and enabled, 421 presence of a COOKIE OPT option is ignored and the server responds as 422 before. 424 When DNS Cookies are implemented and enabled, there are four 425 possibilities: (1) there is no OPT RR at all in the request; (2) 426 there is no valid Client Cookie in the request because the COOKIE OPT 427 option is absent from the request, or one is present but is not a 428 legal length; (3) there is a valid length cookie option in the 429 request with no Server Cookie or an incorrect Server Cookie; or (4) 430 there is a cookie option in the request with a correct Server Cookie. 432 The four possibilities are discussed in the subsections below. 434 In all cases of multiple COOKIE OPT options in a request, only the 435 first (the one closest to the DNS header) is considered. All others 436 are ignored. 438 5.2.1 No Opt RR or No COOKIE OPT option 440 If there is no OPT record or no COOKIE OPT option present in the 441 request then the server responds to the request as if the server 442 doesn't implement the COOKIE OPT. 444 5.2.2 Malformed COOKIE OPT option 446 If the COOKIE OPT is too short to contain a Client Cookie then 447 FORMERR is generated. If the COOKIE OPT is longer than that required 448 to hold a COOKIE OPT with just a Client Cookie (8) but is shorter 449 that the minimum COOKIE OPT with both a Client and Server Cookie (16) 450 then FORMERR is generated. If the COOKIE OPT is longer than the 451 maximum valid COOKIE OPT (40) then a FORMERR is generated. 453 In summary, valid cookie lengths are 8 and 16 to 40 inclusive. 455 5.2.3 Only a Client Cookie 457 Based on server policy, including rate limiting, the server chooses 458 one of the following: 460 (1) Silently discard the request. 462 (2) Send a BADCOOKIE error response. 464 (3) Process the request and provide a normal response. The RCODE is 465 NOERROR unless some non-cookie error occurs in processing the 466 request. 468 If the server responds, choosing 2 or 3 above, it SHALL generate its 469 own COOKIE OPT containing both the Client Cookie copied from the 470 request and a Server Cookie it has generated and adds this COOKIE OPT 471 to the response's OPT record. Servers MUST, at least occasionally, 472 respond to such requests to inform the client of the correct Server 473 Cookie. This is necessary so that such a client can bootstrap to the 474 weakly secure state where requests and responses have recognized 475 Server Cookies and Client Cookies. 477 If the request was received over TCP, the server SHOULD take the weak 478 authentication provided by the use of TCP into account and SHOULD 479 choose 3. In this case, if the server is not willing to accept the 480 weak security provided by TCP as a substitute for the weak security 481 provided by DNS Cookies but instead chooses 2, there is some danger 482 of an indefinite loop of retries (see Section 5.3). 484 5.2.4 A Client Cookie and Server Cookie 486 The server examines the Server Cookie to determine if it is a valid 487 Server Cookie it has generated. This examination will result in a 488 determination of whether the Server Cookie is valid or not. These 489 cases are discussed below. 491 5.2.4.1 A Client Cookie and Invalid Server Cookie 493 This can occur due to a stale Server Cookie being returned, a 494 client's IP address or Client Cookie changing without the DNS server 495 being aware, an anycast server cluster that is not consistently 496 configured, or an attempt to spoof the client. 498 The server SHALL process the request as if the invalid Server Cookie 499 was not present as described in Section 5.2.3. 501 5.2.4.2 A Client Cookie and Valid Server Cookie 503 When this occurs the server can assume that the request is from a 504 client that it has talked to before and defensive measures for 505 spoofed UDP requests, if any, are no longer required. 507 The server SHALL process the request and include a COOKIE OPT in the 508 response by (a) copying the complete COOKIE OPT from the request or 509 (b) generating a new COOKIE OPT containing both the Client Cookie 510 copied from the request and a valid Server Cookie it has generated. 512 5.3 Processing Responses 514 The Client Cookie, when it occurs in a COOKIE OPT option in a DNS 515 reply, is intended to weakly assure the client that the reply came 516 from a server at the source IP address used in the response packet 517 because the Client Cookie value is the value that client would send 518 to that server in a request. In a DNS reply with multiple COOKIE OPT 519 options, all but the first (the one closest to the DNS Header) are 520 ignored. 522 A DNS client where DNS cookies are implemented and enabled examines 523 the response for DNS cookies and MUST discard the response if it 524 contains an illegal COOKIE OPT option length or an incorrect Client 525 Cookie value. If the COOKIE OPT option Client Cookie is correct, the 526 client caches the Server Cookie provided even if the response is an 527 error response (RCODE non-zero). 529 If the reply extended RCODE is BADCOOKIE and the Client Cookie 530 matches what was sent, it means that the server was unwilling to 531 process the request because it did not have the correct Server Cookie 532 in it. The client SHOULD retry the request using the new Server 533 Cookie from the response. Repeated BADCOOKIE responses to requests 534 that use the Server Cookie provided in the previous response may be 535 an indication that the shared secrets / secret generation method in 536 an anycast cluster of servers are inconsistent. If the reply to a 537 retried request with a fresh Server Cookie is BADCOOKIE, the client 538 SHOULD retry using TCP as the transport since the server will likely 539 process the request normally based on the weak security provided by 540 TCP (see Section 5.2.3). 542 If the RCODE is some value other than BADCOOKIE, including zero, the 543 further processing of the response proceeds normally. 545 5.4 QUERYing for a Server Cookie 547 In many cases a client will learn the Server Cookie for a server as 548 the side effect of another transaction; however, there may be times 549 when this is not desirable. Therefore a means is provided for 550 obtaining a Server Cookie through an extension to the QUERY opcode 551 for which opcode most existing implementations require that QDCOUNT 552 be one (see Section 4.1.2 of [RFC1035]). 554 For servers with DNS Cookies enabled, the QUERY opcode behavior is 555 extended to support queries with a empty question section (QDCOUNT 556 zero) provided that an OPT record is present with a COOKIE option. 557 Such servers will reply with an empty answer section and a COOKIE 558 option giving the Client Cookie provided in the query and a valid 559 Server Cookie. 561 If such a query provided just a Client Cookie and no Server Cookie, 562 the response SHALL have the RCODE NOERROR. 564 This mechanism can also be used to confirm/re-establish a existing 565 Server Cookie by sending a cached Server Cookie with the Client 566 Cookie. In this case the response SHALL have the RCODE BADCOOKIE if 567 the Server Cookie sent with the query was invalid and the RCODE 568 NOERROR if it was valid. 570 Servers which don't support the COOKIE option will normally send 571 FORMERR in response to such a query, though REFUSED, NOTIMP, and 572 NOERROR without a COOKIE option are also possible in such responses. 574 5.5 Client and Server Secret Rollover 576 Clients and servers MUST NOT continue to use the same secret in new 577 requests and responses for more than 36 days and SHOULD NOT continue 578 to do so for more than 26 hours. Many clients rolling over their 579 secret at the same time could briefly increase server traffic and 580 exactly predictable rollover times for clients or servers might 581 facilitate guessing attacks. For example, an attacker might increase 582 the priority of attacking secrets they believe will be in effect for 583 an extended period of time. To avoid rollover synchronization and 584 predictability, it is RECOMMENDED that pseudorandom jitter in the 585 range of plus zero to minus at least 40% be applied to the time until 586 a scheduled rollover of a DNS cookie secret. 588 It is RECOMMENDED that a client keep the Client Cookie it is 589 expecting in a reply associated with the outstanding request to avoid 590 rejection of replies due to a bad Client Cookie right after a change 591 in the client secret. It is RECOMMENDED that a server retain its 592 previous secret for a period of time not less than 1 second or more 593 than 5 minutes, after a change in its secret, and consider requests 594 with Server Cookies based on its previous secret to have a correct 595 Server Cookie during that time. 597 When a server or client starts receiving an increased level of 598 requests with bad server cookies or replies with bad client cookies, 599 it would be reasonable for it to believe it is likely under attack 600 and it should consider a more frequent rollover of its secret. 602 6. NAT Considerations and AnyCast Server Considerations 604 In the Classic Internet, DNS Cookies could simply be a pseudo-random 605 function of the client IP address and a sever secret or the server IP 606 address and a client secret. You would want to compute the Server 607 Cookie that way, so a client could cache its Server Cookie for a 608 particular server for an indefinitely amount of time and the server 609 could easily regenerate and check it. You could consider the Client 610 Cookie to be a weak client signature over the server IP address that 611 the client checks in replies and you could extend this weak signature 612 to cover the request ID, for example, or any other information that 613 is returned unchanged in the reply. 615 But we have this reality called NAT [RFC3022], Network Address 616 Translation (including, for the purposes of this document, NAT-PT, 617 Network Address and Protocol Translation, which has been declared 618 Historic [RFC4966]). There is no problem with DNS transactions 619 between clients and servers behind a NAT box using local IP 620 addresses. Nor is there a problem with NAT translation of internal 621 addresses to external addresses or translations between IPv4 and IPv6 622 addresses, as long as the address mapping is relatively stable. 623 Should the external IP address an internal client is being mapped to 624 change occasionally, the disruption is little more than when a client 625 rolls-over its DNS COOKIE secret. And normally external access to a 626 DNS server behind a NAT box is handled by a fixed mapping which 627 forwards externally received DNS requests to a specific host. 629 However, NAT devices sometimes also map ports. This can cause 630 multiple DNS requests and responses from multiple internal hosts to 631 be mapped to a smaller number of external IP addresses, such as one 632 address. Thus there could be many clients behind a NAT box that 633 appear to come from the same source IP address to a server outside 634 that NAT box. If one of these were an attacker (think Zombie or 635 Botnet), that behind-NAT attacker could get the Server Cookie for 636 some server for the outgoing IP address by just making some random 637 request to that server. It could then include that Server Cookie in 638 the COOKIE OPT of requests to the server with the forged local IP 639 address of some other host and/or client behind the NAT box. 640 (Attacker possession of this Server Cookie will not help in forging 641 responses to cause cache poisoning as such responses are protected by 642 the required Client Cookie.) 644 To fix this potential defect, it is necessary to distinguish 645 different clients behind a NAT box from the point of view of the 646 server. It is for this reason that the Server Cookie is specified as 647 a pseudo-random function of both the request source IP address and 648 the Client Cookie. From this inclusion of the Client Cookie in the 649 calculation of the Server Cookie, it follows that a stable Client 650 Cookie, for any particular server, is needed. If, for example, the 651 request ID was included in the calculation of the Client Cookie, it 652 would normally change with each request to a particular server. This 653 would mean that each request would have to be sent twice: first to 654 learn the new Server Cookie based on this new Client Cookie based on 655 the new ID and then again using this new Client Cookie to actually 656 get an answer. Thus the input to the Client Cookie computation must 657 be limited to the server IP address and one or more things that 658 change slowly such as the client secret. 660 In principle, there could be a similar problem for servers, not due 661 to NAT but due to mechanisms like anycast which may cause requests to 662 a DNS server at an IP address to be delivered to any one of several 663 machines. (External requests to a DNS server behind a NAT box usually 664 occur via port forwarding such that all such requests go to one 665 host.) However, it is impossible to solve this the way the similar 666 problem was solved for NATed clients; if the Server Cookie was 667 included in the calculation of the Client Cookie the same way the 668 Client Cookie is included in the Server Cookie, you would just get an 669 almost infinite series of errors as a request was repeatedly retried. 671 For servers accessed via anycast to successfully support DNS COOKIES, 672 the server clones must either all use the same server secret or the 673 mechanism that distributes requests to them must cause the requests 674 from a particular client to go to a particular server for a 675 sufficiently long period of time that extra requests due to changes 676 in Server Cookie resulting from accessing different server machines 677 are not unduly burdensome. (When such anycast-accessed servers act 678 as recursive servers or otherwise act as clients they normally use a 679 different unique address to source their requests to avoid confusion 680 in the delivery of responses.) 682 For simplicity, it is RECOMMENDED that the same server secret be used 683 by each DNS server in a set of anycast servers. If there is limited 684 time skew in updating this secret in different anycast servers, this 685 can be handled by a server accepting requests containing a Server 686 Cookie based on either its old or new secret for the maximum likely 687 time period of such time skew (see also Section 5.5). 689 7. Deployment 691 The DNS cookies mechanism is designed for incremental deployment and 692 to complement the orthogonal techniques in [RFC5452]. Either or both 693 techniques can be deployed independently at each DNS server and 694 client. 696 In particular, a DNS server or client that implements the DNS COOKIE 697 mechanism can interoperate successfully with a DNS client or server 698 that does not implement this mechanism although, of course, in this 699 case it will not get the benefit of the mechanism and the server 700 involved might choose to severely rate limit responses. When such a 701 server or client interoperates with a client or server which also 702 implements the DNS cookies mechanism, they get the weak security 703 benefits of the DNS Cookies mechanism. 705 8. IANA Considerations 707 IANA has assigned the following OPT option value: 709 Value Name Status Reference 710 -------- ------ -------- --------------- 711 10 COOKIE Standard [this document] 713 IANA is requested to assign a new DNS error code in the range above 714 16 and below 3,840 as follows: 716 RCODE Name Description Reference 717 -------- --------- ------------------------- --------------- 718 TBD[23] BADCOOKIE Bad/missing server cookie [this document] 720 9. Security Considerations 722 DNS Cookies provide a weak form of authentication of DNS requests and 723 responses. In particular, they provide no protection against "on- 724 path" adversaries; that is, they provide no protection against any 725 adversary that can observe the plain text DNS traffic, such as an on- 726 path router, bridge, or any device on an on-path shared link (unless 727 the DNS traffic in question on that path is encrypted). 729 For example, if a host is connected via an unsecured IEEE Std 802.11 730 link (Wi-Fi), any device in the vicinity that could receive and 731 decode the 802.11 transmissions must be considered "on-path". On the 732 other hand, in a similar situation but one where 802.11 Robust 733 Security (WPAv2) is appropriately deployed on the Wi-Fi network 734 nodes, only the Access Point via which the host is connecting is "on- 735 path" as far as the 802.11 link is concerned. 737 Despite these limitations, deployment of DNS Cookies on the global 738 Internet is expected to provide a substantial reduction in the 739 available launch points for the traffic amplification and denial of 740 service forgery attacks described in Section 2 above. 742 Should stronger message/transaction security be desired, it is 743 suggested that TSIG or SIG(0) security be used (see Section 3.2); 744 however, it may be useful to use DNS Cookies in conjunction with 745 these features. In particular, DNS Cookies could screen out many DNS 746 messages before the cryptographic computations of TSIG or SIG(0) are 747 required and, if SIG(0) is in use, DNS Cookies could usefully screen 748 out many requests given that SIG(0) does not screen requests but only 749 authenticates the response of complete transactions. 751 9.1 Cookie Algorithm Considerations 753 The cookie computation algorithm for use in DNS Cookies SHOULD be 754 based on a pseudo-random function at least as strong as FNV (Fowler- 755 Noll-Vo [FNV]) because an excessively weak or trivial algorithm could 756 enable adversaries to guess cookies. However, in light of the weak 757 plain-text token security provided by DNS Cookies, a strong 758 cryptography hash algorithm may not be warranted in many cases, and 759 would cause an increased computational burden. Nevertheless there is 760 nothing wrong with using something stronger, for example, HMAC- 761 SHA256-64 [RFC6234], assuming a DNS processor has adequate 762 computational resources available. DNS processors that feel the need 763 for somewhat stronger security without a significant increase in 764 computational load should consider more frequent changes in their 765 client and/or server secret; however, this does require more frequent 766 generation of a cryptographically strong random number [RFC4086]. See 767 Appendices A and B for specific examples of cookie computation 768 algorithms. 770 10. Implementation Considerations 772 The DNS Cookie Option specified herein is implemented in BIND 9.10 773 using a experimental option code. 775 Normative References 777 [RFC1035] - Mockapetris, P., "Domain names - implementation and 778 specification", STD 13, RFC 1035, DOI 10.17487/RFC1035, 779 November 1987, . 781 [RFC2119] - Bradner, S., "Key words for use in RFCs to Indicate 782 Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, 783 March 1997, . 785 [RFC4086] - Eastlake 3rd, D., Schiller, J., and S. Crocker, 786 "Randomness Requirements for Security", BCP 106, RFC 4086, DOI 787 10.17487/RFC4086, June 2005, . 790 [RFC6891] - Damas, J., Graff, M., and P. Vixie, "Extension Mechanisms 791 for DNS (EDNS(0))", STD 75, RFC 6891, DOI 10.17487/RFC6891, 792 April 2013, . 794 Informative References 796 [FNV] - G. Fowler, L. C. Noll, K.-P. Vo, D. Eastlake, "The FNV Non- 797 Cryptographic Hash Algorithm", draft-eastlake-fnv, work in 798 progress. 800 [RFC2845] - Vixie, P., Gudmundsson, O., Eastlake 3rd, D., and B. 801 Wellington, "Secret Key Transaction Authentication for DNS 802 (TSIG)", RFC 2845, DOI 10.17487/RFC2845, May 2000, 803 . 805 [RFC2930] - Eastlake 3rd, D., "Secret Key Establishment for DNS (TKEY 806 RR)", RFC 2930, DOI 10.17487/RFC2930, September 2000, 807 . 809 [RFC2931] - Eastlake 3rd, D., "DNS Request and Transaction Signatures 810 ( SIG(0)s )", RFC 2931, DOI 10.17487/RFC2931, September 2000, 811 . 813 [RFC3022] - Srisuresh, P. and K. Egevang, "Traditional IP Network 814 Address Translator (Traditional NAT)", RFC 3022, DOI 815 10.17487/RFC3022, January 2001, . 818 [RFC4033] - Arends, R., Austein, R., Larson, M., Massey, D., and S. 819 Rose, "DNS Security Introduction and Requirements", RFC 4033, 820 DOI 10.17487/RFC4033, March 2005, . 823 [RFC4034] - Arends, R., Austein, R., Larson, M., Massey, D., and S. 824 Rose, "Resource Records for the DNS Security Extensions", RFC 825 4034, DOI 10.17487/RFC4034, March 2005, . 828 [RFC4035] - Arends, R., Austein, R., Larson, M., Massey, D., and S. 829 Rose, "Protocol Modifications for the DNS Security Extensions", 830 RFC 4035, DOI 10.17487/RFC4035, March 2005, . 833 [RFC4966] - Aoun, C. and E. Davies, "Reasons to Move the Network 834 Address Translator - Protocol Translator (NAT-PT) to Historic 835 Status", RFC 4966, DOI 10.17487/RFC4966, July 2007, 836 . 838 [RFC5452] - Hubert, A. and R. van Mook, "Measures for Making DNS More 839 Resilient against Forged Answers", RFC 5452, DOI 840 10.17487/RFC5452, January 2009, . 843 [RFC6234] - Eastlake 3rd, D. and T. Hansen, "US Secure Hash 844 Algorithms (SHA and SHA-based HMAC and HKDF)", RFC 6234, DOI 845 10.17487/RFC6234, May 2011, . 848 Acknowledgements 850 The contributions of the following are gratefully acknowledged: 852 Gayle Noble, Tim Wicinski 854 The document was prepared in raw nroff. All macros used were defined 855 within the source file. 857 Appendix A: Example Client Cookie Algorithms 859 A.1 A Simple Algorithm 861 An simple example method to compute Client Cookies is the FNV-64 862 [FNV] of the server IP address and the client secret. That is 864 Client Cookie = FNV-64 ( Client Secret | Server IP Address ) 866 where "|" indicates concatenation. 868 A.2 A More Complex Algorithm 870 A more complex algorithm to calculate Client Cookies is given below. 871 It uses more computational resources than the simpler algorithm shown 872 in A.1. 874 Client Cookie = HMAC-SHA256-64 ( Client Secret, 875 Server IP Address ) 877 Appendix B: Example Server Cookie Algorithms 879 B.1 A Simple Algorithm 881 An example of a simple method producing a 64-bit Server Cookie is the 882 FNV-64 [FNV] of the request IP address, the Client Cookie, and the 883 server secret. That is 885 Server Cookie = 886 FNV-64 ( Server Secret | Request IP Address | Client Cookie ) 888 where "|" represents concatenation. 890 B.2 A More Complex Algorithm 892 Since the Server Cookie has a variable size, the server can store 893 various information in that field as long as it is hard for an 894 adversary to guess the entire quantity used for weak authentication. 895 There should be 64 bits of entropy in the Server Cookie; for example 896 it could have a sub-field of 64-bits computed pseudo-randomly with 897 the server secret as one of the inputs to the pseudo-random function. 898 Types of additional information that could be stored include a time 899 stamp and/or a nonce. 901 The example below is one variation for the Server Cookie that has 902 been implemented in a beta release of BIND where the Server Cookie is 903 128 bits composed as follows: 905 Sub-field Size 906 --------- --------- 907 Nonce 32 bits 908 Time 32 bits 909 Hash 64 bits 911 With this algorithm, the server sends a new 128-bit cookie back with 912 every request. The Nonce field assures a low probability that there 913 would be a duplicate. 915 The Time field gives the server time and makes it easy to reject old 916 cookies. 918 The Hash part of the Server Cookie is the hard-to-guess part. In the 919 beta release of BIND, its computation can be configured to use AES, 920 HMAC-SHA1, or, as shown below, HMAC-SHA256: 922 hash = 923 HMAC-SHA256-64 ( Server Secret, 924 (Client Cookie | nonce | time | client IP Address) ) 926 where "|" represents concatenation. 928 Author's Address 930 Donald E. Eastlake 3rd 931 Huawei Technologies 932 155 Beaver Street 933 Milford, MA 01757 USA 935 Telephone: +1-508-333-2270 936 EMail: d3e3e3@gmail.com 938 Mark Andrews 939 Internet Systems Consortium 940 950 Charter Street 941 Redwood City, CA 94063 USA 943 Email: marka@isc.org 945 Copyright, Disclaimer, and Additional IPR Provisions 947 Copyright (c) 2015 IETF Trust and the persons identified as the 948 document authors. All rights reserved. 950 This document is subject to BCP 78 and the IETF Trust's Legal 951 Provisions Relating to IETF Documents 952 (http://trustee.ietf.org/license-info) in effect on the date of 953 publication of this document. Please review these documents 954 carefully, as they describe your rights and restrictions with respect 955 to this document. Code Components extracted from this document must 956 include Simplified BSD License text as described in Section 4.e of 957 the Trust Legal Provisions and are provided without warranty as 958 described in the Simplified BSD License.