WEBVTT

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


00:00:03.388 --> 00:00:10.170 align:middle line:90%
[AUDIO LOGO]

00:00:10.170 --> 00:00:13.080 align:middle line:84%
Vulnerability scanning with
the Metasploit framework.

00:00:13.080 --> 00:00:14.580 align:middle line:84%
In this section of
the course, we're

00:00:14.580 --> 00:00:16.770 align:middle line:84%
going to be exploring
the process of performing

00:00:16.770 --> 00:00:20.640 align:middle line:84%
vulnerability scans with
various Metasploit framework

00:00:20.640 --> 00:00:23.760 align:middle line:84%
modules, both auxiliary
and exploit modules,

00:00:23.760 --> 00:00:25.830 align:middle line:84%
and we'll also be
taking a look at how

00:00:25.830 --> 00:00:29.010 align:middle line:84%
to utilize various Metasploit
framework plug-ins that

00:00:29.010 --> 00:00:33.660 align:middle line:84%
can aid in this process, as
well as how to import scans

00:00:33.660 --> 00:00:35.730 align:middle line:84%
from the Nessus
Vulnerability Scanner

00:00:35.730 --> 00:00:37.920 align:middle line:90%
into the Metasploit framework.

00:00:37.920 --> 00:00:39.700 align:middle line:84%
All right, so
first and foremost,

00:00:39.700 --> 00:00:41.790 align:middle line:90%
what is vulnerability scanning?

00:00:41.790 --> 00:00:44.010 align:middle line:84%
Vulnerability scanning
is essentially

00:00:44.010 --> 00:00:47.760 align:middle line:84%
the process of scanning a target
system for vulnerabilities,

00:00:47.760 --> 00:00:50.670 align:middle line:84%
and furthermore, verifying
whether these vulnerabilities

00:00:50.670 --> 00:00:51.810 align:middle line:90%
can be exploited.

00:00:51.810 --> 00:00:54.480 align:middle line:84%
And in the context of
the Metasploit framework,

00:00:54.480 --> 00:00:58.230 align:middle line:84%
we are specifically looking for
Metasploit framework exploit

00:00:58.230 --> 00:01:01.840 align:middle line:84%
modules that can be used to
exploit these vulnerabilities.

00:01:01.840 --> 00:01:04.379 align:middle line:84%
So again, we're really
narrowing down our search

00:01:04.379 --> 00:01:06.780 align:middle line:84%
here for only
Metasploit modules,

00:01:06.780 --> 00:01:09.120 align:middle line:84%
because again, this is
a Metasploit course.

00:01:09.120 --> 00:01:11.100 align:middle line:84%
So that's really what
we're going to be doing.

00:01:11.100 --> 00:01:13.620 align:middle line:84%
Now the vulnerability
scanning section

00:01:13.620 --> 00:01:17.370 align:middle line:84%
is going to set the stage
for the exploitation sections

00:01:17.370 --> 00:01:21.210 align:middle line:84%
that will of course entail the
process of exploiting target

00:01:21.210 --> 00:01:23.460 align:middle line:84%
systems and, of course,
target services.

00:01:23.460 --> 00:01:27.150 align:middle line:84%
So so far we've been able
to identify and exploit

00:01:27.150 --> 00:01:29.850 align:middle line:84%
misconfigurations
on target systems,

00:01:29.850 --> 00:01:31.740 align:middle line:84%
and we've of course
explored this

00:01:31.740 --> 00:01:34.110 align:middle line:84%
during the information
gathering and enumeration

00:01:34.110 --> 00:01:36.540 align:middle line:84%
phase, where we
were able to obtain

00:01:36.540 --> 00:01:39.450 align:middle line:84%
the version of the service
that's running on a target,

00:01:39.450 --> 00:01:41.550 align:middle line:84%
as well as the operating
system version.

00:01:41.550 --> 00:01:44.280 align:middle line:84%
And then we took a look at how
the perform a few brute force

00:01:44.280 --> 00:01:47.560 align:middle line:84%
attacks, which really
exploited misconfigurations.

00:01:47.560 --> 00:01:50.430 align:middle line:84%
Now misconfigurations
are fine, but when

00:01:50.430 --> 00:01:52.410 align:middle line:84%
we move into the
exploitation phase,

00:01:52.410 --> 00:01:56.790 align:middle line:84%
we are going to be taking a look
at exploit modules that exploit

00:01:56.790 --> 00:02:00.660 align:middle line:84%
specific inherent
vulnerabilities within services

00:02:00.660 --> 00:02:02.560 align:middle line:90%
and within operating system.

00:02:02.560 --> 00:02:06.570 align:middle line:84%
So again, that's really
what our focus will be.

00:02:06.570 --> 00:02:08.850 align:middle line:84%
Now in this section,
we are primarily

00:02:08.850 --> 00:02:11.250 align:middle line:84%
focused with performing
vulnerability scanning

00:02:11.250 --> 00:02:14.280 align:middle line:84%
on target systems,
both Windows and Linux,

00:02:14.280 --> 00:02:17.700 align:middle line:84%
but we'll be focusing on
Windows as a primary example.

00:02:17.700 --> 00:02:19.530 align:middle line:84%
And we'll also
explore the process

00:02:19.530 --> 00:02:23.590 align:middle line:84%
of performing vulnerability
scanning on web applications.

00:02:23.590 --> 00:02:25.315 align:middle line:84%
Now in this particular
video, we are

00:02:25.315 --> 00:02:27.690 align:middle line:84%
going to be taking a look at
how to perform vulnerability

00:02:27.690 --> 00:02:30.660 align:middle line:84%
scanning through the
use of various auxiliary

00:02:30.660 --> 00:02:34.380 align:middle line:84%
and exploit modules in
that we'll be utilizing

00:02:34.380 --> 00:02:38.730 align:middle line:84%
the auxiliary modules to scan
for a specific vulnerability

00:02:38.730 --> 00:02:41.730 align:middle line:84%
or to actually check whether
a particular service is

00:02:41.730 --> 00:02:42.580 align:middle line:90%
vulnerable.

00:02:42.580 --> 00:02:45.540 align:middle line:84%
And then we'll use the exploit
modules to essentially verify

00:02:45.540 --> 00:02:50.640 align:middle line:84%
whether the target service is
vulnerable or can be exploited.

00:02:50.640 --> 00:02:53.970 align:middle line:84%
So again, this is a
very holistic process

00:02:53.970 --> 00:02:57.270 align:middle line:84%
that will involve or that
will encapsulate information

00:02:57.270 --> 00:02:59.850 align:middle line:84%
gathering and enumeration,
which we've already covered.

00:02:59.850 --> 00:03:02.070 align:middle line:84%
And then I'll be exploring
some new techniques

00:03:02.070 --> 00:03:04.920 align:middle line:84%
here that we can
utilize to identify

00:03:04.920 --> 00:03:07.630 align:middle line:84%
exploit modules or rather
identify vulnerabilities,

00:03:07.630 --> 00:03:11.250 align:middle line:84%
and then utilize exploit modules
to essentially take advantage

00:03:11.250 --> 00:03:13.000 align:middle line:90%
of these vulnerabilities.

00:03:13.000 --> 00:03:14.520 align:middle line:84%
We'll also be
exploring the process

00:03:14.520 --> 00:03:17.760 align:middle line:84%
of importing Nessus
scans into the Metasploit

00:03:17.760 --> 00:03:19.150 align:middle line:90%
framework in the next video.

00:03:19.150 --> 00:03:23.040 align:middle line:84%
So again, that's something that
will also be very important.

00:03:23.040 --> 00:03:24.540 align:middle line:84%
But in this video,
we are primarily

00:03:24.540 --> 00:03:29.190 align:middle line:84%
focused with the tools,
modules, and plug-ins

00:03:29.190 --> 00:03:32.400 align:middle line:84%
that again, can help us
perform vulnerability scanning

00:03:32.400 --> 00:03:34.440 align:middle line:90%
within the Metasploit framework.

00:03:34.440 --> 00:03:38.295 align:middle line:84%
So let's get started by taking
a look at the lab environment

00:03:38.295 --> 00:03:39.670 align:middle line:84%
that we're going
to be utilizing.

00:03:39.670 --> 00:03:42.540 align:middle line:84%
So for the purposes of
demonstrating the vulnerability

00:03:42.540 --> 00:03:44.670 align:middle line:84%
scanning process,
we will be utilizing

00:03:44.670 --> 00:03:47.280 align:middle line:84%
an intentionally
vulnerable virtual machine

00:03:47.280 --> 00:03:49.320 align:middle line:90%
called Metasploitable3.

00:03:49.320 --> 00:03:53.430 align:middle line:84%
It is a virtual machine that is
based on Windows Server 2008,

00:03:53.430 --> 00:03:57.630 align:middle line:84%
and was developed by Rapid7,
the same company that actually

00:03:57.630 --> 00:04:00.330 align:middle line:84%
acquired the Metasploit
project early on.

00:04:00.330 --> 00:04:02.220 align:middle line:84%
And this particular
virtual machine

