Hello everyone. I guess we are about ready to get started. So this is a two hour block, but I'll be dividing it up into two intermissions for Q&A. So be sure to have questions in your mind and ready, and don't be afraid to ask a question. If you have a question, something's on your mind, it's likely that at least five other people that occurred to them too. So don't be afraid to ask questions. It's very important to make sure that everybody understands everything that's going on, that I haven't overlooked anything, or I'm not making some crucial mistake, because obviously this is, in the imperfect tense, securing the Tor network. I'm not saying, oh, everything is solved forever, for sure, this is it. It's an ongoing process. Okay, so who the hell am I? I'm a volunteer Tor developer. I work on Tor because I think it's important. For a few reasons that I'll get into later. Professionally, I'm a forward and reverse engineer. I write C++ code and reverse engineer the Microsoft Exchange protocol, along with a few others, for Riverbed Technology. This is a company, shameless plug time, just to berate you people about my employer. We make WAN accelerators, essentially we make WAN traffic fast for companies, large companies with lots of traffic. Lots of branch offices all over the place. Significant accelerations for Windows file sharing that's done across a distributed intranet. Also significant 5 to 50x enhancements of improvement of performance for Microsoft Exchange. That's the protocol that I work on. We also do protocol independent data reduction, so if you send some data over Exchange, the next time you fetch it via the Windows file share, it's also cached and accelerated. And we are pretty good at it. When we go head to head against any of our competitors, 90% win rate. We are outselling Cisco 2 to 1, and they're pretty anti-competitive about their practices. They give significant deals on a lot of their WAN acceleration equipment for people who have Cisco gear. And we're still significantly outselling them. So we're pretty successful. That's the end of that plug. If you're interested in... in that company and work in reverse engineering, fuzzing network protocols, you know, C++ development, network programming, pretty much on Linux, of course, come talk to me afterwards or whatever and we can discuss, you know, setting you up with an interview or whatever. So preaching to the choir about why I think Tor is important for normal people. There's a lot of talk about, you know, it should be... it's a censorship resistance tool. It's for political dissidents, people who are under oppressive firewalls. But I think there's a compelling argument for normal people for basic data hygiene to keep their IP address out of essentially marketing databases. We don't really yet understand the consequences of having all of our, you know, essentially thoughts that we enter into Google whenever we come up with some idea archived and tied to our IP address, which is essentially our identity. And then... maybe not in the case of Google. Google has, you know, they do significant work to try and make sure that they protect the data that they do massively acquire on all of us. But in other companies, bought and sold to whoever. So the second point, you know, like I said, Google might not be that horribly evil, but I read my ISP's privacy policy. In fact, they tell me that they do gather my data in aggregate for marketing purposes. It's not a... I wouldn't specifically say it's not uniquely attributed to me, but they do mention that they gather aggregate data on the Internet usage for marketing and other performance purposes. So, you know, this sort of infrastructure is already... people are already thinking about this. Ways to use our data to either sell us products or see what sort of things we're interested in. And some things we might want to be able to opt out on. And if all of this is tied to our IP address, we don't really have a choice without Tor. And this sort of information can come back to get us in unexpected ways. If you're involved in a lawsuit, discovery can cause this information to turn up. If it's subpoenaed and a judge agrees that it's relevant, the other party that may have that data, to my knowledge of the law, is obliged to comply. This can also happen in bitter divorce cases. And, you know, marketing spam can just randomly show up at your door. Or if you have products shipped to your work, embarrassing catalogs can start showing up at your work. Which has actually happened to me. Based on stuff that you have purchased. And have had shipped to your work because it's convenient to have that southward, you know, lockpick set sent to your work so you can just pick it up or whatever. Rather than risk it being stolen at your apartment or whatever. So, all sorts of sticky issues with privacy that normal people need to be concerned about. Okay, so what is Tor? Quick overview. For those of you who might not be familiar with it, it's been five, no, four hours of Tor talk so far. But just a quick recap. You run a client, the Tor client, that acts as a SOX proxy that you connect your applications to. When your applications connect to this SOX proxy, they issue, they're translated into what Tor calls streams. These streams are then multiplexed on top of encrypted paths that are, that Tor calls circuits. And then these circuits are in turn multiplexed over TLS, SSL connections between the individual relay nodes that are run by volunteers all over the world. These circuits, these paths that your client chooses, consists of three nodes. What's called the guard node, the relay or middle node, and then the exit. These nodes are chosen probabilistically by your client proportional to their bandwidth. So here's a diagram. And that illustrates some properties, some important, the important multiplexing properties that I talked about before. You have two clients essentially choosing two different circuits or paths through the network going through this first hop called the guard node. The reason for that term I'll get into later. These two clients are multiplexed over the same TLS connection in this middle hop between the guard and the relay. And then they diverge off at the relay onto different exits. Now the second client has that, the TCP SOCKS being multiplexed over the circuit being routed through the second path and it goes through the single circuit the individual hops of which are unable to see that there are multiple streams on the circuit other than timing information until it is finally split up by the exit node to connect to whatever, maybe a couple of fetches from the same server or a couple of different servers. The below diagram illustrates essentially the crypto behind this and why it is that the guard node doesn't know who your exit node is. Essentially each node publishes a series of public keys in the Tor directory and then your client uses these public keys to negotiate a layered encrypted channel to each successive hop. So first you negotiate a secret key. First you make the TLS connection to node X. Then you negotiate a secret key with node X. Through that channel you tell node X, please help me negotiate a secret key and make a connection to node Y. And then through encrypting with that secret key you then instruct node Y to extend to node Z and negotiate another secret key. This process of adding additional hops to your path in Tor parlance is known as circuit extending. And you can iteratively extend your circuit effectively as long as you want. And I believe there was one attack to try and essentially DOS the network by making infinite paths. I think there are some protections against that, but I'm not entirely familiar with what those are. Roger can probably offer that up during Q&A or whatever. Passive attacks. So as far as how to secure this network. So in order to secure the Tor network, we really have to look at it from an attacker's point of view. We have to understand the types of attacks, the motivation of the attacker, what the attacker is going to do, and how he's going to do it. So first we should classify these attacks as to what sort of actions the attacker is going to do. Are they going to just observe traffic? Or are they going to actively modify traffic? So under just observing traffic, we have things like packet and connection timing correlation. Looking at things like when does the connection start, how many packets are involved, the pattern of those packets, and when does it finish. We also have things like fingerprinting, noting what a particular website fetch looks like through Tor. Fetch of Wikipedia, a particular Wikipedia page, may exhibit a particular fingerprinting pattern, a particular pattern of cells of encrypted packets that a guard node or an ISP is able to just recognize. Intersection attacks are more subtle and more broad. Basically this is something that you can do passively to catalog a bunch of different attributes of users and add all those attributes up. Active attacks include things like lying about your bandwidth to get more traffic. As I said, your path through Tor is you choose your nodes probabilistically according to the advertised bandwidth that a node says it can carry. So if the node says it can carry more traffic, then you have a higher probability of choosing them and that node should get more clients connecting to it. Failing circuits to bias node selection, that's another one. You can try and modify how the path is chosen by a client by failing circuits arbitrarily. And you can modify application layer traffic at the exit to do things like insert plug-ins. And we'll be getting into more of these specific examples in more detail later. This is basically just to understand this classification idea. So the position of the attack is another variable, another dimension on the classification of these attacks. You can have an internal adversary that is a node operator that is able to see inside and say, okay, well, they can see past that TLS multiplexing and see the individual circuits that are flowing through their node. They're also, at the exit node, they're also able to see past the stream on top of circuit multiplexing and be able to determine which streams are associated to a particular circuit. This ability gives them, has certain attacks that sort of fall out of that, which we'll get to later as well. The external adversary is an ISP or echelon-style adversary. They are able to observe large portions of the Tor network or multiple nodes, but they're assumed to be unable to see inside the node-to-node TLS streams. And it has yet to be proven, but it is likely that due to a couple of factors, in my opinion, that these sorts of adversaries should be frustrated by users who run Tor nodes as both a node and for their client usage. The reason for this is essentially the three main characteristics for a successful timing attack have been demonstrated to be the time of the start of the stream, essentially the number of packets, and the end of the stream. And if you are running a node, you are going to be multiplexing other people's traffic through that node. An external adversary is only going to be able to see these TLS connections. Queuing delays are going to come into effect and cause issues with the adversary being able to tell the exact start of when your connection started. They're going to make it difficult to determine the number of packets in that connection, even if they're trying to calculate the differences between packets entering and leaving. If your traffic is throttled at a constant rate, this is going to frustrate them to some degree, to some unknown degree. Maybe possibly marginal, but I think it should be. There's some hope there. So where can Tor, where does this look like if we look at that same path diagram that I displayed earlier? Obviously, there's a lot of places that Tor can be attacked. In fact, it can be attacked pretty much everywhere. Possibly even there should be some arrows for these TLS links there. Only 1024-bit RSA keys, and some nodes have been around for a real long time, five-ish years. The age of the network is, I believe, five, six years. So we're starting to get close to what, in my opinion, would be a comfortable lifetime for a 1024-bit RSA key. I believe there are plans to allow versioning of the protocol and possibly allow multi-sized and alternate keys. This was at least discussed on IRC at one point. So to break this down into a bit more detail, obviously there's a lot of things going on here. We're going to look at individual cases of relevant attacks. So here's some passive attacks basically extracted from that previous diagram. So at the top, we have intersection attacks, and these are essentially performed independent of the Tor network, maybe with just the knowledge of the fact that a user uses Tor. And then on the other side, there's a connection made from a Tor IP to a server. And the user may do things like reveal their time zone information or maybe say that they work at a particular company or otherwise reveal personal information, some level of vague personal information that over time can add up to eventually identify them. At the bottom, we have both internal and external timing correlation attacks. Now these can be performed by, as I said, an external adversary that is either an ISP or something observing the internet exchange or backbone routers. Or it can also be performed by the nodes themselves who are able to see the, try and match up individual circuits. Active attacks, now these are some of the more down-to-earth deadly attacks. A couple of academic papers revolve around this. One by Parisa Tabriz, Nikita Borisov, and George Danzais basically argued that reliability is essentially the same as security when you're talking about mixed networks. An adversary who is able to fail a large amount of circuits can bias your, begin to bias your path selection. And in this case, you can see that if they own the guard node, they can fail circuits at the guard node if it doesn't extend to a relay node that they control. And then at the relay node, they can fail those circuits if it doesn't extend to an exit node that they control. They can also attempt to find a side channel in the TOR protocol. One potential side channel is to XOR a piece of the, the protocol stream at the guard node, and as this packet flows through the network, when it reaches an exit node, its digest is verified, and if the digest verification fails, that circuit fails. So a malicious exit node then, who is colluding with that guard node, can then potentially on XOR that same byte in the stream, and then those two nodes can guarantee that they're only going to carry traffic that they really want to own. They can also combine this as Damon McCoy demonstrated, and a few other researchers from University of Colorado demonstrated in his work, in their work, that bandwidth lying can come into play here. And they basically demonstrated with very few resources, you can sort of combine these two attacks, and cause people to try and use you, and continually fail their circuits, until they do choose an exit node that they control. Now the TOR, I should clarify that this, that the TOR exit node, TOR code does print out, I believe, a notice, if the digest fails. So this is not something that just can happen all over the place without us knowing, even at this point. This is something that can be detected. But it's possible that there are other side channels involving timing information that are more difficult to detect. Guard node bias is another layer that can be added to this. An adversary at an organization, or a government, can try and either block TOR entirely, or more sinister approach, maybe to just allow access to the guard nodes that they control, that fail circuits that don't extend to the nodes that they're colluding with. Application layer attacks, surveillance and confiscation is one. If you live in a country that may have outlawed TOR, Germany has some nebulous laws that were recently passed that may or may not fall into this category. Some other countries as well, actively block TOR. It's conceivable that others may try and harass users that try to use TOR. In these situations, a confiscation of those TOR users' computers may prove profitable to try and reveal browser history information, cache information, or what have you. Client misconfiguration is sort of a passive attack. If a user uses the SOX proxy improperly, uses the SOX4 version of TOR, then the user may not be able of the protocol. Instead of 4A or 5, DNS requests can happen locally over the network, and then the resolved IP is then fed to TOR. In this case, you've basically leaked the host names of the sites that you're visiting. For the web browser scenario, the TOR extension does verify that things are configured properly, but for other applications, it's up to the user to essentially ensure that they're doing this right. TOR does print out a notice. However, again, in that case, if it's being consistently fed only IP addresses, so if you're watching your Vidalia log window or whatever, you can see that this is the case, oh, I've misconfigured things. Application layer attacks involve things like, as I said, injecting plug-ins. Plug-ins are horrible about bypassing, obeying your proxy settings, which I'll discuss in more detail later, the individual breakdown of exactly how horrible these plug-ins are. Also, things like having JavaScript that waits for events for when you disable TOR or just busy waits until you disable TOR, things like that. Okay, so that's basically a rundown of all the attacks that this presentation is going to discuss. Are there any questions on, thoughts on attacks, anything that pops in your mind about those? Yeah. . I'm unclear on the question. Are you asking what sort of information TOR may be logging at the nodes? . No. . No, there is actually a false rumor going on to that effect. There is no backdoors in TOR to satisfy that, and there have been no requirements on TOR node operators to actually log any sort of traffic. There have been a couple of waves of node seizures of nodes in the TOR network. To my knowledge, all of those machines were returned within a day or two, and I believe most of those nodes are, again, operational, of course, after rotating their, you know, refreshing their node keys and whatnot. Yeah. . Just a small note to the law you were mentioning regarding the question whether or not TOR as a software can be possessed in a legal manner in Germany, and to answer it, it can. Of course, there have been a lot of discussions about it, but the law is in condition of a cybercrime prevention which has been implemented all over Europe. The discussion has just been focused in Germany, but that does mean that, for example, in Austria, we have that kind of law for years now, and we did and established that it's rather narrow. Okay. That is an excellent point, then. Thank you. The point was, I guess, for, I don't know if there are people who would be viewing the podcast or whatever this talk, that essentially all of Europe has this sort of legislation, I guess the EU has handed it down, and several countries have also implemented similar sorts of legislation. The European Council. The European Council. Oh, okay. . Okay. . Oh, sorry. . . . . The trade there is your transition . . . . relay, it will be using a different IP address. And additionally, the TCP streams are also essentially reused. So TCP fingerprinting attacks don't apply. The end-to-end TCP fingerprinting attacks also don't apply. Okay. I think we'll move on to approaches. How do we address some of these problems? Or how do we address these problems? Well, the first approach, while the network was smaller, was to try and verify node operators that the network maintainers would know who they are. And if there was some trouble with their node, they could be easily contacted. This is no longer the case. Essentially, you can just go to Vidalia and say, yes, I want to run a Tor node. And then it sets up your network. And then it sets up your network. And then it sets up your network. And then it sets up your configuration appropriately. The network has essentially just grown too large for verification to be applicable at all. And hopefully, we can continue to grow it larger. Path selection and hacks, there's a couple of different ways that your path is chosen in a specific manner by the client and certain restrictions are placed on your path for security. Tor up from the floor up, this is essentially the slogan of anonymous. The idea is that if something can fit through Tor, shove it through Tor. And if it doesn't, drop it on the floor. So any UDP traffic, anything that might be bypassing plug-in settings or what have you is dropped. And there are a few different projects that do this. Improving network speed and usability is an important component of anonymity to have large amounts of users using the network. And scanning nodes for modification, make sure they're not modifying traffic at the exit node. And make sure that they are reliable, they're not overloaded, and such things like that. And then finally, securing the applications, trying to make sure that the web browser is not going to magically bypass proxy settings, that JavaScript is not going to do mysterious things. Unfortunately, this requires a different threat model that applications don't often consider. And we'll get into all of these in just a moment. We'll get into all of these one by one in a bit more detail. So starting with path selection hacks, there's a couple of hacks that Tor does. The slash 16 hack, when you're choosing a path, no two nodes in that path can be from the same slash 16 net mask. So the idea is if someone is trying to do what's called a Sybil attack, which is running multiple nodes from a colo provider or even on their cable network, this prevents them from easily being able to have a large number of nodes on their network that are going to be able to actively compromise users in this way. It also prevents ISPs from being able to easily surveil traffic. Now, the caveat is obviously that some ISPs have disjoint, especially the larger ISPs, have disjoint IP ranges, and they're not always in the same slash 16, but it does. That's not to say that this is completely ineffective. It is some measure of protection against somebody mounting a trivial Sybil attack with multiple nodes, all from the same rack or whatever. Guard nodes, as you notice, the first node in that path is called a guard. These are chosen from the top 50 percent uptime and top 50 percent bandwidth of the network. The idea is that, well, initially, I believe they were designed, they were called HATS. Helper nodes. And the idea was to mitigate profiling attacks. So essentially, as Nick Mathewson mentioned in his talk, essentially, you don't want, if you never want somebody to know that if you're, you know, some Harley Rider, it was his example, and you like to visit queued overload, and you can continually visit, you continually visit this site every morning, you never want anybody to be able to determine this. If you are continually choosing new entry and exit points all the time, you're not going to be able to determine which entry is good or bad. You're going to be able to determine which entry is good or bad if you do this all the time. Eventually, with some probability, someone will notice that you're visiting queued overload, and will, you know, be able to tell all your biker buddies and embarrass you or what have you, however you want to generalize that example. So having a fixed set of guard nodes between two and three is the goal, can make sure that you're not going to be exposed to the whole network in this way. And you can, in essence, build up sort of trust in your guards. where some guards try and capture and harass a bunch of users. If you're not harassed in this way, your rational response is, oh, well, I trust my guards even more than I can trust Tor even more than assuming that it was an end-to-end attack. The problem is that nodes can go up and down in general, so this can be difficult to do right. You can have basically a time trade-off of risk. If you are still rotating through the network because these things are going up and down, you can still be exposed to a large amount of the network for a short period of time. There are a couple of hacks in how Tor remembers guard nodes to try and prevent this now. This is less of an issue than it was about a month or so ago. Tor routers and live CDs. There are a few of these. One is being presented immediately following this talk. JanusVM is an anonymous and the ZeroBank virtual machine are, I think, the major examples of these guys. Again, basically drop everything that doesn't go through Tor. The major issue with these is that circuit reuse can be a very problematic situation. If you are using antivirus software that updates with a unique identifier, if you have other ID-based software, software updates where you use AIM or you SSH into a shell that has your name in the domain name or you connect to an email account that you don't want linked with your anonymous traffic, an exit node can figure this out and begin to associate them. Now, there is a new NIM functionality in Vidalia that you can click on and say, okay, I want a new identity now. But that's sort of up to the user to be able to differentiate and remember to click on that. And it can be problematic, especially if you are routing all of your applications through like a Tor router, for example. Now, speed and usability, as I touched on, is a key component to Tor security. You want as large a user base as possible. In fact, there have been cases in the past where users have been harassed because they... In fact, there's an example of a professor who was harassed because there were only... Two Tor users from his university and it was suspected that one of them was engaging in an online scam. And so the campus police and possibly some state or federal police contacted him and asked him if... He was a professor who taught about censorship and censorship resistance and they asked him if any students he knew of were still actively using Tor and basically interrogated him. So there's this risk. There's this risk of harassment and there's also the risk of, say, a blogger who wants to blog about work but then brings their laptop to work and they're the only Tor user at their workplace. It's very easy for the system administrator to see, okay, this is the only internal IP address that we have connecting to the Tor network. We have a pretty good idea of who this anonymous blogger who may or may not be causing us problems is and what their identity is. So how do you improve this? Basically, users want speed, the network to be fast, and they want it to be easy. So it's my argument that a lot of them don't need such high-grade anonymity. I suspect that a lot of them are concerned about the data hygiene issue, like they want to just opt out of a few Google queries or they want to opt out of ordering something. They don't want marketers to have their IP address or they don't want IMDB or whatever to have what movies they like. Or these sorts of things. So for this reason, I proposed a two-hop pass proposal. The most deadly attack from a high-level point of view or from a theoretical point of view is the timing correlation attack. Now, this is effective between 95% and 99.9% in simulation. You can get that much certainty to correlate streams that are entering and exiting. So from a theoretical point of view, there's little reason why there should be three hops as opposed to two. But there are a lot of implementation details that can complicate these things. On the conference CD, I have included this proposal. If you want to look through that, I have a reasoning of what some of these major issues are and what can be done about them to try and improve things from an implementation perspective. These include things like, the active circuit failure issue. They include things like a user using an exit with a specific exit policy that exits to a particular IP address. And basically, those sorts of issues. Intelligent path selection is something that's being worked on by one of our Google Summer of Code students. This is basically that... You can try and have the client intelligently determine what the latency is between different Tor nodes and try and build lower latency paths and higher bandwidth paths for users that say, well, we don't need as much anonymity. We just want to be able to fetch websites fast. And we just want IP address obfuscation, essentially. Last point to improving speed and usability, which we're going to go into in a bit more detail, is ensuring the network is evenly balanced and reliable. It turns out, there's a lot of balancing issues with Tor, which is why it's slow for a large amount... A certain percentage of the users experience rough Tor performance. So how can we try and detect some of these mischievous nodes and what have we found so far? So centralized network scanning is essentially using what's called the Tor control port to determine... The Tor control port is a... Is a port that... The Tor exports that allows you to build your own circuits through Tor and get events on circuit failure and get events on... And attach streams to circuits that you build and get events on bandwidth usage and so on. So Snakes on a Tor was a node scan... Or is a node scanner that I've built. And Torflow is a Python library that interacts with the Tor control port and allows you to selectively build paths. Snakes on a Tor, essentially the goal of that scanner is to get the motherfucking snakes off the motherfucking Tor. To verify MD5 sums of URLs that you fetch, make sure that nobody is inserting malicious plug-ins or JavaScript or modifying, inserting exploits into documents or Firefox extensions or what have you. This all... We also, at the same time, we'll verify... This all... We also, at the same time, we'll verify... Is node reliability and bandwidth to try and detect those circuit failure attacks. And it has found some things. For the most part it works against adversaries that are attacking pretty much everybody. But it is vulnerable to detection and there are some issues with adversaries that are only... There are issues with adversaries that are only targeting a select portion of the userbase like users who speak a particular language that the scanner does not speak like Chinese so what does this look like from you know from a network diagram point of view again what is the scanner doing what's it able to detect is outlaid on the top you can detect node bias and connectivity issues circuit failure and bandwidth as I said and content modification but at the bottom we have the arms race essentially the adversary is able to tell that you're not making circuits the same way as then as you as a normal tor user because you're not using guard nodes anymore you're connecting to every tor know that you can to try and verify its reliability so the tour the guard nodes are going to be able to set to tell oh well this was a short-lived connection from this IP and it continually connects to me for only short period of time and then moves on it can then note this IP and provide its special selective service higher bandwidth not fail at circuit circuits or what-have-you similarly the exit node can detect behavioral issues in the URLs that you fetch maybe you don't fetch the images for a page maybe you don't interpret JavaScript or you're missing some HTTP headers so and it can also try and evade your your scanning again you either using this detection or targeting only specific users likewise dynamic and localized content is a problem for a lot of users so it's a problem for a lot of users so it's a problem for a lot of users so it's a scanning if you're just verifying md5s and the content of the page is continually changing like Google News or localized certain localized websites for in particular languages these become both false positive either false positives for the scanner and or opportune targets for malicious nodes to just sort of attack essentially with impunity but stuff we found anyway that some of this is this is pretty interesting we found a a Chinese ISP man in the middling SSL so it was a particular tour node that exhibited self-signed SSL certificates to every SSL site that it visited and tour tour that the same senator does in fact verify these as cell certificates and stores a bunch of them for a handful of sites and verifies of the same we detected this this ISP doing it wasn't the node it turned out that this ISP for some reason was just trying to own all of its clients pop-up blocks some of these some nodes run antivirus software so far as it's been exhibited in Windows users only so it must be some sort of antivirus software inserts JavaScript into pages that are fetched to hook the window dot open call to block some some forms of JavaScript pop-ups so that's sort of helpful but then it also may makes things problematic do we whitelist these nodes and then maybe from scanning but then maybe they have the opportunity to do other malicious activity or malicious nodes can look like this behavior so that complicates things a bit so one node in particular one node was also blocking Google Analytics JavaScript which I thought was amusing so that do the Google Analytics JavaScript wasn't able to tell or you'll add there toward that that IP to whatever statistics that website owner would want to get about you know their users DNS spoofing has been detected SSH and SSL man-in-the-middle there was a few tour nodes that could they seem to come in pairs that were man-in-the-middle SSH and SSL these were detected and and listed as bad exits and overloaded nodes have also been detected and some balancing issues as well were detected which we'll get into in a bit turns out that there's quite a should be quite a bit more capacity on the network than a lot of users are currently experiencing incidentally when we do find these nodes we are able to label them as malicious and prevent clients from actually choosing them in the future so we have two different tags that that that can do that the bad exit tag and the of the removing of the valid tag which the bad exit prevents them from being used as a as an exit and removing the valid tag prevents them from being used as either a guard or an exit so how do we how do we address some of the the issues of trying to of this arms race of adversaries that are able to detect scanning and provide selective service so from there there are a couple of different perspectives that we can approach this from a client based decentralized scanning and node based decentralized scanning client based decentralized scanning we can use the reliability averages from Tor flow and then alert the user if a guard if their guard is failing more than that percentage of circuits or that percentage of circuits times you know the you know two times this standard deviation or whatever also we can alert them if they can only connect to two guards for example or two guards that fit with their whatever firewall restrictions that they may have we can also potentially observe the bandwidth and latency of their connection but that gets a little nebulous for different types of users node based scanning can do things like gather statistics from on average capacity and queue lengths and compare that to the node rankings and make sure that nodes match up to you know what what their expected capacity should be and they don't have large disparity between their their how much they DQ and and how much is being enqueued to them and then the this sort of node based information can be used as a feedback loop to improve balancing as well so passive client node node based scanning looks essentially like this you have three different clients here in this example that are able to detect a few different things about their network. In this top case, you have this client who's able to detect that he's got a high rate of failure to this first hop that's maliciously failing circuits. The second node is able to say, well, I can only connect to a few guard nodes and all the other connections seem to fail. No other explanation like restrictive firewalls for port-based firewalls or anything else seems to explain this. Print out a warning, alert the user. And in the bottom is the more nebulous case, doubtful to what degree this may be successful, trying to detect a lying node that is lying about its bandwidth that may exhibit lower stream rates or maybe higher amounts of timeouts than normal. In this center, you have a node scanner that is again listening to those events on their control port. Potential events that we can add are queue size, rate of increase and rate of drain. To detect overloaded nodes and lying nodes will probably end up appearing pretty much the same. We can also gather statistics on what is the rate of failure to circuits that are created through me and report nodes of failed circuits that way as well. So balancing issues, as I mentioned, through scanning we were able to determine the Tor network is unbalanced. There is in fact a guard, a bug in versions less than 0-1-2-15, bug number 440 on the Tor project, bug flyspray, bugzilla equivalent. Essentially the issue is that nodes, guard nodes were accidentally being chosen uniformly across the guard node space rather than weighted by their bandwidth and this has several issues as far as reliability and user experience. Also there is a bandwidth clipping issue. There is a limit on how high we are going to believe what the bandwidth of a given node is in order, you know, so that nodes can't show up and say, oh I have a terabyte of bandwidth, send me all your Tor traffic. It's currently clipped at 1.5 megabytes a second. There are about 32 nodes that have capacities in excess of 1.5 megabytes a second. So that's essentially wasted capacity. So what are the results from scans? It turns out that the top 5% of these nodes have essentially have room for about 7 times more capacity and the next 10% have room for about 3 times more capacity. We're going to grab the breakdowns of that by percentile and how that was done in these successive slides. There are also high circuit failure rates that drop off, that stop at about the point where nodes are no longer considered for guard status. There are also high extension rates, you know, higher than normal extend times beyond this 50% mark as well. So how is this scanning done? Essentially, we divide the Tor network into five percentile ranges, about 80 nodes per range, and build, in the case of circuit scanning and scanning for circuit failures, build about 500 three-hop paths for each of these 80 nodes and fetch a small file through each path. We count the number of failures and track the extend times through this. Bandwidth scanning is similar. Fetch a 512K file 200 times over two-hop paths and average the bandwidth that we observe through them. So what does this look like? What does this misbalancing look like? And what are some of the effects for users? This is the breakdown of node bandwidth by these five percentile ranges. You can see it follows the typical power law statistics, exponential. This is the exponential drop-off of the amount of bandwidth that nodes are able to provide. It turns out the first 5% of the nodes provide about 45% of the bandwidth. The next 10% after that provide about 30% of the bandwidth, and the rest of these guys provide the remainder, 25%. Now, the average stream bandwidth also seems to follow this statistic, even though in a balanced network, every node should be receiving traffic proportional to its bandwidth. It's capacity. So you have, again, the 7x more capacity. The average stream capacity for the rest of the network past this range is about 10 kilobytes a second, as you can see from this diagram. And the first 5%, the average capacity is 75 kilobytes a second for some reason. And then the next 10% after that, it's about 30 kilobytes a second. So what does this look like in terms of circuit failure? Again, you can see steadily rising circuit failure till about the 50th percentile of the network where nodes stop being considered for guard status, and then it drops off. There's a mysterious blip on the radar here at about 25%. I looked at a number of factors that I'll show in successive slides. Still, I'm still not sure exactly what the cause of this is. It remains a mystery. It's not time of day or uptime or anything like this. It could be that this just happens to be a sweet spot for a certain class of users for rate-limiting their Tor node, and for some reason these users don't exhibit that circuit failure. You can also see that extend times are reasonable, again, in this top 15% of the network, but then they start to spike and continue to rise up until about the point where their nodes are no longer considered for guard status, and then they drop sharply off. After the guard status flag is no longer possible. So what does this mean from a usability standpoint? I actually did a couple of calculations, and it turns out that there's a 70% chance of choosing a pretty badly unbalanced guard, and where that number comes from, as you see here, from where the extend times really begin to pick up, is around this 15 and then all the way up to the 50th percentile. And every user is going to choose a guard from the 0 to 50th percentile. So 15 to 50 is 35% double that is 70. The goal of Tor is to maintain three guards. So for existing clients that have already chosen their guards, they have a 34% chance of choosing three unbalanced guards. So what this means is for 34% of the users, Tor is likely unbearable. And anecdotally, this is the case as well. A friend of mine actually convinced her to install Tor. She comes back to me about a month later and she says, well, you know what, my internet connection was, I thought it was broken for a week. It turns out I just had left Tor on. So for 34% of the users, they are likely experiencing some pretty extreme pain until users begin to update and choose guards based on this bandwidth. And then further statistics, three choose two times the probability of choosing one not so highly loaded guard. You have a three times 0.7 times 0.3 or 44% chance of choosing two out of three bad guards. So for 44% of users, Tor is going to build circuits, 66% of the circuits are going to be slow, 33% are going to be reasonable. And then 19% are going to have one bad guard. And only 3% of the users are probably going to have a reasonable guard. So other factors of load balancing, insane exit policies, allowing BitTorrent, peer-to-peer traffic and SMTP are big factors and nodes that are failing a lot of circuits as well. I was able to determine that. Unfortunately, some of these are also hard to see beyond that initial noise of the circuit failure due to this balancing issue. High uptime versus low uptime, this is probably a factor in that if you're a guard node and you're running for a while, users are going to choose you and hold onto you for as long as they can. After a while, if you run for longer than everybody else in the network, you're going to attract a disproportional number of users. They're going to use you. So far, this doesn't seem to be a definitive statistic, probably because guard nodes do go up and down. But I haven't looked at this in a lot of detail, but again, because it's hard to see through the noise. Scarce guard bandwidth. Guard node bandwidth turns out makes up about 40% of the network bandwidth. It would be nice to avoid these things for the relay choice. That's just a possibility. Just so that they're not being used in positions where or lower their probability of being chosen for non-guard positions because they are a somewhat scarce resource. They're greater than a third of the bandwidth, but that remainder should probably be weighted accordingly to that 7% that's left over. Directory versus node traffic. Nodes that are directory mirrors. The balancing between those two may or may not be an issue. And time of day and location are potential possibilities that could explain some of these blips. Like in here, I did run these scans over a number of days. It's possible this was daytime, nighttime, daytime, nighttime, daytime, nighttime. So that's a possibility. I did try rerunning this one at a 12-hour offset from when it first showed up. And that was not an issue on this blip. So questions about the balancing issues, usability issues of guards? Or any network scanning questions? Yeah? . Oh, yeah, so if you want to try and if you use TOR and you think that, yeah, a lot of the time it is slow, and it's variations on slowness, what you can do is try and find this state file. And just remove that. TOR will choose new guards proportionally. That's probably the best thing for you. And then guard TOR, the newer versions of TOR will choose guards proportionally bandwidth. And you have a higher probability of choosing those lessly weighted guards. And at some point, I believe we will expire the guards that, you know, of users that it chose them prior to that. That 02115 version. So at that point, the network should just, as far as I can tell, should magically rebalance. And then hopefully everything will be a lot better. And there should be four, oh, the other piece of math is that there should be about four times more capacity either for more users or more bandwidth per user. So a current estimate is 200,000 users. Should be room for maybe 800,000. But there's a lot of factors in there that, you know, you can't really say that for sure. There's an economic factor. Some users will put up with a certain amount of speed. And then you have that sort of supply versus demand type curve. Steven Murdock posted some nice graphs on that sort of behavior to the OR talk list. Yeah, so it is done probabilistically. So if you weight it by the bandwidth, unfortunately the only metric we have right now is what nodes say that they are observing that they are carrying. But we are able to detect liars, as I said, by the fact that they exhibit the lower stream bandwidth. Now there's potential for sort of a feedback loop there. So you can say, oh, well, these guys are exhibiting a higher amount of circuit failure via those decentralized mechanism scanning. Avoid them. These have more capacity and sort of dynamically rebalance to try and deal with the nuances of what might not be accounted for by that just basic probabilistic weighting. But that's something that's further down the road after we fix, you know, these basic issues. Yeah? . Scan. I believe if you search the OR talk archives, its name was one. So the subject was, oh, my God, I found one or something like this right after I had announced the snakes on the tour. So I found a snake and I was all excited. So there's that post where you can laugh at me or whatever. . The SSH, I should clarify, though, the SSH man in the middle was actually observed initially independent of the scanner. Somebody, I have a day job, not able to consistently watch this stuff. Turns out somebody found the SSH man in the middle. We were able to detect it reappearing at other dates under different names. So they gave up shortly after the person found them on the mailing list, and then they tried again a bit later, and we found them then. So... Okay, so the application layer. This is, I've done some work on TorButton to try and secure the web browser. So what sort of things go into securing the application layer of Tor? Tor has basically a superset of threat model that most applications were written for. No UDP, unique identifiers are bad. Have to obey. Have to obey the proxy settings. Location information is... It shouldn't be translated. It shouldn't leak your time zone. Updates are dangerous. And, you know, it's a hostile network, essentially. This last one is... A couple of these do apply to other scenarios as well. Proxy settings for web are kind of important, I think, from JavaScript malware these days. If you have a corporate internet that you would like to protect from JavaScript that is able to scan the host on your network, proxy settings and a browser that obeys them would be a nice thing to have. Firefox does have this property. Past versions of IAE have questionable behavior in this regard. We haven't yet reexamined the current behavior of it. But updates, again, some Firefox extensions aren't sent over SSL. That was in the press recently. So what sort of things are... are dangerous from a web-based attacker? Bypassing proxy settings is the main one. This can be done with essentially JavaScript events and plugins. Plugins are horrible at obeying even their own proxy settings. Metarefresh is another one waiting for Tor to be disabled and setting a really long metarefresh timer or a continual refresh loop. Correlation of Tor versus non-Tor. This can be done some surprising ways. Cache is one. You can embed a unique identifier in a document you serve through a Tor node and then you can inspect the DOM of pages later to see if that particular content element has that unique identifier that you've embedded into it. Cookies are another big one. Cookies of several websites do not tie themselves to SSL. So if you visit gmail.google.com is one of them. If you visit the HTTPS version of Google and you log in through HTTPS and then you continue to use it through HTTPS, you will have a number of cookies. One of them is this GX cookie. This cookie can be... You can use that to access mail.google.com outside of SSL. Now this also means that you can insert a content element when a user on the local network or through the Tor network visits cnn.com. And you can cause the browser to transmit that cookie, grab it, and then fetch their inbox behind their back or send mails to them or whatever. Several websites have this sort of property. I just ordered some stuff a bit ago, and the shopping cart had the same problem where I was through SSL, but if you used the Firefox extension, cookie color or whatever, to inspect the properties of the cookies, their cookies were any type of session. They could be sent outside of an SSL connection. So it's possible that in those cases somebody can go back and review my order and try and grab my credit card information or whatever. So those sorts of things are a danger both for Tor and non-Tor usage. History disclosure is another big one. JavaScript can examine the DOM attributes of links and determine if they have the visited attribute or not. It can do this with a very high rate of speed, 10,000 queries a second. See if you have been to... issued particular Google queries. See if you have visited certain websites. The Great Firewall can do this against Tor users to see if they've Googled for censored Google queries. You can even do this without JavaScript. You can do it with CSS and set the style for visited to fetch an image. And without any JavaScript at all, examine people's history and see if they've queried it for certain URLs. And then general anonymity set reduction. Essentially comes about because of user agent, location, locale information, and other information like if you're the only Ice Weasel Debian user, there's probably not very many of them. That definitely cuts down your anonymity set considerably. And history records for that search and seizure case that I discussed before. So the plugin wall of shame all these plugins can bypass proxy settings in one way or another. Flash is pretty great because you'll look at it and you'll look at it in Wireshark. You'll say, oh, hey, it did fetch this thing through my proxy. That's great. And you'll use it for a while and then all of a sudden it'll start making some connections outside your proxy. And then it just disobeys them for some reason. So I'm not sure. I don't know the details of ActionScript that maybe you can just say whether you want to listen to the proxy settings from the browser or not or maybe it has to do with how the embedded object is referenced in the page or if that flash thing is first the movie that then fetches other content itself through ActionScript. Those are possibilities. QuickTime has a proxy for real-time streaming protocol which is primarily UDP media protocol. So that's really irrelevant. And that proxy setting doesn't apply to web streams. There's no other settings. Windows Media Player is probably the most amusing one. It does have proxy settings. It even has a no bypass option. It still ignores it. So you can set that in that application and it'll still use both proxy and not proxy if you watch it in ethereal. Adobe Acrobat Reader will leak DNS. Mplayer plugin obeys proxy settings for AVI files and stuff that you fetch just via straight HTTP. But it does support this real-time streaming protocol which is UDP and some other things that it's unclear how those proxy settings really apply. So what's the solution to this? As I said, I did some work on improving TorButton which is a Firefox extension for Tor so you can toggle your Tor usage. Essentially, I disable all plugins while Tor is enabled. I isolated the dynamic content of a page in a couple of number of ways. CSS can fetch elements based on your hover or whatever to do CSS-based projects without any JavaScript involved. So I wrote an NSI content policy that basically I tag every tab with the Tor state of the load for that tab. And if a successive document fetch tries to happen through that tab and the load state of that tab is different than the current Tor state, that fetch is blocked. Also, similarly, I disable JavaScript based on the Tor state of the initial load. And as soon as you toggle Tor, I disable JavaScript in all the tabs with the state different than the current one and re-enable it in all the tabs with the state that is the same as the current one. Cookie jars. I have an option via code contributed by Colin Jackson that saves all your cookies to a cookie jar that can't be accessed through Tor usage. And is restored when you turn off Tor. Cache management. Make sure the cache never writes to disk. Make sure that it's wiped when you toggle Tor. History management. This is essentially another interface that was implemented by Colin Jackson in one of his extensions to prevent at the rendering engine level to inform it whether a link is visited or not. So it blocks both the CSS and the JavaScript methods of determining whether or not you have visited a site. And user agent spoofing during Tor is done a little bit better than the other extensions for that. User agent spoofer is a Firefox extension that tries to do this, but it misses a couple of JavaScript ways of determining the user agent through the navigator object. Firefox itself has user agent settings that it doesn't apply to certain elements of this navigator object that you have to hook the methods of in order to return appropriate versions for when those methods and attributes are examined. Time zone and locale spoofing. Another thing, this is a bit tricky. Turns out there's no way to specify your time zone in Firefox. You actually have to actively hook the date object and make it return UTC times. The example snippet of code for that is on the conference CD. If you're a JavaScript guru, please have a look at that. I did try and vet it pretty much every way I could think of to try and examine ways to access the original wrapped date object that I wrapped via lexical scoping to try and determine what the original time zone was and various ways of copying objects and so on. As far as I can tell, the method that I used to wrap that object, according to every JavaScript reference I read, is a valid method of obfuscating private member variables or protecting private member variables from external access. It's possible I may have missed something. Please do have a look at that. The ideal solution is for Firefox to provide a time zone setting that we can guarantee applies. A demo of these sorts of things with Tor button is probably in order. I have a few websites loaded over here with basic information. This particular page has user agent information. I don't know if you can see this font. I can make that a little bit bigger. After a while, their CSS starts to fail. Here you can see various properties of that navigator object. They're queried. Then they report that I'm using Linux, a particular build of Firefox, and operating system and CPU. If I then turn on Tor and fetch this via a Tor fetch, you can see as soon as that loads, we'll see that it has been reset. The other example I have is, CSS exploit, able to verify that I've been to Google and Slashdot. Time zone information. Here's the fact that I'm on Pacific time. Plugin information, a list of my plugins. Here's a CSS-only history disclosure. No JavaScript involved. They're able to tell that I visit Google. I probably should have loaded all of these. If I run through all of these, they're able to tell that I've been to Google or Slashdot. I'll just do that one. Here you see that the user agent has been reset to Windows. All these properties are Win32. The user agent is pretty much taken care of. All the CSS exploit stuff fails. The JavaScript method of detecting history fails to tell that I've been to Google or Slashdot. My history has not been cleared. Again, it's through the rendering engine. Time and date information. This one, did that reload through Tor? Plugin information. No plugins have been loaded. CSS history isn't able to tell that I've been through Google. CSS pop-ups. This, I should redo this one. Oh, slowly, slowly, slowly. And then there. The time zones are all reset to GMT on this one. So the CSS pop-up will behave a little bit differently. I have to reload this. Here you can see that this thing fetches images for whenever I mouse over these elements based on the hover CSS attribute. If I reload this again and don't hover over those and then turn on Tor and then hover over them, they don't fetch. So via the content policy. Interesting technical details. I think probably the most interesting one of these is the JavaScript hooking. If you are a JavaScript guru, again, have a look at the Black Hat handout on the conference CD and have a look at that JavaScript. To my knowledge, it is solid, but I tried about a dozen ways of attacking it, accessing the scope variable, trying to access the JavaScript source code via modifying the to string and such things, and copying various data objects, and all those seem to fail. So all of those different attacks. So final thoughts, I guess. Oh, we're wrapping up quite a bit early. Final thoughts. Tor security is not equal to Internet security. It's a superset. Adversary has different goals. A lot of apps don't consider privacy vulnerabilities the same as regular vulnerabilities. They are, you know, again, it's a different sort of threat model involved. So credits and contributions. The following people have contributed. We've got Scott Squires, the original Tor button author. Colin Jackson did the history hooking and cookie jars, borrowed his code. Johannes Renner is the Google Summer of Code student working on Tor flow and intelligent path selection. Nick and Roger for advice and Tor in general. And then shout out to my coworkers, I guess, for, well, at least one of them signs the expense reports and the other two are pretty good guys in general. So what can you do if you're interested in helping Tor? On the conference CD is a Linux script for doing load balancing and you can prioritize Tor traffic below all your other node traffic. I use this on my own Tor node. It doesn't... I notice no impact from the Tor traffic over my SSH traffic or other web traffic. Basically, it's used the Linux QoS support, so it's pretty handy. A nice way to run a Tor node without really interfering with your other activity on your shell server or whatever hosting you might be using. And then, again, please try and raise awareness. Post some, you know, plug-ins or patches to your apps to protect against information disclosure. You know, work to raise awareness about privacy issues. Consider it part... It should be considered part of security measures, I think. There's a lot of arguments for some of these issues with proxy settings that can be made independent of Tor. Similar to those things, that's probably the best way to convince somebody that an issue with Tor is a good one. Is a good thing to fix is to find the example that outside of Tor where it's still a problem. So, that pretty much wraps it up. Questions, comments on those sorts of... Those protection mechanisms? Yeah. Okay. That is still... It's pre-proposal form. So, there's a proposal system in Tor where people write up proposals to essentially work on, you know, proposed features. There's a lot of subtleties there and anonymity issues with providing that. There's also issues where, you know, dissidents in China that are trying to bypass their firewall aren't able to, you know, do this sort of thing. So, do that mean do they get no service or are they going to be... You know, is it going to be horribly abysmal service? I don't know. Other general questions? All right. Yeah, I guess that... I guess we wrapped up quite a bit early. Right. Okay. No more questions.