WEBVTT

00:00:00.000 --> 00:00:03.388 align:middle line:90%


00:00:03.388 --> 00:00:05.324 align:middle line:90%
[ELECTRONIC NOISES]

00:00:05.324 --> 00:00:10.170 align:middle line:90%


00:00:10.170 --> 00:00:13.150 align:middle line:84%
Pivoting with Meterpreter--
in this video,

00:00:13.150 --> 00:00:15.780 align:middle line:84%
we will be exploring the
process of performing

00:00:15.780 --> 00:00:18.180 align:middle line:84%
pivoting once we
have compromised

00:00:18.180 --> 00:00:19.990 align:middle line:90%
a host on an internal network.

00:00:19.990 --> 00:00:22.770 align:middle line:84%
So let's get an idea or
an understanding of what

00:00:22.770 --> 00:00:26.250 align:middle line:84%
pivoting is exactly in case you
might be a little bit confused.

00:00:26.250 --> 00:00:30.060 align:middle line:84%
So pivoting is essentially a
post-exploitation technique

00:00:30.060 --> 00:00:32.520 align:middle line:84%
that involves
utilizing a compromised

00:00:32.520 --> 00:00:35.940 align:middle line:84%
host to attack other systems
on the compromised host's

00:00:35.940 --> 00:00:37.980 align:middle line:90%
private internal network.

00:00:37.980 --> 00:00:40.680 align:middle line:84%
So after gaining
access to one host,

00:00:40.680 --> 00:00:43.500 align:middle line:84%
we can use the compromised
host to exploit other hosts

00:00:43.500 --> 00:00:46.050 align:middle line:84%
on the same internal network
to which we could not

00:00:46.050 --> 00:00:47.640 align:middle line:90%
access previously.

00:00:47.640 --> 00:00:50.100 align:middle line:84%
So the objective
here-- or rather,

00:00:50.100 --> 00:00:54.090 align:middle line:84%
the technique involves
utilizing our compromised host

00:00:54.090 --> 00:00:57.390 align:middle line:84%
on one system to
then scan and exploit

00:00:57.390 --> 00:00:59.970 align:middle line:84%
other systems within
the compromised host's

00:00:59.970 --> 00:01:00.870 align:middle line:90%
private network.

00:01:00.870 --> 00:01:03.090 align:middle line:84%
So the reason I'm
saying private network

00:01:03.090 --> 00:01:06.720 align:middle line:84%
is because previously we could
not access those other systems

00:01:06.720 --> 00:01:10.200 align:middle line:84%
because they were part of an
internal, private network,

00:01:10.200 --> 00:01:12.060 align:middle line:84%
and the IPs could
not be accessed

00:01:12.060 --> 00:01:14.250 align:middle line:90%
or the IPs were unknown to us.

00:01:14.250 --> 00:01:19.620 align:middle line:84%
Irregardless of that,
the primary objective

00:01:19.620 --> 00:01:23.490 align:middle line:84%
here is essentially to gain
access to other systems

00:01:23.490 --> 00:01:27.000 align:middle line:84%
within the compromised host's
internal network, which

00:01:27.000 --> 00:01:29.370 align:middle line:90%
again is pretty important.

00:01:29.370 --> 00:01:31.290 align:middle line:84%
So once we have
exploited one system,

00:01:31.290 --> 00:01:33.150 align:middle line:84%
we need to move on
to other systems.

00:01:33.150 --> 00:01:35.670 align:middle line:84%
And, again, this is
a pretty standard

00:01:35.670 --> 00:01:37.590 align:middle line:90%
within penetration testing.

00:01:37.590 --> 00:01:40.140 align:middle line:84%
Once you've gained access
to a system on a network,

00:01:40.140 --> 00:01:42.090 align:middle line:84%
then you'll also
want to gain access

00:01:42.090 --> 00:01:44.880 align:middle line:84%
to other systems of the
network and make your way up

00:01:44.880 --> 00:01:48.210 align:middle line:84%
to other systems that may
contain other important data

00:01:48.210 --> 00:01:50.250 align:middle line:90%
or business-critical data.

00:01:50.250 --> 00:01:53.160 align:middle line:84%
So Meterpreter essentially
provides us with the ability

00:01:53.160 --> 00:01:56.370 align:middle line:84%
to add a network route to
the internal network subnet

00:01:56.370 --> 00:01:58.925 align:middle line:84%
and consequently scan
and exploit other systems

00:01:58.925 --> 00:01:59.550 align:middle line:90%
on the network.

00:01:59.550 --> 00:02:02.740 align:middle line:84%
And of course, we will be
exploring how this can be done.

00:02:02.740 --> 00:02:04.020 align:middle line:90%
It really is very simple.

00:02:04.020 --> 00:02:06.960 align:middle line:84%
But you need to actually
visualize what pivoting

00:02:06.960 --> 00:02:08.940 align:middle line:90%
is in order to understand it.

00:02:08.940 --> 00:02:12.285 align:middle line:84%
Now, this diagram here
gives you a pretty good idea

00:02:12.285 --> 00:02:13.660 align:middle line:84%
of what we are
going to be doing.

00:02:13.660 --> 00:02:16.710 align:middle line:84%
So first and foremost,
this is us right over here.

00:02:16.710 --> 00:02:19.680 align:middle line:84%
And disregard the actual
IP addresses as well as

00:02:19.680 --> 00:02:21.217 align:middle line:90%
the network subnets.

00:02:21.217 --> 00:02:22.800 align:middle line:84%
Those are, of course,
going to change.

00:02:22.800 --> 00:02:24.880 align:middle line:84%
But the principals
remain the same.