00:04:02.220 --> 00:04:05.700 align:middle line:84%
was created to demonstrate how
the Metasploit framework can

00:04:05.700 --> 00:04:08.200 align:middle line:84%
be used to exploit
a Windows system.

00:04:08.200 --> 00:04:10.230 align:middle line:84%
So again, this particular
virtual machine

00:04:10.230 --> 00:04:12.520 align:middle line:84%
is set up for
educational purposes.

00:04:12.520 --> 00:04:14.160 align:middle line:84%
And again, it's
there to show you

00:04:14.160 --> 00:04:16.260 align:middle line:84%
how you can utilize the
Metasploit framework

00:04:16.260 --> 00:04:18.839 align:middle line:90%
to full effect for exploitation.

00:04:18.839 --> 00:04:22.920 align:middle line:84%
Now again, if you want
to actually set this up

00:04:22.920 --> 00:04:25.410 align:middle line:84%
for yourself, you can
go ahead and do that.

00:04:25.410 --> 00:04:29.340 align:middle line:84%
The setup instructions are
provided through that link that

00:04:29.340 --> 00:04:30.810 align:middle line:90%
is actually on the slides here.

00:04:30.810 --> 00:04:34.020 align:middle line:84%
And if you want to actually
go ahead and set this up

00:04:34.020 --> 00:04:36.330 align:middle line:84%
on your own virtual lab,
you can go ahead and do so.

00:04:36.330 --> 00:04:39.240 align:middle line:84%
However, you don't need to do
that because we are primarily

00:04:39.240 --> 00:04:42.090 align:middle line:84%
going to be focusing on
techniques here as opposed

00:04:42.090 --> 00:04:43.960 align:middle line:90%
to the target environment.

00:04:43.960 --> 00:04:46.770 align:middle line:84%
And the reason being is when
you're performing a penetration

00:04:46.770 --> 00:04:48.690 align:middle line:84%
test with the
Metasploit framework,

00:04:48.690 --> 00:04:51.150 align:middle line:84%
you're really not going
to be again dealing

00:04:51.150 --> 00:04:53.940 align:middle line:84%
with the same type of lab or
the same type of environment.

00:04:53.940 --> 00:04:55.120 align:middle line:90%
It's going to be different.

00:04:55.120 --> 00:04:57.570 align:middle line:84%
So the key thing is
you need to be sure

00:04:57.570 --> 00:05:00.390 align:middle line:84%
and you need to be aware of
the techniques as opposed

00:05:00.390 --> 00:05:02.590 align:middle line:84%
to the actual
target environment.

00:05:02.590 --> 00:05:04.820 align:middle line:84%
So you can go ahead
and take a look

00:05:04.820 --> 00:05:07.220 align:middle line:84%
at how to get that set up
if you want to follow along.

00:05:07.220 --> 00:05:09.980 align:middle line:84%
Irregardless of
that, you can just

00:05:09.980 --> 00:05:13.220 align:middle line:84%
take a look at the techniques we
use and the various modules we

00:05:13.220 --> 00:05:16.700 align:middle line:84%
can utilize, and you should
have no problem replicating

00:05:16.700 --> 00:05:20.720 align:middle line:84%
the process in any environment
that you're working in.

00:05:20.720 --> 00:05:23.540 align:middle line:84%
That being said, let me switch
over to my Kali Linux VM

00:05:23.540 --> 00:05:26.450 align:middle line:84%
and we can get started with
the practical demonstration

00:05:26.450 --> 00:05:28.520 align:middle line:90%
of this video.

00:05:28.520 --> 00:05:31.120 align:middle line:84%
All right, so I'm currently
within my Kali Linux

00:05:31.120 --> 00:05:33.940 align:middle line:84%
virtual machine, and I've set
up the target virtual machine

00:05:33.940 --> 00:05:36.490 align:middle line:84%
on the same local
network so that we

00:05:36.490 --> 00:05:37.700 align:middle line:90%
can communicate with it.

00:05:37.700 --> 00:05:39.550 align:middle line:84%
So the first step
in this process

00:05:39.550 --> 00:05:42.070 align:middle line:84%
will involve identifying
the target IP.

00:05:42.070 --> 00:05:45.910 align:middle line:84%
And in my case, I can simply
run a quick Nmap scan here

00:05:45.910 --> 00:05:48.740 align:middle line:84%
to essentially detect
active hosts on my network.

00:05:48.740 --> 00:05:51.730 align:middle line:84%
So I'll use the sn option, which
will essentially just perform

00:05:51.730 --> 00:05:54.220 align:middle line:84%
a quick ping, and
we are performing

00:05:54.220 --> 00:05:55.940 align:middle line:90%
this on my local network.

00:05:55.940 --> 00:05:59.620 align:middle line:84%
So that is 10.10.1, and
that's the subnet there.

00:05:59.620 --> 00:06:02.020 align:middle line:84%
So I'm just going to
hit Enter and provide

00:06:02.020 --> 00:06:04.300 align:middle line:90%
my password for the user kali.

00:06:04.300 --> 00:06:05.860 align:middle line:84%
I'll give that a
few seconds, and it

00:06:05.860 --> 00:06:09.610 align:middle line:84%
should tell me what hosts are up
and consequently the target IP.

00:06:09.610 --> 00:06:13.105 align:middle line:84%
So if I type in ifconfig,
you can see that--

00:06:13.105 --> 00:06:14.980 align:middle line:84%
well, that actually
doesn't display anything.

00:06:14.980 --> 00:06:19.360 align:middle line:84%
So if I type in ip a s, you can
see that the Kali Linux VM is

00:06:19.360 --> 00:06:21.010 align:middle line:90%
10.10.10.5.

00:06:21.010 --> 00:06:25.390 align:middle line:84%
And right over here, it looks
like the target IP is 10.10.4.

00:06:25.390 --> 00:06:26.770 align:middle line:90%
So we'll copy that.

00:06:26.770 --> 00:06:28.810 align:middle line:84%
The next thing or
the next step is

00:06:28.810 --> 00:06:31.847 align:middle line:84%
to obviously ensure that
the PostgreSQL database

00:06:31.847 --> 00:06:33.430 align:middle line:84%
service is started,
which I've already

00:06:33.430 --> 00:06:35.680 align:middle line:90%
covered how to do quite a bit.

00:06:35.680 --> 00:06:37.180 align:middle line:84%
So you should be
familiar with that.

00:06:37.180 --> 00:06:40.930 align:middle line:84%
Once that is done, we can
type in msfconsole here,

00:06:40.930 --> 00:06:43.990 align:middle line:84%
and that will start up the
Metasploit framework console.

00:06:43.990 --> 00:06:45.860 align:middle line:90%
We'll give that a few seconds.

00:06:45.860 --> 00:06:46.360 align:middle line:90%
Excellent.

00:06:46.360 --> 00:06:47.610 align:middle line:90%
All right, so that started up.

00:06:47.610 --> 00:06:49.630 align:middle line:84%
We'll just verify that
the database is connected

00:06:49.630 --> 00:06:51.310 align:middle line:90%
by typing in db_status.

00:06:51.310 --> 00:06:52.540 align:middle line:90%
Indeed, it is.

00:06:52.540 --> 00:06:54.730 align:middle line:84%
The next step that
we need to perform

00:06:54.730 --> 00:06:58.210 align:middle line:84%
is, of course, set our global
variables for the RHOSTS

00:06:58.210 --> 00:07:01.810 align:middle line:84%
option, and what this will
do is it will essentially

00:07:01.810 --> 00:07:05.650 align:middle line:84%
set up this variable globally
so that the target IP is always

00:07:05.650 --> 00:07:08.110 align:middle line:84%
configured or is always
set whenever we use

00:07:08.110 --> 00:07:10.460 align:middle line:90%
or whenever we load any module.

00:07:10.460 --> 00:07:12.560 align:middle line:84%
So we don't have to
keep on typing it in.

00:07:12.560 --> 00:07:13.630 align:middle line:90%
So I'm going to Enter.

00:07:13.630 --> 00:07:17.440 align:middle line:84%
And we'll also do this for
the RHOST option or setting.

00:07:17.440 --> 00:07:20.980 align:middle line:84%
I'll hit Enter and that should
have the target IP configured

00:07:20.980 --> 00:07:24.280 align:middle line:90%
for any module that we load.

00:07:24.280 --> 00:07:28.300 align:middle line:84%
All right, so now when it comes
down to vulnerability scanning,

00:07:28.300 --> 00:07:29.980 align:middle line:84%
the key piece of
information that you

00:07:29.980 --> 00:07:33.790 align:middle line:84%
require in terms of identifying
vulnerabilities for a target

00:07:33.790 --> 00:07:37.090 align:middle line:84%
operating system or the services
that are running on a target

00:07:37.090 --> 00:07:38.860 align:middle line:90%
is the service version.

00:07:38.860 --> 00:07:41.980 align:middle line:84%
Now in the previous section when
we were performing enumeration,

00:07:41.980 --> 00:07:43.990 align:middle line:84%
I showed you how to do
that through the use

