Instructor: Now in this lecture 2 2
we'll learn how to configure the router 3 3
so that it forwards incoming connections 4 4
to the Kali machine so we can receive reverse connections, 5 5
we can hook people to BeEF 6 6
and launch attacks outside the network the same way 7 7
that we used to launch them inside the network. 8 8
So to get to the router settings, 9 9
usually the router is the first IP in the subnet. 10 10
So you can see that my IP was 192.168.0.11. 11 11
Usually the router is the first one 12 12
so it'll be 198.168.0.1. 13 13
Also, another way to get it, 14 14
you can type in route -n 15 15
and that'll show you where the gateway is. 16 16
And as you can see, 17 17
it's at 192.168.0.1. 18 18
So this is the local IP address of the router. 19 19
We're gonna browse that in our browser, 20 20
so I'm just gonna type it in here. 21 21
192.168.0.1. 22 22
Hit enter. 23 23
And as you can see, 24 24
I have my router settings 25 25
and I have to log in with the username and password. 26 26
Now, the router settings might look different 27 27
from router to router, 28 28
but the names are usually the same. 29 29
Usually, first of all, 30 30
you'll have to log in 31 31
as you can see here for me. 32 32
And you either have a default username and password 33 33
or it will be, 34 34
you'll see them on a sticker behind 35 35
or underneath the router itself. 36 36
So for me, I've actually changed the password 37 37
so I'm just gonna log in. 38 38
So I'm logged in here to my control panel 39 39
and again, it might look different for you. 40 40
But you wanna look for something called IP forwarding. 41 41
For me, it's under Advanced. 42 42
So I'm gonna go to Advanced, 43 43
and then I'm gonna go on Forwarding. 44 44
And this is where I can set up my IP forwarding. 45 45
So look for something called IP forwarding 46 46
or I've actually seen them on some routers 47 47
called virtual network, 48 48
I don't know why. 49 49
But you wanna look for something 50 50
that allows you to set up rules to redirect ports 51 51
inside the network. 52 52
So the port that were listening on at the moment 53 53
is port 8080. 54 54
So that's the port that we picked in the handler, 55 55
that's the port that we picked in the backdoor 56 56
and that's the port that we wanna get the connection on. 57 57
So the public port is gonna be 8080 58 58
and again, the target port is gonna be 8080. 59 59
And the target IP address is the IP address 60 60
that's listening on the port. 61 61
So this is the IP address of the Kali machine 62 62
where you have your handlers running. 63 63
So the IP address of may Kali machine right here 64 64
is 192.168.0.11 65 65
and we can see that also right here 66 66
from the result of ifconfig, 67 67
so it's 192.168.0.11. 68 68
I'm gonna type that in here. 69 69
And that's it, 70 70
that's the rule that we wanna add. 71 71
I'm gonna click on Save 72 72
and that rule is saved. 73 73
So now whenever the router gets a request 74 74
for port 8080, 75 75
it'll know that it's gonna forward that request 76 76
to the Kali machine 77 77
and the router will not cut that connection. 78 78
So we've actually set up a proper route right now. 79 79
So the first thing we did is we created the backdoor. 80 80
We used the real IP in the backdoor, 81 81
we didn't use the private IP, 82 82
so we didn't use the 192.168.0.11, 83 83
we used the real IP. 84 84
We're gonna send that backdoor 85 85
to a device on a different network. 86 86
That device is gonna run the backdoor. 87 87
The backdoor will try to connect back 88 88
on the real IP to the router, 89 89
but the router will know exactly what to do 90 90
with this because we just set up our rule 91 91
telling the router to forward any requests 92 92
that it gets on port 8080 to the Kali machine. 93 93
What I also want to do is, 94 94
I actually wanna set up a rule for port 80. 95 95
This is the port that Apache, 96 96
that my web server runs on. 97 97
And I wanna enable that so that I can download the backdoor 98 98
from the target computer. 99 99
So I'm gonna add the rule for port 80. 100 100
And again, this is gonna be the same machine, 101 101
the Kali machine. 102 102
And we're gonna put port 80 here. 103 103
We're gonna save this rule. 104 104
And this will allow me to download the backdoor 105 105
because I placed the backdoor in /va */www/ right here, 106 106
so I'll actually be able to access my web server in Kali 107 107
and download the backdoor from outside the Internet. 108 108
So I'm gonna start my Apache web server. 109 109
So this is actually just another example, 110 110
you don't even need to do this. 111 111
You can just transfer the backdoor using USB 112 112
or any other method or send it via email. 113 113
I'm just showing you another example 114 114
of how port forwarding is used. 115 115
Now I'm gonna go to a Windows machine 116 116
and that Windows machine is gonna be connected 117 117
to a completely different network. 118 118
And we're gonna download the file from there. 119 119
So here is my Windows machine 120 120
and if I go and check my IP, 121 121
you'll see it has a different external public IP. 122 122
So I'm just gonna look for What's My IP. 123 123
You'll see that the IP here is completely different 124 124
than the IP of this machine that we used. 125 125
So these are two completely separate devices 126 126
connected to different networks. 127 127
And what I'm gonna do know is 128 128
I'm gonna access my Apache web server 129 129
and download the back door. 130 130
And normally, without IP forwarding, 131 131
you won't be able to do that. 132 132
And to access that, 133 133
first I'm gonna get the IP of this machine again 134 134
because I forgot it. 135 135
And it's 89.100.145.189. 136 136
And we called our backdoor, backdoor, 137 137
so I'm just gonna type in backdoor.exe. 138 138
And we're gonna hit enter. 139 139
It's actually 189 here, not 89. 140 140
And as you can see, 141 141
I was able to download the backdoor. 142 142
And this should actually tell you 143 143
that IP forwarding has been set up correctly 144 144
because without that, 145 145
without IP forwarding, 146 146
I wouldn't be able to access my web server 147 147
and download the backdoor. 148 148
So I'm actually accessing the web server in Kali 149 149
as if it's a normal website. 150 150
You can actually host fake webpages, 151 151
you can host websites, 152 152
anything you want right now on your Apache. 153 153
So I'm gonna come in, 154 154
I'm gonna run the backdoor 155 155
and we'll see if that'll give me a reverse connection 156 156
on my Kali machine, 157 157
which is on a completely different network. 158 158
And as you can see, 159 159
I got a reverse Meterpreter shell 160 160
and you can see that the shell is coming 161 161
from an external IP address 162 162
into my internal IP address 163 163
to the Kali machine. 164 164
And right now I can control the target computer 165 165
and do all the things that we do 166 166
in the post connection attacks.