00:02:24.880 --> 00:02:28.170 align:middle line:84%
So this is us right over
here, and this is victim 1.

00:02:28.170 --> 00:02:31.950 align:middle line:84%
So we can access victim
1 because either it's

00:02:31.950 --> 00:02:35.700 align:middle line:84%
a public-facing server or
a public-facing target.

00:02:35.700 --> 00:02:37.680 align:middle line:84%
Or really, we just
have the ability

00:02:37.680 --> 00:02:39.480 align:middle line:90%
to access it through its IP.

00:02:39.480 --> 00:02:43.260 align:middle line:84%
So you can see that
attacker and victim 1

00:02:43.260 --> 00:02:44.610 align:middle line:90%
are part of the same network.

00:02:44.610 --> 00:02:47.680 align:middle line:84%
And of course, that network
could be the internet itself.

00:02:47.680 --> 00:02:50.820 align:middle line:84%
So if we have access to
victim 1's IP address,

00:02:50.820 --> 00:02:53.820 align:middle line:84%
the public IP address, then
we can interact with it.

00:02:53.820 --> 00:02:56.640 align:middle line:84%
And we can then exploit
services that are currently

00:02:56.640 --> 00:03:00.120 align:middle line:84%
running on victim 1 in order
to gain access to victim 1.

00:03:00.120 --> 00:03:02.940 align:middle line:84%
So once we have gained
access to victim 1,

00:03:02.940 --> 00:03:06.270 align:middle line:84%
we can see that victim 1
is part of another network,

00:03:06.270 --> 00:03:08.850 align:middle line:90%
an internal network.

00:03:08.850 --> 00:03:12.000 align:middle line:84%
You can see this is the
internal IP address of victim 1.

00:03:12.000 --> 00:03:14.190 align:middle line:84%
And the internal network
is listed over here.

00:03:14.190 --> 00:03:15.070 align:middle line:90%
This is the subnet.

00:03:15.070 --> 00:03:20.280 align:middle line:84%
As you can see, it's different
from the public network subnet.

00:03:20.280 --> 00:03:23.160 align:middle line:84%
And then as part of the
private internal network,

00:03:23.160 --> 00:03:25.470 align:middle line:84%
there's another system
on that internal network

00:03:25.470 --> 00:03:27.300 align:middle line:90%
called victim 2.

00:03:27.300 --> 00:03:30.100 align:middle line:84%
Victim 2, of course,
has its own IP address.

00:03:30.100 --> 00:03:34.830 align:middle line:84%
And if we try to attack victim
2 from the attacker system,

00:03:34.830 --> 00:03:37.470 align:middle line:84%
we would not be able to access
it because the IP address is

00:03:37.470 --> 00:03:38.700 align:middle line:90%
an internal IP.

00:03:38.700 --> 00:03:40.680 align:middle line:84%
The only way we
can access victim 2

00:03:40.680 --> 00:03:42.690 align:middle line:84%
is through the
compromised victim

00:03:42.690 --> 00:03:44.560 align:middle line:90%
1 system right over here.

00:03:44.560 --> 00:03:48.240 align:middle line:84%
So the objective is to,
again, gain access to victim 1

00:03:48.240 --> 00:03:52.410 align:middle line:84%
and then utilize our Meterpreter
session on victim 1 to access

00:03:52.410 --> 00:03:54.090 align:middle line:90%
and exploit victim 2.

00:03:54.090 --> 00:03:55.830 align:middle line:84%
So it's really,
really very simple.

00:03:55.830 --> 00:03:58.230 align:middle line:84%
Now, the lab environment,
in this case,

00:03:58.230 --> 00:04:00.000 align:middle line:84%
will allow us to
actually demonstrate

00:04:00.000 --> 00:04:00.910 align:middle line:90%
this, which is great.

00:04:00.910 --> 00:04:03.780 align:middle line:84%
So all you need to do is just
fire up the lab environment,

00:04:03.780 --> 00:04:05.067 align:middle line:90%
and I'm going to do the same.

00:04:05.067 --> 00:04:06.900 align:middle line:84%
And I'll see you within
the lab environment,

00:04:06.900 --> 00:04:10.390 align:middle line:84%
and we can explore how
pivoting can be performed.

00:04:10.390 --> 00:04:14.660 align:middle line:84%
So I'll see you within
the lab environment.

00:04:14.660 --> 00:04:16.560 align:middle line:84%
So I'm back in the
lab environment.

00:04:16.560 --> 00:04:19.820 align:middle line:84%
And as you can see, you will
be given two IP addresses.

00:04:19.820 --> 00:04:21.320 align:middle line:84%
And of course, in
your case, they're

00:04:21.320 --> 00:04:24.390 align:middle line:84%
going to be different, but
just take note of them.

00:04:24.390 --> 00:04:26.930 align:middle line:84%
So you can see we have
victim machine 1, which

00:04:26.930 --> 00:04:30.980 align:middle line:84%
we can access directly
because, again, if we copy this

00:04:30.980 --> 00:04:33.770 align:middle line:84%
and we open up a
terminal and say--

00:04:33.770 --> 00:04:35.880 align:middle line:90%
let me just maximize that there.

00:04:35.880 --> 00:04:40.140 align:middle line:84%
And if I say ping and if
I try and ping victim 1,

00:04:40.140 --> 00:04:42.380 align:middle line:84%
you can see that we get
a response from victim 1.

00:04:42.380 --> 00:04:45.920 align:middle line:84%
And we can also interact with
it as it's part of our network.

00:04:45.920 --> 00:04:47.660 align:middle line:84%
Or rather, we can
actually access it.

00:04:47.660 --> 00:04:48.380 align:middle line:90%
So there we are.