00:07:43.990 --> 00:07:46.540 align:middle line:84%
of various Metasploit
auxiliary modules,

00:07:46.540 --> 00:07:49.120 align:middle line:84%
and we also took a
look at how to import

00:07:49.120 --> 00:07:52.450 align:middle line:84%
Nmap scans into the
Metasploit framework console.

00:07:52.450 --> 00:07:53.980 align:middle line:84%
So what we'll do
for the target now

00:07:53.980 --> 00:07:56.480 align:middle line:84%
is we'll just run
the db_nmap command,

00:07:56.480 --> 00:07:59.080 align:middle line:84%
and this will essentially
allow us to perform an Nmap

00:07:59.080 --> 00:08:02.350 align:middle line:84%
scan within the Metasploit
framework console,

00:08:02.350 --> 00:08:05.140 align:middle line:84%
and it will then automatically
import the results

00:08:05.140 --> 00:08:07.220 align:middle line:84%
into the Metasploit
framework database.

00:08:07.220 --> 00:08:10.540 align:middle line:84%
However, before we do that,
I want to set up a workspace

00:08:10.540 --> 00:08:13.750 align:middle line:84%
here that will essentially
help us to sort out

00:08:13.750 --> 00:08:16.270 align:middle line:84%
all of our results
and all of our hosts

00:08:16.270 --> 00:08:17.983 align:middle line:90%
rather and keep them organized.

00:08:17.983 --> 00:08:19.900 align:middle line:84%
So I'm just going to
create a workspace called

00:08:19.900 --> 00:08:24.100 align:middle line:84%
MS3, which is an abbreviation
for Metasploitable3,

00:08:24.100 --> 00:08:25.550 align:middle line:90%
I'll hit Enter.

00:08:25.550 --> 00:08:27.580 align:middle line:84%
And that is the
current workspace

00:08:27.580 --> 00:08:28.810 align:middle line:90%
that we're dealing with.

00:08:28.810 --> 00:08:31.930 align:middle line:84%
All right, so again
we'll say db_nmap.

00:08:31.930 --> 00:08:34.840 align:middle line:84%
And of course, you can
utilize the auxiliary modules

00:08:34.840 --> 00:08:36.289 align:middle line:90%
if you also want to do that.

00:08:36.289 --> 00:08:38.840 align:middle line:84%
But in this case, I'm just going
to speed everything up here.

00:08:38.840 --> 00:08:42.380 align:middle line:84%
So we'll say db_map, and then
we are performing a scene scan.

00:08:42.380 --> 00:08:45.160 align:middle line:84%
So I'm going to say a
lowercase S uppercase S.

00:08:45.160 --> 00:08:48.010 align:middle line:84%
And we also want to perform
some service detection,

00:08:48.010 --> 00:08:50.920 align:middle line:84%
and I'm also going to
perform some operating system

00:08:50.920 --> 00:08:54.040 align:middle line:84%
detection, and then I'll type in
the target IP, which we already

00:08:54.040 --> 00:08:55.370 align:middle line:90%
know.

00:08:55.370 --> 00:08:56.600 align:middle line:90%
And that's pretty much it.

00:08:56.600 --> 00:09:00.040 align:middle line:84%
Now, of course, I can
increase the port range

00:09:00.040 --> 00:09:03.100 align:middle line:84%
if I want to to the entire
TCP port range, which

00:09:03.100 --> 00:09:06.470 align:middle line:90%
is about 65,535 ports.

00:09:06.470 --> 00:09:09.370 align:middle line:84%
But in this case, I'm not going
to do that because again, I'm

00:09:09.370 --> 00:09:11.890 align:middle line:84%
focusing primarily
on techniques here.

00:09:11.890 --> 00:09:12.790 align:middle line:90%
So I'll hit Enter.

00:09:12.790 --> 00:09:14.442 align:middle line:84%
That's going to
perform the Nmap scan.

00:09:14.442 --> 00:09:16.400 align:middle line:84%
So I'm just going to wait
for this to complete.

00:09:16.400 --> 00:09:19.180 align:middle line:84%
And as I said, all the
results or rather the results

00:09:19.180 --> 00:09:21.820 align:middle line:84%
of the Nmap scan will be added
to the Metasploit framework

00:09:21.820 --> 00:09:26.500 align:middle line:84%
database, so that we can refer
back to them whenever we want.

00:09:26.500 --> 00:09:28.940 align:middle line:84%
All right, so the
Nmap scan is complete.

00:09:28.940 --> 00:09:30.670 align:middle line:84%
And as you can see,
it's provided us

00:09:30.670 --> 00:09:32.710 align:middle line:90%
with a lot of information here.

00:09:32.710 --> 00:09:35.410 align:middle line:84%
And we have quite a
few services running,

00:09:35.410 --> 00:09:37.810 align:middle line:84%
services that we have
been able to enumerate

00:09:37.810 --> 00:09:38.930 align:middle line:90%
in the previous section.

00:09:38.930 --> 00:09:42.370 align:middle line:84%
So again, as you can see,
Nmap gives us the port.

00:09:42.370 --> 00:09:45.010 align:middle line:84%
And of course, we know we
are dealing with TCP here,

00:09:45.010 --> 00:09:47.110 align:middle line:84%
the service that's running
on the port, as well

00:09:47.110 --> 00:09:48.850 align:middle line:90%
as the service version.

00:09:48.850 --> 00:09:51.760 align:middle line:84%
And so we already know
that Nmap can automatically

00:09:51.760 --> 00:09:53.320 align:middle line:90%
enumerate the version.

00:09:53.320 --> 00:09:55.930 align:middle line:84%
So again, you can
do this with Nmap

00:09:55.930 --> 00:09:58.240 align:middle line:84%
or you can utilize
the auxiliary modules.

00:09:58.240 --> 00:10:01.490 align:middle line:84%
Whatever your choice is,
it'll work just the same.

00:10:01.490 --> 00:10:04.850 align:middle line:84%
So what we can do is
just clear out of this.

00:10:04.850 --> 00:10:08.380 align:middle line:84%
And if we type in hosts, you
can see that information has now

00:10:08.380 --> 00:10:09.550 align:middle line:90%
been stored here.

00:10:09.550 --> 00:10:14.350 align:middle line:84%
And in this particular case,
we have the target IP, the Mac

00:10:14.350 --> 00:10:15.910 align:middle line:84%
address, and for
some reason, it's

00:10:15.910 --> 00:10:17.800 align:middle line:84%
telling us that the
operating system

00:10:17.800 --> 00:10:19.870 align:middle line:84%
that's running on the
target is Windows 7.

00:10:19.870 --> 00:10:22.630 align:middle line:84%
Of course, we know that
it's Windows Server 2008.

00:10:22.630 --> 00:10:25.540 align:middle line:84%
So if we type in
services, this will

00:10:25.540 --> 00:10:28.720 align:middle line:84%
display all the open services
and the respective ports,

00:10:28.720 --> 00:10:31.390 align:middle line:84%
and we can see that we have
quite a few common services

00:10:31.390 --> 00:10:34.690 align:middle line:84%
that you typically expect
a server to be hosting.

00:10:34.690 --> 00:10:37.540 align:middle line:84%
We have FTP, we have a web
server running on port 80,

00:10:37.540 --> 00:10:43.450 align:middle line:84%
we have SMB which is on both 139
and 445 facilitated by netbios

00:10:43.450 --> 00:10:47.170 align:middle line:84%
on 139 as I've already explained
during the SMB enumeration

00:10:47.170 --> 00:10:48.070 align:middle line:90%
video.

00:10:48.070 --> 00:10:50.620 align:middle line:84%
But you can see that
the SMB port gives us

00:10:50.620 --> 00:10:53.770 align:middle line:84%
an idea as to what the
operating system is

00:10:53.770 --> 00:10:56.540 align:middle line:84%
or rather the specific version
of the operating system.

00:10:56.540 --> 00:10:59.260 align:middle line:84%
And in this case, it tells us
that this is Microsoft Windows

00:10:59.260 --> 00:11:01.750 align:middle line:90%
Server 2008 R2.

00:11:01.750 --> 00:11:03.430 align:middle line:84%
And then we have a
few other services

00:11:03.430 --> 00:11:05.690 align:middle line:84%
and we also get
their exact versions.

00:11:05.690 --> 00:11:09.940 align:middle line:84%
So for example, we have Apache
Tomcat using Coyote JSP Engine

00:11:09.940 --> 00:11:11.710 align:middle line:90%
1.1.

00:11:11.710 --> 00:11:16.810 align:middle line:84%
So the question is, how do we
utilize this particular service

00:11:16.810 --> 00:11:20.920 align:middle line:84%
information to find and
identify vulnerabilities?

00:11:20.920 --> 00:11:24.140 align:middle line:84%
Because we are primarily focused
on manual techniques here.

00:11:24.140 --> 00:11:27.460 align:middle line:84%
So the first thing we can
do is, of course, just

00:11:27.460 --> 00:11:31.420 align:middle line:84%
utilize the exact version here
or I can essentially search

00:11:31.420 --> 00:11:33.640 align:middle line:90%
for Microsoft IIS exploits.

