A place to cache linked articles (think custom and personal wayback machine)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.md 19KB

5 lat temu
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. title: Centralised DoH is bad for privacy, in 2019 and beyond
  2. url: https://blog.powerdns.com/2019/09/25/centralised-doh-is-bad-for-privacy-in-2019-and-beyond/
  3. hash_url: f14ac41ec597f2a6af377eabaf6cc66b
  4. <p>Recently, Mozilla announced it would be <a href="https://blog.mozilla.org/futurereleases/2019/09/06/whats-next-in-making-dns-over-https-the-default/">moving Firefox DNS lookups to Cloudflare by default, for its American audience</a>. There will be a notification about this for existing users, at which point they could choose to go back to provider DNS. But crucially, there will be no opt-in: it is Cloudflare by default, using <a href="https://blog.powerdns.com/2019/02/07/the-big-dns-privacy-debate-at-fosdem/">a technology called DoH</a>.</p>
  5. <p>This reignited some controversy, mostly in Europe, where meetings and panels in <a href="https://www.youtube.com/watch?v=pjin3nv8jAo">Amsterdam</a>, <a href="https://neutralinterconnectdays.nl/speakers/bert-hubert/">The Hague</a>, <a href="http://www.frnog.org/?page=frnog33&amp;lang=en">Paris</a> and <a href="https://www.youtube.com/watch?v=FqVX8WplEPg&amp;feature=youtu.be&amp;list=PLjzK5ZtLlc93nQTtvvXNplEMZJu1NicqR&amp;t=2698">Belfast</a> went over the pros and cons of this move, because it might well come to our shores as well.</p>
  6. <p>During these discussions, I noticed that we haven’t been very analytical about what moving and encrypting DNS does for privacy. Many people appear to conflate the concepts of privacy and encryption, which are in fact very different things.</p>
  7. <p>In this post I argue that in September 2019, centralised DoH “by default” is a net-negative for privacy for everyone and that even in later years it will not improve privacy outside of the most privacy hostile environments – where no one should rely on partial measures like DoH to stay secure.</p>
  8. <h2 id="recapping-what-doh-does">Recapping what DoH does</h2>
  9. <p>DNS is currently typically provided by the operator of a network, which could be your Internet Service Provider, your phone company, your employer or your proverbially evil coffeeshop WiFi.</p>
  10. <p>DNS provided this way is never encrypted. Anyone observing your network traffic can see which DNS lookups are made. A more capable person could also inject fake answers, potentially rerouting your traffic.</p>
  11. <p>DNS over HTTPS meanwhile encrypts DNS queries going over the network, which means that no one between you and the DoH server can see your DNS queries or modify the DNS responses.</p>
  12. <p><strong>Crucially, in both plain DNS and DoH, the operator of the DNS server can see, sell, block and modify your DNS data.</strong> It is only the people in between that get locked out.</p>
  13. <p>DNS privacy matters. Or more in general, knowing what sites you visit matters: your traffic metadata. A complete listing of sites (and servers) contacted will reveal where you work, live, study, what your hobbies are, what equipment/devices you own, what sports teams you follow, which health care providers you frequent, what brand of car you (want to) own &amp; likely your sexual preferences.</p>
  14. <p>Many governments will also be very interested in who communicates with political parties or organizations they don’t like.</p>
  15. <p>Restricting and choosing who can see the meta-data of what sites you visit is therefore very worthwhile.</p>
  16. <p>DNS is one of four ways in which such meta-data gets transmitted in plaintext. For starters, browsers do not exclusively perform HTTPS requests. Many visits still start with a plaintext HTTP request that then redirects to HTTPS.</p>
  17. <p>Secondly, TLS (which underlies HTTPS) very often has to transmit, in plaintext, the name of the site (or server) the user intends to connect to. This is true even in TLS 1.3. There is an <a href="https://datatracker.ietf.org/doc/draft-ietf-tls-esni/history/">IETF draft standard</a> for encrypting this plaintext Server Name Indication, but it is not widely adopted, and needs serious work before it can be standardised.</p>
  18. <blockquote><p>It is frequently and mistakenly thought that TLS 1.3 has plugged this leak, it hasn’t. To verify, try: <code>sudo tshark -i eth0 -T fields -e ssl.handshake.extensions_server_name -Y ssl.handshake.extensions_server_name -n</code></p></blockquote>
  19. <p>Thirdly, to ensure that the certificate used for a TLS connection is valid, many browsers and TLS stacks will perform an OCSP lookup to the Certificate Authority provider. This lookup itself is also plaintext. Note that with some care, <a href="https://www.digicert.com/ssl-support/nginx-enable-ocsp-stapling-on-server.htm">OCSP lookups can be prevented</a>.</p>
  20. <p>Finally, research has uncovered that <a href="https://blog.apnic.net/2019/08/23/what-can-you-learn-from-an-ip-address/">over 95% of websites can uniquely be identified</a> purely by the set of IP addresses they are hosted on, and these IP addresses also can’t be encrypted.</p>
  21. <p>I should also note that unless special measures are taken, a whole horde of dedicated web tracking companies (like Facebook and Google) will record and monetize most of your moves online anyhow, no matter how well encrypted your connection.</p>
  22. <h2 id="privacy-before-and-after-doh">Privacy before and after DoH</h2>
  23. <p>From the above, we see that DNS over HTTPS plugs only one of four (or five) avenues leaking sites visited.</p>
  24. <p>But if we sum it up, pre-DoH, the following parties have access to the names of most of the sites you visit:</p>
  25. <ol>
  26. <li>Your own network provider</li>
  27. <li>Your own government, police, intelligence services (through court orders)</li>
  28. <li>Anyone capable of snooping your local network</li>
  29. <li>Certificate authority providers (through OCSP)</li>
  30. <li>Large scale tracking &amp; advertising companies (Google, Facebook)</li>
  31. </ol>
  32. <p>DNS over HTTPS in browsers is currently exclusively offered by/through American companies. So after switching to DoH, we have to add the following to our list:</p>
  33. <ol>
  34. <li>Cloudflare / your DoH provider</li>
  35. <li>The US Government, NSA, FBI etc</li>
  36. </ol>
  37. <p>Because DoH does not encrypt anything that is not also present in plain text, there is nothing to remove from the list.</p>
  38. <p><strong>Based on this, we can conclude that as it stands, using DoH to a browser-provisioned cloud provider effectively worsens your privacy position.</strong></p>
  39. <p>Note: DNS over HTTPS is the protocol, and it could be used to enhance privacy. Using DoH to move DNS to the cloud is a specific way of using DoH that is damaging to privacy in 2019.</p>
  40. <h2 id="dns-over-https-offers-additional-tracking-capabilities">DNS over HTTPS offers additional tracking capabilities</h2>
  41. <p>DNS over HTTPS opens up DNS to all the tracking possibilities present in HTTPS and TLS. As it stands, DNS over UDP almost always gets some free privacy by mixing all devices on a network together – an outside snooper sees a stream of queries coming from a household, a coffeeshop or even an entire office building, with no way to tie a query to any specific device or user. Such mixing of queries provides an imperfect but useful modicum of privacy.</p>
  42. <p>DNS over HTTPS however neatly separates out each device (and even each individual application on that device) to a separate query stream. This alone is worrying, as we now have individual users’ queries, but the TLS that underlies HTTPS also typically uses <a href="https://blog.cloudflare.com/tls-session-resumption-full-speed-and-secure/">TLS Resumption</a> which offers even further tracking capabilities.</p>
  43. <p>In short, setting up an encrypted connection eats up precious CPU cycles both on client and server. It is therefore possible to reuse a previously established encrypted state for subsequent connections, which saves a lot of time and processor energy.</p>
  44. <p>It does however make it possible to track an application from IP address to IP address because this TLS Resumption session ID <a href="https://nakedsecurity.sophos.com/2018/10/25/could-tls-session-resumption-be-another-super-cookie/">is effectively a cookie</a> that uniquely tracks users across network and IP address changes.</p>
  45. <h2 id="but-what-about-the-privacy-agreement">But what about the privacy agreement?</h2>
  46. <p>DoH providers typically publish privacy policies in which they pledge to provide you excellent DNS service without them benefiting in any way from your data, except possibly through very abstract research, or nebulous performance benefits that might attract customers for other products.</p>
  47. <p>History has shown that the overwhelming majority of providers of free services that carry interesting user data have eventually failed at keeping this promise – either by <a href="https://www.upguard.com/breaches/verizon-cloud-leak">being compromised</a> or by <a href="https://www.androidauthority.com/google-location-history-lawsuit-897097/">accidentally</a> using <a href="https://www.claimsjournal.com/news/national/2019/06/17/291497.htm">the</a> <a href="https://9to5mac.com/2019/08/07/siri-lawsuit-recordings/">data</a> <a href="https://www.theguardian.com/technology/2019/jul/12/facebook-fine-ftc-privacy-violations">anyhow</a>. Apologies ensue, but trust never returns.</p>
  48. <p>In addition to this hypothetical future misbehaviour, no privacy agreement stands up to a court order to hand over data in bulk. It so happens that the US legal &amp; intelligence climate frequently does in fact use <a href="https://twitter.com/nytimes/status/1175001702535192576">subpoenas and national security letters to hoover up user data</a>. It should also be noted that specifically US law affords <a href="https://twitter.com/PowerDNS_Bert/status/1171148978915872768">far less privacy protection</a> to “<a href="https://en.wikipedia.org/wiki/United_States_person">non-US persons</a>“ than the already meager protection provided to American citizens.</p>
  49. <p>Also, US law extends to all servers and services operated by US companies, so “hosting data in Switzerland” <a href="https://twitter.com/PowerDNS_Bert/status/1162459443487019009">does not provide protection</a> if the operator is American.</p>
  50. <p>So relying on a privacy agreement as some kind of <a href="https://twitter.com/adambroach/status/1170227987431792640">axiomatic guarantee of</a> privacy is not grounded in history <a href="https://twitter.com/PowerDNS_Bert/status/1162459443487019009">nor in legal fact</a>.</p>
  51. <h2 id="dns-for-security">DNS for Security</h2>
  52. <p>DNS itself is, oddly enough, not much of a security function in a browser. We derive secrecy and integrity from TLS, which in itself does not care about DNS. As an extreme example, a DNS provider could simply hand out 198.51.100.1 as answer to any browser query, receive TLS connections on that address &amp; connect to the right server from there based on the Server Name Indication, and <a href="https://github.com/dlundquist/sniproxy">things would just work</a>.</p>
  53. <p>This would not allow any snooping (because TLS is end-to-end, and will check the certificate provided by the server hosting that name), but it does show that DNS integrity is irrelevant for browser security, as long as TLS is used faithfully (and we have no alternative to it anyhow).</p>
  54. <h2 id="dns-for-adblocking-censorship-cdn-distribution">DNS for adblocking, censorship, CDN distribution</h2>
  55. <p>Although DNS can not change TLS protected data, it can surely prevent access to such data. Countries frequently use DNS as a censorship choke point because it is easy and cheap. Russia, Turkey and Indonesia use DNS extensively to block access to sites their governments do not like.</p>
  56. <p>Phones and increasingly browsers do not make it easy to block advertisements. One simple way of doing so anyhow <a href="https://pi-hole.net/">is through DNS</a>. Sabotaging the lookups for popular ad-servers is a very effective way of blocking advertising content.</p>
  57. <p>Similarly, using lists of known malware associated domain names, it is very possible to cheaply block devices from accessing botnet infrastructure.</p>
  58. <p>Finally, DNS can be used to optimize connectivity to streaming video caches, based on the IP address of the client computer. Several very large scale CDNs and service providers rely on this technique to route users to the right server.</p>
  59. <p>One significant change with DoH is that the choice what to censor (or block) moves from the network operator to the browser vendor (who picks the DoH provider). If you are a privacy activist this is great, as long as you trust your browser vendor (and its government) more than your own country.</p>
  60. <p>If you want to block ads, malware or if you need to route users to the best server, this will only be possible if the selected DoH vendor provides this service. This may not always be the case, especially if your browser or DoH vendor is also in the advertising business, or in fact competes with other CDNs.</p>
  61. <h2 id="service-provider-originated-doh">Service provider originated DoH</h2>
  62. <p>I (and many others) argue that encrypted DNS is good and that we should be doing more of it. This often gets rejected out of hand because there is no encrypted way to provision a nameserver.</p>
  63. <p>When we connect to a network, in almost all cases our devices get configured automatically with the right network settings &amp; nameservers to use. Crucially, this autoconfiguration (be it DHCP or PPP) is not itself super-encrypted. So although our WiFi or 4G may be encrypted, the nameserver address is provided in plaintext over that connection.</p>
  64. <p>This would allow a clever attacker to provision a snooping DoH server, defeating the point of DoH.</p>
  65. <p>Because of this reason, browser vendors argue that they must ignore this autoconfiguration and hardcode a DoH server to use, over at a vendor they have selected on behalf of the user.</p>
  66. <p>However – we should realize that the worst thing a network provider can do is inject a nameserver to learn what they could already learn from 3 other ways in which a browser leaks what it connects to!</p>
  67. <h2 id="doh-for-oppressive-regimes">DoH for oppressive regimes</h2>
  68. <p>It is frequently brought up that DoH is <a href="https://twitter.com/tcely/status/1175446535716462593">not built for privileged westeners</a> living in countries with (perhaps deteriorating) rule of law. DoH is instead offered as a way for people living in oppressive regimes to evade censorship and scrutiny, which surely is a laudable goal.</p>
  69. <p>It is often said that a little knowledge is a dangerous thing. I have no experience as a political freedom fighter, but I do have family members who have had to flee their profoundly undemocratic country because they are members of persecuted minority.</p>
  70. <p>Some years ago I contacted them because a flaw had been found in TLS encryption that might be dangerous for them, and to my surprise no one there cared. They had been assuming their Internet traffic was being spied upon anyhow, and it turns they were right.</p>
  71. <p>Later they told me “we all use VPNs” and was impressed how privacy conscious they were. But no they told me, everyone does that, because without a VPN the internet here is too slow, they suspected the spying machinery was generally overloaded. The VPN was for speed. It was not assumed to deliver privacy, on which point they were also proven right (most VPN providers are pretty shady).</p>
  72. <p>I mention these two stories to show that our assumptions on oppressive regimes may be wildly off, and not represent the reality on the ground in China, Russia, Iran, Indonesia and Turkey. It is a lot of fun being an armchair imaginary political activist, but things are remarkably different if you actually live there.</p>
  73. <p>Of course, more encryption is good if it makes the life of oppressive regimes harder. It is definitely a case of “we must do something, and this is something”. It is slightly (but only slightly) harder to extract the TLS Server Name Indication than it is to parse plain DNS.</p>
  74. <p>But the dynamics of what will happen when people in those countries start relying on DoH for their safety are very hard to fathom. We hear that <a href="https://twitter.com/AliMirjamali/status/1175450125126311938">some governments</a> have already moved beyond DNS based blocking, something we also saw in Russia during “<a href="https://www.reuters.com/article/us-russia-telegram/russia-tries-more-precise-technology-to-block-telegram-messenger-idUSKCN1LF1ZZ">the Telegram wars</a>”.</p>
  75. <p>In this context, it is instrumental to see DoH as a “very partial VPN” that only encrypts DNS packets, but leaves all other packets unmodified. And in fact, the various DoH apps for phones are implemented as VPN providers. If judged as a VPN, it does look like a terrible one full of weaknesses.</p>
  76. <p>Given this, recommending DoH because it will help dissidents in dangerous countries may be a very “techbro” thing to do – assuming your invention must be helpful without fully understanding the situation. Because for all we know the false sense of security is actually more harmful.</p>
  77. <p>We may wonder why proponents aren’t instead recommending a full VPN as a solution instead of pushing an incomplete solution. Perhaps the <a href="https://www.forbes.com/sites/oreillymedia/2014/03/06/the-creep-factor-how-to-think-about-big-data-and-privacy/">creep factor</a> of routing all your traffic <a href="https://www.theverge.com/2019/2/22/18235908/facebook-onavo-vpn-privacy-service-data-collection">through a cloud provider</a> is too much?</p>
  78. <h2 id="doh-as-an-incremental-step">DoH as an incremental step</h2>
  79. <p>DoH proponents often agree that DoH itself does not fix all metadata privacy leaks, but insist it is a good step. The stated goal is to be able to eventually use any network, no mater how untrusted, and browse the web in complete privacy.</p>
  80. <p>Oddly enough, it DoH proponents say it is fine to already move everyone’s DNS to a central place in another country, even though it currently does not provide any benefit, except sending your DNS to an additional party under control of a foreign snooping happy government.</p>
  81. <p>To achieve the goal of perfect privacy on untrusted networks (without running a VPN) will require us to:</p>
  82. <ol>
  83. <li>Completely shut down plaintext HTTP</li>
  84. <li>Use encrypted DNS</li>
  85. <li>Deploy functional and downgrade-proof encrypted SNI.</li>
  86. <li>Disable OCSP/make OCSP stapling mandatory, or replacing it by an alternate mechanism.</li>
  87. <li>Host everything (every last widget) on large content distribution networks that are able to provide generic IP addresses, that have no discoverable link to the sites they are hosting.</li>
  88. </ol>
  89. <p>If and only if all these steps are completed, shutting down entire internet industries in step 5, does DoH stand a chance to deliver actual privacy benefits.</p>
  90. <h2 id="summarising">Summarising</h2>
  91. <p>Centralised DoH is currently a privacy net negative since anyone that could see your metadata can still see your metadata when DNS is moved to a third party. Additionally, that third party then gets a complete log per device of all DNS queries, in a way that can even be tracked across IP addresses.</p>
  92. <p>Even if further privacy leaks are plugged, DoH to a third party remains at best a partial solution, one that should not be relied upon as a serious security layer, since it will be hard to plug everything, especially if non-CDN content providers survive.</p>
  93. <p>Encrypting DNS is good, but if this could be done without involving additional parties, that would be better.</p>
  94. <p>And for actual privacy on untrusted networks, nothing beats a VPN, except possibly not using hostile networks.</p>