00:04:48.380 --> 00:04:50.900 align:middle line:84%
We can see that on
port 80 victim 1

00:04:50.900 --> 00:04:55.400 align:middle line:84%
is running HFS or the HTTP
File Server version 2.3.

00:04:55.400 --> 00:04:59.690 align:middle line:84%
Now, if we try and access victim
2 or try and ping victim 2,

00:04:59.690 --> 00:05:02.570 align:middle line:84%
which I'll do right now-- let
me just copy victim 2's IP

00:05:02.570 --> 00:05:04.473 align:middle line:90%
address--

00:05:04.473 --> 00:05:05.890 align:middle line:84%
you'll see what
I'm talking about.

00:05:05.890 --> 00:05:08.490 align:middle line:84%
So I'll just head over
back into my terminal.

00:05:08.490 --> 00:05:10.350 align:middle line:90%
And I'll say ping.

00:05:10.350 --> 00:05:12.820 align:middle line:84%
And you can see that we
don't get a response.

00:05:12.820 --> 00:05:17.370 align:middle line:84%
So we cannot communicate with
victim 2 through our Kali Linux

00:05:17.370 --> 00:05:20.230 align:middle line:84%
system or through
our Kali system here.

00:05:20.230 --> 00:05:22.253 align:middle line:90%
So, again, that's a problem.

00:05:22.253 --> 00:05:24.420 align:middle line:84%
Now, of course, that's why
we are covering pivoting.

00:05:24.420 --> 00:05:26.670 align:middle line:84%
So first and foremost,
we'll actually

00:05:26.670 --> 00:05:29.130 align:middle line:90%
need to gain access to victim 1.

00:05:29.130 --> 00:05:32.040 align:middle line:84%
And then we can then
attack victim 2.

00:05:32.040 --> 00:05:34.560 align:middle line:84%
So I'm just going to
terminate the ping there.

00:05:34.560 --> 00:05:37.540 align:middle line:84%
And we are going to set up
or start up the PostgreSQL

00:05:37.540 --> 00:05:39.060 align:middle line:90%
Database Service.

00:05:39.060 --> 00:05:42.370 align:middle line:84%
So I'm going to say
service postgresql start.

00:05:42.370 --> 00:05:47.390 align:middle line:84%
And we'll also start up MSF
console while we're at it.

00:05:47.390 --> 00:05:48.650 align:middle line:90%
There we are.

00:05:48.650 --> 00:05:51.460 align:middle line:84%
And, again, make sure that
you keep these IPs handy

00:05:51.460 --> 00:05:54.280 align:middle line:84%
here as they will
become or will be very

00:05:54.280 --> 00:05:55.990 align:middle line:90%
important during this process.

00:05:55.990 --> 00:05:58.420 align:middle line:84%
And of course, make sure
you're able to distinguish

00:05:58.420 --> 00:06:00.340 align:middle line:90%
between the two.

00:06:00.340 --> 00:06:02.860 align:middle line:84%
So now that we've
started up MSF console,

00:06:02.860 --> 00:06:05.500 align:middle line:84%
we'll create a workspace
for all our activity.

00:06:05.500 --> 00:06:08.140 align:middle line:90%
And we'll just call it pivoting.

00:06:08.140 --> 00:06:10.470 align:middle line:90%
There we are.

00:06:10.470 --> 00:06:12.840 align:middle line:84%
We will not set up the
global variable for rhosts

00:06:12.840 --> 00:06:14.370 align:middle line:90%
because we'll be using two IPs.

00:06:14.370 --> 00:06:17.940 align:middle line:84%
So we don't need to set
up the actual target IP

00:06:17.940 --> 00:06:20.272 align:middle line:84%
because, again, we're dealing
with two systems here.

00:06:20.272 --> 00:06:22.230 align:middle line:84%
So the first thing we
want to do is, of course,

00:06:22.230 --> 00:06:26.040 align:middle line:84%
perform an Nmap scan on victim
1 to identify what services

00:06:26.040 --> 00:06:27.880 align:middle line:90%
we can actually exploit on it.

00:06:27.880 --> 00:06:30.540 align:middle line:84%
And of course, we were able
to find that it's running HSF.

00:06:30.540 --> 00:06:32.820 align:middle line:84%
But, again, let's just
perform it in the event

00:06:32.820 --> 00:06:34.720 align:middle line:90%
that we weren't able to do that.

00:06:34.720 --> 00:06:37.890 align:middle line:84%
So I'm just going to copy
victim 1's IP address here.

00:06:37.890 --> 00:06:40.470 align:middle line:84%
And I'll paste that in
there, and I'll hit Enter.

00:06:40.470 --> 00:06:44.500 align:middle line:84%
And I'm just going to
wait for this to complete.

00:06:44.500 --> 00:06:46.000 align:middle line:90%
So the Nmap scan is complete.

00:06:46.000 --> 00:06:48.880 align:middle line:84%
And of course, we get
confirmation that on port 80

00:06:48.880 --> 00:06:52.330 align:middle line:84%
we have the HTTP File Server
which is, again, the Rejetto

00:06:52.330 --> 00:06:56.470 align:middle line:84%
HTTP File Server version 2.3,
which we've exploited before.

00:06:56.470 --> 00:06:58.810 align:middle line:84%
So we're just going to search
for the Rejetto module.

00:06:58.810 --> 00:07:02.160 align:middle line:84%
So I'm going to
say search rejetto.

00:07:02.160 --> 00:07:02.760 align:middle line:90%
There we are.

00:07:02.760 --> 00:07:05.050 align:middle line:84%
And we're going to utilize
this exploit module here.

00:07:05.050 --> 00:07:07.560 align:middle line:84%
So that's the remote
command execution module.