00:11:33.640 --> 00:11:38.530 align:middle line:84%
So I can say search, and then
limit the type to exploit.

00:11:38.530 --> 00:11:42.230 align:middle line:84%
So we can say exploit, there
we are, and then the name.

00:11:42.230 --> 00:11:45.370 align:middle line:84%
I can then limit that
to Microsoft IIS.

00:11:45.370 --> 00:11:48.910 align:middle line:84%
So I can say I can this space
that in there, and I hit Enter,

00:11:48.910 --> 00:11:52.150 align:middle line:84%
and this is going to give me
all Microsoft IIS exploits.

00:11:52.150 --> 00:11:54.430 align:middle line:84%
However, as you
can see, these are

00:11:54.430 --> 00:11:59.230 align:middle line:84%
all for other versions of
IIS like 5.0, 4.0, et cetera.

00:11:59.230 --> 00:12:03.590 align:middle line:84%
And the one that is running
on the target is version 7.5.

00:12:03.590 --> 00:12:06.700 align:middle line:84%
So again, there's
two scenarios here.

00:12:06.700 --> 00:12:10.330 align:middle line:84%
Number one, this particular
version of Microsoft IIS

00:12:10.330 --> 00:12:13.270 align:middle line:84%
might not be vulnerable
to an inherent exploit

00:12:13.270 --> 00:12:16.960 align:middle line:84%
or there isn't a Metasploit
exploit module available

00:12:16.960 --> 00:12:19.960 align:middle line:84%
that can be used to exploit
this particular vulnerability

00:12:19.960 --> 00:12:21.520 align:middle line:90%
or this particular service.

00:12:21.520 --> 00:12:23.710 align:middle line:84%
And, of course, in this
case, we are primarily

00:12:23.710 --> 00:12:25.540 align:middle line:84%
focused on the
Metasploit framework

00:12:25.540 --> 00:12:28.930 align:middle line:84%
and the exploit modules within
the Metasploit framework.

00:12:28.930 --> 00:12:33.010 align:middle line:84%
So we really can't start
exploring external exploits

00:12:33.010 --> 00:12:37.220 align:middle line:84%
or rather taking a look at how
to use exploit code manually.

00:12:37.220 --> 00:12:39.890 align:middle line:84%
So again, that's
pretty much a dead end.

00:12:39.890 --> 00:12:42.280 align:middle line:84%
Now we can take a look at some
of the other services that

00:12:42.280 --> 00:12:45.100 align:middle line:84%
are running on the
target like MySQL.

00:12:45.100 --> 00:12:47.860 align:middle line:90%
So we can say MySQL 5.5.

00:12:47.860 --> 00:12:49.790 align:middle line:84%
So let's perform
a search for that.

00:12:49.790 --> 00:12:51.730 align:middle line:84%
And let's see if
we get any results.

00:12:51.730 --> 00:12:53.090 align:middle line:90%
So I'll paste that in there.

00:12:53.090 --> 00:12:56.410 align:middle line:84%
And as you can see, it looks
like we have a few MySQL

00:12:56.410 --> 00:12:59.470 align:middle line:84%
exploits, but they're really
not for this particular version

00:12:59.470 --> 00:13:02.410 align:middle line:84%
of MySQL or rather
the exploit names

00:13:02.410 --> 00:13:05.170 align:middle line:84%
and the descriptions don't
give us an idea as to whether

00:13:05.170 --> 00:13:09.580 align:middle line:84%
or not these exploits actually
exploit a vulnerability

00:13:09.580 --> 00:13:12.520 align:middle line:90%
within MySQL version 5.5.

00:13:12.520 --> 00:13:15.220 align:middle line:84%
So you can see that this is
quite a tedious process when

00:13:15.220 --> 00:13:19.810 align:middle line:84%
it comes down to identifying
exploits for specific versions

00:13:19.810 --> 00:13:22.180 align:middle line:84%
or rather for specific
service versions.

00:13:22.180 --> 00:13:25.850 align:middle line:84%
So again, I can also do this
for the Sun GlassFish service.

00:13:25.850 --> 00:13:28.130 align:middle line:84%
So I can essentially
search for that.

00:13:28.130 --> 00:13:30.460 align:middle line:84%
So I can say, copy that,
and then we'll say,

00:13:30.460 --> 00:13:33.500 align:middle line:84%
search, and then
paste that in there.

00:13:33.500 --> 00:13:35.900 align:middle line:84%
And in this case, it looks
like we have a module.

00:13:35.900 --> 00:13:38.230 align:middle line:84%
So how do we verify
or how do we check

00:13:38.230 --> 00:13:39.910 align:middle line:84%
as to whether this
particular exploit

00:13:39.910 --> 00:13:44.800 align:middle line:84%
module will work on the open
source version of GlassFish?

00:13:44.800 --> 00:13:46.090 align:middle line:90%
And that is version 4.

00:13:46.090 --> 00:13:49.510 align:middle line:84%
So in order to do this, we
can just copy the module here

00:13:49.510 --> 00:13:51.670 align:middle line:90%
and then say use.

00:13:51.670 --> 00:13:54.923 align:middle line:84%
And you can see that it
will set up a payload,

00:13:54.923 --> 00:13:56.590 align:middle line:84%
and the payload, as
I mentioned, is what

00:13:56.590 --> 00:13:58.460 align:middle line:90%
is sent to the target system.

00:13:58.460 --> 00:14:00.670 align:middle line:84%
And in this case,
the default payload

00:14:00.670 --> 00:14:03.380 align:middle line:84%
is set to the Meterpreter
payload for Linux system.

00:14:03.380 --> 00:14:06.850 align:middle line:84%
So we pretty much have to
change that if this exploit will

00:14:06.850 --> 00:14:07.525 align:middle line:90%
indeed work.

00:14:07.525 --> 00:14:09.400 align:middle line:84%
And we need to change
it to a Windows payload

00:14:09.400 --> 00:14:12.730 align:middle line:84%
so that we can get an
Meterpreter session back.

00:14:12.730 --> 00:14:14.200 align:middle line:84%
However, before we
do that, we need

00:14:14.200 --> 00:14:17.260 align:middle line:84%
to make sure that this will
work on GlassFish version 4.

00:14:17.260 --> 00:14:19.720 align:middle line:84%
And in order to do this,
we'll clear this out

00:14:19.720 --> 00:14:21.100 align:middle line:90%
and we'll say info.

00:14:21.100 --> 00:14:23.830 align:middle line:84%
Info will display
information pertinent

00:14:23.830 --> 00:14:28.420 align:middle line:84%
to this particular module and
what versions of the service

00:14:28.420 --> 00:14:29.530 align:middle line:90%
it will exploit.

00:14:29.530 --> 00:14:31.240 align:middle line:84%
So if we take a look
at the description,

00:14:31.240 --> 00:14:34.600 align:middle line:84%
you can see it says this module
logs into a GlassFish server

00:14:34.600 --> 00:14:37.630 align:middle line:84%
open source or commercial
using various methods

00:14:37.630 --> 00:14:41.290 align:middle line:84%
such as authentication bypass,
default credentials, or user

00:14:41.290 --> 00:14:45.970 align:middle line:84%
supplied log ins, and deploys
a malicious WAR file in order

00:14:45.970 --> 00:14:47.960 align:middle line:90%
to get remote code execution.

00:14:47.960 --> 00:14:51.970 align:middle line:84%
It has been tested on
GlassFish version 2, 3, and 4.

00:14:51.970 --> 00:14:52.840 align:middle line:90%
So that's great.

00:14:52.840 --> 00:14:55.340 align:middle line:84%
And it also works on
the open source version.

00:14:55.340 --> 00:14:58.760 align:middle line:84%
So in order to run
this particular module,

00:14:58.760 --> 00:15:01.420 align:middle line:84%
we know that it works on
the version that's running

00:15:01.420 --> 00:15:03.650 align:middle line:90%
on the server or on the target.

00:15:03.650 --> 00:15:05.650 align:middle line:84%
And it also works on
the specific version,

00:15:05.650 --> 00:15:07.340 align:middle line:90%
the open source version here.

00:15:07.340 --> 00:15:11.350 align:middle line:84%
So we pretty much have to
configure the module options

00:15:11.350 --> 00:15:12.230 align:middle line:90%
in order to use it.

00:15:12.230 --> 00:15:14.050 align:middle line:84%
So the first thing
we would typically do

00:15:14.050 --> 00:15:15.470 align:middle line:90%
is we would set the payload.

00:15:15.470 --> 00:15:18.010 align:middle line:84%
So we will set the
payload to Windows,

00:15:18.010 --> 00:15:23.360 align:middle line:84%
and then we'd say
meterpreter/reverse_tcp and hit

00:15:23.360 --> 00:15:25.670 align:middle line:84%
Enter because we are
targeting a Windows system.

00:15:25.670 --> 00:15:28.130 align:middle line:84%
And now if we show
the options, we

00:15:28.130 --> 00:15:31.250 align:middle line:84%
need to set up the APP_RPORT,
which is the application

00:15:31.250 --> 00:15:32.730 align:middle line:90%
interface port.

00:15:32.730 --> 00:15:34.580 align:middle line:84%
We also need to set
the target IP, which

00:15:34.580 --> 00:15:37.880 align:middle line:84%
is done through the global
variable, the RPORT, which

00:15:37.880 --> 00:15:40.790 align:middle line:84%
is the target port where
we have GlassFish running,

00:15:40.790 --> 00:15:44.990 align:middle line:84%
and then whether or not there is
an SSL certificate, the target

00:15:44.990 --> 00:15:47.360 align:middle line:90%
URI, the username, et cetera.

00:15:47.360 --> 00:15:50.090 align:middle line:84%
And then, of course, we have
to set the payload options,

00:15:50.090 --> 00:15:52.910 align:middle line:84%
we need to set our own
IP, which is the Kali IP,

00:15:52.910 --> 00:15:56.150 align:middle line:84%
and the port that we want
to listen on in order

00:15:56.150 --> 00:15:58.700 align:middle line:84%
to receive the reverse
connection when the payload is

00:15:58.700 --> 00:16:01.610 align:middle line:84%
executed in order to receive
a Meterpreter session.

00:16:01.610 --> 00:16:03.260 align:middle line:84%
Now in this case,
we haven't performed

00:16:03.260 --> 00:16:06.890 align:middle line:84%
enough enumeration regarding
this particular application

00:16:06.890 --> 00:16:10.970 align:middle line:84%
GlassFish in order to understand
what ports we want to target.

00:16:10.970 --> 00:16:14.150 align:middle line:84%
But again, we can get
a basic idea of what

00:16:14.150 --> 00:16:15.420 align:middle line:90%
values we need to change.

00:16:15.420 --> 00:16:18.350 align:middle line:84%
So if I type in
services, you can

00:16:18.350 --> 00:16:21.740 align:middle line:84%
see that GlassFish is
running on port 8080.

00:16:21.740 --> 00:16:23.120 align:middle line:90%
That's already been configured.

00:16:23.120 --> 00:16:24.980 align:middle line:90%
Yeah, that's the APP_RPORT.

00:16:24.980 --> 00:16:29.060 align:middle line:84%
What is the RPORT or the target
port that we want to target?

00:16:29.060 --> 00:16:30.870 align:middle line:84%
We're really not
sure about that.

00:16:30.870 --> 00:16:35.930 align:middle line:84%
So we pretty much have to check
whether port 4848 is currently

00:16:35.930 --> 00:16:37.070 align:middle line:90%
open on the target.

00:16:37.070 --> 00:16:38.630 align:middle line:84%
But as I said,
this is pretty much

00:16:38.630 --> 00:16:41.360 align:middle line:84%
how you would identify
an exploit module

00:16:41.360 --> 00:16:42.720 align:middle line:90%
through the service version.

00:16:42.720 --> 00:16:44.792 align:middle line:84%
So this is just manual
vulnerability scanning.

00:16:44.792 --> 00:16:47.000 align:middle line:84%
And of course, we're not
going to exploit this module

00:16:47.000 --> 00:16:49.650 align:middle line:90%
because we're not there yet.

00:16:49.650 --> 00:16:52.800 align:middle line:84%
So I'm just going
to take a step back.

00:16:52.800 --> 00:16:56.000 align:middle line:84%
All right, so if we again
explore our services page,

00:16:56.000 --> 00:16:59.420 align:middle line:84%
let's explore a few other
exploits or vulnerabilities

00:16:59.420 --> 00:17:00.080 align:middle line:90%
here.

00:17:00.080 --> 00:17:05.450 align:middle line:84%
And the one I'm particularly
interested is the SMB exploit

00:17:05.450 --> 00:17:09.890 align:middle line:84%
or rather an SMB exploit
for Windows Server 2008 R2.

00:17:09.890 --> 00:17:11.930 align:middle line:84%
And the way we can
do that, of course,

00:17:11.930 --> 00:17:14.480 align:middle line:84%
or the way we can search
for a particular exploit

00:17:14.480 --> 00:17:17.900 align:middle line:84%
is by, again, utilizing the
Metasploit framework console

00:17:17.900 --> 00:17:19.010 align:middle line:90%
search utility.

00:17:19.010 --> 00:17:22.640 align:middle line:84%
Alternatively, we can also
use an inbuilt utility

00:17:22.640 --> 00:17:25.520 align:middle line:84%
that's part of Kali Linux
called searchsploit.

00:17:25.520 --> 00:17:29.180 align:middle line:84%
Now searchsploit is a utility
or a command line utility that

00:17:29.180 --> 00:17:32.840 align:middle line:84%
allows you to search the
ExploitDB or ExploitDB

00:17:32.840 --> 00:17:35.270 align:middle line:84%
database for exploits,
and we can then

00:17:35.270 --> 00:17:38.510 align:middle line:84%
limit the results to only
show Metasploit exploits.

00:17:38.510 --> 00:17:41.180 align:middle line:84%
So I'll open up a new
tab on my Kali VM.

00:17:41.180 --> 00:17:44.870 align:middle line:84%
And as I said, in Kali Linux,
searchsploit is prepackaged,

00:17:44.870 --> 00:17:47.540 align:middle line:84%
so only we need to do
is type in searchsploit

00:17:47.540 --> 00:17:50.540 align:middle line:84%
and you can pretty much search
for any exploit you want.

00:17:50.540 --> 00:17:52.700 align:middle line:84%
And as I said,
searchsploit will actually

00:17:52.700 --> 00:17:55.220 align:middle line:84%
bring up exploits
or exploit code

00:17:55.220 --> 00:17:58.220 align:middle line:84%
that is not available within the
Metasploit framework console,

00:17:58.220 --> 00:18:00.980 align:middle line:84%
and it will also display
Metasploit framework modules.

00:18:00.980 --> 00:18:04.220 align:middle line:84%
So we want to limit the results
to only display the Metasploit

00:18:04.220 --> 00:18:06.080 align:middle line:90%
framework exploit modules.

00:18:06.080 --> 00:18:09.770 align:middle line:84%
Now in order to do this,
we can again, what we'll do

00:18:09.770 --> 00:18:14.150 align:middle line:84%
is we'll try and find exploits
for Microsoft Windows SMB.

00:18:14.150 --> 00:18:19.400 align:middle line:84%
So we'll say Microsoft
Windows SMB, and then

00:18:19.400 --> 00:18:23.540 align:middle line:84%
I'm going to wipe out
the actual output here,

00:18:23.540 --> 00:18:25.190 align:middle line:84%
or before we do
that, if I hit Enter,

00:18:25.190 --> 00:18:29.250 align:middle line:84%
you can see there's quite
a few exploits here.

00:18:29.250 --> 00:18:32.630 align:middle line:84%
And the way to distinguish
the standard exploit code

00:18:32.630 --> 00:18:34.340 align:middle line:84%
from the Metasploit
modules is you'll

00:18:34.340 --> 00:18:37.040 align:middle line:84%
see that right
beside the name here,

00:18:37.040 --> 00:18:40.850 align:middle line:84%
there will be a bracket with
the name Metasploit within it.

00:18:40.850 --> 00:18:43.490 align:middle line:84%
That means that
there is a Metasploit

00:18:43.490 --> 00:18:45.890 align:middle line:84%
module available for
this particular exploit.

00:18:45.890 --> 00:18:49.130 align:middle line:84%
So let's limit it to only
the Metasploit modules.

00:18:49.130 --> 00:18:51.710 align:middle line:84%
And the way I'll do that is
I'll pipe out the content

00:18:51.710 --> 00:18:55.820 align:middle line:84%
and I will say grep, and we'll
use the expressions filter here

00:18:55.820 --> 00:18:57.980 align:middle line:84%
to make sure that we
are case sensitive.

00:18:57.980 --> 00:19:00.140 align:middle line:90%
So I'll say Metasploit.

00:19:00.140 --> 00:19:01.970 align:middle line:84%
And once we hit
Enter, it's only going

00:19:01.970 --> 00:19:05.150 align:middle line:84%
to show you the
Metasploit modules.

00:19:05.150 --> 00:19:08.750 align:middle line:84%
OK, so we can see that
there's quite a few modules

00:19:08.750 --> 00:19:09.740 align:middle line:90%
that we can utilize.

00:19:09.740 --> 00:19:13.070 align:middle line:84%
However, we still don't know
whether any of these Metasploit

00:19:13.070 --> 00:19:17.960 align:middle line:84%
modules will work on the
version or the operating system.

00:19:17.960 --> 00:19:23.180 align:middle line:84%
And in this case, we know
it's Windows Server 2008.

00:19:23.180 --> 00:19:25.400 align:middle line:84%
Now if we take a look
at the information

00:19:25.400 --> 00:19:30.200 align:middle line:84%
displayed here, so for
example, if we actually

00:19:30.200 --> 00:19:32.810 align:middle line:84%
take a look at this
particular exploit here,

00:19:32.810 --> 00:19:35.630 align:middle line:84%
we can see that this
works on Windows 7, 8.1,

