Nahroud Seyrafi. Thank you, thank you. Thanks for being here shortly after lunch or during lunch or I don't know what's the exact timing of lunch during DEF CON. It's my first time. So this talk, everything about it started during an internship I had at CloudFlare with Nick Sullivan who's sitting there over the summer. Essentially I joined a week or two after CloudFlare launched this consumer DNS service 1111. You may have heard about it. It was a small thing. And one day Nick walks in and says, okay, we don't keep any logs of users and anything that we happen to have any sort of IP information we delete after 24 hours. But what if we moved that over to Tor so we didn't have any information about the user requests. So that's sort of the whole chain of events. So that's the whole chain of events. So that's sort of the chain of events. That we started looking at how do we do this over Tor. Starting an onion server service to serve as our DNS or HTTPS serverer. And ran into some problems. One of them, which I imagine if you run any onion service you might have noticed is if you want to add HTTPS to your onion service, you have the option of paying a lot for extended evaluation. Or using your own certificate of 30 which is ScienceCenter's master of this, but if you want to not a good idea generally. So here's an alternative that I sort of connect back to an older idea which is opportunistic encryption. So opportunistic encryption is an idea, not just one idea, but in general across many different protocols. As far back as star TLS and very recent as upgrading HTTPS over HTTP and things like that, the idea is you can start the connection normally unencrypted, but there's some sort of tag, some sort of communication and if the server and client both support it, they can upgrade their connection over a more secure format. So the motto on the RFC that announced opportunistic encryption was some protection most of the time. So the idea is that you can start the connection normally unencrypted, but there's also protection most of the time. On the other hand, mine is, opportunistic onions, more protection some of the time. And here's how it works. So I'm going to start with a short crash course of how Tor works. Of course I'm not going to include all the details, but it'll be the gist of it hopefully. Okay. So, great, nothing is out of the screen. So on that side we have a client laptop and this side we have the origin web server. In the middle we have the Tor connection. So the server. So we start with the client and we have the web server, and so on and so on. In cloud. Well, we have the Tor network. In the middle we have a bunch of different nodes, some of them are relay nodes, exit nodes, various kinds of parties in the Tor network. We also have the hidden service directory which is sort of in between, inside and out. The address to those hidden service directories are fixed and the first time the client is trying to make some kind of communication to get information about the rest of the nodes has to do some out of Tor network communication. Okay, so the first step, I numbered them, the zero step is getting some information from the hidden service directory. Then, via some process, the client establishes a circuit to an exit node somewhere in the world and this circuit passes through a guard node that may or may not be fixed and a relay node. And after that, the exit node essentially requests whatever final destination, final website you wanted from the internet and sends that back to you over the Tor network. But before that, the exit node has to also make a DNS inquiry if the request was a domain name, not an IP address, and then make the request to the origin. And I've sort of color-coded this into a list. The green ones are encrypted. The orange ones may or may not be encrypted. Because if your origin supports HTTPS, if you're going to, say, gmail.com that supports HTTPS over Tor, then you usually don't have any problem. But if it doesn't, if the destination doesn't support HTTPS or if the first request is not HTTPS, then that might introduce some problems. Okay. So what is, where does the idea of onions come from? The idea is, take this image that we have. This is sort of the way I intuitively think about it. Look at the exit node, cut it down there, and mirror everything on the left to the right. So essentially, that RP in the middle, the rendezvous point, you can think of it as an exit node on both sides. That's not an accurate description, but it does the job. You start with, the client starts with connecting to a guard node, it really not around any point that via some, a number of steps, establishes a connection with an onion service. And the onion service, note that in this case, is inside the Tor network. So no communication is going outside of the Tor network on this side. This is here, this communication is in this network. You start by starting the hot sob, and you click to doihu Cast on the toraai, architectural device in the espera. This connection communication number 5 and 4, we're going out of Tor network. Here everything is inside. Okay, so what can we do with this? First of all, as I said, one problem is that if you want to have an HTTPS certificate for an onion service, if you have any, if you've seen any onion services, the addresses look like a 56 character, randomly, random looking 56 character domain name, dot onion. Or the older HSV2, which is shorter, but still a semi-random string of characters, dot onion. So one question is, how do you remember this address? Some people like Facebook, for instance, tried to essentially mine a nice looking address. So they generated Facebook www core address and dot I or something like that dot onion. But, if in general, anybody wanted to do that, first they would have the problem of many people don't have that much computing power, and two, even if you do, if you want to have an HTTPS certificate for your website, again, you have to go to certificate authorities and you have to pay for extended valuation, which costs a lot, at least a few hundred dollars a year, I think. And, I think, you know, I personally think it's too much. Uh, so the alternative is, is this. So, imagine that the origin, um, was partially in the Tor network and partially out. Okay? So the first, the very first connection, the very first request that you make, still goes through the, uh, the, the same steps, through a guard relay, uh, sorry, through a guard, a relay, exit node, requesting the DNS information. Maybe, maybe, maybe, maybe, maybe, maybe, maybe, maybe. But, now, you know, you're, you're making connection to the origin, so far everything is the same, then the origin responds with an alt service header. What is an alt service header? An alt service header is a new HTTP, well, not, not so new, but, uh, it's a recent, uh, HTTP header that essentially tells the website that if you want to communicate with this host, uh, you can also use this other host. Uh, that, you know, the, the origin, you know, uh, is, is, is the, is used as a, uh, tells the client that this has the same credentials, this has the same resources, everything the same. There's a small difference. This is not to be confused with the old Apache rewrite rules. This is different because Apache rewrite rules, you could have, for instance, for certain pages, you could have a rewrite rule or something like this. This is for the whole host. So for instance, if I own, I don't know, examples dot com, and I say you can also reach example dot com via, you know, a certain IP address, then after a certain, after a number of steps, after a number of steps, the browser makes sure that the two host names are, you know, can serve the same website, they have the same HTTPS certificate, and then instead of connecting to example dot com, if, for instance, the network connection to the IP address is faster, it can make the connection to the browser faster. So you can make the connection to the IP address. So what we do is we send an alt service header, and in it, we put the address for the onion service. And so the point here is that you're making a connection to example dot com, and you get a response that says you can also connect to me via this long string of characters dot onion. This is, you know, you can connect to me via this long string of characters dot onion. This is also another address for me. What the browser does, the browser sends a request to that establishes a circuit with that onion service. So here's where I go here. After getting the alt service, the client establishes a circuit to the onion service, and verifies that the onion service can serve the same exact certificate, the same exact HTTPS certificate, as the origin in the very first request. So the important point here is that you can also connect to the dot onion service. So the point here is that the certificate does not have to be, does not have to have the onion address in it. It can only have, it only needs to have the, you know, example dot com. Does that make sense? So the main point that you needed extended valuation was that dot onion, you know, certificate authorities don't like giving free certificates to dot onions. But with, for instance, let's say, let's say, let's encrypt, you can get a free certificate for your website. And using this system, you can use the same exact certificate to establish, well, to have an onion service. Okay. So any, any questions so far before I go into benefits and why, why we did this? Sure. Right. So, yes. So you notice here that the from this picture to this picture, the length of the circuit from the client to the onion service is shorter. So the point is that this system is, is, is for when the content provider, the, the onion service wants to remain hidden. But if, you know, we are talking about a website that already has a domain name, that already has a publicly accessible IP address, you know, there's nothing, there's nothing to prevent. The point at this point is to enable, about the people from the Tor network to connect to it, instead of going through an exit node, just connect directly all inside the Tor network. Right? So there is no, there is no privacy or anonymity cost for the, for the web server because, you know, the, the, the, the, you know, the location was already public to begin with. But that's a good point. Thank you. Thank you for the question. Okay. So, let's look at some of the benefits. First of all, this is going to reduce the load on the exit nodes because only the very first request has to go through an exit node. After that, the browser can, you know, for a certain amount of time, perhaps remember that this, this host name can be accessed by this onion, onion service and only make connections to the onion service. Another is that the attack surface from the exit node is reduced because instead of every request going, going through the exit node, only the very first one does, does that. And lastly, because of that, we think this improves privacy of the users. For instance, you know, there, there are some papers on correlation, correlation attacks on the Tor network if someone could observe network traffic coming out of user's client, for instance, at ISP level and coming into the, to the onion service. For instance, if you were running an onion service on, you know, Google cloud and your internet was, or your user's internet was via Google fiber, then Google would have information on both sides of the Tor network, going in through Google fiber and going out to onion service. And at that point, Google could have some, you know, information via some correlation attacks. And this would hopefully prevent it because only one request is going through and you can't, you can't do any sort of correlation of how much, you know, how much the size of the content is or anything like that. Okay. But specifically, why was Cloudflare interested in this? This is because we can, because of the system, instead of, so from, from the server's point of view, from Cloudflare's point of view, instead of all the requests coming from the IP address of the exit node, we see specific circuits. We can't, you know, identify who the user is, but we can distinguish them. We can say that this is, this is a circuit for the first user, this is a circuit for the second user, this is a circuit for the third user, and then there's separate, separate users. I should note that users can have multiple circuits and, and we can't, we have no way of linking those. So it doesn't, you know, cost any anonymity for the user. But it gives us the advantage of, you know, having more fine-grained race limiting. Which means if, if, you know, an exit node, if there are a lot of DDoS attacks or something like that coming from an exit node, we don't have to ban all of it and ban, you know, all the, or, you know, capture all the good people using that, um, that exit node. We can look at the circuits individually and say, oh, this circuit is doing something, you know, funky or too many requests or they look like some sort of, you know, SQL attack or something like that. We will capture that, but anyone else can, can carry through normally. So this is going to hopefully, uh, reduce capture friction for Tor users. Let's see. And, uh, I should mention many thanks are owed to, uh, Mozilla, people at Cloudflare, of course, and, uh, the Tor project. We had a meeting about a couple of months ago to discuss, you know, how could we, uh, make this actually usable. And part of it was having the Tor browser, the newer, the newer version of the Tor browser, which hopefully should be coming out soon, uh, be able to use this alt service header and also use HTTP2, which was a requirement for, for this system to work. Um, and, and, and I should mention, if you want to test this, um, feel free to send an email to onion-beta at cloudflare.com. Um, this is also, uh, okay for free customers. You don't have to be a paid customer. And, um, uh, also on the, on the client side, if you want to test it, you would have to go to the config and just change two things, namely, uh, uh, enable alt service and enable HTTP2. Um, okay. Any questions? I have one more thing to, oh, yes. If you have questions, we're going to bring questions up to the mic. Just a second. Oh, I see, I see. Okay. So, but you still have a few minutes, so you're good. Sure. So, um, one last thing that I promised in the description to offer was a caddy, caddy is a, uh, HTTP2 server, um, plug-in to enable this. This is, uh, currently on GitHub. Uh, if you find my GitHub account, I should have perhaps put a link here. Um, it is called caddy-opportunistic onion, or sorry, caddy-alt onion. And, uh, also, if you send an email to this, uh, you'll be able to, you'll be able to, um, I'll make sure to publicize it via that. And, and hopefully at some point it'll be published on caddy's website. All right. Thank you. All right. Any questions line up to the mic, please? We got five minutes for questions, and then after that, if, uh, the speaker has time, you can tag up with them, uh, outside. Hi. Uh, I have two questions. Uh, first one is, uh, what do you think of the implication of, uh, bootstrapping this process based on DNS? And the second one is, uh, yeah, how reliable is the circuit tracking to identify clients on, uh, hidden services? Right. Uh, so the first question was, uh, uh, so we've actually thought about ways of providing, um, you know, if, if you see a request, okay, we already have, uh, a DNS server, uh, on an, an onion service. So we were thinking of how can we have, you know, if, if, if a request is coming through this onion service, which serves, you know, a, a, a, a, a, a, a, a, a, a, a DNS, the client clearly supports Tor, so we can, we might as well send maybe a CNAME or something like that directly to the .dn address. We're still, um, you know, we're trying to work out the kinks of it to make sure that, uh, you know, there's no chance of us, the server, uh, this, the DNS provider, or, or, you know, maybe not us, but whoever is the DNS provider, you know, giving you a random onions, onion address. That's one, one, one problem. The second one, uh, was it about, uh, fingerprinting the user? Uh, no, it is about, um, like, to my understanding, it's not, uh, I didn't know there was a one-to-one mapping between the circuits, uh, hidden service builds with these clients and, uh, actual clients. Oh, the, the, this is not a one-to-one correspondence. So, um, uh, each individual Tor client can, can establish multiple circuits. In fact, the circuits happen all over the time, you know. Uh, the, the, the connection you make to the hidden service directory or, maybe not that one, the connection to, um, each of the relays, the rendezvous points, all of these are, to introduction points for the onion service, all of these are circuits. Um, and all of the, all of them have some sort of internal ID to, you know, to distinguish them. Um, so, in a sense, between a client and an onion service, there can be multiple circuits. Um, but the point is that we can ban, we can, you know, challenge each circuit individually instead of, instead of just, and massive IP address or something like that. Alright, thank you. Thank you. All right, let's give it up for our esteemed speaker. Thank you.