Instructor: Now in this lecture
we'll learn how to configure the router
so that it forwards incoming connections
to the Kali machine so we can receive reverse connections,
we can hook people to BeEF
and launch attacks outside the network the same way
that we used to launch them inside the network.
So to get to the router settings,
usually the router is the first IP in the subnet.
So you can see that my IP was 192.168.0.11.
Usually the router is the first one
so it'll be 198.168.0.1.
Also, another way to get it,
you can type in route -n
and that'll show you where the gateway is.
And as you can see,
it's at 192.168.0.1.
So this is the local IP address of the router.
We're gonna browse that in our browser,
so I'm just gonna type it in here.
192.168.0.1.
Hit enter.
And as you can see,
I have my router settings
and I have to log in with the username and password.
Now, the router settings might look different
from router to router,
but the names are usually the same.
Usually, first of all,
you'll have to log in
as you can see here for me.
And you either have a default username and password
or it will be,
you'll see them on a sticker behind
or underneath the router itself.
So for me, I've actually changed the password
so I'm just gonna log in.
So I'm logged in here to my control panel
and again, it might look different for you.
But you wanna look for something called IP forwarding.
For me, it's under Advanced.
So I'm gonna go to Advanced,
and then I'm gonna go on Forwarding.
And this is where I can set up my IP forwarding.
So look for something called IP forwarding
or I've actually seen them on some routers
called virtual network,
I don't know why.
But you wanna look for something
that allows you to set up rules to redirect ports
inside the network.
So the port that were listening on at the moment
is port 8080.
So that's the port that we picked in the handler,
that's the port that we picked in the backdoor
and that's the port that we wanna get the connection on.
So the public port is gonna be 8080
and again, the target port is gonna be 8080.
And the target IP address is the IP address
that's listening on the port.
So this is the IP address of the Kali machine
where you have your handlers running.
So the IP address of may Kali machine right here
is 192.168.0.11
and we can see that also right here
from the result of ifconfig,
so it's 192.168.0.11.
I'm gonna type that in here.
And that's it,
that's the rule that we wanna add.
I'm gonna click on Save
and that rule is saved.
So now whenever the router gets a request
for port 8080,
it'll know that it's gonna forward that request
to the Kali machine
and the router will not cut that connection.
So we've actually set up a proper route right now.
So the first thing we did is we created the backdoor.
We used the real IP in the backdoor,
we didn't use the private IP,
so we didn't use the 192.168.0.11,
we used the real IP.
We're gonna send that backdoor
to a device on a different network.
That device is gonna run the backdoor.
The backdoor will try to connect back
on the real IP to the router,
but the router will know exactly what to do
with this because we just set up our rule
telling the router to forward any requests
that it gets on port 8080 to the Kali machine.
What I also want to do is,
I actually wanna set up a rule for port 80.
This is the port that Apache,
that my web server runs on.
And I wanna enable that so that I can download the backdoor
from the target computer.
So I'm gonna add the rule for port 80.
And again, this is gonna be the same machine,
the Kali machine.
And we're gonna put port 80 here.
We're gonna save this rule.
And this will allow me to download the backdoor
because I placed the backdoor in /va */www/ right here,
so I'll actually be able to access my web server in Kali
and download the backdoor from outside the Internet.
So I'm gonna start my Apache web server.
So this is actually just another example,
you don't even need to do this.
You can just transfer the backdoor using USB
or any other method or send it via email.
I'm just showing you another example
of how port forwarding is used.
Now I'm gonna go to a Windows machine
and that Windows machine is gonna be connected
to a completely different network.
And we're gonna download the file from there.
So here is my Windows machine
and if I go and check my IP,
you'll see it has a different external public IP.
So I'm just gonna look for What's My IP.
You'll see that the IP here is completely different
than the IP of this machine that we used.
So these are two completely separate devices
connected to different networks.
And what I'm gonna do know is
I'm gonna access my Apache web server
and download the back door.
And normally, without IP forwarding,
you won't be able to do that.
And to access that,
first I'm gonna get the IP of this machine again
because I forgot it.
And it's 89.100.145.189.
And we called our backdoor, backdoor,
so I'm just gonna type in backdoor.exe.
And we're gonna hit enter.
It's actually 189 here, not 89.
And as you can see,
I was able to download the backdoor.
And this should actually tell you
that IP forwarding has been set up correctly
because without that,
without IP forwarding,
I wouldn't be able to access my web server
and download the backdoor.
So I'm actually accessing the web server in Kali
as if it's a normal website.
You can actually host fake webpages,
you can host websites,
anything you want right now on your Apache.
So I'm gonna come in,
I'm gonna run the backdoor
and we'll see if that'll give me a reverse connection
on my Kali machine,
which is on a completely different network.
And as you can see,
I got a reverse Meterpreter shell
and you can see that the shell is coming
from an external IP address
into my internal IP address
to the Kali machine.
And right now I can control the target computer
and do all the things that we do
in the post connection attacks.