Instructor: In the previous lecture,
we discussed a good solution
to protect us from man-in-the-middle attacks.
And that solution was to use HTTPS Everywhere plugin.
With this plugin, as seen earlier,
we were able to force all HTTPS websites
to always load over HTTPS.
Therefore, if anybody intercepts our data,
it will be useless because it will be encrypted with HTTPS.
So this solution is really good, it's free.
The only problem is, as you know,
it only works with websites that use HTTPS.
So we seen earlier if you log in or use the HTTP website,
your data is still exposed,
hackers or anybody that intercepts your data
is still able to read your usernames, your passwords,
or inject JavaScript code,
serve you fake updates, and so on.
Also, as seen earlier, with this plugin,
the hacker or anybody that intercepts your data
will be able to see the websites that you visit.
Not only that, but they'll also be able
to manipulate DNS requests, and therefore,
they will be able to run DNS spoofing attacks.
At the end of the previous lecture, I said,
if you want to take your security to the next level,
then you should think about using a VPN.
Let me show you what happens when we use a VPN,
and then I'll explain it in more details
to help you understand what's happening.
So I'm back here at my hacker machine.
As you know, it's already the man-in-the-middle,
I'm gonna clear the screen.
And I'm actually gonna even turn off HTTPS Everywhere.
Now, it's a good idea to use both at the same time,
but I'm just gonna turn it off
just to show you the difference.
You can use any VPN provider you want,
it really doesn't matter,
most of them use more or less the same technologies.
We at zSecurity provide our own VPN service called ZSVPN,
so I have it right here, it comes with no logs.
We support all operating systems, Linux, Windows, OS X,
Android, and iOS, and even Tails,
which is a privacy focused Linux Distro.
So like I said, you can use anything you want,
they all use more or less the same technology.
What I wanna highlight right now is what happens
when you actually go ahead and use a VPN.
So I'm gonna open my client,
and I'm gonna connect to a server,
one of the servers right here.
And what this will do is,
it will establish an encrypted tunnel between my computer
and the VPN server that I just connected to.
Therefore, right now, let me show you let's just start,
I'll delete everything.
And let's start by going to some websites,
for example, we'll go to google.com,
then we'll go to bing.com.
And then let's go to Stack Overflow
and make sure it loads over HTTPS.
Now, keep in mind, I am not using HTTPS Everywhere.
But you'll notice that it will still load over HTTPS,
as you can see, we're not able to downgrade it.
And let's take this even one step further,
let's go to vulnweb.com, and just login.
So again, this is a website that only uses HTTP,
it simply does not support HTTPS.
But let's log in and see if we can still capture the data.
So I'll just put my password now 0987654321, Log In.
And let's go back to our Kali machine
to see if we detected anything.
Now as you can see,
we're not able to read any of the traffic
sent to and from the target.
So with the case when we used HTTPS Everywhere,
we were able to see at least, the domains,
the websites that the targets visited.
And we were able to see data sent over HTTP
when we logged in to vulnweb.com.
But in this case, as you can see, right now,
we can't see the username and the password,
even if they're sent over HTTP to vulnwebweb.
And we can't see the domain names that the target visited.
And the reason for this is because we are using a VPN,
and like I said, a VPN creates an encrypted tunnel
between our computer and a server, and all of our data
will be sent through this encrypted tunnel.
Let me explain this to you with diagrams to make it simpler.
So in general, let's say you try to go to google.com,
your connection will pass through a number of hubs,
but at the end, it's going directly to google.com.
Hence the red arrow indicating that this connection
could possibly not be encrypted.
Therefore, your data might be at risk.
Now when you use a VPN,
you connect to a VPN server in a certain country.
And when you do that, you create an encrypted tunnel
between your computer and the VPN server.
So let's say you want to go to google.com,
data request will first be sent to the VPN server,
now the VPN server will be able to read this,
but the data is sent in an encrypted tunnel.
Therefore, if anybody intercepts this data,
they will not be able to see
what you are sending to your VPN server.
That's why we don't even care
if someone manages to intercept our connection
because our data is simply gonna be gibberish to them
as you can see in here.
Then, once the VPN server receives your request,
it will forward it to the destination
that you're requesting,
and the response will follow a similar route.
Now, because of this structure,
because of the way that the data is always encrypted
between you and the VPN server,
using a VPN can be useful in so many scenarios,
because it adds an extra layer of encryption.
Therefore, it improves our privacy and anonymity in general,
it allows us to bypass censorship
because let's say your internet service provider
is preventing you from accessing certain services,
or certain websites, they will not be able to know
what these websites and these services are,
because again, the connection is encrypted,
and they won't even know what you're doing.
All they'll see is that you're connecting
to a server in some country.
And last but not least, it'll also protect us from hackers,
or anybody that intercepts our connection,
again, because all of our data is encrypted,
therefore, we don't really care
who intercepts this data, the data will be gibberish.
Now, also because of the structure,
you need to be careful when you pick a VPN provider,
because this structure introduces the VPN provider
as a man-in-the-middle, so as you can see,
we send everything to the VPN server first,
and then it goes to the internet.
And the VPN server is able to decrypt this data
because the tunnel, the VPN encryption,
is only used between our computer and the VPN server.
So if the admin of the VPN server
wanted to analyze your data,
and see what you sent and received,
they will be able to do that.
Therefore, you need to make sure
that you pick a reputable VPN provider,
a company that you can trust.
You wanna stay away from free providers,
because providing a VPN service is very expensive.
Therefore, if someone's able to give it to you for free,
they must have another angle,
or another reason of why they are giving this for free.
You wanna make sure that the VPN's provider keeps no logs,
and with all of that,
you can use HTTPS Everywhere plugin with the VPN.
If you do that, you will actually fix the problem
of the data leaving the VPN server
because your data will be encrypted
between your computer and the VPN server
with two layers of encryption.
First using the VPN encryption,
and second using TLS because of HTTPS Everywhere.
Then data leaving the VPN server
will be encrypted with one layer of encryption,
which is the encryption enforced by HTTPS Everywhere.
Therefore, even though the VPN provider
is able to see your data,
and able to decrypt the encryption used in the VPN tunnel,
they will still not be able to see your data
because it will still be encrypted with TLS.
So this basically solves the problem
of the VPN server being able to see your data,
because at the VPN server,
your data will still be encrypted with TLS.
So to summarize the two methods
that we covered to protect our data
from man-in-the-middle attacks,
with HTTPS Everywhere, it's great, it's free.
The only problem is it only works with HTTPS websites,
the person intercepting the data
will still be able to see the websites we visit,
and they will still be able to run DNS spoofing attacks.
Then we spoke about using a VPN.
And with using a VPN, everything gets encrypted,
so that's even better.
None of the attacks that we talked about,
and that we covered in this course will work
'cause everything gets encrypted.
The only problem is, it's not free.
There are free services, but like I said,
they're not great, so you shouldn't use them,
just don't Use a VPN if you don't wanna pay for it.
The other problem with the VPN
is that the VPN provider can see your data,
so you're introducing a man-in-the-middle.
But we can take this one step further
and use HTTPS Everywhere with a VPN, and with that,
we're getting all of the benefits of using a VPN.
So everything gets encrypted,
protect us from all man-in-the-middle attacks,
but without the problem of the VPN provider
being able to see our data
because our data will be encrypted with two layers.
Therefore, even the VPN provider
will not be able to see what we sent or received
because it will still be encrypted with TLS.
So the only downside to using HTTPS Everywhere with a VPN
is the fact that you have to pay for the VPN service.