00:19:35.630 --> 00:19:38.990 align:middle line:84%
and Windows Server
2008, as well as R2.

00:19:38.990 --> 00:19:41.040 align:middle line:84%
And this is the
EternalBlue exploit,

00:19:41.040 --> 00:19:43.820 align:middle line:84%
which we explored earlier
on, and it provides us

00:19:43.820 --> 00:19:46.170 align:middle line:84%
with the Microsoft
vulnerability code here.

00:19:46.170 --> 00:19:47.990 align:middle line:84%
Now the Metasploit
framework already

00:19:47.990 --> 00:19:50.780 align:middle line:84%
has a module for this
particular exploit.

00:19:50.780 --> 00:19:52.620 align:middle line:84%
As you can see,
that's the one here.

00:19:52.620 --> 00:19:55.490 align:middle line:84%
So we can actually load it
within the Metasploit framework

00:19:55.490 --> 00:19:58.460 align:middle line:84%
and check whether this
particular version of Windows

00:19:58.460 --> 00:20:00.110 align:middle line:90%
is vulnerable to this exploit.

00:20:00.110 --> 00:20:06.970 align:middle line:84%
So what I'll do is I will
say search eternalblue,

00:20:06.970 --> 00:20:09.730 align:middle line:84%
and we can see that we
have the exploit module.

00:20:09.730 --> 00:20:12.250 align:middle line:84%
However, we also
have another module

00:20:12.250 --> 00:20:14.530 align:middle line:84%
that's pertinent to
this particular exploit,

00:20:14.530 --> 00:20:20.530 align:middle line:84%
and that is the auxiliary
module for smb_ms17_010.

00:20:20.530 --> 00:20:22.480 align:middle line:84%
And what this
module is used to do

00:20:22.480 --> 00:20:25.420 align:middle line:84%
is it's used to actually
check whether the target is

00:20:25.420 --> 00:20:27.580 align:middle line:84%
vulnerable to this
particular vulnerability

00:20:27.580 --> 00:20:29.260 align:middle line:90%
or this particular exploit.

00:20:29.260 --> 00:20:32.020 align:middle line:84%
So let's use that and let's
see whether the target is

00:20:32.020 --> 00:20:33.110 align:middle line:90%
vulnerable at all.

00:20:33.110 --> 00:20:38.500 align:middle line:84%
So I'll say show options,
and the only option

00:20:38.500 --> 00:20:41.320 align:middle line:84%
we need to change is the target
IP, which is already done,

00:20:41.320 --> 00:20:44.050 align:middle line:84%
and the RPORT has been
configured correctly,

00:20:44.050 --> 00:20:46.570 align:middle line:84%
we don't have any of the
credentials or the domain

00:20:46.570 --> 00:20:47.300 align:middle line:90%
information.

00:20:47.300 --> 00:20:49.210 align:middle line:90%
So we just hit Run.

00:20:49.210 --> 00:20:50.870 align:middle line:90%
And it completes rather quickly.

00:20:50.870 --> 00:20:52.810 align:middle line:84%
And as you can see,
it says the host

00:20:52.810 --> 00:20:59.410 align:middle line:84%
is likely vulnerable to MS17-010
Windows Server 2008 R2 Standard

00:20:59.410 --> 00:21:04.330 align:middle line:84%
7601 Service Pack 1, and it's
a 64-bit version of Windows.

00:21:04.330 --> 00:21:06.310 align:middle line:84%
So this particular
module tells us

00:21:06.310 --> 00:21:08.200 align:middle line:84%
that it is vulnerable
to this exploit,

00:21:08.200 --> 00:21:11.440 align:middle line:84%
and furthermore, it also gives
us some additional information

00:21:11.440 --> 00:21:14.890 align:middle line:84%
regarding the specific version
of Windows Server that's

00:21:14.890 --> 00:21:17.228 align:middle line:84%
running and also
the architecture.

00:21:17.228 --> 00:21:18.770 align:middle line:84%
So again, it's a
very helpful module.

00:21:18.770 --> 00:21:21.010 align:middle line:84%
So now that we
know that works, we

00:21:21.010 --> 00:21:25.080 align:middle line:84%
can actually utilize the
real exploit module here,

00:21:25.080 --> 00:21:26.490 align:middle line:90%
which I'll just paste in there.

00:21:26.490 --> 00:21:29.990 align:middle line:84%
And as you can see, it sets the
default payload to Windows x64

00:21:29.990 --> 00:21:33.180 align:middle line:84%
Meterpreter reverse TCP, which
will work fine in our case,

00:21:33.180 --> 00:21:35.600 align:middle line:84%
because the target
operating system is Windows

00:21:35.600 --> 00:21:37.770 align:middle line:90%
and the architecture is 64-bit.

00:21:37.770 --> 00:21:40.040 align:middle line:84%
So if I show the
options now, you

00:21:40.040 --> 00:21:43.490 align:middle line:84%
can see that we need to set
the payload options, which

00:21:43.490 --> 00:21:44.960 align:middle line:90%
is set perfectly fine.

00:21:44.960 --> 00:21:47.720 align:middle line:84%
In my case, this
is my Kali Linux IP

00:21:47.720 --> 00:21:51.050 align:middle line:84%
and the LPORT is set
to port 4444, which

00:21:51.050 --> 00:21:52.730 align:middle line:90%
is currently open in my case.

00:21:52.730 --> 00:21:55.160 align:middle line:84%
And again, we don't need to
provide any other information

00:21:55.160 --> 00:21:58.100 align:middle line:84%
here because the global
variable that we set earlier

00:21:58.100 --> 00:21:59.960 align:middle line:84%
has already configured
the target IP

00:21:59.960 --> 00:22:02.750 align:middle line:84%
and the target port is
set to the default SMB

00:22:02.750 --> 00:22:04.790 align:middle line:90%
port, which is port 445.

00:22:04.790 --> 00:22:06.290 align:middle line:90%
So I can just hit Run.

00:22:06.290 --> 00:22:08.878 align:middle line:84%
And as you can see,
it looks like you

00:22:08.878 --> 00:22:10.670 align:middle line:84%
can see it told us
right over here the host

00:22:10.670 --> 00:22:13.400 align:middle line:84%
is likely vulnerable
to MS17-010,

00:22:13.400 --> 00:22:15.500 align:middle line:84%
and then it says the
target is vulnerable,

00:22:15.500 --> 00:22:18.200 align:middle line:84%
it's going to connect to
the target for exploitation,

00:22:18.200 --> 00:22:20.750 align:middle line:84%
and then establishes
a connection,

00:22:20.750 --> 00:22:23.880 align:middle line:84%
and then it essentially
performs the exploit here.

00:22:23.880 --> 00:22:25.580 align:middle line:84%
So it's going to
send the stage and we

00:22:25.580 --> 00:22:28.730 align:middle line:84%
get a Meterpreter session,
which means we now have access

00:22:28.730 --> 00:22:29.970 align:middle line:90%
to the target system.

00:22:29.970 --> 00:22:33.950 align:middle line:84%
So if I say sysinfo, you can
see we are on the target system

00:22:33.950 --> 00:22:36.920 align:middle line:84%
and this just gives
us basic information

00:22:36.920 --> 00:22:38.820 align:middle line:90%
regarding the target system.

00:22:38.820 --> 00:22:43.820 align:middle line:84%
So that's how to, again,
identify or perform

00:22:43.820 --> 00:22:46.220 align:middle line:84%
some manual vulnerability
scanning with the Metasploit

00:22:46.220 --> 00:22:46.910 align:middle line:90%
framework.

00:22:46.910 --> 00:22:50.480 align:middle line:84%
So I'll just exit and
shut down that session.

00:22:50.480 --> 00:22:52.700 align:middle line:84%
The next technique that
I want to highlight

00:22:52.700 --> 00:22:57.675 align:middle line:84%
is the process or the
db_autopwn plugin.

00:22:57.675 --> 00:22:59.300 align:middle line:84%
Now this is very
important because it's

00:22:59.300 --> 00:23:02.462 align:middle line:84%
an extremely useful plug-in
for the Metasploit framework.

00:23:02.462 --> 00:23:03.920 align:middle line:84%
Let me just clear
out the terminal,

00:23:03.920 --> 00:23:07.120 align:middle line:84%
and I'll open up
my browser here.

00:23:07.120 --> 00:23:09.240 align:middle line:84%
So again, this
particular plug-in

00:23:09.240 --> 00:23:11.820 align:middle line:84%
is available on its
own GitHub repository,

00:23:11.820 --> 00:23:15.630 align:middle line:84%
and the name of the plugin
is metasploit-autopwn.

00:23:15.630 --> 00:23:18.360 align:middle line:84%
So it'll give you a basic
description as to what it is.

00:23:18.360 --> 00:23:21.210 align:middle line:84%
It says this is a Metasploit
plug-in for easy exploit

00:23:21.210 --> 00:23:22.500 align:middle line:90%
and vulnerability attack.

00:23:22.500 --> 00:23:25.740 align:middle line:84%
What this means is that
it is essentially utilized