00:07:07.560 --> 00:07:10.590 align:middle line:84%
So I'm going to
say copy and use.

00:07:10.590 --> 00:07:12.720 align:middle line:90%
Paste the module name there.

00:07:12.720 --> 00:07:15.180 align:middle line:84%
We don't need to change
the payload at the moment.

00:07:15.180 --> 00:07:18.510 align:middle line:84%
And in our case, we really do
not need a 64-bit Meterpreter

00:07:18.510 --> 00:07:19.240 align:middle line:90%
session.

00:07:19.240 --> 00:07:21.210 align:middle line:84%
So if I show the
options, we'll now

00:07:21.210 --> 00:07:23.725 align:middle line:84%
have to configure the
rhosts value manually.

00:07:23.725 --> 00:07:24.850 align:middle line:90%
So let's do that right now.

00:07:24.850 --> 00:07:28.140 align:middle line:84%
I'm going to set the
IP address of victim 1.

00:07:28.140 --> 00:07:28.660 align:middle line:90%
There we go.

00:07:28.660 --> 00:07:32.140 align:middle line:84%
So I'm going to say
set rhosts and put

00:07:32.140 --> 00:07:33.820 align:middle line:90%
in the IP address of victim 1.

00:07:33.820 --> 00:07:35.830 align:middle line:84%
You can then configure
your payload options.

00:07:35.830 --> 00:07:38.570 align:middle line:84%
So you can specify the
lhost and lport options.

00:07:38.570 --> 00:07:41.200 align:middle line:84%
In this case, we'll leave
them as the defaults.

00:07:41.200 --> 00:07:42.970 align:middle line:84%
And we don't need
to change anything

00:07:42.970 --> 00:07:44.830 align:middle line:84%
else because the port
has been configured

00:07:44.830 --> 00:07:46.240 align:middle line:90%
as well as the target URI.

00:07:46.240 --> 00:07:49.950 align:middle line:84%
So we know that HFS is running
on the root of the web server,

00:07:49.950 --> 00:07:51.700 align:middle line:84%
so we don't need to
do anything else here.

00:07:51.700 --> 00:07:55.060 align:middle line:84%
We just type in exploit, and
we should get our Meterpreter

00:07:55.060 --> 00:07:56.500 align:middle line:90%
session on victim 1.

00:07:56.500 --> 00:08:04.400 align:middle line:90%


00:08:04.400 --> 00:08:05.510 align:middle line:90%
There we go, fantastic.

00:08:05.510 --> 00:08:07.820 align:middle line:84%
So we can perform
some enumeration

00:08:07.820 --> 00:08:10.045 align:middle line:84%
to identify the actual
operating system version.

00:08:10.045 --> 00:08:11.420 align:middle line:84%
And in this case,
we can see it's

00:08:11.420 --> 00:08:16.910 align:middle line:84%
running Windows Server 2012
R2, and it's a 64-bit operating

00:08:16.910 --> 00:08:17.450 align:middle line:90%
system.

00:08:17.450 --> 00:08:19.970 align:middle line:84%
As I said, we really don't
need to upgrade our Meterpreter

00:08:19.970 --> 00:08:21.500 align:middle line:90%
session.

00:08:21.500 --> 00:08:26.750 align:middle line:84%
So we've gained access to
this system here, to victim 1.

00:08:26.750 --> 00:08:29.870 align:middle line:84%
And we now need to utilize
our access on victim 1

00:08:29.870 --> 00:08:31.430 align:middle line:90%
to gain access to victim 2.

00:08:31.430 --> 00:08:35.299 align:middle line:84%
So what we can do is if I
type in the ipconfig command,

00:08:35.299 --> 00:08:38.000 align:middle line:84%
this will list out the
interfaces available to us.

00:08:38.000 --> 00:08:42.289 align:middle line:84%
And we know that victim 2
is part of the same subnet

00:08:42.289 --> 00:08:44.100 align:middle line:90%
that victim 1 is on.

00:08:44.100 --> 00:08:47.270 align:middle line:84%
So we can copy the
actual interface IP here.

00:08:47.270 --> 00:08:49.280 align:middle line:84%
And of course, in your
case it may be different.

00:08:49.280 --> 00:08:52.490 align:middle line:84%
But just look for the one
that has the victim 1 IP

00:08:52.490 --> 00:08:53.460 align:middle line:90%
address here.

00:08:53.460 --> 00:08:55.700 align:middle line:90%
So we can copy that.

00:08:55.700 --> 00:08:59.780 align:middle line:84%
And we will then now utilize
Meterpreter to add a route.

00:08:59.780 --> 00:09:03.390 align:middle line:84%
So, again, to add a
route is fairly simple.

00:09:03.390 --> 00:09:07.430 align:middle line:84%
We can essentially
just say run autoroute.

00:09:07.430 --> 00:09:10.650 align:middle line:84%
And we then specify
the subnet that we

00:09:10.650 --> 00:09:12.810 align:middle line:90%
want to establish a route to.

00:09:12.810 --> 00:09:14.610 align:middle line:90%
We paste that in there.

00:09:14.610 --> 00:09:17.130 align:middle line:84%
And we're going to change
this obviously to a 0.

00:09:17.130 --> 00:09:21.720 align:middle line:84%
And the network-- or
actually, the subnet range

00:09:21.720 --> 00:09:25.560 align:middle line:84%
or the actual range of this
network is limited to 20.

00:09:25.560 --> 00:09:27.630 align:middle line:84%
And we hit Enter,
and that's going

00:09:27.630 --> 00:09:30.820 align:middle line:84%
to add a route to that
network as you can see here.

