
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title><![CDATA[ The Cloudflare Blog ]]></title>
        <description><![CDATA[ Get the latest news on how products at Cloudflare are built, technologies used, and join the teams helping to build a better Internet. ]]></description>
        <link>https://blog.cloudflare.com</link>
        <atom:link href="https://blog.cloudflare.com/" rel="self" type="application/rss+xml"/>
        <language>en-us</language>
        <image>
            <url>https://blog.cloudflare.com/favicon.png</url>
            <title>The Cloudflare Blog</title>
            <link>https://blog.cloudflare.com</link>
        </image>
        <lastBuildDate>Fri, 10 Apr 2026 01:27:56 GMT</lastBuildDate>
        <item>
            <title><![CDATA[Introducing the Cloudflare Onion Service]]></title>
            <link>https://blog.cloudflare.com/cloudflare-onion-service/</link>
            <pubDate>Thu, 20 Sep 2018 12:00:00 GMT</pubDate>
            <description><![CDATA[ Two years ago this week Cloudflare introduced Opportunistic Encryption, a feature that provided additional security and performance benefits to websites that had not yet moved to HTTPS. ]]></description>
            <content:encoded><![CDATA[ <p></p><ul><li><p><b>When</b>: a cold San Francisco summer afternoon</p></li><li><p><b>Where</b>: Room <a href="https://httpstat.us/305">305</a>, Cloudflare</p></li><li><p><b>Who</b>: 2 from Cloudflare + 9 from the Tor Project</p></li></ul><p>What could go wrong?</p>
    <div>
      <h3>Bit of Background</h3>
      <a href="#bit-of-background">
        
      </a>
    </div>
    <p>Two years ago this week Cloudflare introduced <a href="/opportunistic-encryption-bringing-http-2-to-the-unencrypted-web/">Opportunistic Encryption</a>, a feature that provided additional security and performance benefits to websites that had not yet moved to HTTPS. Indeed, back in the old days some websites only used HTTP --- weird, right? “Opportunistic” here meant that the server advertised support for HTTP/2 via an <a href="https://tools.ietf.org/html/rfc7838">HTTP Alternative Service</a> header in the hopes that any browser that recognized the protocol could take advantage of those benefits in subsequent requests to that domain.</p><p>Around the same time, CEO Matthew Prince <a href="/the-trouble-with-tor/">wrote</a> about the importance and challenges of privacy on the Internet and tasked us to find a solution that provides <b>convenience</b>, <b>security</b>, and <b>anonymity</b>.</p><p>From neutralizing fingerprinting vectors and everyday browser trackers that <a href="https://www.eff.org/privacybadger">Privacy Badger</a> feeds on, all the way to mitigating correlation attacks that only big actors are capable of, guaranteeing privacy is a complicated challenge. Fortunately, the <a href="https://www.torproject.org/">Tor Project</a> addresses this extensive <a href="https://www.torproject.org/projects/torbrowser/design/#adversary">adversary model</a> in Tor Browser.</p><p>However, the Internet is full of bad actors, and distinguishing legitimate traffic from malicious traffic, which is one of Cloudflare’s core features, becomes much more difficult when the traffic is anonymous. In particular, many features that make Tor a great tool for privacy also make it a tool for hiding the source of malicious traffic. That is why many resort to using CAPTCHA challenges to make it more expensive to be a bot on the Tor network. There is, however, a collateral damage associated with using CAPTCHA challenges to stop bots: humans eyes also have to deal with them.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/59vmBdRen9zTJnzUEwUOOL/54910c287d16f022e66afc2d8ff68d0e/Captcha-Example.png" />
            
            </figure><p>One way to minimize this is using privacy-preserving cryptographic signatures, aka blinded tokens, such as those that power <a href="/privacy-pass-the-math/">Privacy Pass</a>.</p><p>The other way is to use onions.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3CENi6YjjPGrHKOsS7hfgE/3f07dbad9c56b377cb5bcfa7d8f40c36/Onion-Cloudflare.png" />
            
            </figure>
    <div>
      <h3>Here Come the Onions</h3>
      <a href="#here-come-the-onions">
        
      </a>
    </div>
    <p>Today’s edition of the Crypto Week introduces an “opportunistic” solution to this problem, so that under suitable conditions, anyone using <a href="https://blog.torproject.org/new-release-tor-browser-80">Tor Browser 8.0</a> will benefit from improved security and performance when visiting Cloudflare websites without having to face a CAPTCHA. At the same time, this feature enables more fine-grained rate-limiting to prevent malicious traffic, and since the mechanics of the idea described here are not specific to Cloudflare, anyone can <a href="https://github.com/mahrud/caddy-altonions">reuse this method</a> on their own website.</p><p>Before we continue, if you need a refresher on what Tor is or why we are talking about onions, check out the <a href="https://www.torproject.org/about/overview.html.en">Tor Project</a> website or our own blog post on the <a href="/welcome-hidden-resolver/">DNS resolver onion</a> from June.</p><p>As Matthew mentioned in his blog post, one way to sift through Tor traffic is to use the <a href="https://www.torproject.org/docs/onion-services.html.en">onion service</a> protocol. Onion services are Tor nodes that advertise their public key, encoded as an address with .onion <a href="https://www.cloudflare.com/learning/dns/top-level-domain/">TLD</a>, and use “rendezvous points” to establish connections entirely within the Tor network:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4YwoSQd9m6fwJ4INk44fsz/7aa81a4f71f35f9323ba4173e328d356/Tor-network-example-1.png" />
            
            </figure><p>While onion services are designed to provide anonymity for content providers, <a href="https://securedrop.org/directory/">media organizations</a> use them to allow whistleblowers to communicate securely with them and <a href="https://www.facebook.com/notes/protect-the-graph/making-connections-to-facebook-more-secure/1526085754298237">Facebook</a> uses one to tell Tor users from bots.</p><p>The technical reason why this works is that from an onion service’s point of view each individual Tor connection, or circuit, has a unique but ephemeral number associated to it, while from a normal server’s point of view all Tor requests made via one exit node share the same IP address. Using this circuit number, onion services can distinguish individual circuits and terminate those that seem to behave maliciously. To clarify, this does not mean that onion services can identify or track Tor users.</p><p>While bad actors can still establish a fresh circuit by repeating the rendezvous protocol, doing so involves a cryptographic key exchange that costs time and computation. Think of this like a cryptographic <a href="https://en.wikipedia.org/wiki/File:Dial_up_modem_noises.ogg">dial-up</a> sequence. Spammers can dial our onion service over and over, but every time they have to repeat the key exchange.</p><p>Alternatively, finishing the rendezvous protocol can be thought of as a small proof of work required in order to use the Cloudflare Onion Service. This increases the cost of using our onion service for performing denial of service attacks.</p>
    <div>
      <h3>Problem solved, right?</h3>
      <a href="#problem-solved-right">
        
      </a>
    </div>
    <p>Not quite. As discussed when we introduced the <a href="/welcome-hidden-resolver/">hidden resolver</a>, the problem of ensuring that a seemingly random .onion address is correct is a barrier to usable security. In that case, our solution was to purchase an <a href="https://www.digicert.com/extended-validation-ssl.htm">Extended Validation</a> (EV) certificate, which costs considerably more. Needless to say, this limits who can buy an HTTPS certificate for their onion service to a <a href="https://crt.sh/?Identity=%25.onion">privileged few</a>.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1n6CTaL7LjM6pQGorlXIQ6/4ffd43906dcaa7fac54a098379d12171/Address-Bar.png" />
            
            </figure><p>Some people <a href="https://cabforum.org/pipermail/public/2017-November/012451.html">disagree</a>. In particular, the <a href="https://blog.torproject.org/tors-fall-harvest-next-generation-onion-services">new generation</a> of onion services resolves the weakness that Matthew pointed to as a possible reason why the CA/B Forum <a href="https://cabforum.org/2015/02/18/ballot-144-validation-rules-dot-onion-names/">only permits</a> EV certificates for onion services. This could mean that getting Domain Validation (DV) certificates for onion services could be possible soon. We certainly hope that’s the case.</p><p>Still, DV certificates lack the organization name (e.g. “Cloudflare, Inc.”) that appears in the address bar, and cryptographically relevant numbers are nearly impossible to remember or distinguish for humans. This brings us back to the problem of usable security, so we came up with a different idea.</p>
    <div>
      <h3>Looking at onion addresses differently</h3>
      <a href="#looking-at-onion-addresses-differently">
        
      </a>
    </div>
    <p>Forget for a moment that we’re discussing anonymity. When you type “cloudflare.com” in a browser and press enter, your device first resolves that domain name into an IP address, then your browser asks the server for a certificate valid for “cloudflare.com” and attempts to establish an encrypted connection with the host. As long as the certificate is trusted by a certificate authority, there’s no reason to mind the IP address.</p><p>Roughly speaking, the idea here is to simply switch the IP address in the scenario above with an .onion address. As long as the certificate is valid, the .onion address itself need not be manually entered by a user or even be memorable. Indeed, the fact that the certificate was valid indicates that the .onion address was correct.</p><p>In particular, in the same way that a single IP address can serve millions of domains, a single .onion address should be able to serve any number of domains.</p><p>Except, <a href="https://www.cloudflare.com/learning/dns/what-is-dns/">DNS</a> doesn’t work this way.</p>
    <div>
      <h3>How does it work then?</h3>
      <a href="#how-does-it-work-then">
        
      </a>
    </div>
    <p>Just as with Opportunistic Encryption, we can point users to the Cloudflare Onion Service using <a href="https://tools.ietf.org/html/rfc7838">HTTP Alternative Services</a>, a mechanism that allows servers to tell clients that the service they are accessing is available at another network location or over another protocol. For instance, when Tor Browser makes a request to “cloudflare.com,” Cloudflare adds an Alternative Service header to indicate that the site is available to access over HTTP/2 via our onion services.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/2G5bKEOaIJdnsqhNTT2Ozo/e1466f89156e68b539b2cefc8d506d2a/tor-resquest_2x.png" />
            
            </figure><p>In the same sense that Cloudflare owns the IP addresses that serve our customers’ websites, we run 10 .onion addresses. Think of them as 10 Cloudflare points of presence (or PoPs) within the Tor network. The exact header looks something like this, except with all 10 .onion addresses included, each starting with the prefix “cflare”:</p>
            <pre><code>alt-svc: h2="cflare2nge4h4yqr3574crrd7k66lil3torzbisz6uciyuzqc2h2ykyd.onion:443"; ma=86400; persist=1</code></pre>
            <p>This simply indicates that the “cloudflare.com” can be authoritatively accessed using HTTP/2 (“h2”) via the onion service “cflare2n[...].onion”, over virtual port 443. The field “ma” (max-age) indicates how long in seconds the client should remember the existence of the alternative service and “persist” indicates whether alternative service cache should be cleared when the network is interrupted.</p><p>Once the browser receives this header, it attempts to make a new Tor circuit to the onion service advertised in the alt-svc header and confirm that the server listening on virtual port 443 can present a valid certificate for “cloudflare.com” — that is, the original hostname, not the .onion address.</p><p>The onion service then relays the Client Hello packet to a local server which can serve a certificate for “cloudflare.com.” This way the Tor daemon itself can be very minimal. Here is a sample configuration file:</p>
            <pre><code>SocksPort 0
HiddenServiceNonAnonymousMode 1
HiddenServiceSingleHopMode 1
HiddenServiceVersion 3
HiddenServicePort 443
SafeLogging 1
Log notice stdout</code></pre>
            <p>Be careful with using the configuration above, as it enables a non-anonymous setting for onion services that do not require anonymity for themselves. To clarify, this does not sacrifice privacy or anonymity of Tor users, just the server. Plus, it improves latency of the circuits.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5NVzWfvM9FVH73gjp0AG3X/8a3dbf2a8440bb0f32e05626e30bb695/Tor-Onion-Service-Cloudflare.png" />
            
            </figure><p>If the certificate is signed by a trusted certificate authority, for any subsequent requests to “cloudflare.com” the browser will connect using HTTP/2 via the onion service, sidestepping the need for going through an exit node.</p><p>Here are the steps summarized one more time:</p><ol><li><p>A new Tor circuit is established;</p></li><li><p>The browser sends a Client Hello to the onion service with SNI=cloudflare.com;</p></li><li><p>The onion service relays the packet to a local server;</p></li><li><p>The server replies with Server Hello for SNI=cloudflare.com;</p></li><li><p>The onion service relays the packet to the browser;</p></li><li><p>The browser verifies that the certificate is valid.</p></li></ol><p>To reiterate, the certificate presented by the onion service only needs to be valid for the original hostname, meaning that the onion address need not be mentioned anywhere on the certificate. This is a huge benefit, because it allows you to, for instance, present a free <a href="https://letsencrypt.org">Let’s Encrypt</a> certificate for your .org domain rather than an expensive EV certificate.</p><p>Convenience, ✓</p>
    <div>
      <h3>Distinguishing the Circuits</h3>
      <a href="#distinguishing-the-circuits">
        
      </a>
    </div>
    <p>Remember that while one exit node can serve many many different clients, from Cloudflare’s point of view all of that traffic comes from one IP address. This pooling helps cover the malicious traffic among legitimate traffic, but isn’t essential in the security or privacy of Tor. In fact, it can potentially hurt users by exposing their traffic to <a href="https://trac.torproject.org/projects/tor/wiki/doc/ReportingBadRelays">bad exit nodes</a>.</p><p>Remember that Tor circuits to onion services carry a circuit number which we can use to rate-limit the circuit. Now, the question is how to inform a server such as nginx of this number with minimal effort. As it turns out, with only a <a href="https://github.com/torproject/tor/pull/343/">small tweak</a> in the Tor binary, we can insert a <a href="https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt">Proxy Protocol</a> header in the beginning of each packet that is forwarded to the server. This protocol is designed to help TCP proxies pass on parameters that can be lost in translation, such as source and destination IP addresses, and is already supported by nginx, Apache, Caddy, etc.</p><p>Luckily for us, the IPv6 space is so vast that we can encode the Tor circuit number as an IP address in an unused range and use the Proxy Protocol to send it to the server. Here is an example of the header that our Tor daemon would insert in the connection:</p>
            <pre><code>PROXY TCP6 2405:8100:8000:6366:1234:ABCD ::1 43981 443\r\n</code></pre>
            <p>In this case, 0x1234ABCD encodes the circuit number in the last 32 bits of the source IP address. The local Cloudflare server can then transparently use that IP to assign reputation, show CAPTCHAs, or block requests when needed.</p><p>Note that even though requests relayed by an onion service don’t carry an IP address, you will see an IP address like the one above with country code “T1” in your logs. This IP only specifies the circuit number seen by the onion service, not the actual user IP address. In fact, 2405:8100:8000::/48 is an unused subnet allocated to Cloudflare that we are not routing globally for this purpose.</p><p>This enables customers to continue detecting bots using IP reputation while sparing humans the trouble of clicking on CAPTCHA street signs over and over again.</p><p>Security, ✓</p>
    <div>
      <h3>Why should I trust Cloudflare?</h3>
      <a href="#why-should-i-trust-cloudflare">
        
      </a>
    </div>
    <p>You don’t need to. The Cloudflare Onion Service presents the exact same certificate that we would have used for direct requests to our servers, so you could audit this service using Certificate Transparency (which includes <a href="/introducing-certificate-transparency-and-nimbus/">Nimbus</a>, our certificate transparency log), to reveal any potential cheating.</p><p>Additionally, since Tor Browser 8.0 makes a new circuit for each hostname when connecting via an .onion alternative service, the circuit number cannot be used to link connections to two different sites together.</p><p>Note that all of this works without running any entry, relay, or exit nodes. Therefore the only requests that we see as a result of this feature are the requests that were headed for us anyway. In particular, since no new traffic is introduced, Cloudflare does not gain any more information about what people do on the internet.</p><p>Anonymity, ✓</p>
    <div>
      <h3>Is it faster?</h3>
      <a href="#is-it-faster">
        
      </a>
    </div>
    <p>Tor isn’t known for being fast. One reason for that is the physical cost of having packets bounce around in a decentralized network. Connections made through the Cloudflare Onion Service don’t add to this cost because the number of hops is no more than usual.</p><p>Another reason is the bandwidth costs of exit node operators. This is an area that we hope this service can offer relief since it shifts traffic from exit nodes to our own servers, reducing exit node operation costs along with it.</p><p>BONUS: Performance, ✓</p>
    <div>
      <h3>How do I enable it?</h3>
      <a href="#how-do-i-enable-it">
        
      </a>
    </div>
    <p>Onion Routing is now available to all Cloudflare customers, enabled by default for Free and <a href="https://www.cloudflare.com/plans/pro/">Pro plans</a>. The option is available in the Crypto tab of the Cloudflare dashboard.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/5hA2RUo2mh5WZDM5xSkwow/d407c5fb030c3df65cf64fdbad2fffcd/Screen-Shot-2018-09-20-at-7.36.11-AM.jpg" />
            
            </figure>
    <div>
      <h3>Browser support</h3>
      <a href="#browser-support">
        
      </a>
    </div>
    <p>We recommend using <a href="https://blog.torproject.org/new-release-tor-browser-80">Tor Browser 8.0</a>, which is the first stable release based on Firefox 60 ESR, and supports .onion Alt-Svc headers as well as HTTP/2. The new Tor Browser for Android (alpha) also supports this feature. You can check whether your connection is routed through an onion service or not in the Developer Tools window under the Network tab. If you're using the Tor Browser and you don't see the Alt-Svc in the response headers, that means you're already using the .onion route. In future versions of Tor Browser you'll be able to see this <a href="https://trac.torproject.org/projects/tor/ticket/27590">in the UI</a>.</p><blockquote><p>We've got BIG NEWS. We gave Tor Browser a UX overhaul.</p><p>Tor Browser 8.0 has a new user onboarding experience, an updated landing page, additional language support, and new behaviors for bridge fetching, displaying a circuit, and visiting .onion sites.<a href="https://t.co/fpCpSTXT2L">https://t.co/fpCpSTXT2L</a> <a href="https://t.co/xbj9lKTApP">pic.twitter.com/xbj9lKTApP</a></p><p>— The Tor Project (@torproject) <a href="https://twitter.com/torproject/status/1037397236257366017?ref_src=twsrc%5Etfw">September 5, 2018</a></p></blockquote><p>There is also interest from other privacy-conscious browser vendors. Tom Lowenthal, Product Manager for Privacy &amp; Security at <a href="https://brave.com/">Brave</a> said:</p><blockquote><p>Automatic upgrades to `.onion` sites will provide another layer of safety to Brave’s Private Browsing with Tor. We’re excited to implement this emerging standard.</p></blockquote>
    <div>
      <h3>Any last words?</h3>
      <a href="#any-last-words">
        
      </a>
    </div>
    <p>Similar to Opportunistic Encryption, Opportunistic Onions do not fully protect against attackers who can simply remove the alternative service header. Therefore it is important to use <a href="https://www.eff.org/https-everywhere">HTTPS Everywhere</a> to secure the first request. Once a Tor circuit is established, subsequent requests should stay in the Tor network from source to destination.</p><p>As we maintain and <a href="https://trac.torproject.org/projects/tor/ticket/27502">improve</a> this service we will share what we learn. In the meanwhile, feel free to try out this idea on <a href="https://github.com/mahrud/caddy-altonions">Caddy</a> and reach out to us with any comments or suggestions that you might have.</p>
    <div>
      <h3>Acknowledgments</h3>
      <a href="#acknowledgments">
        
      </a>
    </div>
    <p>Patrick McManus of Mozilla for enabling support for .onion alternative services in Firefox; Arthur Edelstein of the Tor Project for reviewing and enabling HTTP/2 and HTTP Alternative Services in Tor Browser 8.0; Alexander Færøy and George Kadianakis of the Tor Project for adding support for Proxy Protocol in onion services; the entire Tor Project team for their invaluable assistance and discussions; and last, but not least, many folks at Cloudflare who helped with this project.</p>
    <div>
      <h4>Addresses used by the Cloudflare Onion Service</h4>
      <a href="#addresses-used-by-the-cloudflare-onion-service">
        
      </a>
    </div>
    
            <pre><code>cflarexljc3rw355ysrkrzwapozws6nre6xsy3n4yrj7taye3uiby3ad.onion
cflarenuttlfuyn7imozr4atzvfbiw3ezgbdjdldmdx7srterayaozid.onion
cflares35lvdlczhy3r6qbza5jjxbcplzvdveabhf7bsp7y4nzmn67yd.onion
cflareusni3s7vwhq2f7gc4opsik7aa4t2ajedhzr42ez6uajaywh3qd.onion
cflareki4v3lh674hq55k3n7xd4ibkwx3pnw67rr3gkpsonjmxbktxyd.onion
cflarejlah424meosswvaeqzb54rtdetr4xva6mq2bm2hfcx5isaglid.onion
cflaresuje2rb7w2u3w43pn4luxdi6o7oatv6r2zrfb5xvsugj35d2qd.onion
cflareer7qekzp3zeyqvcfktxfrmncse4ilc7trbf6bp6yzdabxuload.onion
cflareub6dtu7nvs3kqmoigcjdwap2azrkx5zohb2yk7gqjkwoyotwqd.onion
cflare2nge4h4yqr3574crrd7k66lil3torzbisz6uciyuzqc2h2ykyd.onion</code></pre>
            <p><a href="/subscribe/"><i>Subscribe to the blog</i></a><i> for daily updates on our announcements.</i></p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/15NmOPYhQ1eUrnNvavD3TX/f3878ea7031dee5fa0b8fcfffb5e6563/Crypto-Week.png" />
            
            </figure><p></p> ]]></content:encoded>
            <category><![CDATA[Crypto Week]]></category>
            <category><![CDATA[Security]]></category>
            <category><![CDATA[Tor]]></category>
            <category><![CDATA[Privacy]]></category>
            <category><![CDATA[Privacy Pass]]></category>
            <category><![CDATA[Cryptography]]></category>
            <guid isPermaLink="false">7mmYqDqVbCUWqpT2wyf2OU</guid>
            <dc:creator>Mahrud Sayrafi</dc:creator>
        </item>
        <item>
            <title><![CDATA[Introducing DNS Resolver for Tor]]></title>
            <link>https://blog.cloudflare.com/welcome-hidden-resolver/</link>
            <pubDate>Tue, 05 Jun 2018 14:46:17 GMT</pubDate>
            <description><![CDATA[ As was mentioned in the original 1.1.1.1 blog post, our policy is to never write client IP addresses to disk and wipe all logs within 24 hours. Still some folks might not want to reveal their IP address to the resolver at all. This is why we are launching a Tor hidden service for our resolver. ]]></description>
            <content:encoded><![CDATA[ <p></p><p>In case you haven’t heard yet, Cloudflare <a href="/dns-resolver-1-1-1-1/">launched</a> a privacy-first <a href="https://www.cloudflare.com/learning/dns/what-is-dns/">DNS</a> resolver service on April 1st. It was no joke! The service, which was our first consumer-focused service, supports emerging DNS standards such as DNS over HTTPS:443 and TLS:853 in addition to traditional protocols over UDP:53 and TCP:53, all in one easy to remember address: <a href="https://1.1.1.1/">1.1.1.1</a>.</p><p>As it was mentioned in the original blog post, our policy is to never, ever write client IP addresses to disk and wipe all logs within 24 hours. Still, the exceptionally privacy-conscious folks might not want to reveal their IP address to the resolver at all, and we respect that. This is why we are launching a Tor onion service for our resolver at <a href="https://dns4torpnlfs2ifuz2s2yf3fc7rdmsbhm6rw75euj35pac6ap25zgqad.onion/">dns4torpnlfs2ifuz2s2yf3fc7rdmsbhm6rw75euj35pac6ap25zgqad.onion</a> and accessible via <a href="https://tor.cloudflare-dns.com/">tor.cloudflare-dns.com</a>.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/36t8h9iQGlsrDy3TQc1tKA/e9e068e98b028fca2ba78befea43aff2/tor.gif" />
            
            </figure><p><b>NOTE:</b> the hidden resolver is still an experimental service and should not be used in production or for other critical uses until it is more tested.</p>
    <div>
      <h3>Crash Course on Tor</h3>
      <a href="#crash-course-on-tor">
        
      </a>
    </div>
    
    <div>
      <h4>What is <a href="https://www.torproject.org/">Tor</a>?</h4>
      <a href="#what-is">
        
      </a>
    </div>
    <p>Imagine an alternative Internet where, in order to connect to <a href="http://www.cloudflare.com">www.cloudflare.com</a>, instead of delegating the task of finding a path to our servers to your internet provider, you had to go through the following steps to reach Cloudflare:</p><ol><li><p>You calculate a path to your destination, like this:</p>
            <pre><code> You -&gt; Your ISP -&gt; X -&gt; Y -&gt; Z -&gt; www.cloudflare.com.</code></pre>
            </li><li><p>You encrypt your packet with Z’s public key, then with Y’s, and finally with X’s.</p></li><li><p>You submit the result to X, who decrypts with their private key;</p></li><li><p>X submits the result to Y, who decrypts with their private key;</p></li><li><p>Y submits the result to Z, who decrypts with their private key to get the original packet;</p></li><li><p>Z submits the packet to <a href="www.cloudflare.com">www.cloudflare.com</a>.</p></li></ol><p>If everyone plays their roles correctly, it is possible to ensure only the entry relay X knows your IP address and only the exit relay Z knows the website you’re connecting you, thereby providing you with privacy and anonymity. This is a simplified version of Tor: a collection of volunteer-run computers and servers around the world acting as relays for a huge network built on top of the Internet where every hop from one relay to the next peels one layer of encryption, hence its name: the onion router.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/1yOeNLuz06vq97sSVI7Wh3/de4df11e1d5a16707fc9782e08e353f9/exit-node.png" />
            
            </figure>
    <div>
      <h4>What are Tor onion services?</h4>
      <a href="#what-are-tor-onion-services">
        
      </a>
    </div>
    <p>Keeping internet users anonymous is not the only function of the Tor network. In particular, one caveat of the procedure above is that the connection is still accessible by the exit relay and anyone sitting between there and the destination, including network providers. To solve this problem, and to also provide anonymity for content publishers, Tor allows for onion services. Onion services are Tor nodes that advertise their public key, encoded as an address with .onion TLD, and establish connections entirely within the Tor network:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/3xHVrOH2M3xUJAoyWyOrVv/18da5a8d9cabe75b4e6e4d043794033b/image_3.png" />
            
            </figure>
    <div>
      <h4>How do you resolve a domain while using Tor?</h4>
      <a href="#how-do-you-resolve-a-domain-while-using-tor">
        
      </a>
    </div>
    <p>The process of returning an IP address given a domain name is called <i>DNS resolution</i>. Since Tor still uses IP addresses, you still need to do DNS resolution to browse the web over Tor. There are two common methods to resolve a domain name when using Tor:</p><ol><li><p>Resolve the name directly, then talk to the IP address through Tor;</p></li><li><p>Ask a Tor exit relay to resolve the name publicly and connect to the IP.</p></li></ol><p>Clearly, the first option leaks your IP to your DNS resolver and, unless your client uses DNS-over-HTTPS or DNS-over-TLS, it leaks your destination name to your ISP. What is less obvious is that the second option can open you to manipulation <a href="https://arstechnica.com/information-technology/2014/01/scientists-detect-spoiled-onions-trying-to-sabotage-tor-privacy-network/">attacks</a> such as DNS poisoning or sslstrip by <a href="https://trac.torproject.org/projects/tor/wiki/doc/ReportingBadRelays">bad relays</a>. This is where our new service comes in:</p><ol><li><p>Ask a .onion-based resolver service!</p></li></ol>
    <div>
      <h3>How does the Cloudflare hidden resolver work?</h3>
      <a href="#how-does-the-cloudflare-hidden-resolver-work">
        
      </a>
    </div>
    <p>In a few words, our .onion-based resolver service is a Tor onion service which forwards all communication on DNS ports to the corresponding ports on 1.1.1.1, hence the apparent client IP is an internal IP rather than yours. There is, however, more than meets the eye.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/58mt2tE0qg8NuZBxlQLIkv/896c317a4e879fda177519e1a7ae8ab7/image_4.png" />
            
            </figure>
    <div>
      <h4>Is the hidden resolver secure?</h4>
      <a href="#is-the-hidden-resolver-secure">
        
      </a>
    </div>
    <p>One glaring difference between using 1.1.1.1 and this service is that the .onion address is "dns4tor" plus 49 seemingly random alphanumeric characters. This 56 character long string, in fact, contains a full Ed25519 public key which is used to secure communication with the onion service. This poses a number of challenges towards usable security:</p><ol><li><p>How can the users make sure that that the address is correct?</p></li></ol><p>We simply bought a <a href="https://crt.sh/?id=439705277">certificate</a> with tor.cloudflare-dns.com as subject name and the .onion address as a subject alternative name. This way, if you’re in the right place, you should see this:</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/WiWQY2XjyAsa9JZ9nJAbf/de8f31b6bfa3c419e1b35d62c40bbc8e/image_5.png" />
            
            </figure><ol><li><p>How can the users remember this address?</p></li></ol><p>We don’t think you should need to remember this address. Ideally, all you would need to do is go to <a href="https://tor.cloudflare-dns.com">https://tor.cloudflare-dns.com</a> and have the browser route your request to the .onion address. This is possible using the "<a href="https://tools.ietf.org/html/rfc7838">Alt-Svc</a>" HTTP header which is an optional header notifying the browser that the resources can be accessed from an alternative network location, possibly using a different protocol. Thanks to <a href="https://hacks.mozilla.org/2018/05/a-cartoon-intro-to-dns-over-https/">Mozilla</a>, using .onion addresses as alternative services is now possible in <a href="https://nightly.mozilla.org/">Firefox Nightly</a>.</p><p>Think of this feature like <a href="/opportunistic-encryption-bringing-http-2-to-the-unencrypted-web/">opportunistic encryption</a>: once your browser receives an Alt-Svc header indicating that a .onion address is available for tor.cloudflare-dns.com, if it knows that .onion addresses can be accessed (for instance through a SOCKS proxy), it attempts to check that the alternative service has the same or a higher level of security. This includes making sure that it is possible to connect to the onion service using the same certificate and <a href="https://tools.ietf.org/html/rfc6066#section-3">Server Name</a>. If that is the case, the browser uses the alternative service instead, therefore ensuring that your future requests do not leave the Tor network.</p>
    <div>
      <h4>Is the hidden resolver fast?</h4>
      <a href="#is-the-hidden-resolver-fast">
        
      </a>
    </div>
    <p>Here is a thought experiment: suppose between each two points on Earth there is a fiber-optic cable, capable of lossless transmission of packets at the speed of light.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/7olJSMff3uxlGuOb2G6j3E/99c18c3b4a9a94c4586bdf2e8e6bd390/image_6.png" />
            
            </figure><p>Using a back-of-the-envelope calculation it’s easy to see that, on average, each packet traverses a distance equivalent to a <b>quarter</b> of the circumference of the Earth in about <b>33ms</b>, while each Tor packet takes about <b>200ms</b> to go <b>one and a half</b> turns around the Earth before reaching an onion service; that’s three turns for a round trip that ensures anonymity of both parties.</p><p>Cloudflare, however, does not require anonymity for its servers, which is why we can reduce the number of relays to just three by enabling an <a href="https://trac.torproject.org/projects/tor/ticket/17178">optional</a> <a href="https://gitweb.torproject.org/torspec.git/tree/proposals/260-rend-single-onion.txt">setting</a> for onion services that prioritize lower latency over location anonymity of the service. To emphasize, this does not impact client privacy or anonymity whatsoever. Indeed, as you may have noticed, in the first onion service image the origin is three hops away from the rendezvous point whereas our onion service is only one hop away.</p><p>We are actively working on developing ways to make this service faster and ensure it has as little downtime as possible.</p>
    <div>
      <h4>Why should I use the Cloudflare hidden resolver?</h4>
      <a href="#why-should-i-use-the-cloudflare-hidden-resolver">
        
      </a>
    </div>
    <p>First and foremost, resolving DNS queries through the Tor network, for instance by connecting to Google’s 8.8.8.8 resolver, guarantees a significantly higher level of anonymity than making the requests directly. Not only does doing so prevent the resolver from ever seeing your IP address, even your ISP won’t know that you’ve attempted to resolve a domain name.</p><p>Still, unless the destination is an onion service, passive attackers can capture packets exiting the Tor network and malicious Exit Nodes can poison DNS queries or downgrade encryption through <a href="https://moxie.org/software/sslstrip/">sslstripping</a>. Even if you limit your browsing to <a href="https://www.eff.org/pages/tor-and-https">only HTTPS</a> sites, passive attackers can find out which addresses you’ve connected to. Even worse, actors capable of comparing traffic both before it enters the Tor network and after it leaves the network can potentially use the metadata (size, time, etc.) to <a href="https://nymity.ch/tor-dns/">deanonymize</a> the client. The only solution, then, is to eliminate the need for Exit Nodes by using onion services instead. That is what our .onion-based resolver offers.</p><p>Moreover, if your client does not support encrypted DNS queries, using a .onion-based resolver can secure the connection from on-path attacks, including BGP hijacking attacks. This means having the same level of security for DNS-over-UDP and DNS-over-TCP as DNS-over-HTTPS and DNS-over-TLS provides.</p><p>Your personal anonymity, however, is not the only reason why you should use this service. The power of Tor in ensuring everyone’s anonymity rests on the number of people who use it. If only whistleblowers, for instance, were to use the Tor network, then anyone connecting to the Tor network would automatically be suspected of being a whistleblower. Therefore the more people use Tor to browse memes or to watch cat videos on the Internet, the easier it will be for those who truly need anonymity to blend in with the traffic.</p><p>One barrier to using Tor for many users is that it is simply slow, so I can try to sympathize with those who wouldn’t sacrifice quick website load times to help keep activists and dissidents anonymous. That said, DNS requests are small in size and since most browsers and operating systems cache DNS results the total traffic is not significant. As a result, using the .onion-based resolver will only slightly slow down your initial DNS request without slowing down anything else, while still contributing to the overall anonymity of the Tor network and its users.</p>
    <div>
      <h3>Why should I trust the Cloudflare hidden resolver?</h3>
      <a href="#why-should-i-trust-the-cloudflare-hidden-resolver">
        
      </a>
    </div>
    <p>Using a .onion-based resolver ensures that your ISP never finds out that you’re resolving a domain, the Exit Nodes don’t get a chance to manipulate DNS replies, and the resolver never finds out your IP address. However, the unique benefit of using the Cloudflare .onion-based resolver is combining the power of Tor with all privacy-preserving features of the 1.1.1.1 resolver, such as query name minimization, as well as a team of engineers working on improving it at every level, including standards like DNS-over-HTTPS and DNS-over-TLS.</p><p>As CEO Matthew Prince said about <a href="/the-trouble-with-tor/">two years ago</a>, anonymity online is a cause we value at Cloudflare. In addition, when we announced the 1.1.1.1 resolver we <a href="https://developers.cloudflare.com/1.1.1.1/commitment-to-privacy/">committed</a> to taking every technical step to ensure we can’t know what you do on the internet. Providing a way to use the resolver through the Tor network and making it as fast as possible is a big step in that direction.</p>
    <div>
      <h3>How to set it up?</h3>
      <a href="#how-to-set-it-up">
        
      </a>
    </div>
    <p>The .onion-based resolver supports every DNS protocol that 1.1.1.1 supports, only over the Tor network. However, since not every DNS client is capable of connecting to the Tor network, some hacking is required to get it to work. Here we will explain how to set up DNS-over-HTTPS provided from the .onion-based resolver, but for all other scenarios head to our <a href="http://developers.cloudflare.com/1.1.1.1/fun-stuff/dns-over-tor/">developers page</a> to get the details of how to use the .onion-based resolver.</p>
    <div>
      <h4>Remember cloudflared?</h4>
      <a href="#remember-cloudflared">
        
      </a>
    </div>
    <p>Here is how you can set up <code>cloudflared</code> to start a DNS client that uses DNS over HTTPS, routed through the Tor network:</p><ol><li><p>First, start with downloading <code>cloudflared</code> by following the regular guide for <a href="https://developers.cloudflare.com/1.1.1.1/dns-over-https/cloudflared-proxy/">Running a DNS over HTTPS Client</a>.</p></li><li><p>Start a Tor SOCKS proxy and use <code>socat</code> to forward port TCP:443 to localhost:</p>
            <pre><code> socat TCP4-LISTEN:443,reuseaddr,fork SOCKS4A:127.0.0.1:dns4torpnlfs2ifuz2s2yf3fc7rdmsbhm6rw75euj35pac6ap25zgqad.onion:443,socksport=9150</code></pre>
            </li><li><p>Instruct your machine to treat the .onion address as localhost:</p>
            <pre><code> cat &lt;&lt; EOF &gt;&gt; /etc/hosts
 127.0.0.1 dns4torpnlfs2ifuz2s2yf3fc7rdmsbhm6rw75euj35pac6ap25zgqad.onion
 EOF</code></pre>
            </li><li><p>Finally, start a local DNS over UDP daemon:</p>
            <pre><code> cloudflared proxy-dns --upstream "https://dns4torpnlfs2ifuz2s2yf3fc7rdmsbhm6rw75euj35pac6ap25zgqad.onion/dns-query"
 INFO[0000] Adding DNS upstream                           url="https://dns4torpnlfs2ifuz2s2yf3fc7rdmsbhm6rw75euj35pac6ap25zgqad.onion/dns-query"
 INFO[0000] Starting DNS over HTTPS proxy server          addr="dns://localhost:53"
 INFO[0000] Starting metrics server                       addr="127.0.0.1:35659"</code></pre>
            </li><li><p>Profit!</p></li></ol> ]]></content:encoded>
            <category><![CDATA[1.1.1.1]]></category>
            <category><![CDATA[Tor]]></category>
            <category><![CDATA[Privacy]]></category>
            <category><![CDATA[DNS]]></category>
            <category><![CDATA[Resolver]]></category>
            <category><![CDATA[Cryptography]]></category>
            <guid isPermaLink="false">5IWsSpqyKELgaGEVhkAhxx</guid>
            <dc:creator>Mahrud Sayrafi</dc:creator>
        </item>
    </channel>
</rss>