idnits 2.17.1 draft-ietf-dnssd-privacy-02.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 3, 2017) is 2488 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) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) == Outdated reference: A later version (-05) exists of draft-ietf-dnssd-pairing-01 == Outdated reference: A later version (-25) exists of draft-ietf-dnssd-push-11 == Outdated reference: A later version (-28) exists of draft-ietf-tls-tls13-20 -- Obsolete informational reference (is this intentional?): RFC 7626 (Obsoleted by RFC 9076) Summary: 1 error (**), 0 flaws (~~), 4 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group C. Huitema 3 Internet-Draft Private Octopus Inc. 4 Intended status: Standards Track D. Kaiser 5 Expires: January 4, 2018 University of Konstanz 6 July 3, 2017 8 Privacy Extensions for DNS-SD 9 draft-ietf-dnssd-privacy-02.txt 11 Abstract 13 DNS-SD (DNS Service Discovery) normally discloses information about 14 both the devices offering services and the devices requesting 15 services. This information includes host names, network parameters, 16 and possibly a further description of the corresponding service 17 instance. Especially when mobile devices engage in DNS Service 18 Discovery over Multicast DNS at a public hotspot, a serious privacy 19 problem arises. 21 We propose to solve this problem by a two-stage approach. In the 22 first stage, hosts discover Private Discovery Service Instances via 23 DNS-SD using special formats to protect their privacy. These service 24 instances correspond to Private Discovery Servers running on peers. 25 In the second stage, hosts directly query these Private Discovery 26 Servers via DNS-SD over TLS. A pairwise shared secret necessary to 27 establish these connections is only known to hosts authorized by a 28 pairing system. 30 Status of This Memo 32 This Internet-Draft is submitted in full conformance with the 33 provisions of BCP 78 and BCP 79. 35 Internet-Drafts are working documents of the Internet Engineering 36 Task Force (IETF). Note that other groups may also distribute 37 working documents as Internet-Drafts. The list of current Internet- 38 Drafts is at http://datatracker.ietf.org/drafts/current/. 40 Internet-Drafts are draft documents valid for a maximum of six months 41 and may be updated, replaced, or obsoleted by other documents at any 42 time. It is inappropriate to use Internet-Drafts as reference 43 material or to cite them other than as "work in progress." 45 This Internet-Draft will expire on January 4, 2018. 47 Copyright Notice 49 Copyright (c) 2017 IETF Trust and the persons identified as the 50 document authors. All rights reserved. 52 This document is subject to BCP 78 and the IETF Trust's Legal 53 Provisions Relating to IETF Documents 54 (http://trustee.ietf.org/license-info) in effect on the date of 55 publication of this document. Please review these documents 56 carefully, as they describe your rights and restrictions with respect 57 to this document. Code Components extracted from this document must 58 include Simplified BSD License text as described in Section 4.e of 59 the Trust Legal Provisions and are provided without warranty as 60 described in the Simplified BSD License. 62 Table of Contents 64 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 65 1.1. Requirements . . . . . . . . . . . . . . . . . . . . . . 4 66 2. Privacy Implications of DNS-SD . . . . . . . . . . . . . . . 4 67 2.1. Privacy Implication of Publishing Service Instance Names 4 68 2.2. Privacy Implication of Publishing Node Names . . . . . . 5 69 2.3. Privacy Implication of Publishing Service Attributes . . 5 70 2.4. Device Fingerprinting . . . . . . . . . . . . . . . . . . 6 71 2.5. Privacy Implication of Discovering Services . . . . . . . 7 72 3. Design of the Private DNS-SD Discovery Service . . . . . . . 7 73 3.1. Device Pairing . . . . . . . . . . . . . . . . . . . . . 8 74 3.2. Discovery of the Private Discovery Service . . . . . . . 8 75 3.2.1. Obfuscated Instance Names . . . . . . . . . . . . . . 9 76 3.2.2. Using a Predictable Nonce . . . . . . . . . . . . . . 9 77 3.2.3. Using a Short Proof . . . . . . . . . . . . . . . . . 10 78 3.2.4. Direct Queries . . . . . . . . . . . . . . . . . . . 12 79 3.3. Private Discovery Service . . . . . . . . . . . . . . . . 12 80 3.3.1. A Note on Private DNS Services . . . . . . . . . . . 13 81 3.4. Randomized Host Names . . . . . . . . . . . . . . . . . . 14 82 3.5. Timing of Obfuscation and Randomization . . . . . . . . . 14 83 4. Private Discovery Service Specification . . . . . . . . . . . 14 84 4.1. Host Name Randomization . . . . . . . . . . . . . . . . . 15 85 4.2. Device Pairing . . . . . . . . . . . . . . . . . . . . . 15 86 4.3. Private Discovery Server . . . . . . . . . . . . . . . . 15 87 4.3.1. Establishing TLS Connections . . . . . . . . . . . . 16 88 4.4. Publishing Private Discovery Service Instances . . . . . 16 89 4.5. Discovering Private Discovery Service Instances . . . . . 17 90 4.6. Direct Discovery of Private Discovery Service Instances . 18 91 4.7. Using the Private Discovery Service . . . . . . . . . . . 18 92 5. Security Considerations . . . . . . . . . . . . . . . . . . . 18 93 5.1. Attacks Against the Pairing System . . . . . . . . . . . 19 94 5.2. Denial of Discovery of the Private Discovery Service . . 19 95 5.3. Replay Attacks Against Discovery of the Private Discovery 96 Service . . . . . . . . . . . . . . . . . . . . . . . . . 19 97 5.4. Denial of Private Discovery Service . . . . . . . . . . . 20 98 5.5. Replay Attacks against the Private Discovery Service . . 20 99 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 21 100 7. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 21 101 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 21 102 8.1. Normative References . . . . . . . . . . . . . . . . . . 21 103 8.2. Informative References . . . . . . . . . . . . . . . . . 22 104 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 23 106 1. Introduction 108 DNS-SD [RFC6763] over mDNS [RFC6762] enables configurationless 109 service discovery in local networks. It is very convenient for 110 users, but it requires the public exposure of the offering and 111 requesting identities along with information about the offered and 112 requested services. Parts of the published information can seriously 113 breach the user's privacy. These privacy issues and potential 114 solutions are discussed in [KW14a] and [KW14b]. 116 There are cases when nodes connected to a network want to provide or 117 consume services without exposing their identity to the other parties 118 connected to the same network. Consider for example a traveler 119 wanting to upload pictures from a phone to a laptop when connected to 120 the Wi-Fi network of an Internet cafe, or two travelers who want to 121 share files between their laptops when waiting for their plane in an 122 airport lounge. 124 We expect that these exchanges will start with a discovery procedure 125 using DNS-SD [RFC6763] over mDNS [RFC6762]. One of the devices will 126 publish the availability of a service, such as a picture library or a 127 file store in our examples. The user of the other device will 128 discover this service, and then connect to it. 130 When analyzing these scenarios in Section 2, we find that the DNS-SD 131 messages leak identifying information such as the instance name, the 132 host name or service properties. We review the design constraint of 133 a solution in Section 3, and describe the proposed solution in 134 Section 4. 136 While we focus on a mDNS-based distribution of the DNS-SD resource 137 records, our solution is agnostic about the distribution method and 138 also works with other distribution methods, e.g. the classical 139 hierarchical DNS. 141 1.1. Requirements 143 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 144 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 145 document are to be interpreted as described in [RFC2119]. 147 2. Privacy Implications of DNS-SD 149 DNS-Based Service Discovery (DNS-SD) is defined in [RFC6763]. It 150 allows nodes to publish the availability of an instance of a service 151 by inserting specific records in the DNS ([RFC1033], [RFC1034], 152 [RFC1035]) or by publishing these records locally using multicast DNS 153 (mDNS) [RFC6762]. Available services are described using three types 154 of records: 156 PTR Record: Associates a service type in the domain with an 157 "instance" name of this service type. 159 SRV Record: Provides the node name, port number, priority and weight 160 associated with the service instance, in conformance with 161 [RFC2782]. 163 TXT Record: Provides a set of attribute-value pairs describing 164 specific properties of the service instance. 166 In the remaining subsections, we will review the privacy issues 167 related to publishing instance names, node names, service attributes 168 and other data, as well as review the implications of using the 169 discovery service as a client. 171 2.1. Privacy Implication of Publishing Service Instance Names 173 In the first phase of discovery, the client obtains all the PTR 174 records associated with a service type in a given naming domain. 175 Each PTR record contains a Service Instance Name defined in Section 4 176 of [RFC6763]: 178 Service Instance Name = . . 180 The portion of the Service Instance Name is meant to 181 convey enough information for users of discovery clients to easily 182 select the desired service instance. Nodes that use DNS-SD over mDNS 183 [RFC6762] in a mobile environment will rely on the specificity of the 184 instance name to identify the desired service instance. In our 185 example of users wanting to upload pictures to a laptop in an 186 Internet Cafe, the list of available service instances may look like: 188 Alice's Images . _imageStore._tcp . local 189 Alice's Mobile Phone . _presence._tcp . local 190 Alice's Notebook . _presence._tcp . local 191 Bob's Notebook . _presence._tcp . local 192 Carol's Notebook . _presence._tcp . local 194 Alice will see the list on her phone and understand intuitively that 195 she should pick the first item. The discovery will "just work". 197 However, DNS-SD/mDNS will reveal to anybody that Alice is currently 198 visiting the Internet Cafe. It further discloses the fact that she 199 uses two devices, shares an image store, and uses a chat application 200 supporting the _presence protocol on both of her devices. She might 201 currently chat with Bob or Carol, as they are also using a _presence 202 supporting chat application. This information is not just available 203 to devices actively browsing for and offering services, but to 204 anybody passively listing to the network traffic. 206 2.2. Privacy Implication of Publishing Node Names 208 The SRV records contain the DNS name of the node publishing the 209 service. Typical implementations construct this DNS name by 210 concatenating the "host name" of the node with the name of the local 211 domain. The privacy implications of this practice are reviewed in 212 [RFC8117]. Depending on naming practices, the host name is either a 213 strong identifier of the device, or at a minimum a partial 214 identifier. It enables tracking of both the device, and, by 215 extension, the device's owner. 217 2.3. Privacy Implication of Publishing Service Attributes 219 The TXT record's attribute-value pairs contain information on the 220 characteristics of the corresponding service instance. This in turn 221 reveals information about the devices that publish services. The 222 amount of information varies widely with the particular service and 223 its implementation: 225 o Some attributes like the paper size available in a printer, are 226 the same on many devices, and thus only provide limited 227 information to a tracker. 229 o Attributes that have freeform values, such as the name of a 230 directory, may reveal much more information. 232 Combinations of attributes have more information power than specific 233 attributes, and can potentially be used for "fingerprinting" a 234 specific device. 236 Information contained in TXT records does not only breach privacy by 237 making devices trackable, but might directly contain private 238 information about the user. For instance the _presence service 239 reveals the "chat status" to everyone in the same network. Users 240 might not be aware of that. 242 Further, TXT records often contain version information about services 243 allowing potential attackers to identify devices running exploit- 244 prone versions of a certain service. 246 2.4. Device Fingerprinting 248 The combination of information published in DNS-SD has the potential 249 to provide a "fingerprint" of a specific device. Such information 250 includes: 252 o The list of services published by the device, which can be 253 retrieved because the SRV records will point to the same host 254 name. 256 o The specific attributes describing these services. 258 o The port numbers used by the services. 260 o The values of the priority and weight attributes in the SRV 261 records. 263 This combination of services and attributes will often be sufficient 264 to identify the version of the software running on a device. If a 265 device publishes many services with rich sets of attributes, the 266 combination may be sufficient to identify the specific device. 268 A sometimes heard argument is that devices providing services can be 269 identified by observing the local traffic, and that trying to hide 270 the presence of the service is futile. This argument, however, does 271 not carry much weight because 273 1. proving privacy at the discovery layer is of the essence for 274 enabling automatically configured privacy-preserving network 275 applications. Application layer protocols are not forced to 276 leverage the offered privacy, but if device tracking is not 277 prevented at the deeper layers, including the service discovery 278 layer, obfuscating a certain service's protocol at the 279 application layer is futile. 281 2. Further, even if the application layer does not protect privacy, 282 it is hard to record and analyse the unicast traffic (which most 283 applications will generate) compared to just listening to the 284 multicast messages sent by DNS-SD/mDNS. 286 The same argument can be extended to say that the pattern of services 287 offered by a device allows for fingerprinting the device. This may 288 or may not be true, since we can expect that services will be 289 designed or updated to avoid leaking fingerprints. In any case, the 290 design of the discovery service should avoid making a bad situation 291 worse, and should as much as possible avoid providing new 292 fingerprinting information. 294 2.5. Privacy Implication of Discovering Services 296 The consumers of services engage in discovery, and in doing so reveal 297 some information such as the list of services they are interested in 298 and the domains in which they are looking for the services. When the 299 clients select specific instances of services, they reveal their 300 preference for these instances. This can be benign if the service 301 type is very common, but it could be more problematic for sensitive 302 services, such as for example some private messaging services. 304 One way to protect clients would be to somehow encrypt the requested 305 service types. Of course, just as we noted in Section 2.4, traffic 306 analysis can often reveal the service. 308 3. Design of the Private DNS-SD Discovery Service 310 In this section, we present the design of a two-stage solution that 311 enables private use of DNS-SD, without affecting existing users. The 312 solution is largely based on the architecture proposed in [KW14b], 313 which separates the general private discovery problem in three 314 components. The first component is an offline pairing mechanism, 315 which is performed only once per pair of users. It establishes a 316 shared secret over an authenticated channel, allowing devices to 317 authenticate using this secret without user interaction at any later 318 point in time. We use the pairing system proposed in 319 [I-D.ietf-dnssd-pairing]. 321 The further two components are online (in contrast to pairing they 322 are performed anew each time joining a network) and compose the two 323 service discovery stages, namely 325 o Discovery of the Private Discovery Service -- the first stage -- 326 in which hosts discover the Private Discovery Service (PDS), a 327 special service offered by every host supporting our extension. 328 After the discovery, hosts connect to the PSD offered by paired 329 peers. 331 o Actual Service Discovery -- the second stage -- is performed 332 through the Private Discovery Service, which only accepts 333 encrypted messages associated with an authenticated session; thus 334 not compromising privacy. 336 In other words, the hosts first discover paired peers and then 337 directly engage in privacy preserving service discovery. 339 The stages are independent with respect to means used for 340 transmitting the necessary data. While in our extension the messages 341 for the first stage are transmitted using IP multicast, the messages 342 for the second stage are transmitted via unicast. One could also 343 imagine using a Distributed Hash Table for the first stage, being 344 completely independent of multicast. 346 3.1. Device Pairing 348 Any private discovery solution needs to differentiate between 349 authorized devices, which are allowed to get information about 350 discoverable entities, and other devices, which should not be aware 351 of the availability of private entities. The commonly used solution 352 to this problem is establishing a "device pairing". 354 Device pairing has to be performed only once per pair of users. This 355 is important for user-friendliness, as it is the only step that 356 demands user-interaction. After this single pairing, privacy 357 preserving service discovery works fully automatically. In this 358 document, we utilize [I-D.ietf-dnssd-pairing] as the pairing 359 mechanism. 361 The pairing yields a mutually authenticated shared secret, and 362 optionally mutually authenticated public keys or certificates added 363 to a local web of trust. Public key technology has many advantages, 364 but shared secrets are typically easier to handle on small devices. 366 3.2. Discovery of the Private Discovery Service 368 The first stage of service discovery is to check whether instances of 369 compatible Private Discovery Services are available in the local 370 scope. The goal of that stage is to identify devices that share a 371 pairing with the querier, and are available locally. The service 372 instances can be discovered using regular DNS-SD procedures, but the 373 list of discovered services will have to be filtered so only paired 374 devices are retained. 376 3.2.1. Obfuscated Instance Names 378 The instance names for the Private Discovery Service are obfuscated, 379 so that authorized peers can associate the instance with its 380 publisher, but unauthorized peers can only observe what looks like a 381 random name. To achieve this, the names are composed as the 382 concatenation of a nonce and a proof, which is composed by hashing 383 the nonce with a pairing key: 385 PrivateInstanceName = | 386 proof = hash(|) 388 The publisher will publish as many instances as it has established 389 pairings. 391 The discovering party that looks for instances of the service will 392 receive lists of advertisements from nodes present on the network. 393 For each advertisement, it will parse the instance name, and then, 394 for each available pairing key, compares the proof to the hash of the 395 nonce concatenated with this pairing key. If there is no match, it 396 discards the instance name. If there is a match, it has discovered a 397 peer. 399 3.2.2. Using a Predictable Nonce 401 Assume that there are N nodes on the local scope, and that each node 402 has on average M pairings. Each node will publish on average M 403 records, and the node engaging in discovery may have to process on 404 average N*M instance names. The discovering node will have to 405 compute on average M potential hashes for each nonce. The number of 406 hash computations would scale as O(N*M*M), which means that it could 407 cause a significant drain of resource in large networks. 409 In order to minimize the amount of computing resource, we suggest 410 that the nonce be derived from the current time, for example set to a 411 representation of the current time rounded to some period. With this 412 convention, receivers can predict the nonces that will appear in the 413 published instances. 415 The publishers will have to create new records at the end of each 416 rounding period. If the rounding period is set too short, they will 417 have to repeat that very often, which is inefficient. On the other 418 hand, if the rounding period is too long, the system may be exposed 419 to replay attacks. We propose to set a value of about 5 minutes, 420 which seems to be a reasonable compromise. 422 Receivers can pre-calculate all the M relevant proofs once per time 423 interval and then establish a mapping from the corresponding instance 424 names to the pairing data in form of a hash table. These M relevant 425 proofs are the proofs resulting from hashing a host's M pairing keys 426 alongside the current nonce. Each time they receive an instance 427 name, they can test in O(1) time if the received service information 428 is relevant or not. 430 Unix defines a 32 bit time stamp as the number of seconds elapsed 431 since January 1st, 1970 not counting leap seconds. The most 432 significant 24 bits of this 32 bit number represent the number of 256 433 seconds intervals since the epoch. 256 seconds correspond to 4 434 minutes and 16 seconds, which is close enough to our design goal of 5 435 minutes. We will thus use this 24 bit number as nonce, represented 436 as 3 octets. 438 For coping with time skew, receivers pre-calculate proofs for the 439 respective next time interval and store hash tables for the last, the 440 current, and the next time interval. When receiving a service 441 instance name, receivers first check whether the nonce corresponds to 442 the current, the last or the next time interval, and if so, check 443 whether the instance name is in the corresponding hash table. For 444 (approximately) meeting our design goal of 5 min validity, the last 445 time interval may only be considered if the current one is less than 446 half way over and the next time interval may only be considered if 447 the current time interval is more than half way over. 449 Publishers will need to compute O(M) hashes at most once per time 450 stamp interval. If records can be created "on the fly", publishers 451 will only need to perform that computation upon receipt of the first 452 query during a given interval, and cache the computed results for the 453 remainder of the interval. There are however scenarios in which 454 records have to be produced in advance, for example when records are 455 published within a scope defined by a domain name and managed by a 456 "classic" DNS server. In such scenarios, publishers will need to 457 perform the computations and publication exactly once per time stamp 458 interval. 460 3.2.3. Using a Short Proof 462 Devices will have to publish as many instance names as they have 463 peers. The instance names will have to be represented via a text 464 string, which means that the binary concatenation of nonce and proof 465 will have to be encoded using a binary-to-text conversion such as 466 BASE64 ([RFC2045] section 6.8) or BASE32 ([RFC4648] section 6). 468 Using long proofs, such as the full output of SHA256 [RFC4055], would 469 generate fairly long instance names: 48 characters using BASE64, or 470 56 using BASE32. These long names would inflate the network traffic 471 required when discovering the privacy service. They would also limit 472 the number of DNS-SD PTR records that could be packed in a single 473 1500 octet sized packet, to 23 or fewer with BASE64, or 20 or fewer 474 with BASE32. 476 Shorter proofs lead to shorter messages, which is more efficient as 477 long as we do not encounter too many collisions. A collision will 478 happen if the proof computed by the publisher using one key matches a 479 proof computed by a receiver using another key. If a receiver 480 mistakenly believes that a proof fits one of its peers, it will 481 attempt to connect to the service as explained in section Section 4.5 482 but in the absence of the proper pairwise shared key, the connection 483 will fail. This will not create an actual error, but the probability 484 of such events should be kept low. 486 The following table provides the probability that a discovery agent 487 maintaining 100 pairings will observe a collision after receiving 488 100000 advertisement records. It also provides the number of 489 characters required for the encoding of the corresponding instance 490 name in BASE64 or BASE32, assuming 24 bit nonces. 492 +-------+------------+--------+--------+ 493 | Proof | Collisions | BASE64 | BASE32 | 494 +-------+------------+--------+--------+ 495 | 24 | 5.96046% | 8 | 16 | 496 | 32 | 0.02328% | 11 | 16 | 497 | 40 | 0.00009% | 12 | 16 | 498 | 48 | 3.6E-09 | 12 | 16 | 499 | 56 | 1.4E-11 | 15 | 16 | 500 +-------+------------+--------+--------+ 502 Table 1 504 The table shows that for a proof, 24 bits would be too short. 32 bits 505 might be long enough, but the BASE64 encoding requires padding if the 506 input is not an even multiple of 24 bits, and BASE32 requires padding 507 if the input is not a multiple of 40 bits. Given that, the desirable 508 proof lengths are thus 48 bits if using BASE64, or 56 bits if using 509 BASE32. The resulting instance name will be either 12 characters 510 long with BASE64, allowing 54 advertisements in an 1500 byte mDNS 511 message, or 16 characters long with BASE32, allowing 47 512 advertisements per message. 514 In the specification section, we will assume BASE64, and 48 bit 515 proofs composed of the first 6 bytes of a SHA256 hash. 517 3.2.4. Direct Queries 519 The preceding sections assume that the discovery is performed using 520 the classic DNS-SD process, in which a query for all available 521 "instance names" of a service provides a list of PTR records. The 522 discoverer will then select the instance names that correspond to its 523 peers, and request the SRV and TXT records corresponding to the 524 service instance, and then obtain the relevant A or AAAA records. 525 This is generally required in DNS-SD because the instance names are 526 not known in advance, but for the Private Discovery Service the 527 instance names can be predicted, and a more efficient Direct Query 528 method can be used. 530 At a given time, the node engaged in discovery can predict the nonce 531 that its peer will use, since that nonce is composed by rounding the 532 current time. The node can also compute the proofs that its peers 533 might use, since it knows the nonce and the keys. The node can thus 534 build a list of instance names, and directly query the SRV records 535 corresponding to these names. If peers are present, they will answer 536 directly. 538 This "direct query" process will result in fewer network messages 539 than the regular DNS-SD query process in some circumstances, 540 depending on the number of peers per node and the number of nodes 541 publishing the presence discovery service in the desired scope. 543 When using mDNS, it is possible to pack multiple queries in a single 544 broadcast message. Using name compression and 12 characters per 545 instance name, it is possible to pack 70 queries in a 1500 octet mDNS 546 multicast message. It is also possible to request unicast replies to 547 the queries, resulting in significant efficiency gains in wireless 548 networks. 550 3.3. Private Discovery Service 552 The Private Discovery Service discovery allows discovering a list of 553 available paired devices, and verifying that either party knows the 554 corresponding shared secret. At that point, the querier can engage 555 in a series of directed discoveries. 557 We have considered defining an ad-hoc protocol for the private 558 discovery service, but found that just using TLS would be much 559 simpler. The directed Private Discovery Service is just a regular 560 DNS-SD service, accessed over TLS, using the encapsulation of DNS 561 over TLS defined in [RFC7858]. The main difference with plain DNS 562 over TLS is the need for authentication. 564 We assume that the pairing process has provided each pair of 565 authorized client and server with a shared secret. We can use that 566 shared secret to provide mutual authentication of clients and servers 567 using "Pre-Shared Key" authentication, as defined in [RFC4279] and 568 incorporated in the latest version of TLS [I-D.ietf-tls-tls13]. 570 One difficulty is the reliance on a key identifier in the protocol. 571 For example, in TLS 1.3 the PSK extension is defined as: 573 opaque psk_identity<0..2^16-1>; 575 struct { 576 select (Role) { 577 case client: 578 psk_identity identities<2..2^16-1>; 580 case server: 581 uint16 selected_identity; 582 } 583 } PreSharedKeyExtension 585 According to the protocol, the PSK identity is passed in clear text 586 at the beginning of the key exchange. This is logical, since server 587 and clients need to identify the secret that will be used to protect 588 the connection. But if we used a static identifier for the key, 589 adversaries could use that identifier to track server and clients. 590 The solution is to use a time-varying identifier, constructed exactly 591 like the "proof" described in Section 3.2, by concatenating a nonce 592 and the hash of the nonce with the shared secret. 594 3.3.1. A Note on Private DNS Services 596 Our solution uses a variant of the DNS over TLS protocol [RFC7858] 597 defined by the DNS Private Exchange working group (DPRIVE). DPRIVE 598 further published an UDP variant, DNS over DTLS [RFC8094], which 599 would also be a candidate. 601 DPRIVE and Private Discovery solve however two somewhat different 602 problems. DPRIVE is concerned with the confidentiality of DNS 603 transactions, addressing the problems outlined in [RFC7626]. 604 However, DPRIVE does not address the confidentiality or privacy 605 issues with publication of services, and is not a direct solution to 606 DNS-SD privacy: 608 o Discovery queries are scoped by the domain name within which 609 services are published. As nodes move and visit arbitrary 610 networks, there is no guarantee that the domain services for these 611 networks will be accessible using DNS over TLS or DNS over DTLS. 613 o Information placed in the DNS is considered public. Even if the 614 server does support DNS over TLS, third parties will still be able 615 to discover the content of PTR, SRV and TXT records. 617 o Neither DNS over TLS nor DNS over DTLS applies to MDNS. 619 In contrast, we propose using mutual authentication of the client and 620 server as part of the TLS solution, to ensure that only authorized 621 parties learn the presence of a service. 623 3.4. Randomized Host Names 625 Instead of publishing their actual host names in the SRV records, 626 nodes could publish randomized host names. That is the solution 627 argued for in [RFC8117]. 629 Randomized host names will prevent some of the tracking. Host names 630 are typically not visible by the users, and randomizing host names 631 will probably not cause much usability issues. 633 3.5. Timing of Obfuscation and Randomization 635 It is important that the obfuscation of instance names is performed 636 at the right time, and that the obfuscated names change in synchrony 637 with other identifiers, such as MAC Addresses, IP Addresses or host 638 names. If the randomized host name changed but the instance name 639 remained constant, an adversary would have no difficulty linking the 640 old and new host names. Similarly, if IP or MAC addresses changed 641 but host names remained constant, the adversary could link the new 642 addresses to the old ones using the published name. 644 The problem is handled in [RFC8117], which recommends to pick a new 645 random host name at the time of connecting to a new network. New 646 instance names for the Private Discovery Services should be composed 647 at the same time. 649 4. Private Discovery Service Specification 651 The proposed solution uses the following components: 653 o Host name randomization to prevent tracking. 655 o Device pairing yielding pairwise shared secrets. 657 o A Private Discovery Server (PDS) running on each host. 659 o Discovery of the PDS instances using DNS-SD. 661 These components are detailed in the following subsections. 663 4.1. Host Name Randomization 665 Nodes publishing services with DNS-SD and concerned about their 666 privacy MUST use a randomized host name. The randomized name MUST be 667 changed when network connectivity changes, to avoid the correlation 668 issues described in Section 3.5. The randomized host name MUST be 669 used in the SRV records describing the service instance, and the 670 corresponding A or AAAA records MUST be made available through DNS or 671 MDNS, within the same scope as the PTR, SRV and TXT records used by 672 DNS-SD. 674 If the link-layer address of the network connection is properly 675 obfuscated (e.g. using MAC Address Randomization), the Randomized 676 Host Name MAY be computed using the algorithm described in section 677 3.7 of [RFC7844]. If this is not possible, the randomized host name 678 SHOULD be constructed by simply picking a 48 bit random number 679 meeting the Randomness Requirements for Security expressed in 680 [RFC4075], and then use the hexadecimal representation of this number 681 as the obfuscated host name. 683 4.2. Device Pairing 685 Nodes that want to leverage the Private Directory Service for private 686 service discovery among peers MUST share a secret with each of these 687 peers. Each shared secret MUST be a 256 bit randomly chosen number. 688 We RECOMMEND using the pairing mechanism proposed in 689 [I-D.ietf-dnssd-pairing] to establish these secrets. 691 [[TODO: Should we support mutually authenticated certificates? They 692 can also be used to initiate TLS and have several advantages, i.e. 693 allow setting an expiry date.]] 695 4.3. Private Discovery Server 697 A Private Discovery Server (PDS) is a minimal DNS server running on 698 each host. Its task is to offer resource records corresponding to 699 private services only to authorized peers. These peers MUST share a 700 secret with the host (see Section 4.2). To ensure privacy of the 701 requests, the service is only available over TLS [RFC5246], and the 702 shared secrets are used to mutually authenticate peers and servers. 704 The Private Name Server SHOULD support DNS push notifications 705 [I-D.ietf-dnssd-push], e.g. to facilitate an up-to-date contact list 706 in a chat application without polling. 708 4.3.1. Establishing TLS Connections 710 The PDS MUST only answer queries via DNS over TLS [RFC7858] and MUST 711 use a PSK authenticated TLS handshake [RFC4279]. The client and 712 server SHOULD negotiate a forward secure cipher suite such as DHE-PSK 713 or ECDHE-PSK when available. The shared secret exchanged during 714 pairing MUST be used as PSK. To guarantee interoperability, 715 implementations of the Private Name Server MUST support 716 TLS_PSK_WITH_AES_256_GCM_SHA384. 718 When using the PSK based authentication, the "psk_identity" parameter 719 identifying the pre-shared key MUST be identical to the "Instance 720 Identifier" defined in Section 4.4, i.e. 24 bit nonce and 48 bit 721 proof encoded in BASE64 as 12 character string. The server will use 722 the pairing key associated with this instance identifier. 724 4.4. Publishing Private Discovery Service Instances 726 Nodes that provide the Private Discovery Service SHOULD advertise 727 their availability by publishing instances of the service through 728 DNS-SD. 730 The DNS-SD service type for the Private Discovery Service is 731 "_pds._tcp". 733 Each published instance describes one server and one pairing. In the 734 case where a node manages more than one pairing, it should publish as 735 many instances as necessary to advertise the PDS to all paired peers. 737 Each instance name is composed as follows: 739 pick a 24 bit nonce, set to the 24 most 740 significant bits of the 32 bit Unix GMT time. 742 compute a 48 bit proof: 743 proof = first 48 bits of HASH(|) 745 set the 72 bit binary identifier as the concatenation 746 of nonce and proof 748 set instance_name = BASE64(binary identifier) 750 In this formula, HASH SHOULD be the function SHA256 defined in 751 [RFC4055], and BASE64 is defined in section 6.8 of [RFC2045]. The 752 concatenation of a 24 bit nonce and 48 bit proof result in a 72 bit 753 string. The BASE64 conversion is 12 characters long per [RFC6763]. 755 4.5. Discovering Private Discovery Service Instances 757 Nodes that wish to discover Private Discovery Service Instances 758 SHOULD issue a DNS-SD discovery request for the service type 759 "_pds._tcp". They MAY, as an alternative, use the Direct Discovery 760 procedure defined in Section 4.6. If nodes send a DNS-SD discovery 761 request, they will receive in response a series of PTR records, 762 providing the names of the instances present in the scope. 764 For each time interval, the querier SHOULD pre-calculate a hash table 765 mapping instance names to pairings according to the following 766 conceptual algorithm: 768 nonce = 24 bit rounded time stamp of the\ 769 respective next time interval 770 for each available pairing 771 retrieve the key Xj of pairing number j 772 compute F = first 48 bits of hash(nonce, Xj) 773 construct the binary instance_name as described\ 774 in the previous section 775 instance_names[nonce][instance_name] = Xj; 777 The querier SHOULD store the hash tables for the previous, the 778 current, and the next time interval. 780 The querier SHOULD examine each instance to see whether it 781 corresponds to one of its available pairings, according to the 782 following conceptual algorithm: 784 for each received instance_name: 785 convert the instance name to binary using BASE64 786 if the conversion fails, 787 discard the instance. 788 if the binary instance length is not multiple 72 bits, 789 discard the instance. 791 nonce = first 24 bits of binary. 793 Check that the nonce matches the first 24 bits of 794 the current time, or the previous interval (24 bit number 795 minus 1) if the current interval is less than half over, 796 or the next interval (24 bit number plus 1) if the 797 current interval is more than half over. If the 798 nonce does not match an acceptable value, discard 799 the instance. 801 if ((Xj = instance_names[nonce][instance_name]) != null) 802 mark the pairing number j as available 804 The check of the current time is meant to mitigate replay attacks, 805 while not mandating a time synchronization precision better than two 806 minutes. 808 Once a pairing has been marked available, the querier SHOULD try 809 connecting to the corresponding instance, using the selected key. 810 The connection is likely to succeed, but it MAY fail for a variety of 811 reasons. One of these reasons is the probabilistic nature of the 812 hint, which entails a small chance of "false positive" match. This 813 will occur if the hash of the nonce with two different keys produces 814 the same result. In that case, the TLS connection will fail with an 815 authentication error or a decryption error. 817 4.6. Direct Discovery of Private Discovery Service Instances 819 Nodes that wish to discover Private Discovery Service Instances MAY 820 use the following Direct Discovery procedure instead of the regular 821 DNS-SD Discovery explained in Section 4.5. 823 To perform Direct Discovery, nodes should compose a list of Private 824 Discovery Service Instances Names. There will be one name for each 825 pairing available to the node. The Instance name for each name will 826 be composed of a nonce and a proof, using the algorithm specified in 827 Section 4.4. 829 The querier will issue SRV record queries for each of these names. 830 The queries will only succeed if the corresponding instance is 831 present, in which case a pairing is discovered. After that, the 832 querier SHOULD try connecting to the corresponding instance, as 833 explained in Section 4.4. 835 4.7. Using the Private Discovery Service 837 Once instances of the Private Discovery Service have been discovered, 838 peers can establish TLS connections and send DNS requests over these 839 connections, as specified in DNS-SD. 841 5. Security Considerations 843 This document specifies a method for protecting the privacy of nodes 844 that offer and query for services. This is especially useful when 845 operating in a public space. Hiding the identity of the publishing 846 nodes prevents some forms of "targeting" of high value nodes. 847 However, adversaries can attempt various attacks to break the 848 anonymity of the service, or to deny it. A list of these attacks and 849 their mitigations are described in the following sections. 851 5.1. Attacks Against the Pairing System 853 There are a variety of attacks against pairing systems, which may 854 result in compromised pairing secrets. If an adversary manages to 855 acquire a compromised key, the adversary will be able to perform 856 private service discovery according to Section 4.5. This will allow 857 tracking of the service. The adversary will also be able to discover 858 which private services are available for the compromised pairing. 860 Attacks on pairing systems are detailed in [I-D.ietf-dnssd-pairing]. 862 5.2. Denial of Discovery of the Private Discovery Service 864 The algorithm described in Section 4.5 scales as O(M*N), where M is 865 the number of pairings per node and N is the number of nodes in the 866 local scope. Adversaries can attack this service by publishing 867 "fake" instances, effectively increasing the number N in that scaling 868 equation. 870 Similar attacks can be mounted against DNS-SD: creating fake 871 instances will generally increase the noise in the system and make 872 discovery less usable. Private Discovery Service discovery SHOULD 873 use the same mitigations as DNS-SD. 875 The attack could be amplified if the clients needed to compute proofs 876 for all the nonces presented in Private Discovery Service Instance 877 names. This is mitigated by the specification of nonces as rounded 878 time stamps in Section 4.5. If we assume that timestamps must not be 879 too old, there will be a finite number of valid rounded timestamps at 880 any time. Even if there are many instances present, they would all 881 pick their nonces from this small number of rounded timestamps, and a 882 smart client will make sure that proofs are only computed once per 883 valid time stamp. 885 5.3. Replay Attacks Against Discovery of the Private Discovery Service 887 Adversaries can record the service instance names published by 888 Private Discovery Service instances, and replay them later in 889 different contexts. Peers engaging in discovery can be misled into 890 believing that a paired server is present. They will attempt to 891 connect to the absent peer, and in doing so will disclose their 892 presence in a monitored scope. 894 The binary instance identifiers defined in Section 4.4 start with 24 895 bits encoding the most significant bits of the "UNIX" time. In order 896 to protect against replay attacks, clients SHOULD verify that this 897 time is reasonably recent, as specified in Section 4.5. 899 [[TODO: Should we somehow encode the scope in the identifier? Having 900 both scope and time would really mitigate that attack. For example, 901 one could add a local IPv4 or IPv6 prefix in the nonce. However, 902 this won't work in networks behind NAT. It would also increase the 903 size of the instance name.]] 905 5.4. Denial of Private Discovery Service 907 The Private Discovery Service is only available through a mutually 908 authenticated TLS connection, which provides state-of-the-art 909 protection mechanisms. However, adversaries can mount a denial of 910 service attack against the service. In the absence of shared 911 secrets, the connections will fail, but the servers will expend some 912 CPU cycles defending against them. 914 To mitigate such attacks, nodes SHOULD restrict the range of network 915 addresses from which they accept connections, matching the expected 916 scope of the service. 918 This mitigation will not prevent denial of service attacks performed 919 by locally connected adversaries; but protecting against local denial 920 of service attacks is generally very difficult. For example, local 921 attackers can also attack mDNS and DNS-SD by generating a large 922 number of multicast requests. 924 5.5. Replay Attacks against the Private Discovery Service 926 Adversaries may record the PSK Key Identifiers used in successful 927 connections to a private discovery service. They could attempt to 928 replay them later against nodes advertising the private service at 929 other times or at other locations. If the PSK Identifier is still 930 valid, the server will accept the TLS connection, and in doing so 931 will reveal being the same server observed at a previous time or 932 location. 934 The PSK identifiers defined in Section 4.3.1 start with the 24 most 935 significant bits of the "UNIX" time. In order to mitigate replay 936 attacks, servers SHOULD verify that this time is reasonably recent, 937 and fail the connection if it is too old, or if it occurs too far in 938 the future. 940 The processing of timestamps is however affected by the accuracy of 941 computer clocks. If the check is too strict, reasonable connections 942 could fail. To further mitigate replay attacks, servers MAY record 943 the list of valid PSK identifiers received in a recent past, and fail 944 connections if one of these identifiers is replayed. 946 6. IANA Considerations 948 This draft does not require any IANA action. (Or does it? What 949 about the _pds tag?) 951 7. Acknowledgments 953 This draft results from initial discussions with Dave Thaler, and 954 encouragements from the DNS-SD working group members. 956 8. References 958 8.1. Normative References 960 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 961 Extensions (MIME) Part One: Format of Internet Message 962 Bodies", RFC 2045, DOI 10.17487/RFC2045, November 1996, 963 . 965 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 966 Requirement Levels", BCP 14, RFC 2119, 967 DOI 10.17487/RFC2119, March 1997, 968 . 970 [RFC4055] Schaad, J., Kaliski, B., and R. Housley, "Additional 971 Algorithms and Identifiers for RSA Cryptography for use in 972 the Internet X.509 Public Key Infrastructure Certificate 973 and Certificate Revocation List (CRL) Profile", RFC 4055, 974 DOI 10.17487/RFC4055, June 2005, 975 . 977 [RFC4075] Kalusivalingam, V., "Simple Network Time Protocol (SNTP) 978 Configuration Option for DHCPv6", RFC 4075, 979 DOI 10.17487/RFC4075, May 2005, 980 . 982 [RFC4279] Eronen, P., Ed. and H. Tschofenig, Ed., "Pre-Shared Key 983 Ciphersuites for Transport Layer Security (TLS)", 984 RFC 4279, DOI 10.17487/RFC4279, December 2005, 985 . 987 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 988 (TLS) Protocol Version 1.2", RFC 5246, 989 DOI 10.17487/RFC5246, August 2008, 990 . 992 [RFC6763] Cheshire, S. and M. Krochmal, "DNS-Based Service 993 Discovery", RFC 6763, DOI 10.17487/RFC6763, February 2013, 994 . 996 8.2. Informative References 998 [I-D.ietf-dnssd-pairing] 999 Huitema, C. and D. Kaiser, "Device Pairing Using Short 1000 Authentication Strings", draft-ietf-dnssd-pairing-01 (work 1001 in progress), March 2017. 1003 [I-D.ietf-dnssd-push] 1004 Pusateri, T. and S. Cheshire, "DNS Push Notifications", 1005 draft-ietf-dnssd-push-11 (work in progress), June 2017. 1007 [I-D.ietf-tls-tls13] 1008 Rescorla, E., "The Transport Layer Security (TLS) Protocol 1009 Version 1.3", draft-ietf-tls-tls13-20 (work in progress), 1010 April 2017. 1012 [KW14a] Kaiser, D. and M. Waldvogel, "Adding Privacy to Multicast 1013 DNS Service Discovery", DOI 10.1109/TrustCom.2014.107, 1014 2014, . 1017 [KW14b] Kaiser, D. and M. Waldvogel, "Efficient Privacy Preserving 1018 Multicast DNS Service Discovery", 1019 DOI 10.1109/HPCC.2014.141, 2014, 1020 . 1023 [RFC1033] Lottor, M., "Domain Administrators Operations Guide", 1024 RFC 1033, DOI 10.17487/RFC1033, November 1987, 1025 . 1027 [RFC1034] Mockapetris, P., "Domain names - concepts and facilities", 1028 STD 13, RFC 1034, DOI 10.17487/RFC1034, November 1987, 1029 . 1031 [RFC1035] Mockapetris, P., "Domain names - implementation and 1032 specification", STD 13, RFC 1035, DOI 10.17487/RFC1035, 1033 November 1987, . 1035 [RFC2782] Gulbrandsen, A., Vixie, P., and L. Esibov, "A DNS RR for 1036 specifying the location of services (DNS SRV)", RFC 2782, 1037 DOI 10.17487/RFC2782, February 2000, 1038 . 1040 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 1041 Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006, 1042 . 1044 [RFC6762] Cheshire, S. and M. Krochmal, "Multicast DNS", RFC 6762, 1045 DOI 10.17487/RFC6762, February 2013, 1046 . 1048 [RFC7626] Bortzmeyer, S., "DNS Privacy Considerations", RFC 7626, 1049 DOI 10.17487/RFC7626, August 2015, 1050 . 1052 [RFC7844] Huitema, C., Mrugalski, T., and S. Krishnan, "Anonymity 1053 Profiles for DHCP Clients", RFC 7844, 1054 DOI 10.17487/RFC7844, May 2016, 1055 . 1057 [RFC7858] Hu, Z., Zhu, L., Heidemann, J., Mankin, A., Wessels, D., 1058 and P. Hoffman, "Specification for DNS over Transport 1059 Layer Security (TLS)", RFC 7858, DOI 10.17487/RFC7858, May 1060 2016, . 1062 [RFC8094] Reddy, T., Wing, D., and P. Patil, "DNS over Datagram 1063 Transport Layer Security (DTLS)", RFC 8094, 1064 DOI 10.17487/RFC8094, February 2017, 1065 . 1067 [RFC8117] Huitema, C., Thaler, D., and R. Winter, "Current Hostname 1068 Practice Considered Harmful", RFC 8117, 1069 DOI 10.17487/RFC8117, March 2017, 1070 . 1072 Authors' Addresses 1074 Christian Huitema 1075 Private Octopus Inc. 1076 Friday Harbor, WA 98250 1077 U.S.A. 1079 Email: huitema@huitema.net 1080 URI: http://privateoctopus.com/ 1081 Daniel Kaiser 1082 University of Konstanz 1083 Konstanz 78457 1084 Germany 1086 Email: daniel.kaiser@uni-konstanz.de