00:09:30.820 --> 00:09:33.520 align:middle line:84%
You have the netmask
specified as well.

00:09:33.520 --> 00:09:35.820 align:middle line:84%
And as you can see, it
says right over here,

00:09:35.820 --> 00:09:38.170 align:middle line:84%
added drought to that
particular subnet.

00:09:38.170 --> 00:09:42.300 align:middle line:84%
So that means we can now access
that subnet with MSF console.

00:09:42.300 --> 00:09:44.190 align:middle line:84%
And the reason
that is the case is

00:09:44.190 --> 00:09:46.170 align:middle line:84%
because we utilize our
Meterpreter session

00:09:46.170 --> 00:09:47.670 align:middle line:90%
to add the route.

00:09:47.670 --> 00:09:50.640 align:middle line:84%
So that way, Meterpreter
is very intelligent,

00:09:50.640 --> 00:09:53.880 align:middle line:84%
and that means we can
utilize other modules to scan

00:09:53.880 --> 00:09:55.500 align:middle line:90%
the target, or victim 2.

00:09:55.500 --> 00:09:58.260 align:middle line:84%
So we'll put this session
in the background.

00:09:58.260 --> 00:10:02.220 align:middle line:84%
And what I'll do is
if I actually list out

00:10:02.220 --> 00:10:05.520 align:middle line:84%
the sessions here,
I will say sessions.

00:10:05.520 --> 00:10:07.630 align:middle line:84%
And of course, we
can always rename it.

00:10:07.630 --> 00:10:10.230 align:middle line:84%
So if you want to rename a
session, all we need to do

00:10:10.230 --> 00:10:11.490 align:middle line:90%
is type in sessions.

00:10:11.490 --> 00:10:14.220 align:middle line:84%
And then you can
specify the actual name

00:10:14.220 --> 00:10:20.148 align:middle line:84%
of your session and then, of
course, the actual session ID.

00:10:20.148 --> 00:10:21.690 align:middle line:84%
So in this case,
what I'm going to do

00:10:21.690 --> 00:10:23.790 align:middle line:84%
is I'm going to
say sessions name,

00:10:23.790 --> 00:10:30.020 align:middle line:84%
and then I'm going to
say this is victim 1.

00:10:30.020 --> 00:10:33.260 align:middle line:84%
And we're going to set
the actual ID to 1.

00:10:33.260 --> 00:10:35.600 align:middle line:84%
So that's going to rename
session 1 to victim 1

00:10:35.600 --> 00:10:38.510 align:middle line:84%
so that we can, again, keep
track of all our sessions

00:10:38.510 --> 00:10:41.600 align:middle line:84%
and what systems they
currently represent.

00:10:41.600 --> 00:10:43.430 align:middle line:84%
So in this case,
that's victim 1.

00:10:43.430 --> 00:10:47.450 align:middle line:84%
Fantastic, so now that we
have established our route

00:10:47.450 --> 00:10:49.220 align:middle line:84%
or added our route,
what we can do

00:10:49.220 --> 00:10:51.860 align:middle line:84%
is utilize the port
scan module to scan

00:10:51.860 --> 00:10:55.260 align:middle line:84%
for open ports on
the target system.

00:10:55.260 --> 00:10:58.280 align:middle line:84%
Now, of course, remember
just because we've

00:10:58.280 --> 00:11:01.040 align:middle line:84%
added the route doesn't mean
that we can actually utilize

00:11:01.040 --> 00:11:03.410 align:middle line:90%
external tools like Nmap.

00:11:03.410 --> 00:11:05.240 align:middle line:84%
What I mean by
that is you can run

00:11:05.240 --> 00:11:08.120 align:middle line:90%
Nmap within the MSF console.

00:11:08.120 --> 00:11:11.360 align:middle line:84%
But the route will only
be applicable to modules

00:11:11.360 --> 00:11:13.070 align:middle line:90%
within the Metasploit framework.

00:11:13.070 --> 00:11:17.120 align:middle line:84%
So if we use the port
scanner, we can say use,

00:11:17.120 --> 00:11:19.760 align:middle line:84%
paste that in there,
and we then want

00:11:19.760 --> 00:11:22.350 align:middle line:84%
to set up the rhosts
option to victim 2

00:11:22.350 --> 00:11:23.600 align:middle line:90%
because we've added the route.

00:11:23.600 --> 00:11:25.820 align:middle line:84%
That means we can
now scan victim 2.

00:11:25.820 --> 00:11:29.570 align:middle line:84%
So I'll copy that, and
we'll paste it in here.

00:11:29.570 --> 00:11:34.220 align:middle line:84%
And we're going to set the
port range to maybe 1 to 100.

00:11:34.220 --> 00:11:36.440 align:middle line:84%
So that'll save us a
little bit of time.

00:11:36.440 --> 00:11:38.600 align:middle line:84%
And then we can
hit run or exploit.

00:11:38.600 --> 00:11:40.100 align:middle line:84%
I'm just going to
exploit, and we'll

00:11:40.100 --> 00:11:41.780 align:middle line:84%
give that a few
seconds to complete

00:11:41.780 --> 00:11:45.570 align:middle line:90%
the port scan on victim 2.

00:11:45.570 --> 00:11:49.440 align:middle line:84%
As you can see, we've been able
to identify that on victim 2

00:11:49.440 --> 00:11:50.940 align:middle line:90%
we have port 80 running.

00:11:50.940 --> 00:11:53.730 align:middle line:84%
So, again, just to prove to
you that this route that we've

00:11:53.730 --> 00:11:58.030 align:middle line:84%
added doesn't work externally,
I can copy victim 2's IP address

00:11:58.030 --> 00:12:02.310 align:middle line:84%
and then utilize Firefox
and open that up here.

