WEBVTT

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


00:00:03.395 --> 00:00:04.850 align:middle line:90%
[ELECTRONIC NOISES]

00:00:04.850 --> 00:00:10.200 align:middle line:90%


00:00:10.200 --> 00:00:12.960 align:middle line:84%
SMB enumeration--
in this video, we're

00:00:12.960 --> 00:00:14.850 align:middle line:84%
going to be taking a
look at how to utilize

00:00:14.850 --> 00:00:17.340 align:middle line:84%
various auxiliary
modules to enumerate

00:00:17.340 --> 00:00:20.130 align:middle line:84%
as much information
as possible from SMB.

00:00:20.130 --> 00:00:23.070 align:middle line:84%
So first and
foremost, what is SMB?

00:00:23.070 --> 00:00:25.710 align:middle line:84%
SMB stands for the
Server Message Block.

00:00:25.710 --> 00:00:27.840 align:middle line:84%
It is a network file
sharing protocol

00:00:27.840 --> 00:00:31.380 align:middle line:84%
that is used to facilitate the
sharing of files and devices

00:00:31.380 --> 00:00:34.950 align:middle line:84%
between computers on a local
network, also known as a LAN.

00:00:34.950 --> 00:00:37.680 align:middle line:84%
So if you've ever worked
on a Windows environment

00:00:37.680 --> 00:00:40.830 align:middle line:84%
where one or more Windows
computers are connected

00:00:40.830 --> 00:00:44.460 align:middle line:84%
to each other locally, then
you should be familiar with SMB

00:00:44.460 --> 00:00:46.120 align:middle line:84%
even if you've
never heard of it.

00:00:46.120 --> 00:00:48.060 align:middle line:84%
An example of this
would be when you

00:00:48.060 --> 00:00:50.220 align:middle line:84%
are trying to set
up a file share so

00:00:50.220 --> 00:00:52.350 align:middle line:84%
that you can share
files from your PC

00:00:52.350 --> 00:00:54.970 align:middle line:90%
to other PCs on the network.

00:00:54.970 --> 00:00:57.780 align:middle line:84%
And this is all
facilitated through SMB.

00:00:57.780 --> 00:01:02.070 align:middle line:84%
Another example of this is
if you want to set up a share

00:01:02.070 --> 00:01:04.680 align:middle line:84%
or, rather, you want to allow
other users on a network

00:01:04.680 --> 00:01:08.010 align:middle line:84%
to access a printer that
is connected to your PC.

00:01:08.010 --> 00:01:11.790 align:middle line:84%
This is, again, handled
and facilitated by SMB.

00:01:11.790 --> 00:01:16.150 align:middle line:84%
Now, SMB uses port
445 on the TCP stack.

00:01:16.150 --> 00:01:19.530 align:middle line:84%
However, originally on older
versions of Windows SMB

00:01:19.530 --> 00:01:23.624 align:middle line:84%
ran on top of the NetBIOS
protocol using port 139

00:01:23.624 --> 00:01:28.020 align:middle line:84%
and was available
on both 139 and 445.

00:01:28.020 --> 00:01:30.330 align:middle line:84%
However, on newer
versions of Windows

00:01:30.330 --> 00:01:33.390 align:middle line:84%
and in, again,
modern networks SMB

00:01:33.390 --> 00:01:37.030 align:middle line:84%
is usually found on port
445 on the TCP stack.

00:01:37.030 --> 00:01:39.480 align:middle line:84%
Now, what happens when
we move over to Linux?

00:01:39.480 --> 00:01:41.370 align:middle line:90%
Does Linux have SMB?

00:01:41.370 --> 00:01:43.920 align:middle line:84%
Or can we actually
share files with Linux?

00:01:43.920 --> 00:01:45.330 align:middle line:90%
Absolutely.

00:01:45.330 --> 00:01:46.980 align:middle line:84%
This is where SAMBA
comes into play.

00:01:46.980 --> 00:01:50.010 align:middle line:84%
SAMBA is the Linux
implementation of SMB

00:01:50.010 --> 00:01:51.870 align:middle line:84%
and essentially
allows Windows systems

00:01:51.870 --> 00:01:55.120 align:middle line:84%
to access Linux shares and
devices and vice versa.

00:01:55.120 --> 00:01:59.190 align:middle line:84%
So, again, typically when we're
talking about SMB on Windows,

00:01:59.190 --> 00:02:00.930 align:middle line:90%
it's simply called SMB.

00:02:00.930 --> 00:02:03.900 align:middle line:84%
However, when we're talking
about SMB on a Linux target

00:02:03.900 --> 00:02:04.980 align:middle line:90%
it's called SAMBA.

00:02:04.980 --> 00:02:07.440 align:middle line:84%
But the technology
essentially works the same.

00:02:07.440 --> 00:02:11.009 align:middle line:84%
And really, nothing changes when
it comes down to enumeration.

00:02:11.009 --> 00:02:13.530 align:middle line:84%
Now, we can utilize
auxiliary modules

00:02:13.530 --> 00:02:17.700 align:middle line:84%
to enumerate SMB information
like the SMB version.

00:02:17.700 --> 00:02:20.940 align:middle line:84%
Now, the SMB version is not
just important in identifying

