|
|
Log in / Subscribe / Register

Spoiled onions and Tor exit relays

By Nathan Willis
January 29, 2014

The Tor network offers users a valuable set of features designed to ensure anonymity, but those features rely on the availability of well-behaved Tor nodes. A research team in Sweden recently explored the Tor network looking for malicious nodes, and its newly-released findings indicate that while the bad actors are few, they are indeed out there.

The team is led by Philipp Winter and Stefan Lindskog at Karlstad University; their past research has looked at other potential threats to Tor, such as the "Great Firewall of China" and various deep-packet inspection (DPI) techniques. The new study took a look at Tor exit relays, the final nodes in Tor's network circuits which make the last-hop connections with Internet servers. These connections are not encrypted by Tor (although the payload connection itself could certainly be running over SSL/TLS), so they are particularly important to the integrity of the Tor network as a whole. A malicious exit relay could undermine its connections with a variety of man-in-the-middle (MITM) attacks: traffic sniffing, DNS poisoning, SSL stripping, or even HTTPS MITM interception.

Like a relay over trouble water

Winter and Lindskog monitored the Tor network for four months in 2013, analyzing the behavior of more than 1000 exit relays. They published their results [PDF] in January 2014. To detect a malicious relay, they used a lightweight Python tool that creates Tor circuits to a decoy destination, specifically choosing each exit relay used in order to test as many as possible. This is a non-standard feature of the test program; Tor clients can choose the circuit they use for their connection (in order to make it harder for outside attackers to predict the circuit), but by default Tor randomizes the circuit, rather than asking the user for input.

Relays conducting HTTPS MITM attacks could be detected by simply comparing the fingerprint of the destination's X.509 certificate as reported by the relay with the known, correct certificate. The tool could also detect SSL stripping attacks, in which the malicious relay would rewrite HTTPS URLs as HTTP equivalents. Here again, detecting the interference of the exit relay is a simple matter of comparing the document returned through Tor with the known original.

The team also tested SSH connections, in which a malicious relay might attempt to replace the destination server's public key, as well as DNS requests. SSH MITM attacks are more difficult to carry out, they note, because replacing the destination key only fools the SSH client if the client has never connected to the server before—for a known server, SSH will report the key mismatch to the user. DNS poisoning, they note, is not common, but in the past there have been incidents reported where Tor exit relays inadvertently blocked certain sites by running filtering software.

Results and impact

Over the course of the four-month scan, the team encountered just 25 misbehaving exit relays. As a percentage of Tor's total network, that is quite small; the roughly 1000 relays scanned during the test accounted for every active exit relay the team saw. Still, some might consider 2.5% high, particularly in light of the fact that most Tor clients cannot select the exit relay used for their connection.

The bad relays are summarized in a table as well as in the paper. The majority of the attacks detected were HTTPS MITM (18), followed by SSH MITM (5); several relays were found to mount both attacks. There were also two SSL-stripping relays, two relays that redirected DNS requests, and one that used an HTML injection attack.

Looking at the fake HTTPS certificates returned by the bad relays revealed another interesting fact: the researchers found that all of the HTTPS MITM relays returned a certificate signed by the same root Certificate Authority (labeled "Main Authority," which is not a genuine CA). That may suggest that all of the malicious exit relays were run by the same attacker, although there are other possibilities (such as a malicious-relay-in-a-box program). These exit relays were located in several countries, in several different IP address blocks, but in addition to using the same root CA, they were all running the same version of Tor.

The decoy destination site requested during each test also appears to have made a difference. The team reports that some of the tested relays would only launch an attack against their decoy site that used the word "bank" in its domain name.

Interpreting the significance of these results is a subjective exercise. The Tor network has mechanisms in place to block an exit relay if it is believed to be acting maliciously. The paper also notes that the HTTPS MITM attacks would be difficult to pull off against a real user, because the phony root CA used would trigger an invalid-certificate warning from the browser. Of course, that supposes that the user takes the invalid-certificate warning seriously, which is certainly not guaranteed, but it could be argued that a Tor user would be more cautious than average.

Going forward, the researchers recommend a few possible paths to protect users against attack. One is fetching server certificates in parallel over multiple Tor circuits, a technique that has also been recommended elsewhere for use with direct HTTPS connections (such as Convergence). They also speculate that initiating a certificate fetch (over a different circuit) whenever an invalid-certificate warning is encountered could be valuable.

For its part, the Tor project has historically been good about anticipating new threats and adapting to them. The Tor Browser Bundle, for example, incorporates the HTTPS Everywhere extension specifically to guard against SSL-stripping attacks. Whether or not 25 bad exit relays constitutes a significant-enough threat to prompt changes to Tor is up to the project to decide. The existing countermeasures can certainly block out 25 bad exit relays, but perhaps there would be ways to detect these relays without requiring a four-month study. For Tor users, the good news is that the vast majority of tor exit relays seem to be behaving properly—but the bad news is that there are no guarantees.

Index entries for this article
SecurityAnonymity
SecurityInternet/Tor


to post comments

Spoiled onions and Tor exit relays

Posted Jan 30, 2014 1:57 UTC (Thu) by apoelstra (subscriber, #75205) [Link]

I have seen such a Main Authority certificate once before on LWN. Firefox angrily flagged it, so I went on IRC to ask others to confirm the cert fingerprints. They did not match, so I shrugged, started a new Tor circuit and tried again, successfully.

I've always assumed my exit nodes are malicious. For example, any passwords I enter on non-SSL sites over Tor are probably being recorded. To be honest, I'm surprised only 2.5% of exit nodes were overtly modifying traffic like this.

As an aside, I found it very frustrating to be unable to copy-and-paste SSL fingerprints out of Firefox's Page Info window. I suppose I should file a bug about this.

Spoiled onions and Tor exit relays

Posted Jan 30, 2014 10:03 UTC (Thu) by xav (guest, #18536) [Link] (3 responses)

The NSA can probably forge valid certificates.

Spoiled onions and Tor exit relays

Posted Jan 30, 2014 10:47 UTC (Thu) by johill (subscriber, #25196) [Link] (2 responses)

Wouldn't they still have detected that, since they likely connected to servers they controlled, so could compare the certificate exactly?

Spoiled onions and Tor exit relays

Posted Jan 30, 2014 15:45 UTC (Thu) by raven667 (subscriber, #5198) [Link] (1 responses)

And they can only forge certs very very rarely, like what was done for Stuxnet, so this could only be used against pretty high-value targets. And certificate pinning could detect it, once detected the whole thing is kind of blown and you can't do it anymore.

Spoiled onions and Tor exit relays

Posted Jan 30, 2014 16:36 UTC (Thu) by njwhite (guest, #51848) [Link]

Exactly, and as the exit relay can't tell who it's relaying data for (at least without controlling a significant portion of the Tor network), it won't work. It's too high value a technique to use unless you're confident of your target.

I suppose if the exit monitored the traffic looking for e.g. a specific username being entered in plaintext on a certain site it could MITM, but even then you'd struggle, as IIRC tor switches circuits every 10 minutes anyway.

Spoiled onions and Tor exit relays

Posted Jan 31, 2014 8:59 UTC (Fri) by Lunar^ (guest, #47323) [Link]

It's important to note that the 25 bad relays that were detected never where all active at the same time.

Many of them appeared serially: once detected, the operators moved the relay to a new IP address and got a fresh identity key.

For this reason and how Tor weights exit relays in the selection process, one should not be mislead by the “2.5%” figure. It never was the probability of a Tor user to go through one of these bad relays. The latter is much lower.


Copyright © 2014, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds