馃攳
How TOR Works- Computerphile - YouTube
Channel: Computerphile
[0]
Let's talk a bit about anonymization, more specifically onion routing, so Max has done a very good video on the Dark web
[7]
And the deep web and the service web and the differences between them when people talk about the dark web
[13]
They're mostly talking about Tor and specifically Tor hidden services. Now I'm not talking about that certainly today
[18]
I might do that in a different video
[20]
Tor literally stands for the onion router, right, it is an implementation of onion routing right which was developed in the mid 90s by
[27]
US Naval research.The idea is
[30]
It bounces around connections between different routers so that they're hard to track and it's and it provides anonymity
[37]
So this is different from confidentiality which we usually associate with encryption right most of the time, we're encrypting messages
[44]
So that even if people see that we've sent a message
[47]
We, they can't read what it is like, but sometimes we don't even want people to see that we sent a message at all
[55]
So what I'd like to do is focus on onion routing specifically bearing in mind, that Tor is a and implementation of it
[62]
so in some sense
[63]
I'm also talking about Tor, okay
[65]
And maybe we'll focus a little bit more on what it is that Tor does differently a bit later.
[69]
So this is me and which is my very well drawn computer as always and I want to talk to a server here
[74]
Which doesn't have a monitor because in my view servers don't have monitors, so normally on this client server setup
[79]
I want to talk to a server, but in this case
[82]
I don't want anyone to know that I'm talking to a server at all
[84]
I'd like to be remain completely anonymous, right, now if I then go onto the server and log on obviously that's not anonymous anymore
[91]
Right so it's limits to this
[92]
but this is the idea, now how this works is I'm going to bounce my connection around and
[98]
Then it's going to go to the server and if in essence the last node on the hop, the last hop on the network is
[104]
Is going to be the one actually visits that website on my behalf a bit like a proxy we're going to use multiple levels of encryption
[110]
to try and
[112]
Essentially confuse people who are trying to work out what's going on right now Tor in it in
[117]
In its implementation uses three hops three intermediate nodes, so I'm going to limit: one
[124]
That's not a very good computer
[126]
Two. Hang on I thought servers didn't have monitors. Oh no, so well. Aw, don't. I mean
[133]
yeah, so that's a good question right so you can run Tor and you can be an onion router on a client machine on a
[139]
Laptop you know it doesn't really matter if your net connection is quite good
[143]
you can do it. The software is free and they
[147]
Very much want people to sign up and become these intermediate nodes because in some ways that's what the power tor is
[152]
we'll get to that a little bit but
[155]
in essence what happens here is I send a message to
[157]
To this guy he forwarded on to this one he falls it on to this one who then forwards onto the server when a server
[164]
Responds they simply pass the messages back now this haven't really solved any problems yet
[169]
Because anyone sniffing here will know well ok we just need to sniff there and then sniff there.
[173]
and they can kind of reassemble the communication
[176]
It makes it a bit of a pain, but it doesn't stop anyone from finding out: What's going on?
[181]
I, even if these were encrypted so what we need to do is have multiple layers of encryption
[185]
What's clever about onion routing, Is that no one in this network knows anything about the whole connection.
[192]
They just know what's before them, and what's after them. Alright?
[195]
so let me show you how this works so
I'm going to use different colored pen alright, so let's use this red pen.
[199]
Let's imagine for a minute that I've established some shared symmetric keys with these three nodes here, right?
[204]
So just like in previous videos where we talked about encryption
[208]
We're talking about let's say an AES key
[210]
And I have one shared with this guy and one shared with him and one shared with this guy no one else knows what they are.
[215]
like because I used a key exchange to do this, so I had K1 K2 and K3
[221]
and this router knows K1 this router knows K2, and this router knows catering now that might seem implausible
[228]
But actually that's quite easy to set up using modern key exchange right Diffie鈥揌ellman for example performance is quite well
[233]
If I encrypt something with K1 only this router
[236]
Can see it all right and if I could encrypt some of K3 only this router can see it right there is no
[241]
Encryption with the server at the Moment. Now onion Routing
[245]
Essentially sends messages, encrypted multiple times with different keys in layers, so this message here
[252]
is encrypted three times, right
[254]
So this is where we sort of fast forward as I draw a bunch of lines on
[257]
But we're going to say this [risk route] message here encrypted once with K3. It's encrypted another time with K2
[265]
And when it's encrypted a final time
[267]
With K1 now let's think about what that means
[271]
it means that only
[273]
This router here
[275]
Could unlock the first layer. That's the first thing it means it also means that when it's done that it's
[280]
Got a totally garbled message, but because it's still encrypted twice already right, so it's gibberish it can't possibly know what's going on
[286]
But what it can do is forward that message on to k2 so k2 takes a message,
[291]
Which is encrypted by k3 and then again encrypted by k2 and it can strip off a layer as well
[297]
But again, it then looks at the message
[298]
And it doesn't make any sense because it's still encrypted by k3 so it forwarded on to this router
[304]
Encrypted by K3 finally K3
[307]
Decrypts this message looks at it
[309]
And it does make sense because it's not encrypted anymore, and it and it says the message says I'd like to go to Facebook please,
[315]
and it goes I can do that and it connects to Facebook and receives a response now on the way back
[321]
the exact reverse process happens.
[323]
This router will add its encryption of k3 and forward the message onto router 2 - who will add K2
[328]
Route 1 adds k1 and only we can decrypt the whole message because we have all the keys
[335]
What's really interesting is the property that this gives us, the first thing is that k 2 doesn't need to know anything,
[341]
except the address of K1 and the address of k3 it doesn't need to know who I am right it receives a message from
[348]
K1 and all it knows based on the protocol is this is a message that needs to be forwarded to k3
[353]
After I've removed my layer of encryption
[354]
That's all it knows when it receives a message from k3 it adds its encryption
[359]
And then passed it straight out the other door to router 1 so if this was compromised by an attacker
[364]
They've learnt nothing right. They've learned that two of these guys and running Tor nodes or onion routing nodes
[370]
They haven't learned who I am they haven't learned who the server is because both times it is encrypted with layers of encryption that they can't remove.
[376]
This is kind of gives you an insight into what it is
[378]
That's clever about onion routing they think about some of the other things that it does.
[382]
K3 knows who the server is because it receives a message. That said I'd like to go to Facebook
[387]
So it knows that someone on this network in visiting Facebook, and it knows that the next
[391]
Hop is this chap this router here it knows nothing else. It doesn't know who this client is
[396]
It doesn't know who router one is so there's no way for it to say: Ahh, Mike's visiting Facebook again, right?
[402]
He's on there too often, because the way that the Tor protocol works. You don't actually know when you decrypt your layer
[408]
How many more layers there are there could be 200 nodes and layers they don't tend to be but they could be.
[413]
so the output node only knows what's going on on the server side and
[417]
Similarly the input node my external is called a guard node is only aware that this client is browsing Tor any messages
[424]
It receives are usually encrypted with two other layers of encryption that it can't decrypt so it just says well
[430]
I've got this message. I need to forward it on to this router. That's all I know right
[434]
I don't know, but they're on Facebook. I don't know that they are on a forum or they're doing amazon shopping
[438]
I don't know anything about what they're doing, so this is what Tor does Tor is in essence an implementation of this approach, right?
[444]
So it has a protocol with you know message lengths and structures that are well defined in its
[451]
Documentation that specify how you establish these keys how you send these messages
[456]
How each one should decrypt them and forward them on to the next one, but in essence what you do is
[462]
This client here will create what we call a circuit
[465]
Which is this three hops, by
[467]
first establishing a shared key of him then instructing him to do the same and then him to do the same and
[474]
adding extending the circuit each time they want to with new nodes on the end and
[478]
Every time I do that all the previous messages have been encrypted. So nobody knows what's going on, so it's quite interesting
[486]
Is it slower because of all these hops?
It's a lot slower like you've got to consider that
[491]
These nodes first of all they might be they might be serving a lot of clients at once so there might be other ca-
[496]
uhh, keys
[496]
shared with other people coming in here and leaving here and this one might be an exit node sometimes and he's talking to servers and
[502]
browsing the web for people
[504]
and so yes
[506]
You don't want to be signing up to be an onion router if you haven't got quite a lot of bandwidth also consider that they?
[510]
May not be located very close together, right?
[512]
So this could be in Germany this one in the united states this over in Japan not really important
[517]
but a point is that it's making you know large global hops which take in the order of
[522]
Sub-second but not small amounts of time
[525]
so you can expect to wait a
[527]
Little bit longer for your messages to get through, all right, but the benefit you get is that no one knows?
[532]
What what it is you're doing, right?
[534]
We've got a situation here where no one really knows anything about what's going on at all, right? Which is very very clever
[540]
and
[541]
Has obvious benefits to people who want to remain anonymous.
[544]
Now there's a few things we've missed out
[546]
It's a lot of things I've missed out right because because the Tor protocol is quite complicated
[550]
But this is the general idea the first thing is that if you go, if you if you create this circuit,
[555]
And then you just go to Facebook and type in your username password and click it
[559]
You know that's going to give away what you're up to, all right, Facebook will know who you are for a start
[563]
But if you go to a website, that's not even encrypted at all. This is sent in the clear, right?
[568]
So someone's sniffing in at this point
[569]
Let me use my blue pen for sort of eavesdroppers like if someone's eavesdropping in at this position
[574]
They'll know exactly what you're doing, right?
[575]
And you type in username and password then they have your username and password. So you still have to use TLS or HTTPS,
[582]
uhh,
[582]
connections to the actual servers right, but that's really on you once you've set up this circuit
[588]
You said normal HTTP requests and responses to servers as you would normally
[593]
It's just instead of it going through your normal internet connection and your normal ISP router it goes through this circuit
[601]
and with all the encryption happening
[603]
so in actual fact the
[604]
Implementation the Tor uses. It works essentially like a proxy you talk to your own proxy server which handles all this for you and then
[612]
responses come back so yes your web connection is a little bit slower, but for all you know it's
[617]
Just a normal connection to a server. That's basically how it works is really not a lot
[620]
more to it than that right and it's quite elegant, and it works very very well
[624]
is using tools that like just installing a different kind of browser?
[628]
Yeah
You use a Tor browser or you can use it as a service and then you know pipe other thi- other services through it
[633]
But Tor is not illegal and nor should it be it's just encryption. There are a few downsides right the first aside from the speed
[641]
The first is that
[643]
people can sniff on this network and start to get the pieces of the puzzle the more positions
[648]
You are you know the more pieces you get right?
[650]
But so if I'm sniffing here at position A then what you see is you see that I'm using Tor you can't see anything else
[656]
If I'm sniffing here or here I learn nothing right apart from this encrypted messages going on Tor these onion routers are
[664]
listed publicly in the directory so finding their identity is not a
[668]
Great concern of mine if I'm sniffing a position B at the exit node
[672]
I find out that someone on Tor is visiting this website if it's encrypted
[676]
Let's say using TLS
[678]
Then that's all I find out the next question that people be asking is what happens if I control both A and B
[684]
All right, if I'm at the front of the network going in and at the exit node
[688]
Can I start to find out?
[690]
What's going on? And the answer is yes, right?
[693]
That's the weakness of Tor and something that basically is unsolvable apart from just to be very very vigilant
[699]
So how would this work, well?
[701]
You've got to remember that this is the big network. There's lots of users on it
[705]
C is not the only person talking to this router, right?
[707]
He's going to be the intermediary for conversations the third node the second node the first node
[713]
He might be an exit node. He might also be talking to servers
[716]
There's a lot of traffic going in and out like some of which is Tor some of which is not
[720]
What we're talking about is looking at a lot of traffic coming from my machine to this router
[724]
And a lot of traffic going from other routers to websites and trying to correlate them and work out what it was that I did
[730]
Right, which is not an easy job, but you can imagine that if you've got some time signature of messages
[735]
But let's say a sort of message, message, message, message, message
[739]
Then talking to this server coming out here is going to be a kind of mess of lots of messages
[744]
But you might be able to find the key points that match up
[749]
With what I sent in like that's the idea this traffic. Analysis is the main
[754]
Approach to essentially De-Anonymizing people if you found that I sent 15 messages of a certain size and
[762]
a certain Sort of Tempo should we say and
[765]
Then you found out that those 50 messages came out somewhere else on the network
[769]
At the same just shortly after let's say a half a second after, at the exact same tempo
[773]
That's a little bit interesting.
[775]
With all these layers of encryption does that change the file size?
[778]
No, which is a good thing right? This is cleverly designed with that in mind
[782]
So Tor messages are called cells and cells are 512 bytes long. They're always
[787]
512 bytes long the way that a router works out whether it's
[790]
Reading a message or whether it needs to forward it on it's basically based on a small
[794]
hash or digest that's held in the message essentially it looks at the tail end of the message,
[800]
calculates a hash on it and goes well
[802]
that doesn't match the hash I've got at all it must still be encrypted because it's nonsense
[805]
So then it knows to forward it on, see. And it does this by basically
[810]
avoiding changing the size of the message it will be obvious as you say right if if
[815]
three layers of Encryption added ahead of each time
[818]
You would know how far along the hops were and the whole attack would be a lot easier
[821]
Right so onion routing is based around the idea that any message between any node in the network looks like any other message
[828]
Right it could be the first one could the last one it could be something in the middle
[832]
Right it could have nefarious information on it. It could have perfectly benign information on it impossible to know all right
[838]
Which is really really clever.
[841]
There's a lot of research on Tor that goes into
[844]
Working out how to minimize a chance for both A and B are nefarious
[848]
That's the idea, so this is why they sometimes call these guard nodes because usually you select some trusted ones
[854]
And you only use those for example. We don't pick at random because lots of
Most Recent Videos:
You can go back to the homepage right here: Homepage