00:02:20.940 --> 00:02:23.430 align:middle line:90%
what version of SMB is running.

00:02:23.430 --> 00:02:26.010 align:middle line:84%
It is also important
in identifying

00:02:26.010 --> 00:02:29.850 align:middle line:84%
the target operating
system, which it can do.

00:02:29.850 --> 00:02:32.550 align:middle line:84%
We will then take a look
at how to enumerate shares

00:02:32.550 --> 00:02:35.940 align:middle line:84%
and enumerate users as well
as perform a brute force

00:02:35.940 --> 00:02:38.880 align:middle line:84%
attack in order to
identify users in passwords

00:02:38.880 --> 00:02:41.760 align:middle line:84%
or, rather, the passwords
for specific users.

00:02:41.760 --> 00:02:44.250 align:middle line:84%
We will also explore
the process of how

00:02:44.250 --> 00:02:48.270 align:middle line:84%
we can utilize these credentials
to authenticate to the SMB

00:02:48.270 --> 00:02:50.940 align:middle line:84%
server and then of course
download files, upload

00:02:50.940 --> 00:02:53.350 align:middle line:84%
files, et cetera, and
how we can access shares.

00:02:53.350 --> 00:02:58.770 align:middle line:84%
So let's get started
with the lab environment.

00:02:58.770 --> 00:03:00.940 align:middle line:84%
I am back in the
lab environment.

00:03:00.940 --> 00:03:05.070 align:middle line:84%
And the first thing we want to
do is identify the target IP.

00:03:05.070 --> 00:03:08.380 align:middle line:84%
So we will say
ifconfig, hit Enter,

00:03:08.380 --> 00:03:11.500 align:middle line:84%
and we are looking for
the interface ethernet 1.

00:03:11.500 --> 00:03:14.290 align:middle line:84%
And We can get our
IP right over here.

00:03:14.290 --> 00:03:16.930 align:middle line:84%
And as per the way
the lab is set up,

00:03:16.930 --> 00:03:22.600 align:middle line:84%
the target IP is going
to be 192.91.46.3.

00:03:22.600 --> 00:03:24.520 align:middle line:84%
And of course, this will
change in your case.

00:03:24.520 --> 00:03:27.790 align:middle line:84%
However, all you need to do
is just change the 2 to a 3.

00:03:27.790 --> 00:03:29.620 align:middle line:90%
So, again, I'll just copy that.

00:03:29.620 --> 00:03:31.270 align:middle line:84%
That is going to
be the target IP.

00:03:31.270 --> 00:03:33.010 align:middle line:90%
And I'll clear up my terminal.

00:03:33.010 --> 00:03:34.810 align:middle line:84%
The next thing we
want to do is start up

00:03:34.810 --> 00:03:36.025 align:middle line:90%
the PostgreSQL service.

00:03:36.025 --> 00:03:43.400 align:middle line:90%


00:03:43.400 --> 00:03:46.010 align:middle line:84%
That is going to start up the
PostgreSQL database server

00:03:46.010 --> 00:03:49.537 align:middle line:84%
so that we can interact with the
Metasploit framework database.

00:03:49.537 --> 00:03:51.995 align:middle line:84%
I'm now going to start up the
Metasploit framework console.

00:03:51.995 --> 00:04:00.980 align:middle line:90%


00:04:00.980 --> 00:04:02.990 align:middle line:84%
Once that is started
up, we can, again,

00:04:02.990 --> 00:04:05.730 align:middle line:84%
add a new workspace
for our activity.

00:04:05.730 --> 00:04:10.240 align:middle line:84%
So in this case, we're just
going to call it smb_enum.

00:04:10.240 --> 00:04:10.840 align:middle line:90%
There we go.

00:04:10.840 --> 00:04:14.860 align:middle line:84%
Workspace smb_enum is
added and currently active.

00:04:14.860 --> 00:04:16.722 align:middle line:84%
Now, before we
actually proceed, I'm

00:04:16.722 --> 00:04:18.430 align:middle line:84%
going to show you a
little trick that you

00:04:18.430 --> 00:04:20.620 align:middle line:84%
can do with the
Metasploit framework

00:04:20.620 --> 00:04:23.920 align:middle line:84%
in regards to the target
IP because as we've already

00:04:23.920 --> 00:04:28.300 align:middle line:84%
seen within the previous
videos accessing the target IP

00:04:28.300 --> 00:04:32.470 align:middle line:84%
and memorizing it is really
not a good way of, again,

00:04:32.470 --> 00:04:34.600 align:middle line:84%
moving or working our
way through the lab.

00:04:34.600 --> 00:04:37.570 align:middle line:84%
And this is where we have the
Metasploit framework module

00:04:37.570 --> 00:04:38.570 align:middle line:90%
variables.

00:04:38.570 --> 00:04:41.120 align:middle line:84%
And as I mentioned within
the earlier videos,

00:04:41.120 --> 00:04:44.210 align:middle line:84%
we can essentially set up a
global variable for the target

00:04:44.210 --> 00:04:44.710 align:middle line:90%
IP.

00:04:44.710 --> 00:04:48.880 align:middle line:84%
So we can say setg, and that is
going to set a global variable.

00:04:48.880 --> 00:04:50.860 align:middle line:84%
And the variable that
we're going to be setting

00:04:50.860 --> 00:04:53.470 align:middle line:84%
is the rhost option,
which is the target IP.

00:04:53.470 --> 00:04:55.720 align:middle line:84%
We then paste in
the IP we copied

00:04:55.720 --> 00:04:57.610 align:middle line:90%
and, again, change the 2 to a 3.

00:04:57.610 --> 00:05:00.400 align:middle line:84%
And now what that means
is that this IP will

00:05:00.400 --> 00:05:03.490 align:middle line:84%
be set for the rhost
variable with whichever

00:05:03.490 --> 00:05:04.880 align:middle line:90%
module that we use.

00:05:04.880 --> 00:05:07.810 align:middle line:84%
So, again, that's going
to save us a lot of time.

00:05:07.810 --> 00:05:10.390 align:middle line:84%
Now given that is
done, we can actually

00:05:10.390 --> 00:05:13.210 align:middle line:84%
move on to the next
step, which is, again,

00:05:13.210 --> 00:05:17.800 align:middle line:84%
the process of searching
for SMB auxiliary modules.

00:05:17.800 --> 00:05:21.188 align:middle line:84%
So we can essentially say
search smb and hit Enter.

00:05:21.188 --> 00:05:23.230 align:middle line:84%
And as you can see this
is not a very good search

00:05:23.230 --> 00:05:26.840 align:middle line:84%
because it actually
returns a lot of results.

00:05:26.840 --> 00:05:29.260 align:middle line:84%
So what we can do is
narrow down our search

00:05:29.260 --> 00:05:30.790 align:middle line:90%
results, which I'm going to do.

00:05:30.790 --> 00:05:33.280 align:middle line:84%
So I'm going to
say search, and I

00:05:33.280 --> 00:05:36.250 align:middle line:84%
am going to say
search type is going

00:05:36.250 --> 00:05:38.500 align:middle line:84%
to be an auxiliary
module, so auxiliary.

00:05:38.500 --> 00:05:41.260 align:middle line:84%
And then the name
is SMB and this

00:05:41.260 --> 00:05:45.310 align:middle line:84%
is going to bring up only SMB
modules and more specifically

00:05:45.310 --> 00:05:47.800 align:middle line:90%
auxiliary SMB modules.

00:05:47.800 --> 00:05:49.750 align:middle line:84%
So the first thing
we want to do is

00:05:49.750 --> 00:05:52.780 align:middle line:84%
we want to identify
the version of SMB that

00:05:52.780 --> 00:05:54.290 align:middle line:90%
is running on the target.

00:05:54.290 --> 00:05:57.340 align:middle line:84%
So we are looking for the
SMB version module, which

00:05:57.340 --> 00:05:59.680 align:middle line:84%
is right over here, which
is an auxiliary scanner

00:05:59.680 --> 00:06:01.390 align:middle line:90%
SMB, SMB version.

00:06:01.390 --> 00:06:05.320 align:middle line:84%
So we can just copy that, and
we can then say use and then

00:06:05.320 --> 00:06:08.770 align:middle line:84%
paste in the module name that
is currently loaded and active.

00:06:08.770 --> 00:06:11.140 align:middle line:84%
If we say show
options, we don't need

00:06:11.140 --> 00:06:13.150 align:middle line:84%
to set the target IP
because we already

00:06:13.150 --> 00:06:14.500 align:middle line:90%
set the global variable.

00:06:14.500 --> 00:06:15.520 align:middle line:90%
That's excellent.

00:06:15.520 --> 00:06:21.290 align:middle line:84%
We don't have the SMB domain,
the SMB pass, or the SMB user.

00:06:21.290 --> 00:06:24.070 align:middle line:84%
So we cannot provide
any information there.

00:06:24.070 --> 00:06:26.470 align:middle line:84%
You can also increase
the number of threads.

00:06:26.470 --> 00:06:29.030 align:middle line:84%
But in our case, we're
only scanning one target.

00:06:29.030 --> 00:06:32.068 align:middle line:84%
So I'm just going to run
and give that a few seconds.

00:06:32.068 --> 00:06:33.610 align:middle line:84%
As you can see, it's
going to tell us

00:06:33.610 --> 00:06:34.960 align:middle line:90%
host could not be identified.

00:06:34.960 --> 00:06:37.210 align:middle line:84%
But it provides us with
the version of SAMBA

00:06:37.210 --> 00:06:38.660 align:middle line:90%
that's running on the target.

00:06:38.660 --> 00:06:42.100 align:middle line:84%
And in some cases, you may get
an incorrect operating system

00:06:42.100 --> 00:06:43.210 align:middle line:90%
detection banner.

00:06:43.210 --> 00:06:45.850 align:middle line:84%
So in this case, you can
see it says Windows 6.1.

00:06:45.850 --> 00:06:49.840 align:middle line:84%
But then in brackets, the
banner says SAMBA 4.3.11,

00:06:49.840 --> 00:06:50.830 align:middle line:90%
and this is on Ubuntu.

00:06:50.830 --> 00:06:54.100 align:middle line:84%
So this is exactly what
is running on the target.

00:06:54.100 --> 00:06:57.190 align:middle line:84%
And now we've been able to
identify that it is a SAMBA