00:23:25.740 --> 00:23:29.520 align:middle line:84%
to identify exploit modules for
the ports that are currently

00:23:29.520 --> 00:23:31.230 align:middle line:90%
open on a target system.

00:23:31.230 --> 00:23:33.480 align:middle line:84%
And the way it does
this is it takes a look

00:23:33.480 --> 00:23:35.790 align:middle line:84%
at your database
and the services

00:23:35.790 --> 00:23:38.370 align:middle line:84%
that are currently running
or that are currently

00:23:38.370 --> 00:23:41.790 align:middle line:84%
open on the target systems
that you've scanned,

00:23:41.790 --> 00:23:44.940 align:middle line:84%
and then it provides you with
a list of exploit modules

00:23:44.940 --> 00:23:47.410 align:middle line:84%
that you can use for
each of those services.

00:23:47.410 --> 00:23:50.580 align:middle line:84%
So the way we can again
utilize this particular plugin

00:23:50.580 --> 00:23:54.000 align:middle line:84%
is we can copy or
download it, and then we

00:23:54.000 --> 00:23:57.330 align:middle line:84%
can transfer it into the user
share Metasploit framework

00:23:57.330 --> 00:23:59.410 align:middle line:84%
plugins directory
as it says here.

00:23:59.410 --> 00:24:04.410 align:middle line:84%
So I'll just copy that, and I'll
open up a new terminal here,

00:24:04.410 --> 00:24:06.570 align:middle line:84%
and I'll just head over
into my downloads directory

00:24:06.570 --> 00:24:08.850 align:middle line:84%
and paste in the
wget code there.

00:24:08.850 --> 00:24:11.820 align:middle line:84%
That's going to download
the Metasploit plug-in.

00:24:11.820 --> 00:24:13.690 align:middle line:84%
As you can see,
it is a Ruby file.

00:24:13.690 --> 00:24:15.065 align:middle line:84%
So we'll give that
a few seconds.

00:24:15.065 --> 00:24:15.690 align:middle line:90%
There we are.

00:24:15.690 --> 00:24:17.250 align:middle line:90%
It completes downloading.

00:24:17.250 --> 00:24:18.490 align:middle line:90%
So there it is.

00:24:18.490 --> 00:24:20.800 align:middle line:84%
So we now need to copy
this, and in my case,

00:24:20.800 --> 00:24:23.310 align:middle line:84%
I'll move it and
we want to move it

00:24:23.310 --> 00:24:28.630 align:middle line:84%
into the
usr/share/metasploit-framework

00:24:28.630 --> 00:24:31.250 align:middle line:90%
plug-in's directory.

00:24:31.250 --> 00:24:32.540 align:middle line:90%
All right, so that is done.

00:24:32.540 --> 00:24:35.330 align:middle line:84%
Now in order to load this,
what I would recommend doing

00:24:35.330 --> 00:24:38.810 align:middle line:84%
is just saying load
and then db_autopwn.

00:24:38.810 --> 00:24:43.193 align:middle line:84%
So I can say load
db_autopwn, hit Enter.

00:24:43.193 --> 00:24:45.110 align:middle line:84%
As you can see, it's
going to say successfully

00:24:45.110 --> 00:24:46.190 align:middle line:90%
loaded plug-in.

00:24:46.190 --> 00:24:50.400 align:middle line:84%
And now in order to use it,
we can say db_autopwn and hit

00:24:50.400 --> 00:24:50.900 align:middle line:90%
Enter.

00:24:50.900 --> 00:24:53.730 align:middle line:84%
That's going to bring
up the documentation.

00:24:53.730 --> 00:24:56.060 align:middle line:84%
Now don't worry if it
gives you this error here.

00:24:56.060 --> 00:24:58.160 align:middle line:84%
The db_autopwn
command is deprecated.

00:24:58.160 --> 00:25:00.620 align:middle line:84%
That's because it's
no longer supported,

00:25:00.620 --> 00:25:02.760 align:middle line:84%
but it still works
perfectly fine.

00:25:02.760 --> 00:25:05.060 align:middle line:84%
And again, what this
means is that it's not

00:25:05.060 --> 00:25:07.520 align:middle line:84%
a part of the Metasploit
framework anymore,

00:25:07.520 --> 00:25:10.760 align:middle line:84%
and you have to sort of set
it up manually as we did.

00:25:10.760 --> 00:25:13.430 align:middle line:84%
So what we can do,
as I said, this

00:25:13.430 --> 00:25:16.550 align:middle line:84%
interacts directly with the
Metasploit framework database,

00:25:16.550 --> 00:25:20.630 align:middle line:84%
and will only work if your scans
or your service information

00:25:20.630 --> 00:25:23.450 align:middle line:84%
is already within the
Metasploit framework database.

00:25:23.450 --> 00:25:25.250 align:middle line:84%
So I really recommend
that you actually

00:25:25.250 --> 00:25:28.230 align:middle line:84%
start enumerating all
of the information,

00:25:28.230 --> 00:25:30.080 align:middle line:84%
so that it's stored
within the database,

00:25:30.080 --> 00:25:32.180 align:middle line:84%
and you can do that
either through Nmap

00:25:32.180 --> 00:25:33.950 align:middle line:84%
or through the
auxiliary modules as we

00:25:33.950 --> 00:25:35.420 align:middle line:90%
did in the previous section.

00:25:35.420 --> 00:25:41.030 align:middle line:84%
To use it, what we can say
is we can type in db_autopwn,

00:25:41.030 --> 00:25:44.340 align:middle line:84%
and then what we want to
use is the p option here,

00:25:44.340 --> 00:25:46.250 align:middle line:84%
which will select
the modules based

00:25:46.250 --> 00:25:48.830 align:middle line:84%
on the open ports on
the target system.

00:25:48.830 --> 00:25:50.540 align:middle line:84%
And the other option
we want to use

00:25:50.540 --> 00:25:54.170 align:middle line:84%
is the t option, which will show
all matching exploit modules.

00:25:54.170 --> 00:25:57.470 align:middle line:84%
Now if we just run
it as is, you'll

00:25:57.470 --> 00:25:59.090 align:middle line:84%
see that it'll
actually enumerate

00:25:59.090 --> 00:26:01.180 align:middle line:90%
quite a lot of modules.

00:26:01.180 --> 00:26:04.010 align:middle line:84%
So I'll hit Enter, we'll give
that a few seconds to start up.

00:26:04.010 --> 00:26:13.730 align:middle line:90%


00:26:13.730 --> 00:26:16.090 align:middle line:84%
So as you can see, it's
enumerating exploits

00:26:16.090 --> 00:26:18.010 align:middle line:90%
for each of the open ports.

00:26:18.010 --> 00:26:21.160 align:middle line:84%
Now, this can be quite hectic
because as you can see,

00:26:21.160 --> 00:26:24.910 align:middle line:84%
it's going to display
exploits for essentially all

00:26:24.910 --> 00:26:27.730 align:middle line:84%
the open ports, and
it's really not specific

00:26:27.730 --> 00:26:30.350 align:middle line:84%
because it's not utilizing
the service version.

00:26:30.350 --> 00:26:32.710 align:middle line:84%
So in order to make
this more streamlined

00:26:32.710 --> 00:26:36.730 align:middle line:84%
or to narrow down our search,
we can target specific ports

00:26:36.730 --> 00:26:38.390 align:middle line:90%
or specific services.

00:26:38.390 --> 00:26:42.280 align:middle line:84%
And in order to do this, what
we can do is essentially--

00:26:42.280 --> 00:26:44.410 align:middle line:84%
let me just open up
the documentation page,

00:26:44.410 --> 00:26:46.750 align:middle line:84%
we can utilize the
PI option, which

00:26:46.750 --> 00:26:49.600 align:middle line:84%
allows us to specify
the port range that we

00:26:49.600 --> 00:26:51.830 align:middle line:90%
want to perform the scan for.

00:26:51.830 --> 00:26:55.750 align:middle line:84%
So again, I can
limit this to PI.

00:26:55.750 --> 00:27:00.160 align:middle line:84%
I'll just say PI and let's
say target the SMB port which

00:27:00.160 --> 00:27:02.650 align:middle line:84%
is port 445, we hit
Enter, again give

00:27:02.650 --> 00:27:04.360 align:middle line:90%
that a few seconds to start up.

00:27:04.360 --> 00:27:07.890 align:middle line:90%


00:27:07.890 --> 00:27:09.430 align:middle line:90%
All right, so that is complete.

00:27:09.430 --> 00:27:11.490 align:middle line:84%
And as you can see,
it's now limited

00:27:11.490 --> 00:27:14.310 align:middle line:84%
all the matching exploits
to just a few here.

00:27:14.310 --> 00:27:17.250 align:middle line:84%
However, as you can see
it's also providing us

00:27:17.250 --> 00:27:19.440 align:middle line:84%
with exploit modules
for Samba, which

00:27:19.440 --> 00:27:22.020 align:middle line:90%
is the Linux equivalent of SMB.

00:27:22.020 --> 00:27:25.320 align:middle line:84%
While in our case, we are
targeting a Windows box.