00:12:02.310 --> 00:12:04.950 align:middle line:84%
And if I paste that in there,
you can see that we still

00:12:04.950 --> 00:12:07.530 align:middle line:84%
cannot access port 80 even
though we've added the route.

00:12:07.530 --> 00:12:10.350 align:middle line:84%
The route is only
applicable to MSF console.

00:12:10.350 --> 00:12:12.850 align:middle line:84%
So I just want to make
that as clear as possible.

00:12:12.850 --> 00:12:14.910 align:middle line:90%
So we can now utilize--

00:12:14.910 --> 00:12:18.180 align:middle line:84%
we can probably utilize
an auxiliary module

00:12:18.180 --> 00:12:20.940 align:middle line:84%
to scan or to obtain
the actual banner

00:12:20.940 --> 00:12:22.890 align:middle line:90%
or to identify the HTTP version.

00:12:22.890 --> 00:12:24.430 align:middle line:90%
But that will not work.

00:12:24.430 --> 00:12:26.430 align:middle line:84%
And if we want to
perform an Nmap scan,

00:12:26.430 --> 00:12:29.550 align:middle line:84%
we'll actually need to
forward port 80 on victim 2

00:12:29.550 --> 00:12:32.910 align:middle line:84%
to a local port or a port
on our local host, which

00:12:32.910 --> 00:12:36.780 align:middle line:84%
is the Kali Linux VM or
the Kali Linux instance.

00:12:36.780 --> 00:12:39.150 align:middle line:84%
And the only way we
can do that is we

00:12:39.150 --> 00:12:41.880 align:middle line:84%
actually have to head
over to sessions 1.

00:12:41.880 --> 00:12:44.590 align:middle line:84%
And we can perform
the port forwarding.

00:12:44.590 --> 00:12:48.750 align:middle line:84%
So we are going to say port
forward add, and we then

00:12:48.750 --> 00:12:51.150 align:middle line:84%
need to specify the
local port that we

00:12:51.150 --> 00:12:54.250 align:middle line:84%
want to actually, again,
perform the port forwarding on.

00:12:54.250 --> 00:12:59.430 align:middle line:84%
So if we want to port forward
the port 80 from victim 2

00:12:59.430 --> 00:13:02.010 align:middle line:84%
onto our local port, we
can specify the port here.

00:13:02.010 --> 00:13:05.880 align:middle line:84%
In this case, we'll just
run port 80 on victim 2

00:13:05.880 --> 00:13:10.920 align:middle line:84%
to port 1234 on the
Kali Linux system here.

00:13:10.920 --> 00:13:12.750 align:middle line:84%
And we then need
to specify the port

00:13:12.750 --> 00:13:16.090 align:middle line:84%
that we want to forward
on victim 2, which is 80.

00:13:16.090 --> 00:13:19.260 align:middle line:84%
And then we specify
victim 2's IP address.

00:13:19.260 --> 00:13:21.720 align:middle line:84%
So I'll just specify
the r option,

00:13:21.720 --> 00:13:24.660 align:middle line:84%
and I'll copy victim
2's IP address here.

00:13:24.660 --> 00:13:28.600 align:middle line:90%


00:13:28.600 --> 00:13:29.100 align:middle line:90%
There we go.

00:13:29.100 --> 00:13:31.220 align:middle line:84%
As you can see, local
TCP relay created.

00:13:31.220 --> 00:13:33.470 align:middle line:84%
So, again, just to explain
what's going on, because we

00:13:33.470 --> 00:13:37.940 align:middle line:84%
cannot perform an Nmap scan
on victim 2 directly we need

00:13:37.940 --> 00:13:39.620 align:middle line:90%
to set up port forwarding.

00:13:39.620 --> 00:13:41.570 align:middle line:84%
Port forwarding
essentially allows us

00:13:41.570 --> 00:13:44.570 align:middle line:84%
to forward the remote
port 80 to our local port

00:13:44.570 --> 00:13:47.660 align:middle line:84%
1234, which will again
consequently allow

00:13:47.660 --> 00:13:51.230 align:middle line:84%
us to perform a service
version enumeration.

00:13:51.230 --> 00:13:53.330 align:middle line:84%
So I'll put this session
in the background now,

00:13:53.330 --> 00:13:54.920 align:middle line:90%
and we can now use Nmap.

00:13:54.920 --> 00:13:57.620 align:middle line:84%
So I'll use the db_nmap
command to perform the scan

00:13:57.620 --> 00:13:59.120 align:middle line:90%
within MSF console.

00:13:59.120 --> 00:14:00.890 align:middle line:84%
And I'll then say,
I want to perform

00:14:00.890 --> 00:14:05.360 align:middle line:84%
a -sV scan, service version
detection scan, on port 1234

00:14:05.360 --> 00:14:07.310 align:middle line:84%
because, remember,
we forwarded port

00:14:07.310 --> 00:14:10.910 align:middle line:84%
80 on victim 2 our local
host or to our port

00:14:10.910 --> 00:14:14.490 align:middle line:90%
1234 on the Kali instance.

00:14:14.490 --> 00:14:16.940 align:middle line:84%
So we specified
port 1234 locally.

00:14:16.940 --> 00:14:19.280 align:middle line:84%
And then because we are
performing the scan on the Kali

00:14:19.280 --> 00:14:21.320 align:middle line:84%
system, we'll say
local host because we

00:14:21.320 --> 00:14:24.530 align:middle line:84%
are performing the
scan on our IP address,

00:14:24.530 --> 00:14:26.390 align:middle line:90%
not victim 1 or victim 2.