00:06:57.190 --> 00:07:02.620 align:middle line:84%
server, and it's being
run on an Ubuntu Linux

00:07:02.620 --> 00:07:03.970 align:middle line:90%
distribution or server.

00:07:03.970 --> 00:07:07.880 align:middle line:84%
So we've already identified
some useful information there.

00:07:07.880 --> 00:07:10.450 align:middle line:84%
Now we can utilize this
version information

00:07:10.450 --> 00:07:13.720 align:middle line:84%
to try and find out whether
this particular version of SAMBA

00:07:13.720 --> 00:07:16.600 align:middle line:84%
is vulnerable to an
inherent vulnerability

00:07:16.600 --> 00:07:19.190 align:middle line:84%
that we can exploit to
gain access to the target.

00:07:19.190 --> 00:07:22.280 align:middle line:84%
However, in this case, we're
not going to be exploring that.

00:07:22.280 --> 00:07:25.420 align:middle line:84%
So now that we've
identified the SMB version,

00:07:25.420 --> 00:07:29.050 align:middle line:84%
the next thing we can do is try
and search or try and enumerate

00:07:29.050 --> 00:07:29.890 align:middle line:90%
users.

00:07:29.890 --> 00:07:33.620 align:middle line:84%
So we are going to, again, just
use our previous search filter.

00:07:33.620 --> 00:07:35.110 align:middle line:90%
So that is such.

00:07:35.110 --> 00:07:37.930 align:middle line:84%
The type is auxiliary,
and the name is SMB.

00:07:37.930 --> 00:07:41.620 align:middle line:84%
And we are looking for
SMB enum users, which

00:07:41.620 --> 00:07:43.520 align:middle line:90%
is this module right over here.

00:07:43.520 --> 00:07:45.820 align:middle line:84%
As you can see, the
information says that this

00:07:45.820 --> 00:07:48.440 align:middle line:90%
is SMB user enumeration module.

00:07:48.440 --> 00:07:51.610 align:middle line:84%
So what it'll do is it'll
actually, again, enumerate

00:07:51.610 --> 00:07:53.890 align:middle line:90%
the users, the SMB users.

00:07:53.890 --> 00:07:56.570 align:middle line:84%
So we're going to say
use and hit Enter.

00:07:56.570 --> 00:07:58.290 align:middle line:84%
That's going to load
that new module.

00:07:58.290 --> 00:08:00.810 align:middle line:84%
Now if you want to learn more
about a particular module,

00:08:00.810 --> 00:08:02.610 align:middle line:84%
you can type in
the info command.

00:08:02.610 --> 00:08:04.910 align:middle line:84%
And as you can see,
it says the name.

00:08:04.910 --> 00:08:09.200 align:middle line:84%
It also provides you the module
name itself and a few licensing

00:08:09.200 --> 00:08:10.170 align:middle line:90%
information.

00:08:10.170 --> 00:08:12.560 align:middle line:84%
And as you can see,
the description says,

00:08:12.560 --> 00:08:16.580 align:middle line:84%
this will determine what local
users exist via the SAM RPC

00:08:16.580 --> 00:08:20.450 align:middle line:84%
service, which essentially means
we should be able to identify

00:08:20.450 --> 00:08:22.200 align:middle line:90%
some user accounts with this.

00:08:22.200 --> 00:08:25.560 align:middle line:84%
So the target-- the rhosts
option has already been set,

00:08:25.560 --> 00:08:26.810 align:middle line:90%
so we don't need to do that.

00:08:26.810 --> 00:08:29.460 align:middle line:84%
Again, we don't have any of
the other information here,

00:08:29.460 --> 00:08:31.610 align:middle line:84%
so we don't need to
provide it and aren't

00:08:31.610 --> 00:08:32.850 align:middle line:90%
required to provide it.

00:08:32.850 --> 00:08:36.659 align:middle line:84%
So all we need to do
now is just hit run.

00:08:36.659 --> 00:08:39.659 align:middle line:84%
And as you can see, it performs
the check successfully.

00:08:39.659 --> 00:08:42.169 align:middle line:84%
So it says SAMBA recon,
and we get a list

00:08:42.169 --> 00:08:43.490 align:middle line:90%
of users right over here.

00:08:43.490 --> 00:08:47.060 align:middle line:84%
So we have John, Ella, Aisha,
Shawn, Emma, and admin.

00:08:47.060 --> 00:08:48.950 align:middle line:84%
The admin user
looks interesting,

00:08:48.950 --> 00:08:51.420 align:middle line:84%
and we are going to get
to that in a few seconds.

00:08:51.420 --> 00:08:54.950 align:middle line:84%
So I want you to take down or
take a note of these usernames

00:08:54.950 --> 00:08:59.240 align:middle line:84%
and save them because they will
come in handy in a few seconds.

00:08:59.240 --> 00:09:02.420 align:middle line:84%
So now that we have enumerated
the users, what we can do

00:09:02.420 --> 00:09:04.880 align:middle line:84%
is take a look at how to
enumerate shares, which

00:09:04.880 --> 00:09:08.210 align:middle line:84%
is, again, why we are performing
enumeration because shares

00:09:08.210 --> 00:09:11.450 align:middle line:84%
could potentially allow
us to access files that

