I have frequently heard that the endpoints of a Tor connection are unencrypted. This makes no sense to me. If the purpose of Tor was originally to protect dissidents in places like China, then why would the connection from a computer running Tor browser to the Tor network be unencrypted? Anybody with influence at the ISP could then listen to all traffic. So I have assumed that the claim that Tor is not encrypted in the first/last legs is nonsense. But is it? I keep hearing this claim.
Your connection into the Tor network itself is encrypted, as are connections between Tor nodes. In fact, each hop is encrypted with a new key to avoid back-tracing.
What might be unencrypted is the connection from your Exit Node onto the web, if you're connecting over an unencrypted protocol. This means that if you're viewing a standard HTTP webpage then the final Tor node in your circuit and their ISP can see the unencrypted data, but they won't be able to trace it back to its origin (unless that data contains anything personally identifying you).
If you connect to a remote site (e.g example.com) using the Tor Browser, then strictly speaking there are five "hops" (TCP connections) involved, marked A, B, C, D and E below:
browser -A-> Tor client -B-> entry node -C-> middle node -D-> exit node -E-> example.com
Of these five hops,
- "A" is the connection between the Tor browser and the "Tor" program; it uses a protocol called SOCKS which is unencrypted. Both the Tor browser and the Tor program are part of the Tor Browser bundle; so if you are using the Tor browser bundle both programs are running on your computer under your control, and nobody can eavesdrop on the connection. The Tor client picks a path through the Tor network by choosing an entry node, a middle node and an exit node.
- "B", "C" and "D" are the hops which make up the chosen path through the Tor network, each is encrypted with a layer of encryption, such that each node can remove one layer.
- "E" is the connection that the exit node makes to the remote site you wanted to contact (example.com). Tor doesn't "add" any encryption to this hop; therefore whether it is encrypted or not depends on whether the remote site supports encryption, and whether you (or your browser) chose to use it when you tried to access the site.
If the remote site supports encryption (as is the case when you access a site via a https:// URL) then the traffic will be encrypted "from end to end" (i.e. from Tor browser on your computer to the remote site). If it does not (e.g. a normal http connection), then hop "E" will be unencrypted, and it is possible for the exit node or anybody else who can eavesdrop on the traffic between the exit node and the remote site to listen in.
The Tor Browser comes with an extension, https-everywhere, preinstalled, which will automatically "upgrade" any http connection attempt to an encrypted https connection if it knows that the remote site supports it.
Tor uses onion routing for its encryption which means you will encrypt sent messages using the encryption keys shared with each node. However, the last node or the end point will be able to decrypt the message and see its contents (in order to know where the next hop destination is). And if you message sent is unencrypted (non-HTTPS) then it is able to see your unencrypted/plaintext message too.
So, the last node may be able to act as a man-in-the-middle and modify your messages without being detected. Thus, using HTTPS is recommended since the HTTPS encryption key is shared between you and the web server, the last node would not be able to decrypt and view the message contents.
why would the connection from a computer running Tor browser to the Tor network be unencrypted?
The 'Tor network' starts at the Tor client, which typically runs on the same machine as the browser.
The traffic from the Tor client to the Guard relay is encrypted in 3 layers of encryption.
The traffic form the exit node to the final destination is plaintext.