00:14:26.390 --> 00:14:29.510 align:middle line:84%
So I'll hit Enter, and
let me just specify

00:14:29.510 --> 00:14:32.270 align:middle line:84%
the db_nmap command or let
me type it in correctly.

00:14:32.270 --> 00:14:33.590 align:middle line:90%
That is db_nmap.

00:14:33.590 --> 00:14:36.635 align:middle line:84%
Hit Enter, and then we'll
give this a few seconds.

00:14:36.635 --> 00:14:39.350 align:middle line:90%


00:14:39.350 --> 00:14:41.090 align:middle line:84%
As you can see,
it's successfully

00:14:41.090 --> 00:14:42.600 align:middle line:90%
scanned the forwarded port.

00:14:42.600 --> 00:14:44.930 align:middle line:84%
So you can see on
our Kali Linux IP

00:14:44.930 --> 00:14:48.770 align:middle line:84%
on port 1234 it provides
us with the service version

00:14:48.770 --> 00:14:52.040 align:middle line:84%
here for the actual service
that's running on victim 2

00:14:52.040 --> 00:14:52.760 align:middle line:90%
on port 80.

00:14:52.760 --> 00:14:55.010 align:middle line:84%
The only reason we
performed port forwarding

00:14:55.010 --> 00:14:58.760 align:middle line:84%
is so that we can identify what
service is running on victim 2

00:14:58.760 --> 00:14:59.930 align:middle line:90%
on port 80.

00:14:59.930 --> 00:15:03.080 align:middle line:84%
So now that we know it's
BadBlue, which we have actually

00:15:03.080 --> 00:15:05.090 align:middle line:84%
exploited before,
we can actually

00:15:05.090 --> 00:15:06.722 align:middle line:90%
search for the BadBlue exploit.

00:15:06.722 --> 00:15:08.180 align:middle line:84%
So I'm going to
search for it here.

00:15:08.180 --> 00:15:11.300 align:middle line:90%
I'm going to say search badblue.

00:15:11.300 --> 00:15:14.420 align:middle line:84%
And we are going to be utilizing
the PassThru Buffer Overflow

00:15:14.420 --> 00:15:15.588 align:middle line:90%
module.

00:15:15.588 --> 00:15:16.130 align:middle line:90%
There we are.

00:15:16.130 --> 00:15:17.850 align:middle line:90%
And I'm going to say use.

00:15:17.850 --> 00:15:19.610 align:middle line:84%
And of course, you
can also verify

00:15:19.610 --> 00:15:23.420 align:middle line:84%
this that is the case by
navigating to local hosts.

00:15:23.420 --> 00:15:28.250 align:middle line:84%
So if I say 127.0.0.1
and 1234, you

00:15:28.250 --> 00:15:31.280 align:middle line:84%
should be able to see that
we can access BadBlue.

00:15:31.280 --> 00:15:33.863 align:middle line:84%
But in this case, it's
not rendering correctly

00:15:33.863 --> 00:15:35.780 align:middle line:84%
because it's not running
on the target system.

00:15:35.780 --> 00:15:38.480 align:middle line:84%
We've just performed some
basic port forwarding.

00:15:38.480 --> 00:15:40.560 align:middle line:90%
So we do know that is working.

00:15:40.560 --> 00:15:43.250 align:middle line:84%
However, that's pretty much it
in regards to port forwarding.

00:15:43.250 --> 00:15:45.240 align:middle line:84%
We now have all the
information we need.

00:15:45.240 --> 00:15:49.370 align:middle line:84%
So we'll say use the
BadBlue passthru exploit.

00:15:49.370 --> 00:15:51.260 align:middle line:90%
And we're going to leave--

00:15:51.260 --> 00:15:54.740 align:middle line:84%
we'll actually need to change
the actual payload to a bind

00:15:54.740 --> 00:15:56.128 align:middle line:90%
TCP Meterpreter payload.

00:15:56.128 --> 00:15:57.420 align:middle line:90%
So I'm going to set that first.

00:15:57.420 --> 00:16:00.440 align:middle line:84%
So I'm going to say set payload
because we will actually

00:16:00.440 --> 00:16:01.670 align:middle line:90%
want to bind.

00:16:01.670 --> 00:16:05.840 align:middle line:84%
So I'm going to say Windows
Meterpreter reverse TCP

00:16:05.840 --> 00:16:08.280 align:middle line:84%
as a reverse connection
will not be possible.

00:16:08.280 --> 00:16:10.610 align:middle line:84%
So I'm going to say set
payload Windows Meterpreter.

00:16:10.610 --> 00:16:15.680 align:middle line:84%
And we're going to say bind TCP,
not reverse TCP, so bind_tcp.

00:16:15.680 --> 00:16:16.790 align:middle line:90%
Hit Enter.

00:16:16.790 --> 00:16:20.270 align:middle line:84%
And if we show
the options, we'll

00:16:20.270 --> 00:16:25.740 align:middle line:84%
need to change the lport option
as well as the rhosts option.

00:16:25.740 --> 00:16:29.600 align:middle line:84%
So what I'm going to do
now is we will actually

00:16:29.600 --> 00:16:31.080 align:middle line:90%
just get that information.

00:16:31.080 --> 00:16:33.420 align:middle line:84%
So you should have the
victim's IP address here.

00:16:33.420 --> 00:16:39.690 align:middle line:84%
So what we'll say is we will
set the actual rhosts value.

00:16:39.690 --> 00:16:42.540 align:middle line:84%
So I'm going to copy
victim 2's IP address here.

00:16:42.540 --> 00:16:47.180 align:middle line:84%
So I'm going to say set
rhosts to victim 2's IP.

00:16:47.180 --> 00:16:49.460 align:middle line:84%
We are, of course,
targeting port 80, not