00:09:11.450 --> 00:09:15.920 align:middle line:84%
have been shared on this
particular SMB server.

00:09:15.920 --> 00:09:17.510 align:middle line:84%
And these files
could potentially

00:09:17.510 --> 00:09:20.460 align:middle line:84%
be useful in gaining access
to the target system.

00:09:20.460 --> 00:09:21.860 align:middle line:90%
So, again, we'll just search.

00:09:21.860 --> 00:09:25.370 align:middle line:84%
We'll just run the search
term or the search utility

00:09:25.370 --> 00:09:27.920 align:middle line:84%
again here and specify
that we're looking

00:09:27.920 --> 00:09:29.970 align:middle line:90%
for SMB auxiliary modules.

00:09:29.970 --> 00:09:33.860 align:middle line:84%
And as you can see, we have the
auxiliary module here, SMB enum

00:09:33.860 --> 00:09:35.900 align:middle line:84%
shares, which allows
us to enumerate

00:09:35.900 --> 00:09:38.690 align:middle line:84%
the shares on this
particular SMB server

00:09:38.690 --> 00:09:40.080 align:middle line:90%
or on the target system.

00:09:40.080 --> 00:09:42.920 align:middle line:84%
So we will say use,
paste in the module name

00:09:42.920 --> 00:09:45.510 align:middle line:84%
there, and we're going
to clear that out.

00:09:45.510 --> 00:09:47.600 align:middle line:90%
And we can now say show options.

00:09:47.600 --> 00:09:50.150 align:middle line:84%
And as you can see, we now
have additional options.

00:09:50.150 --> 00:09:52.530 align:middle line:84%
But the rhosts option
remains the same.

00:09:52.530 --> 00:09:54.260 align:middle line:90%
That's been set globally.

00:09:54.260 --> 00:09:58.130 align:middle line:84%
We can add the SMB password and
user, but we don't have that.

00:09:58.130 --> 00:10:01.820 align:middle line:84%
As for the other options,
we can, again, essentially

00:10:01.820 --> 00:10:04.130 align:middle line:84%
set the show files
option to true

00:10:04.130 --> 00:10:06.620 align:middle line:84%
to show detailed
information when spidering.

00:10:06.620 --> 00:10:07.940 align:middle line:90%
That might be useful.

00:10:07.940 --> 00:10:10.610 align:middle line:84%
And we can leave
the other options

00:10:10.610 --> 00:10:13.770 align:middle line:84%
as they are as they're not
really pertinent at the moment.

00:10:13.770 --> 00:10:16.790 align:middle line:84%
So we're going to
set show files--

00:10:16.790 --> 00:10:18.560 align:middle line:84%
let me just correct
the syntax there,

00:10:18.560 --> 00:10:22.270 align:middle line:90%
so set show files to true.

00:10:22.270 --> 00:10:23.930 align:middle line:90%
That is a boolean value.

00:10:23.930 --> 00:10:26.862 align:middle line:84%
So for every boolean
option, you can, again,

00:10:26.862 --> 00:10:27.820 align:middle line:90%
set it to the opposite.

00:10:27.820 --> 00:10:29.800 align:middle line:84%
In this case, we're
setting it to true,

00:10:29.800 --> 00:10:32.770 align:middle line:90%
and then we can just hit run.

00:10:32.770 --> 00:10:33.580 align:middle line:90%
So we hit run.

00:10:33.580 --> 00:10:35.920 align:middle line:84%
And as you can see,
we get various shares.

00:10:35.920 --> 00:10:37.870 align:middle line:84%
Now, you might be a
little bit confused

00:10:37.870 --> 00:10:40.600 align:middle line:84%
because you're seeing
users here that we were

00:10:40.600 --> 00:10:42.700 align:middle line:90%
able to enumerate previously.

00:10:42.700 --> 00:10:46.090 align:middle line:84%
But these are shares for
the specific users, which

00:10:46.090 --> 00:10:48.790 align:middle line:84%
means we can pretty much
access these shares if we

00:10:48.790 --> 00:10:52.310 align:middle line:84%
have or are able to get
legitimate credentials.

00:10:52.310 --> 00:10:55.000 align:middle line:84%
Now, if you remember
closely when we essentially

00:10:55.000 --> 00:10:57.910 align:middle line:84%
performed the user
enumeration, we

00:10:57.910 --> 00:11:01.460 align:middle line:84%
were able to identify that
there is a user called admin.

00:11:01.460 --> 00:11:04.780 align:middle line:84%
So what if we try and perform
a brute force in order

00:11:04.780 --> 00:11:07.480 align:middle line:84%
to identify the password
for the user admin?

00:11:07.480 --> 00:11:09.820 align:middle line:84%
And that will consequently
give us access

00:11:09.820 --> 00:11:11.270 align:middle line:90%
to all of these shares.

00:11:11.270 --> 00:11:13.440 align:middle line:84%
So let's actually
try and do that.

00:11:13.440 --> 00:11:15.160 align:middle line:84%
Now, the way we can
actually do that is

00:11:15.160 --> 00:11:19.232 align:middle line:84%
by using another auxiliary
module called SMB login.

00:11:19.232 --> 00:11:21.190 align:middle line:84%
So, again, I'm just going
to clear out of that.

