Network Working GroupInternet Engineering Task Force (IETF) A. MayrhoferInternet-DraftRequest for Comments: 8467 nic.at GmbHIntended status:Category: ExperimentalJuly 19,October 2018Expires: January 20, 2019ISSN: 2070-1721 PaddingPolicyPolicies forEDNS(0) draft-ietf-dprive-padding-policy-06Extension Mechanisms for DNS (EDNS(0)) Abstract RFC 7830 specifies theEDNS(0) 'Padding' option,"Padding" option for Extension Mechanisms for DNS (EDNS(0)) but does not specify the actual padding length for specific applications. This memo lists the possible options("Padding Policies"),("padding policies"), discusses the implications of eachof these options,option, and provides a recommended (experimental) option. Status of This Memo ThisInternet-Draftdocument issubmitted in full conformance with the provisions of BCP 78not an Internet Standards Track specification; it is published for examination, experimental implementation, andBCP 79. Internet-Drafts are working documentsevaluation. This document defines an Experimental Protocol for the Internet community. This document is a product of the Internet Engineering Task Force (IETF).Note that other groups may also distribute working documents as Internet-Drafts. The listIt represents the consensus ofcurrent Internet- Drafts is at https://datatracker.ietf.org/drafts/current/. Internet-Drafts are draftthe IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Not all documentsvalidapproved by the IESG are candidates fora maximumany level of Internet Standard; see Section 2 of RFC 7841. Information about the current status ofsix monthsthis document, any errata, and how to provide feedback on it may beupdated, replaced, or obsoleted by other documentsobtained atany time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." This Internet-Draft will expire on January 20, 2019.https://www.rfc-editor.org/info/rfc8467. Copyright Notice Copyright (c) 2018 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Table of Contents 1. Introduction. . . . . . . . . . . . . . . . . . . . . . . . 2....................................................2 2. Terminology. . . . . . . . . . . . . . . . . . . . . . . . . 3.....................................................2 3. General Guidance. . . . . . . . . . . . . . . . . . . . . . 3................................................3 4. Padding Strategies. . . . . . . . . . . . . . . . . . . . . 3..............................................3 4.1.Block Length Padding -RecommendedStrategy . . . . . . . 3Strategy: Block-Length Padding .................3 4.2. Other Strategies. . . . . . . . . . . . . . . . . . . . 5...........................................5 4.2.1.Maximal LengthMaximal-Length Padding. . . . . . . . . . . . . . . 5..............................5 4.2.2.Random LengthRandom-Length Padding. . . . . . . . . . . . . . . . 5...............................5 4.2.3.Random Block LengthRandom-Block-Length Padding. . . . . . . . . . . . . 6 6..........................6 5. IANA Considerations. . . . . . . . . . . . . . . . . . . . . 6 7..............................................6 6. Security Considerations. . . . . . . . . . . . . . . . . . . 7 9..........................................6 7. References. . . . . . . . . . . . . . . . . . . . . . . . . 8 9.1.......................................................7 7.1. Normative References. . . . . . . . . . . . . . . . . . 8 9.2........................................7 7.2. Informative References. . . . . . . . . . . . . . . . . 9.....................................7 Appendix A.Non-sensiblePadding Policies. . . . . . . . . . . 9That Are Not Sensible ................8 A.1. No Padding. . . . . . . . . . . . . . . . . . . . . . . 9.................................................8 A.2.Fixed LengthFixed-Length Padding. . . . . . . . . . . . . . . . . . 10 5........................................8 Acknowledgements. . . . . . . . . . . . . . . . . . . . . . 6...................................................9 Author's Address. . . . . . . . . . . . . . . . . . . . . . . . 10...................................................9 1. Introduction [RFC7830] specifies theExtensionsExtension Mechanisms for DNS (EDNS(0)) "Padding" option, which allows DNS clients and servers to artificially increase the size of a DNS message by a variable number of bytes, hampering size-based correlation of encrypted DNS messages. However, RFC 7830 deliberately does not specify the actual length of padding to be used. This memo discusses options regarding the actual size of padding, lists advantages and disadvantages of each of these"Padding Strategies","padding strategies", and provides a recommended (experimental) strategy. Padding DNS messages is useful only when transport isencrypted,encrypted using protocols such as DNS over Transport Layer Security [RFC7858], DNS over Datagram Transport Layer Security[RFC8094][RFC8094], or other encrypted DNS transports specified in the future. 2. Terminology The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. 3. General Guidance EDNS(0) options space: The maximum messagelengthlength, as dictated by theprotocolprotocol, limits the space for EDNS(0) options. Since padding will reduce the message space available to other EDNS(0) options, the "Padding" option MUST be the last EDNS(0) option applied before a DNS message is sent. Resource Conservation: Especially in situations where networking and processing resources are scarce(e.g. battery powered(e.g., battery-powered long-life devices, lowbandwidthbandwidth, orhigh costhigh-cost links), thetradeofftrade-off between increased size of padded DNS messages and the corresponding gain in confidentiality must be carefully considered. Transport Protocol Independence: The message size used as input to the various padding strategies MUST be calculated excluding the potential extra 2-octet length field used in TCP transport. Otherwise, the padded (observable) size of the DNS packets could significantly change between different transportprotocols,protocols and reveal an indication of the original (unpadded) length. For example, given a"Block Length" paddingBlock-Length Padding strategy with a block length of 32octets,octets and a DNS message with a size of 59 octets, the message would be padded to 64 octets when transported over UDP. If that same messagewaswere transported overTCP,TCP and the padding strategywould considerconsidered the extra 2 octets of the length field (61 octets in total), the padded message would be 96 octets long (as the minimum length of thePadding"Padding" option is 4 octets). 4. Padding Strategies This section contains a recommended strategy, as well as a non- exhaustive list of other sensiblestrategies instrategies, for choosing padding length. Note that, for completeness, Appendix A contains two more(non-sensible) strategies.strategies that are not sensible. 4.1.Block Length Padding -RecommendedStrategyStrategy: Block-Length Padding Based on empirical research performed by Daniel K. Gillmor[dkg-padding-ndss], EDNS Padding[NDSS-PADDING], padding SHOULD be performed following the"BlockBlock- LengthPadding"Padding strategy as follows: (1) Clients SHOULD pad queries to the closest multiple of 128 octets. (2) If aServerserver receives a query that includes the EDNS(0)Padding Option,"Padding" option, it MUST pad the corresponding response(See(see Section 4 ofRFC7830)RFC 7830) and SHOULD pad the corresponding response to a multiple of 468 octets (see below). Note that the recommendation aboveappliesonly applies if the DNS transport is encrypted(See(see Section 6 of RFC 7830). InBlock LengthBlock-Length Padding, a sender pads each message so that its padded length is a multiple of a chosen block length. This creates a greatly reduced variety of message lengths. An implementor needs to consider that even the zero-lengthEDNS(0) Padding Option"Padding" option increases the length of the packet by 4 octets. Options: BlockLength - forlength. For queries, values between 16 and 128 octets were discussed before empiric research was performed. Responses will require larger block sizes (see[dkg-padding-ndss][NDSS-PADDING] and above for a discussion). Very large block lengths will have confidentiality properties similar to the"Maximal Length Padding"Maximal-Length Padding strategy (Section 4.2.1), since almost all messages will fit into a single block. Such "very large block length" valuesareare: o 288 bytes for the query (the maximum size of a one-question query over TCP, without any EDNS(0)options),options) and o the EDNS(0) buffer size of the server for the responses. Advantages: This policy is reasonably easy to implement, reduces the variety of message ("fingerprint") sizes significantly, and does not require a source of (pseudo) random numbers, since the padding length required can be derived from the actual (unpadded) message. Disadvantage: Given an unpadded message and the block size of the padding (which is assumed to be public knowledge once a server is reachable), the size range of a padded message can be predicted. Therefore, the minimum length of the unpadded message can beinfered.inferred. The empirical research cited above performed a simulation of padding, based on real-world DNS traffic captured on busy recursive resolvers of a research network. The evaluation of the performance of individual padding policies was based on a "cost to attacker" and "cost to defender" function, where the "cost to attacker" was defined as the percentage of query/response pairs falling into the same sizebucket,bucket and "cost to defender" was defined as the size factor between padded and unpadded messages. Padding with a block size of 128 bytes on the queryside,side and 468 bytes on the response side was considered the optimum trade-off between defender and attacker cost. The response block size of 468 was chosen so that 3 blocks of 468 octets would still comfortably fit into typical Maximum Transmission Unit (MTU) size values. TheBlock Sizeblock size will interact with the MTU size. Especially for length values that are a large fraction of the MTU, unless the block length is chosen so that a multiple just fits into the MTU,BlockBlock- Length Padding may causeunneccessaryunnecessary fragmentation forUDP basedUDP-based delivery.Also, chosingOf course, choosing a block length larger than the MTUof coursealways forcesto always fragment.fragmentation. Note: OnceDNSSEC validatingDNSSEC-validating clients become more prevalent, observed size patterns are expected to change significantly. Insuchthat case, the recommended strategy might need to be revisited. 4.2. Other Strategies 4.2.1.Maximal LengthMaximal-Length Padding InMaximal Length PaddingMaximal-Length Padding, the sender pads every message to the maximum sizeasallowed by protocol negotiations. Advantages:Maximal LengthMaximal-Length Padding, when combined with encrypted transport, provides the highest possible level ofmessage sizemessage-size confidentiality. Disadvantages:Maximal LengthMaximal-Length Padding iswasteful,wasteful and requires resources on the client, all interveningnetworknetworks and equipment, and the server. Depending on the negotiated size, this strategy will commonly exceed theMTU,MTU andthenresult in a consistent number offragmentsfragments, reducing delivery probability whendatagram baseddatagram-based transport (such as UDP) is used. Due to resource consumption,Maximal LengthMaximal-Length Padding is NOT RECOMMENDED. 4.2.2.Random LengthRandom-Length Padding When usingRandom LengthRandom-Length Padding, a sender pads each message with a random amount of padding. Due to the size of theEDNS(0) Padding Option"Padding" option itself, each message size ishenceincreased by at least 4 octets. The upper limit for padding is the maximum message size. However, a client or server may choose to impose a lower maximum padding length. Options: Maximum and minimum padding length. Advantages: Theoretically, this policy should create a natural"distribution"distribution of message sizes. Disadvantage:Random Length paddingRandom-Length Padding allows an attacker who can observe a large number of requests to infer the length of the original value by observing the distribution of total lengths. According to the limited empirical data available,Random LengthRandom-Length Padding exposes slightly more entropy to an attacker thanBlockBlock- Length Padding.Due toBecause of that, and the risk outlined above,Random LengthRandom-Length Padding is NOT RECOMMENDED. 4.2.3.Random Block LengthRandom-Block-Length Padding This policy combinesBlock LengthBlock-Length Padding with a random component. Specifically, a sender randomly chooses between a few block length values and then appliesBlock LengthBlock-Length Padding based on the chosen block length. The random selection of block length might even be reasonably based on a "weak" source of randomness, such as the transaction ID of the message. Options: Number of and the values for the set ofBlock Lengths,block lengths; source of"randomness"randomness Advantages: Compared toBlock LengthBlock-Length Padding, this creates more variety in the resulting message sizes for a certain individual original message length. Disadvantage: Requires more implementation effort compared to simpleBlock Length Padding Random Block LengthBlock-Length Padding. Random-Block-Length Padding(asrequires further empirical study, as do other combinations of paddingstrategies) requires further empirical study. 6.strategies. 5. IANA Considerations This document has noconsiderations for IANA. 7.IANA actions. 6. Security Considerations The choice of the right padding policy (and the right parameters for the chosen policy) has a significant impact on the resilience of encrypted DNS against size-based correlation attacks. Therefore, any implementor ofEDNS(0) Paddingthe "Padding" option must carefully consider which policies to implement, the default policy chosen, which parameters to make configurable, and the default parameter values. No matter how carefully a client selects theirPaddingpadding policy, this effort can be jeopardized if the server chooses to apply an ineffectivePaddingpadding policy to the corresponding response packets. Therefore, a client applyingPaddingthe "Padding" option may want to choose a DNS serverwhich does applythat applies a padding policy on responses that is at leastanequallyeffective Padding policy on responses.effective. Note that even with encryption and padding, it might be trivial to identify that the observed traffic is DNS. Also, padding does not prevent informationleakleaks via other side channels (particularly timing information and number of query/response pairs).Counter-measuresCountermeasures against suchotherside channels could include injecting artificial "cover traffic" into the stream of DNSmessages,messages or delaying DNS responses by a certain amount of jitter. Such strategies are out of the scope of this document. Additionally, there isneithernot enough theoretic analysisnoror experimental data available to recommend any such countermeasures.9.7. References9.1.7.1. Normative References[dkg-padding-ndss][NDSS-PADDING] Gillmor, D., "Empirical DNS Padding Policy", March 2017, <https://dns.cmrg.net/ ndss2017-dprive-empirical-DNS-traffic-size.pdf>. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, <https://www.rfc-editor.org/info/rfc2119>. [RFC7830] Mayrhofer, A., "The EDNS(0) Padding Option", RFC 7830, DOI 10.17487/RFC7830, May 2016, <https://www.rfc-editor.org/info/rfc7830>. [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, <https://www.rfc-editor.org/info/rfc8174>.9.2.7.2. Informative References [RFC7858] Hu, Z., Zhu, L., Heidemann, J., Mankin, A., Wessels, D., and P. Hoffman, "Specification for DNS over Transport Layer Security (TLS)", RFC 7858, DOI 10.17487/RFC7858, May 2016, <https://www.rfc-editor.org/info/rfc7858>. [RFC8094] Reddy, T., Wing, D., and P. Patil, "DNS over Datagram Transport Layer Security (DTLS)", RFC 8094, DOI 10.17487/RFC8094, February 2017, <https://www.rfc-editor.org/info/rfc8094>. Appendix A.Non-sensiblePadding Policies That Are Not Sensible A.1. No Padding In the"No Padding"No Padding policy, theEDNS0 Padding"Padding" option is not used, and the size of the final (actually, "non-padded") message obviously exactly matches the size of the unpadded message. Even though this"non-policy""non- policy" seems redundant in this list, its properties must be considered for caseswherein which just one of the parties (client or server) applies padding. Also, this"policy"policy is required when the remaining message size of the unpadded message does not allow for thePadding"Padding" option to be included(less-- i.e., there are fewer than 4 octetsleft).left. Advantages: This"policy"policy requires no additional resources on the client,serverserver, and network side. Disadvantages: The original size of the message remainsunchanged, henceunchanged; hence, this approach provides no additional confidentiality."No Padding"The No Padding policy MUST NOT be used unless message size disallows the use ofPadding.the "Padding" option. A.2.Fixed LengthFixed-Length Padding Infixed length padding,Fixed-Length Padding, a sender chooses to pad each message with a padding of constant length. Options: Actual length of padding Advantages: Since the padding is constant in length, this policy is very easy toimplement,implement and at least ensures that the message length diverges from the length of the original packet (even if only by a fixedvalue)value). Disadvantage: Obviously, the amount of padding is easily discoverable from a single unencryptedmessage,message or by observing message patterns. When a public DNS server applies this policy, the length of the padding hence must be assumed to be public knowledge. Therefore, this policy is (almost) as useless as the"No Padding" optionNo Padding policy described above."Fixed Length Padding"The Fixed-Length Padding policy MUST NOT be used except for test applications.5.Acknowledgements Daniel K. Gillmor performed empirical research out of which the "Recommended Strategy" was copied. Stephane Bortzmeyer and Hugo Connery provided text. Shane Kerr, Sara Dickinson, Paul Hoffman, Magnus Westerlund, Charlie Kaufman, JoeClarkeClarke, and Meral Shirazipour performed reviews or provided substantial comments. Author's Address Alexander Mayrhofer nic.at GmbH Karlsplatz 1/2/9 Vienna 1010 Austria Email: alex.mayrhofer.ietf@gmail.com URI: http://edns0-padding.org/