00:16:49.460 --> 00:16:54.380 align:middle line:84%
the actual locally forward port
because we have the route added

00:16:54.380 --> 00:16:55.670 align:middle line:90%
within MSF console.

00:16:55.670 --> 00:16:57.270 align:middle line:90%
So we don't need to do that.

00:16:57.270 --> 00:16:59.330 align:middle line:84%
I'm going to set lport
to a different port

00:16:59.330 --> 00:17:03.350 align:middle line:84%
because we currently have--
or we are currently listening

00:17:03.350 --> 00:17:04.970 align:middle line:84%
or we currently have
a session that's

00:17:04.970 --> 00:17:07.339 align:middle line:90%
established on port 4444.

00:17:07.339 --> 00:17:10.550 align:middle line:84%
So I'm going to set
that to maybe 4433.

00:17:10.550 --> 00:17:18.010 align:middle line:84%
And we can then set the target
to BadBlue Enterprise Edition.

00:17:18.010 --> 00:17:20.349 align:middle line:84%
Or in this case, we can
actually just exploit it

00:17:20.349 --> 00:17:24.010 align:middle line:84%
and test it to see whether
it will actually work.

00:17:24.010 --> 00:17:27.329 align:middle line:84%
So it's going to try
target BadBlue EE 2.7

00:17:27.329 --> 00:17:28.890 align:middle line:90%
Universal, which is great.

00:17:28.890 --> 00:17:30.165 align:middle line:90%
And it sends the stage.

00:17:30.165 --> 00:17:32.840 align:middle line:90%


00:17:32.840 --> 00:17:35.300 align:middle line:84%
And we get Meterpreter
session 2 open.

00:17:35.300 --> 00:17:37.940 align:middle line:84%
So if we say
sysinfo, you can now

00:17:37.940 --> 00:17:43.070 align:middle line:84%
see that session 2 is on Windows
2016 or Windows Server 2016.

00:17:43.070 --> 00:17:45.600 align:middle line:84%
So it's a different
system altogether.

00:17:45.600 --> 00:17:49.520 align:middle line:84%
And if I just put
this in the background

00:17:49.520 --> 00:17:52.110 align:middle line:84%
and I list out my sessions, you
can see we have two sessions.

00:17:52.110 --> 00:17:57.650 align:middle line:84%
So I can say sessions name, and
I can just call this victim 2.

00:17:57.650 --> 00:18:00.590 align:middle line:90%
And that is session ID 2.

00:18:00.590 --> 00:18:03.530 align:middle line:84%
So that will rename
session 2 to victim 2.

00:18:03.530 --> 00:18:06.958 align:middle line:84%
And if we check
out session 2, we

00:18:06.958 --> 00:18:08.750 align:middle line:84%
can see that this is,
of course, different.

00:18:08.750 --> 00:18:11.870 align:middle line:84%
So sysinfo, you can see
Windows Server 2016.

00:18:11.870 --> 00:18:15.440 align:middle line:84%
If I put that in the
background and I say sessions 1

00:18:15.440 --> 00:18:19.410 align:middle line:84%
and say sysinfo, you can
see Windows Server 2012.

00:18:19.410 --> 00:18:22.350 align:middle line:84%
So that is how to
perform pivoting as well

00:18:22.350 --> 00:18:23.520 align:middle line:90%
as port forwarding.

00:18:23.520 --> 00:18:27.300 align:middle line:84%
And you can see how useful this
is or how useful the auto-route

00:18:27.300 --> 00:18:30.720 align:middle line:84%
functionality within Meterpreter
is and how it can be used

00:18:30.720 --> 00:18:33.540 align:middle line:84%
to essentially provide you with
access or allow you to perform

00:18:33.540 --> 00:18:36.690 align:middle line:84%
or utilize the various
Metasploit modules to exploit

00:18:36.690 --> 00:18:40.200 align:middle line:84%
systems that we cannot reach,
but we can access through

00:18:40.200 --> 00:18:43.770 align:middle line:84%
the compromised host that
we compromised first,

00:18:43.770 --> 00:18:46.570 align:middle line:90%
or rather victim 1 in this case.

00:18:46.570 --> 00:18:50.340 align:middle line:84%
So that is going to conclude
the practical demonstration

00:18:50.340 --> 00:18:51.180 align:middle line:90%
side of this video.

00:18:51.180 --> 00:18:54.550 align:middle line:90%


00:18:54.550 --> 00:18:56.260 align:middle line:84%
Now that we've
taken a look at how

00:18:56.260 --> 00:18:59.170 align:middle line:84%
to perform post-exploitation
on Windows systems,

00:18:59.170 --> 00:19:02.410 align:middle line:84%
we now need to explore how
to perform post-exploitation

00:19:02.410 --> 00:19:03.770 align:middle line:90%
on Linux systems.

00:19:03.770 --> 00:19:06.790 align:middle line:84%
So the next video will be
the beginning of the Linux

00:19:06.790 --> 00:19:08.920 align:middle line:84%
post-exploitation
section, and then we'll

00:19:08.920 --> 00:19:12.250 align:middle line:84%
explore the various
post-exploitation modules,

00:19:12.250 --> 00:19:14.380 align:middle line:84%
techniques, and
utilities that we

00:19:14.380 --> 00:19:18.550 align:middle line:84%
can use to essentially elevate
our privileges on a Linux

00:19:18.550 --> 00:19:22.060 align:middle line:84%
system, enumerate information,
so on and so forth.

00:19:22.060 --> 00:19:25.500 align:middle line:84%
So I'll see you
in the next video.

00:19:25.500 --> 00:19:26.000 align:middle line:90%