00:11:21.190 --> 00:11:26.560 align:middle line:84%
And we can just say search SMB
login just to get it directly.

00:11:26.560 --> 00:11:27.260 align:middle line:90%
There we are.

00:11:27.260 --> 00:11:28.480 align:middle line:90%
That's the module there.

00:11:28.480 --> 00:11:31.750 align:middle line:84%
This is an SMB login checker
similar to the FTP login

00:11:31.750 --> 00:11:33.520 align:middle line:84%
checker, which
essentially allows

00:11:33.520 --> 00:11:34.810 align:middle line:90%
us to perform a brute force.

00:11:34.810 --> 00:11:39.440 align:middle line:84%
So I'm just going to copy
that and say use, hit Enter.

00:11:39.440 --> 00:11:41.390 align:middle line:84%
If we show the
options here, you can

00:11:41.390 --> 00:11:43.190 align:middle line:84%
see that we have
quite a few options.

00:11:43.190 --> 00:11:46.800 align:middle line:84%
And I'll go through some
of the most important ones.

00:11:46.800 --> 00:11:49.610 align:middle line:84%
The first one that we want
to set obviously is rhosts.

00:11:49.610 --> 00:11:52.140 align:middle line:84%
So, again, in our case
that's set, which is great.

00:11:52.140 --> 00:11:55.820 align:middle line:84%
rport is set to 445, which
again is the correct option.

00:11:55.820 --> 00:11:59.030 align:middle line:84%
We now need to specify
the user, which

00:11:59.030 --> 00:12:01.670 align:middle line:90%
we can do by saying SMB user.

00:12:01.670 --> 00:12:04.040 align:middle line:84%
And that is the username to
authenticate as, remember,

00:12:04.040 --> 00:12:07.760 align:middle line:84%
we are only performing a brute
force for the admin user.

00:12:07.760 --> 00:12:10.460 align:middle line:84%
And we're not, again,
using a user list.

00:12:10.460 --> 00:12:12.200 align:middle line:90%
We're just specifying one user.

00:12:12.200 --> 00:12:14.970 align:middle line:84%
We then need to set
the password file.

00:12:14.970 --> 00:12:16.470 align:middle line:90%
So, again, there we are.

00:12:16.470 --> 00:12:18.360 align:middle line:84%
That's the file
containing the password.

00:12:18.360 --> 00:12:22.250 align:middle line:84%
So let's start off by
setting the SMB user--

00:12:22.250 --> 00:12:25.280 align:middle line:84%
or rather, the SMB username that
we want to authenticate with.

00:12:25.280 --> 00:12:26.960 align:middle line:90%
So I'm going to say SMB user.

00:12:26.960 --> 00:12:29.785 align:middle line:84%
And we're going to
set that to admin

00:12:29.785 --> 00:12:31.160 align:middle line:84%
because that was
the user we were

00:12:31.160 --> 00:12:33.020 align:middle line:90%
able to enumerate initially.

00:12:33.020 --> 00:12:36.500 align:middle line:84%
We then want to set the password
file, which is right over here.

00:12:36.500 --> 00:12:46.380 align:middle line:90%


00:12:46.380 --> 00:12:48.480 align:middle line:84%
And the word list
or the password list

00:12:48.480 --> 00:12:51.120 align:middle line:84%
that we're going to be using
is similar to the FTP video

00:12:51.120 --> 00:12:54.850 align:middle line:84%
where we used the Metasploit
framework password list.

00:12:54.850 --> 00:12:59.480 align:middle line:84%
So we're going to say
user/share/metasploit/framework.

00:12:59.480 --> 00:13:02.380 align:middle line:84%
So, again, just type in
metasploit/framework and then

00:13:02.380 --> 00:13:04.690 align:middle line:90%
data/wordlists.

00:13:04.690 --> 00:13:08.260 align:middle line:84%
And we are going to be
using unix_passwords.txt.

00:13:08.260 --> 00:13:09.370 align:middle line:90%
So we hit Enter.

00:13:09.370 --> 00:13:12.200 align:middle line:84%
That's going to set that
value or that option.

00:13:12.200 --> 00:13:15.160 align:middle line:84%
The other options you can
change are the brute force speed

00:13:15.160 --> 00:13:18.440 align:middle line:84%
as well as any other required
option right over here.

00:13:18.440 --> 00:13:21.340 align:middle line:84%
So the other option that
we might want to set

00:13:21.340 --> 00:13:22.785 align:middle line:90%
is a stop on success.

00:13:22.785 --> 00:13:24.160 align:middle line:84%
So that will stop
the brute force

00:13:24.160 --> 00:13:26.170 align:middle line:90%
once we get a correct password.

00:13:26.170 --> 00:13:28.420 align:middle line:84%
And then, of course,
the number of threads,

00:13:28.420 --> 00:13:29.480 align:middle line:90%
you can also change.

00:13:29.480 --> 00:13:31.730 align:middle line:84%
In this case, we're not going
to change anything else.

00:13:31.730 --> 00:13:33.500 align:middle line:90%
We're just going hit run.

00:13:33.500 --> 00:13:35.170 align:middle line:84%
And in this case,
it looks like we're