00:27:25.320 --> 00:27:28.050 align:middle line:84%
However, it also does
provide us with all the SMB

00:27:28.050 --> 00:27:29.970 align:middle line:90%
exploits for Windows here.

00:27:29.970 --> 00:27:31.840 align:middle line:90%
And they start right over here.

00:27:31.840 --> 00:27:33.690 align:middle line:84%
So you can see we
have quite a few.

00:27:33.690 --> 00:27:36.255 align:middle line:84%
Now the next obvious
step would be

00:27:36.255 --> 00:27:39.720 align:middle line:84%
to essentially perform more
research about the target

00:27:39.720 --> 00:27:42.840 align:middle line:84%
operating system and
what vulnerabilities

00:27:42.840 --> 00:27:45.810 align:middle line:84%
that specific version
of SMB suffers from,

00:27:45.810 --> 00:27:49.570 align:middle line:84%
and then finding the appropriate
exploit module to use.

00:27:49.570 --> 00:27:52.350 align:middle line:84%
And in our case, we know
that the EternalBlue exploit

00:27:52.350 --> 00:27:53.320 align:middle line:90%
does work.

00:27:53.320 --> 00:27:55.380 align:middle line:84%
And again, it also
provides that here,

00:27:55.380 --> 00:27:57.930 align:middle line:84%
and then it provides us with
a few other exploit modules

00:27:57.930 --> 00:27:59.430 align:middle line:90%
that are very, very helpful.

00:27:59.430 --> 00:28:01.560 align:middle line:84%
And as you can see,
this can be very helpful

00:28:01.560 --> 00:28:04.080 align:middle line:84%
when trying to limit
your search for exploits

00:28:04.080 --> 00:28:06.950 align:middle line:84%
or to perform vulnerability
scanning with the Metasploit

00:28:06.950 --> 00:28:07.450 align:middle line:90%
framework.

00:28:07.450 --> 00:28:09.210 align:middle line:84%
So again, you can
also limit the port

00:28:09.210 --> 00:28:11.130 align:middle line:90%
to maybe something like port 21.

00:28:11.130 --> 00:28:13.740 align:middle line:84%
We know we have FTP
running on the target.

00:28:13.740 --> 00:28:17.010 align:middle line:84%
But again, you can utilize
this however you want.

00:28:17.010 --> 00:28:21.150 align:middle line:84%
It's an extremely useful module
or other plugin that can again

00:28:21.150 --> 00:28:22.380 align:middle line:90%
save you a lot of time.

00:28:22.380 --> 00:28:25.950 align:middle line:84%
Now what we can do
finally is we can make

00:28:25.950 --> 00:28:27.750 align:middle line:90%
use of the analyze command.

00:28:27.750 --> 00:28:30.330 align:middle line:84%
Now the analyze command
will essentially

00:28:30.330 --> 00:28:32.520 align:middle line:84%
analyze the contents of
the Metasploit framework

00:28:32.520 --> 00:28:34.710 align:middle line:84%
database, so your
hosts and services,

00:28:34.710 --> 00:28:38.430 align:middle line:84%
and then will provide you
with a list of vulnerabilities

00:28:38.430 --> 00:28:41.250 align:middle line:84%
that those particular
services suffer from

00:28:41.250 --> 00:28:42.990 align:middle line:90%
or that can be exploited.

00:28:42.990 --> 00:28:44.520 align:middle line:90%
So I'm going to hit analyze.

00:28:44.520 --> 00:28:47.640 align:middle line:84%
And as you can see, it tells
us analysis for the host

00:28:47.640 --> 00:28:51.330 align:middle line:84%
10.10.10.4, it provides us with
the following exploits that are

00:28:51.330 --> 00:28:52.630 align:middle line:90%
ready for testing.

00:28:52.630 --> 00:28:54.210 align:middle line:84%
And then it also
tells us what is

00:28:54.210 --> 00:28:57.220 align:middle line:84%
required in the event we want
to use this particular one.

00:28:57.220 --> 00:28:59.700 align:middle line:84%
So it says credentials
are required for this one.

00:28:59.700 --> 00:29:01.710 align:middle line:84%
But EternalBlue and
another one that we

00:29:01.710 --> 00:29:05.700 align:middle line:84%
weren't able to identify,
which is the doublepulsar_rce

00:29:05.700 --> 00:29:06.340 align:middle line:90%
exploit.

00:29:06.340 --> 00:29:08.050 align:middle line:90%
So I didn't know about that.

00:29:08.050 --> 00:29:12.630 align:middle line:84%
So now if we type in vulnc, you
can see that it's essentially

00:29:12.630 --> 00:29:16.260 align:middle line:84%
been able to detect a
vulnerability for SMB,

00:29:16.260 --> 00:29:18.930 align:middle line:84%
and it provides us with the
description here, the Microsoft

00:29:18.930 --> 00:29:22.440 align:middle line:84%
security or vulnerability
code and the type of exploit,

00:29:22.440 --> 00:29:24.660 align:middle line:84%
and then it provides
us with the various CVE

00:29:24.660 --> 00:29:26.460 align:middle line:84%
links and the reference
links that you

00:29:26.460 --> 00:29:29.910 align:middle line:84%
can utilize to learn more about
this particular vulnerability

00:29:29.910 --> 00:29:31.290 align:middle line:90%
or this particular exploit.

00:29:31.290 --> 00:29:35.100 align:middle line:84%
So again, this is how to
perform vulnerability scanning

00:29:35.100 --> 00:29:36.780 align:middle line:84%
with the Metasploit
framework and how

00:29:36.780 --> 00:29:40.470 align:middle line:84%
to utilize the various
auxiliary and exploit modules

00:29:40.470 --> 00:29:43.680 align:middle line:84%
to test whether a
particular service is

00:29:43.680 --> 00:29:45.300 align:middle line:90%
vulnerable to an exploit or not.

00:29:45.300 --> 00:29:47.460 align:middle line:84%
And of course, we've
also explored the process

00:29:47.460 --> 00:29:49.980 align:middle line:84%
of utilizing
searchsploit in order

00:29:49.980 --> 00:29:52.020 align:middle line:84%
to identify or find
vulnerabilities

00:29:52.020 --> 00:29:53.320 align:middle line:90%
for specific services.

00:29:53.320 --> 00:29:55.080 align:middle line:84%
So it's really very,
very simple when

00:29:55.080 --> 00:29:56.880 align:middle line:90%
it comes down to utilizing it.

00:29:56.880 --> 00:30:00.090 align:middle line:84%
So for example, if I
again search for services

00:30:00.090 --> 00:30:03.810 align:middle line:84%
and I maybe want to target this
particular version of Apache

00:30:03.810 --> 00:30:06.900 align:middle line:84%
Tomcat, again I just
open up searchsploit

00:30:06.900 --> 00:30:10.110 align:middle line:84%
and I can then add this
within double quotation marks

00:30:10.110 --> 00:30:12.660 align:middle line:84%
and I'll paste that
in there, hit Enter,

00:30:12.660 --> 00:30:14.770 align:middle line:84%
you can see it doesn't
give us anything there.

00:30:14.770 --> 00:30:18.420 align:middle line:84%
So if we get rid of
this here, let's see

00:30:18.420 --> 00:30:20.520 align:middle line:84%
whether we get any
exploits or any matches.

00:30:20.520 --> 00:30:23.130 align:middle line:84%
As you can see, it
provides us with a list

00:30:23.130 --> 00:30:26.460 align:middle line:84%
of exploits for Apache
Tomcat, and then, of course,

00:30:26.460 --> 00:30:29.250 align:middle line:84%
you can limit it to
the Metasploit modules,

00:30:29.250 --> 00:30:32.700 align:middle line:84%
and then, of course, again,
utilize that particular module

00:30:32.700 --> 00:30:34.770 align:middle line:84%
or test that particular
module to see

00:30:34.770 --> 00:30:38.670 align:middle line:84%
whether you can actually exploit
that particular target service.

00:30:38.670 --> 00:30:40.830 align:middle line:84%
All right, so that
is going to conclude

00:30:40.830 --> 00:30:44.370 align:middle line:90%
the practical demonstration.

00:30:44.370 --> 00:30:47.700 align:middle line:84%
In the next video, we are going
to be taking a look at how

00:30:47.700 --> 00:30:50.280 align:middle line:84%
to import scan results,
vulnerability scan

00:30:50.280 --> 00:30:53.440 align:middle line:84%
results from Nessus into
the Metasploit framework.

00:30:53.440 --> 00:30:55.170 align:middle line:84%
And again, how
these results can be

00:30:55.170 --> 00:30:58.080 align:middle line:84%
used to identify
potentially useful

00:30:58.080 --> 00:31:00.360 align:middle line:84%
exploit modules that
can be used to exploit

00:31:00.360 --> 00:31:01.890 align:middle line:90%
these vulnerable services.

00:31:01.890 --> 00:31:04.460 align:middle line:90%
So I'll see you there.

00:31:04.460 --> 00:31:05.000 align:middle line:90%