00:13:35.170 --> 00:13:38.240 align:middle line:84%
able to identify the
password for the user admin.

00:13:38.240 --> 00:13:41.320 align:middle line:84%
And in this case, you can see
that the password for the user

00:13:41.320 --> 00:13:44.920 align:middle line:84%
admin is just password, which
again is not a strong password.

00:13:44.920 --> 00:13:47.230 align:middle line:84%
But in this case, again,
all I'm trying to do

00:13:47.230 --> 00:13:49.730 align:middle line:84%
is to demonstrate these
techniques to you.

00:13:49.730 --> 00:13:52.780 align:middle line:84%
So now that we've identified
a username and a password,

00:13:52.780 --> 00:13:57.430 align:middle line:84%
we can actually try and
check out the various shares

00:13:57.430 --> 00:14:00.280 align:middle line:84%
and essentially try and access
the files within these shares.

00:14:00.280 --> 00:14:03.220 align:middle line:84%
Now, the way we can do
this is through a utility

00:14:03.220 --> 00:14:06.610 align:middle line:84%
called smbclient, which is
not a part of the Metasploit

00:14:06.610 --> 00:14:07.660 align:middle line:90%
framework.

00:14:07.660 --> 00:14:10.570 align:middle line:84%
But, again, I'm going
over above and beyond here

00:14:10.570 --> 00:14:13.400 align:middle line:84%
just to demonstrate how useful
this information can be.

00:14:13.400 --> 00:14:16.990 align:middle line:84%
So what we'll do is I'll
just exit from the Metasploit

00:14:16.990 --> 00:14:17.980 align:middle line:90%
framework.

00:14:17.980 --> 00:14:18.770 align:middle line:90%
There we are.

00:14:18.770 --> 00:14:24.330 align:middle line:84%
And in order to use the utility,
we can simply say smbclient.

00:14:24.330 --> 00:14:26.790 align:middle line:84%
And then we use the
-L option, and this is

00:14:26.790 --> 00:14:29.170 align:middle line:90%
going to list out the shares.

00:14:29.170 --> 00:14:33.750 align:middle line:84%
So we now need to provide
the target IP, which again we

00:14:33.750 --> 00:14:35.770 align:middle line:90%
can obtain right over here.

00:14:35.770 --> 00:14:37.590 align:middle line:90%
That's the target IP there.

00:14:37.590 --> 00:14:41.465 align:middle line:84%
And then we can specify the
actual share we want to use.

00:14:41.465 --> 00:14:43.590 align:middle line:84%
But in this case, we're
not really sure what shares

00:14:43.590 --> 00:14:46.980 align:middle line:84%
we have because the
SMB enum shares module

00:14:46.980 --> 00:14:49.740 align:middle line:84%
gave us only three shares, but
I think there could be more.

00:14:49.740 --> 00:14:51.870 align:middle line:84%
So let's try and
do that, and we're

00:14:51.870 --> 00:14:53.880 align:middle line:84%
going to log in
as the user admin.

00:14:53.880 --> 00:14:56.400 align:middle line:84%
So I'm going to say
user admin, hit Enter.

00:14:56.400 --> 00:14:58.240 align:middle line:84%
It's going to ask us
for admin's password.

00:14:58.240 --> 00:15:00.600 align:middle line:84%
So I'm going to type it
in, which is just password.

00:15:00.600 --> 00:15:01.800 align:middle line:90%
We hit Enter.

00:15:01.800 --> 00:15:04.530 align:middle line:84%
And as you can see, this
will display a list of shares

00:15:04.530 --> 00:15:05.200 align:middle line:90%
available.

00:15:05.200 --> 00:15:06.840 align:middle line:90%
So we have a public share.

00:15:06.840 --> 00:15:09.810 align:middle line:84%
We have a share for the
user John, Aisha, Emma,

00:15:09.810 --> 00:15:11.490 align:middle line:90%
everyone in IPC.

00:15:11.490 --> 00:15:14.940 align:middle line:84%
Now if we want to access
any of these shares, what

00:15:14.940 --> 00:15:17.670 align:middle line:84%
we'll need to do is we
can do it with smbclient.

00:15:17.670 --> 00:15:20.610 align:middle line:84%
And in this case, we're
not listing out the shares.

00:15:20.610 --> 00:15:23.040 align:middle line:84%
We want to log in
directly, and we want

00:15:23.040 --> 00:15:24.430 align:middle line:90%
to access one of these shares.

00:15:24.430 --> 00:15:27.150 align:middle line:84%
So let's start off
with the public share.

00:15:27.150 --> 00:15:30.180 align:middle line:84%
So we essentially just
type in the share name

00:15:30.180 --> 00:15:33.480 align:middle line:84%
after the IP address
and the two backslashes.

00:15:33.480 --> 00:15:36.450 align:middle line:84%
We provide the username that
we have credentials for.

00:15:36.450 --> 00:15:39.660 align:middle line:84%
So we hit Enter, and then I'm
just going to type in password.

00:15:39.660 --> 00:15:42.310 align:middle line:84%
And it looks like
we're able to log in.

00:15:42.310 --> 00:15:45.510 align:middle line:84%
So we're currently interacting
with the SMB server

00:15:45.510 --> 00:15:46.690 align:middle line:90%
on the target system.

00:15:46.690 --> 00:15:50.220 align:middle line:84%
So if I say LS, you can see that
we have two directories here.

00:15:50.220 --> 00:15:51.960 align:middle line:90%
We have dev and secret.

00:15:51.960 --> 00:15:54.750 align:middle line:84%
If we check out the
secret directory,

00:15:54.750 --> 00:15:57.390 align:middle line:84%
we should be able to get the
flag, as you can see there.

00:15:57.390 --> 00:16:00.960 align:middle line:84%
In order to download a file
from SMB using the smbclient,

00:16:00.960 --> 00:16:03.960 align:middle line:84%
we can simply say
get and then flag.

00:16:03.960 --> 00:16:05.790 align:middle line:84%
And I'll just type
that in correctly.

00:16:05.790 --> 00:16:06.900 align:middle line:90%
There we are, get flag.

00:16:06.900 --> 00:16:08.400 align:middle line:84%
And that is going
to save it for us.

00:16:08.400 --> 00:16:11.890 align:middle line:84%
And if we exit now, we
should have the flag here.

00:16:11.890 --> 00:16:14.140 align:middle line:84%
So I'm just going to get
the contents of the flag,

00:16:14.140 --> 00:16:15.180 align:middle line:90%
and there you are.

00:16:15.180 --> 00:16:17.198 align:middle line:84%
So, again, we can
also try and access

00:16:17.198 --> 00:16:18.240 align:middle line:90%
some of the other shares.

00:16:18.240 --> 00:16:21.488 align:middle line:84%
So let me just list
all the shares again.

00:16:21.488 --> 00:16:22.030 align:middle line:90%
There we are.

00:16:22.030 --> 00:16:24.760 align:middle line:84%
We can try and access the
share for maybe Aisha.

00:16:24.760 --> 00:16:25.780 align:middle line:90%
Let's try that out.

00:16:25.780 --> 00:16:28.300 align:middle line:84%
Maybe that will reveal
something-- something else,

00:16:28.300 --> 00:16:29.530 align:middle line:90%
rather.

00:16:29.530 --> 00:16:31.405 align:middle line:84%
So we'll try and access
the share for Aisha.

00:16:31.405 --> 00:16:34.060 align:middle line:90%


00:16:34.060 --> 00:16:36.730 align:middle line:84%
We hit Enter, type in the
password that we obtained.

00:16:36.730 --> 00:16:38.770 align:middle line:84%
And, again, if we
type in LS, it looks

00:16:38.770 --> 00:16:40.870 align:middle line:90%
like we have a directory there.

00:16:40.870 --> 00:16:43.220 align:middle line:84%
And we cut out the
contents of the directory,

00:16:43.220 --> 00:16:45.910 align:middle line:84%
and we have another flag,
et cetera, et cetera.

00:16:45.910 --> 00:16:47.750 align:middle line:90%
So the idea is fairly simple.

00:16:47.750 --> 00:16:50.620 align:middle line:84%
We were able to enumerate
the SMB version.

00:16:50.620 --> 00:16:53.620 align:middle line:84%
We were also able to
enumerate the users as well

00:16:53.620 --> 00:16:54.700 align:middle line:90%
as the shares.

00:16:54.700 --> 00:16:57.250 align:middle line:84%
And furthermore, we were
able to perform a brute force

00:16:57.250 --> 00:17:00.850 align:middle line:84%
attack in order to identify the
password for the admin user.

00:17:00.850 --> 00:17:04.150 align:middle line:84%
That information has allowed
us to gain access to shares

00:17:04.150 --> 00:17:05.740 align:middle line:84%
that we pretty
much would not have

00:17:05.740 --> 00:17:09.530 align:middle line:84%
been able to access if we didn't
have the admin user's password.

00:17:09.530 --> 00:17:13.690 align:middle line:84%
So this is really how
powerful the auxiliary modules

00:17:13.690 --> 00:17:16.900 align:middle line:84%
can come or can be when
it comes down to SMB.

00:17:16.900 --> 00:17:19.990 align:middle line:84%
And of course, I covered how
to use smbclient, which is

00:17:19.990 --> 00:17:21.430 align:middle line:90%
beyond the scope of this video.

00:17:21.430 --> 00:17:24.609 align:middle line:84%
But I just wanted to show you
how important this information

00:17:24.609 --> 00:17:27.339 align:middle line:84%
can be when you're working
within an environment that

00:17:27.339 --> 00:17:30.700 align:middle line:84%
has SMB, irregardless
of whether it is Windows

00:17:30.700 --> 00:17:32.500 align:middle line:90%
or it is Linux with SAMBA.

00:17:32.500 --> 00:17:37.940 align:middle line:84%
So, again, I'm going to move
on back to the slides now.

00:17:37.940 --> 00:17:39.950 align:middle line:84%
So that was a very
productive session.

00:17:39.950 --> 00:17:42.530 align:middle line:84%
In the next video, we'll
begin taking a look

00:17:42.530 --> 00:17:46.310 align:middle line:84%
at how to perform HTTP
or web server enumeration

00:17:46.310 --> 00:17:48.500 align:middle line:90%
with auxiliary modules.

00:17:48.500 --> 00:17:49.000 align:middle line:90%