WEBVTT

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


00:00:10.260 --> 00:00:12.120 align:middle line:90%
Exploiting SAMBA.

00:00:12.120 --> 00:00:15.090 align:middle line:84%
Now that we have an
idea of how to exploit

00:00:15.090 --> 00:00:18.690 align:middle line:84%
multiple services running
on a Linux system like FTP,

00:00:18.690 --> 00:00:22.830 align:middle line:84%
Shellshock, as well as SSH,
let's turn our attention

00:00:22.830 --> 00:00:26.820 align:middle line:84%
to the open source Linux
implementation of SMB, which

00:00:26.820 --> 00:00:27.960 align:middle line:90%
is SAMBA.

00:00:27.960 --> 00:00:31.140 align:middle line:84%
However, before we actually get
started with the exploitation

00:00:31.140 --> 00:00:35.040 align:middle line:84%
section, let's get an idea
of what SAMBA is and what,

00:00:35.040 --> 00:00:37.570 align:middle line:84%
as an attacker, we are
going to be looking for.

00:00:37.570 --> 00:00:38.070 align:middle line:90%
All right.

00:00:38.070 --> 00:00:42.120 align:middle line:84%
So SMB essentially stands
for the Server Message Block.

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

00:00:44.700 --> 00:00:47.670 align:middle line:84%
that is used to facilitate
the sharing of files

00:00:47.670 --> 00:00:50.760 align:middle line:84%
and peripherals like
printers between computers

00:00:50.760 --> 00:00:53.970 align:middle line:84%
on a local network
also known as a LAN.

00:00:53.970 --> 00:00:58.560 align:middle line:84%
Now, SMB uses port 445
by default, which is TCP.

00:00:58.560 --> 00:01:02.940 align:middle line:84%
However, originally, SMB ran
on top of the NetBIOS port

00:01:02.940 --> 00:01:06.660 align:middle line:90%
or protocol using port 139.

00:01:06.660 --> 00:01:10.260 align:middle line:84%
And it's not uncommon to
find Windows systems as well

00:01:10.260 --> 00:01:13.380 align:middle line:84%
as Linux systems
running both the NetBIOS

00:01:13.380 --> 00:01:16.290 align:middle line:84%
port and the actual
SMB port, which

00:01:16.290 --> 00:01:20.250 align:middle line:84%
is port 445 as a means
of offering compatibility

00:01:20.250 --> 00:01:24.450 align:middle line:84%
to older systems that
still utilize NetBIOS.

00:01:24.450 --> 00:01:26.970 align:middle line:84%
Now, I want to explain
something that I did not

00:01:26.970 --> 00:01:30.210 align:middle line:84%
explain during the SMB
exploitation section

00:01:30.210 --> 00:01:34.080 align:middle line:84%
within the Windows exploitation
section of this course.

00:01:34.080 --> 00:01:35.880 align:middle line:84%
Within that section,
we were primarily

00:01:35.880 --> 00:01:38.940 align:middle line:84%
focused on obtaining
credentials in order

00:01:38.940 --> 00:01:41.950 align:middle line:84%
to execute arbitrary
commands on the target.

00:01:41.950 --> 00:01:45.210 align:middle line:84%
And that was facilitated
through the PS exit command

00:01:45.210 --> 00:01:48.810 align:middle line:84%
and we also explored other
tools like CrackMapExec

00:01:48.810 --> 00:01:50.670 align:middle line:84%
and that really
is a vulnerability

00:01:50.670 --> 00:01:52.650 align:middle line:84%
within the Windows
operating system.

00:01:52.650 --> 00:01:56.970 align:middle line:84%
And the same thing can be
done relatively similarly

00:01:56.970 --> 00:01:58.210 align:middle line:90%
on a Linux system.

00:01:58.210 --> 00:02:00.930 align:middle line:84%
However, in this video,
I want to highlight

00:02:00.930 --> 00:02:02.460 align:middle line:90%
another aspect of SMB.

00:02:02.460 --> 00:02:04.830 align:middle line:84%
So going back to
my original example

00:02:04.830 --> 00:02:07.140 align:middle line:84%
that I highlighted within
the Windows section,

00:02:07.140 --> 00:02:08.970 align:middle line:84%
if you have ever
worked within a Windows

00:02:08.970 --> 00:02:12.000 align:middle line:84%
environment or an environment
that has more than 5 or 10

00:02:12.000 --> 00:02:15.510 align:middle line:84%
Windows systems, SMB
can typically be used

00:02:15.510 --> 00:02:17.677 align:middle line:84%
or is typically
used to share files.

00:02:17.677 --> 00:02:18.760 align:middle line:90%
And how would you do that?

00:02:18.760 --> 00:02:23.550 align:middle line:84%
Well, let's say you're running
a system on that local network

00:02:23.550 --> 00:02:26.070 align:middle line:84%
and someone asks you to
share a file or folder,

00:02:26.070 --> 00:02:30.120 align:middle line:84%
well, you could email
it to them or you

00:02:30.120 --> 00:02:33.340 align:middle line:84%
could copy it to a flash
drive and give it to them.

00:02:33.340 --> 00:02:36.690 align:middle line:84%
However, the actual
pre-determined solution

00:02:36.690 --> 00:02:39.240 align:middle line:84%
for this is to set
up a file share.

00:02:39.240 --> 00:02:43.890 align:middle line:84%
And the file share again, can be
configured to essentially only

00:02:43.890 --> 00:02:46.410 align:middle line:90%
be accessed by specific users.

00:02:46.410 --> 00:02:49.410 align:middle line:84%
But irregardless
of that, file share

00:02:49.410 --> 00:02:52.560 align:middle line:84%
could contain important
information pertinent

00:02:52.560 --> 00:02:55.510 align:middle line:84%
to that company or to
that particular person.

00:02:55.510 --> 00:02:57.300 align:middle line:84%
And once you set
up the file share,

00:02:57.300 --> 00:03:00.180 align:middle line:84%
you can essentially share
that or provide access

00:03:00.180 --> 00:03:03.000 align:middle line:84%
to the specific set
of files or folders

00:03:03.000 --> 00:03:07.110 align:middle line:84%
to really any user on
that local area network.

00:03:07.110 --> 00:03:10.680 align:middle line:84%
And all of this is being
facilitated through SMB

00:03:10.680 --> 00:03:12.220 align:middle line:90%
or the SMB protocol.

00:03:12.220 --> 00:03:12.720 align:middle line:90%
All right.

00:03:12.720 --> 00:03:14.340 align:middle line:90%
So I just want to explain that.

00:03:14.340 --> 00:03:16.020 align:middle line:84%
And I want you to
keep that in mind

00:03:16.020 --> 00:03:18.180 align:middle line:84%
as we are going to
be primarily focused

00:03:18.180 --> 00:03:21.780 align:middle line:84%
on enumerating shares as
well as downloading files

00:03:21.780 --> 00:03:23.650 align:middle line:90%
from these shares.

00:03:23.650 --> 00:03:25.840 align:middle line:84%
So just keep that in
the back of your mind.

00:03:25.840 --> 00:03:30.090 align:middle line:84%
Now, SAMBA is the Linux
implementation of SMB

00:03:30.090 --> 00:03:32.970 align:middle line:84%
and allows Windows systems
to access Linux chairs

00:03:32.970 --> 00:03:34.060 align:middle line:90%
and devices.

00:03:34.060 --> 00:03:37.260 align:middle line:84%
Now, SAMBA doesn't come
pre-packaged with most Linux

00:03:37.260 --> 00:03:39.780 align:middle line:84%
distributions because
again, going back

00:03:39.780 --> 00:03:43.500 align:middle line:84%
to the Linux development
ideology and philosophy,

00:03:43.500 --> 00:03:45.900 align:middle line:84%
the Linux and Unix
philosophy essentially

00:03:45.900 --> 00:03:50.070 align:middle line:84%
revolves around the fact that
a system or rather you should

00:03:50.070 --> 00:03:52.620 align:middle line:84%
be able to customize your
system and make it work

00:03:52.620 --> 00:03:54.160 align:middle line:90%
the way you want it to work.

00:03:54.160 --> 00:03:57.960 align:middle line:84%
So it doesn't include any of the
additional packages like SAMBA

00:03:57.960 --> 00:04:00.345 align:middle line:90%
or FTP or anything like that.

00:04:00.345 --> 00:04:04.183 align:middle line:84%
All have to be
installed by you--

00:04:04.183 --> 00:04:06.600 align:middle line:84%
actually, you need to go ahead
and do that yourself, which

00:04:06.600 --> 00:04:08.230 align:middle line:90%
is a good thing.

00:04:08.230 --> 00:04:10.650 align:middle line:84%
However, as I said,
SAMBA is essentially

00:04:10.650 --> 00:04:12.750 align:middle line:84%
used to allow Windows
systems to access

00:04:12.750 --> 00:04:16.920 align:middle line:84%
Linux shares and, of course,
devices connected to that Linux

00:04:16.920 --> 00:04:18.100 align:middle line:90%
system.

00:04:18.100 --> 00:04:23.700 align:middle line:84%
So again, SAMBA isn't really
a common port or service

00:04:23.700 --> 00:04:26.345 align:middle line:84%
that you typically find
running on a Linux server,

00:04:26.345 --> 00:04:27.720 align:middle line:84%
but it's something
that you might

00:04:27.720 --> 00:04:31.200 align:middle line:84%
find running on an internal
network or on a Linux server

00:04:31.200 --> 00:04:32.970 align:middle line:90%
within an internal network.

00:04:32.970 --> 00:04:36.270 align:middle line:84%
So it's always good to
know how to exploit SAMBA.

00:04:36.270 --> 00:04:38.790 align:middle line:84%
Now, I've already
covered the process

00:04:38.790 --> 00:04:41.940 align:middle line:84%
of exploiting an inherent
vulnerability within SAMBA,

00:04:41.940 --> 00:04:44.400 align:middle line:84%
and I did that within
my Metasploit course.

00:04:44.400 --> 00:04:47.280 align:middle line:84%
So you can check that out,
and that will essentially

00:04:47.280 --> 00:04:49.980 align:middle line:84%
provide you with a way of
obtaining a reverse shell.

00:04:49.980 --> 00:04:53.580 align:middle line:84%
In this case, we are focused
on firstly identifying

00:04:53.580 --> 00:04:56.010 align:middle line:84%
legitimate credentials
and then authenticating

00:04:56.010 --> 00:05:00.270 align:middle line:84%
with the SAMBA server or with
the actual target via SAMBA

00:05:00.270 --> 00:05:04.050 align:middle line:84%
and, of course, utilizing
those credentials to list out

00:05:04.050 --> 00:05:07.260 align:middle line:84%
the shares, download files
from the shares, et cetera.

00:05:07.260 --> 00:05:11.790 align:middle line:84%
So Samba utilizes username and
password authentication just

00:05:11.790 --> 00:05:14.250 align:middle line:84%
like SMB in order
to obtain access

00:05:14.250 --> 00:05:16.560 align:middle line:84%
to the server or
a network share.

00:05:16.560 --> 00:05:18.720 align:middle line:84%
Now, in order to obtain
these credentials,

00:05:18.720 --> 00:05:21.570 align:middle line:84%
we can perform a brute
force attack with Hydra.

00:05:21.570 --> 00:05:24.360 align:middle line:84%
And again, once we've
obtained these credentials,

00:05:24.360 --> 00:05:27.030 align:middle line:84%
we can use a utility
called SMB map, which

00:05:27.030 --> 00:05:29.160 align:middle line:84%
comes pre-packaged
with Kali Linux

00:05:29.160 --> 00:05:32.010 align:middle line:84%
in order to enumerate
SAMBA shared drives, a list

00:05:32.010 --> 00:05:33.570 align:middle line:84%
the contents of
the shares, as well

00:05:33.570 --> 00:05:37.990 align:middle line:84%
as download files, and execute
remote commands on the target.

00:05:37.990 --> 00:05:41.820 align:middle line:84%
We can also utilize a
tool called smbclient.

00:05:41.820 --> 00:05:44.820 align:middle line:84%
Smbclient is a client that
is part of the SAMBA software

00:05:44.820 --> 00:05:47.970 align:middle line:84%
suite, and it communicates
with the LAN manager server,

00:05:47.970 --> 00:05:51.450 align:middle line:84%
offering an interface similar
to that of the FTP program,

00:05:51.450 --> 00:05:53.190 align:middle line:84%
and it can be used
to download files

00:05:53.190 --> 00:05:55.300 align:middle line:84%
from the server to
the local machine

00:05:55.300 --> 00:05:58.650 align:middle line:84%
and vise versa in addition
to retrieving directory

00:05:58.650 --> 00:06:01.000 align:middle line:84%
information from
the actual server.

00:06:01.000 --> 00:06:01.500 align:middle line:90%
All right.

00:06:01.500 --> 00:06:05.280 align:middle line:84%
So we'll also be exploring
other utilities like enum4linux.

00:06:05.280 --> 00:06:08.010 align:middle line:84%
But, of course, all
of those utilities

00:06:08.010 --> 00:06:11.200 align:middle line:84%
really work well when you
have legitimate credentials.

00:06:11.200 --> 00:06:13.920 align:middle line:84%
Now, I will not be going
over a vulnerability

00:06:13.920 --> 00:06:17.880 align:middle line:84%
or misconfiguration called the
null session misconfiguration,

00:06:17.880 --> 00:06:20.670 align:middle line:84%
whereby, the SAMBA
server has been

00:06:20.670 --> 00:06:24.870 align:middle line:84%
really hasn't been configured
to essentially be secure.

00:06:24.870 --> 00:06:27.330 align:middle line:84%
And as a result,
individual can essentially

00:06:27.330 --> 00:06:30.150 align:middle line:84%
authenticate and take
a look at the shares

00:06:30.150 --> 00:06:31.820 align:middle line:90%
without providing a password.

00:06:31.820 --> 00:06:33.570 align:middle line:84%
That is something that
you will really not

00:06:33.570 --> 00:06:35.660 align:middle line:90%
find on any modern system.

00:06:35.660 --> 00:06:37.590 align:middle line:84%
So I will be skipping
over that, and we

00:06:37.590 --> 00:06:39.870 align:middle line:84%
are going to be
targeting a system that

00:06:39.870 --> 00:06:43.080 align:middle line:84%
has a properly secured
instance of SAMBA running

00:06:43.080 --> 00:06:47.250 align:middle line:84%
and consequently, with
various shares that

00:06:47.250 --> 00:06:48.870 align:middle line:84%
contain interesting
files that we

00:06:48.870 --> 00:06:50.860 align:middle line:90%
are going to be trying to get.

00:06:50.860 --> 00:06:51.360 align:middle line:90%
All right.

00:06:51.360 --> 00:06:55.080 align:middle line:84%
So this video has a lab
environment attached to it

00:06:55.080 --> 00:06:57.550 align:middle line:84%
that will allow us to showcase
some of these techniques.

00:06:57.550 --> 00:06:59.987 align:middle line:84%
So just fire up the lab
environment as will I.

00:06:59.987 --> 00:07:02.070 align:middle line:84%
And I'll see you within
the lab environment, where

00:07:02.070 --> 00:07:07.060 align:middle line:84%
we can get started with the
process of exploiting SAMBA.

00:07:07.060 --> 00:07:07.560 align:middle line:90%
All right.

00:07:07.560 --> 00:07:09.670 align:middle line:84%
So I'm back in the
lab environment.

00:07:09.670 --> 00:07:11.520 align:middle line:84%
And again, in this
lab environment,

00:07:11.520 --> 00:07:13.800 align:middle line:84%
you'll not be provided
with a desktop interface

00:07:13.800 --> 00:07:15.900 align:middle line:84%
or a desktop
environment, you'll just

00:07:15.900 --> 00:07:19.480 align:middle line:84%
be provided with a terminal,
which is perfectly fine.

00:07:19.480 --> 00:07:21.300 align:middle line:84%
And, of course, the
next logical step

00:07:21.300 --> 00:07:23.820 align:middle line:84%
would be to identify
the target IP, which can

00:07:23.820 --> 00:07:25.980 align:middle line:90%
be done by typing in ifconfig.

00:07:25.980 --> 00:07:29.400 align:middle line:84%
And you want to take a look at
the interface ethernet1 that

00:07:29.400 --> 00:07:30.870 align:middle line:90%
is your IP right over here.

00:07:30.870 --> 00:07:34.030 align:middle line:84%
The subnet is going to be
different in your case.

00:07:34.030 --> 00:07:35.880 align:middle line:84%
The target IP or
the target system

00:07:35.880 --> 00:07:38.380 align:middle line:84%
is running on the next
IP within this subnet.

00:07:38.380 --> 00:07:40.270 align:middle line:84%
So if your IP,
which in your case,

00:07:40.270 --> 00:07:44.130 align:middle line:84%
it will be the second IP
address on the subnet.

00:07:44.130 --> 00:07:48.220 align:middle line:84%
The target IP address is the
third IP address on the subnet.

00:07:48.220 --> 00:07:50.765 align:middle line:84%
So all you need to do is
just copy the IP address.

00:07:50.765 --> 00:07:52.390 align:middle line:84%
And as I said, of
course, in your case,

00:07:52.390 --> 00:07:53.550 align:middle line:90%
it's going to be different.

00:07:53.550 --> 00:07:56.070 align:middle line:84%
All you need to do is
just change the 2 to a 3

00:07:56.070 --> 00:07:57.600 align:middle line:90%
and that's the target IP.

00:07:57.600 --> 00:08:01.090 align:middle line:84%
So the first thing we're going
to do now is run an Nmap scan,

00:08:01.090 --> 00:08:04.500 align:middle line:84%
and I'm just going to perform a
service version detection scan.

00:08:04.500 --> 00:08:06.690 align:middle line:84%
And I'm going to paste
in the target IP.

00:08:06.690 --> 00:08:09.510 align:middle line:84%
So again, remember to
replace the 2 with a 3,

00:08:09.510 --> 00:08:10.710 align:middle line:90%
and I'll hit Enter.

00:08:10.710 --> 00:08:13.080 align:middle line:84%
And let's see what
we're able to identify.

00:08:13.080 --> 00:08:18.230 align:middle line:90%


00:08:18.230 --> 00:08:18.730 align:middle line:90%
All right.

00:08:18.730 --> 00:08:21.790 align:middle line:84%
So we can see that this
target is running SAMBA,

00:08:21.790 --> 00:08:24.820 align:middle line:84%
and the actual service
version is not displayed.

00:08:24.820 --> 00:08:28.870 align:middle line:84%
But we know it's anywhere
from version 3 to version 4.

00:08:28.870 --> 00:08:31.240 align:middle line:84%
And you can see you have
the NetBIOS port as well as

00:08:31.240 --> 00:08:36.110 align:middle line:84%
the typical the standard
SMB port, which is port 445.

00:08:36.110 --> 00:08:36.610 align:middle line:90%
All right.

00:08:36.610 --> 00:08:38.740 align:middle line:84%
So as you can see
here, the service info

00:08:38.740 --> 00:08:41.380 align:middle line:84%
tells you that it's
SAMBA recon brute.

00:08:41.380 --> 00:08:44.058 align:middle line:84%
So again, that's just a
bit of information there.

00:08:44.058 --> 00:08:45.850 align:middle line:84%
All right, so the first
thing we need to do

00:08:45.850 --> 00:08:51.520 align:middle line:84%
is we need to perform a
brute force on SMB or SAMBA

00:08:51.520 --> 00:08:53.380 align:middle line:84%
running on this
particular target.

00:08:53.380 --> 00:08:57.670 align:middle line:84%
Now, this can easily be done
through the use of the utility

00:08:57.670 --> 00:09:01.330 align:middle line:84%
Hydra, which is extremely
versatile in regards

00:09:01.330 --> 00:09:04.900 align:middle line:84%
to the actual protocols that
it allows you to brute force.

00:09:04.900 --> 00:09:08.500 align:middle line:84%
Now, for the purpose of
this lab environment,

00:09:08.500 --> 00:09:12.040 align:middle line:84%
the usernames that you
will need to gain access

00:09:12.040 --> 00:09:15.370 align:middle line:84%
to the target system or
to the actual SMB shares

00:09:15.370 --> 00:09:17.260 align:middle line:84%
have already been
provided to you.

00:09:17.260 --> 00:09:20.380 align:middle line:84%
And the two of them are
going to be admin and Jane.

00:09:20.380 --> 00:09:23.170 align:middle line:84%
However, the only one we
are going to be utilizing

00:09:23.170 --> 00:09:26.390 align:middle line:84%
or essentially using
is the admin user.

00:09:26.390 --> 00:09:28.390 align:middle line:84%
So within our brute
force, we do not

00:09:28.390 --> 00:09:31.360 align:middle line:84%
need to specify a word
list that contains

00:09:31.360 --> 00:09:33.490 align:middle line:84%
the administrator or
rather the usernames

00:09:33.490 --> 00:09:34.960 align:middle line:84%
that we would like
to brute force.

00:09:34.960 --> 00:09:36.880 align:middle line:84%
Because we already
have the username

00:09:36.880 --> 00:09:38.440 align:middle line:84%
we would like to
brute force with.

00:09:38.440 --> 00:09:39.860 align:middle line:90%
We can just specify it here.

00:09:39.860 --> 00:09:41.710 align:middle line:84%
So we're going to
say admin and then

00:09:41.710 --> 00:09:45.250 align:middle line:84%
we specify the actual word list
that contains the password.

00:09:45.250 --> 00:09:49.540 align:middle line:84%
In this case, we will say user
share metasploit framework,

00:09:49.540 --> 00:09:52.570 align:middle line:90%
data, word lists.

00:09:52.570 --> 00:09:58.240 align:middle line:84%
And we can utilize
Unix passwords.txt

00:09:58.240 --> 00:09:58.750 align:middle line:90%
All right.

00:09:58.750 --> 00:10:01.180 align:middle line:84%
And I'm going to
specify the target IP.

00:10:01.180 --> 00:10:03.250 align:middle line:90%
Remember to change the 2 to a 3.

00:10:03.250 --> 00:10:05.290 align:middle line:90%
And the protocol is SMB.

00:10:05.290 --> 00:10:07.070 align:middle line:90%
And we can hit Enter.

00:10:07.070 --> 00:10:07.570 align:middle line:90%
All right.

00:10:07.570 --> 00:10:08.230 align:middle line:90%
So there we are.

00:10:08.230 --> 00:10:09.772 align:middle line:84%
The brute force is
complete, and that

00:10:09.772 --> 00:10:11.650 align:middle line:90%
completed relatively quickly.

00:10:11.650 --> 00:10:13.660 align:middle line:84%
And that really is
the case whenever

00:10:13.660 --> 00:10:16.090 align:middle line:84%
you have a one
username specified,

00:10:16.090 --> 00:10:18.250 align:middle line:84%
the brute force will
be much more efficient

00:10:18.250 --> 00:10:20.410 align:middle line:84%
because you're only
testing the passwords

00:10:20.410 --> 00:10:22.180 align:middle line:90%
for that particular username.

00:10:22.180 --> 00:10:24.100 align:middle line:84%
So we can see that
that was successful,

00:10:24.100 --> 00:10:28.040 align:middle line:84%
and we got the password for the
admin user, which is fantastic.

00:10:28.040 --> 00:10:31.580 align:middle line:84%
So we can now utilize
a tool called smbmap.

00:10:31.580 --> 00:10:32.080 align:middle line:90%
All right.

00:10:32.080 --> 00:10:36.010 align:middle line:84%
So we can just say smbmap
here, and I'll just hit Enter.

00:10:36.010 --> 00:10:38.140 align:middle line:84%
And this will give you
an idea as to how you can

00:10:38.140 --> 00:10:39.980 align:middle line:90%
utilize this particular tool.

00:10:39.980 --> 00:10:44.650 align:middle line:84%
So if we take a look at
the actual documentation.

00:10:44.650 --> 00:10:47.650 align:middle line:84%
Here you can see this is
a SAMBA share enumerator.

00:10:47.650 --> 00:10:52.570 align:middle line:84%
And the actual documentation
is actually fantastic,

00:10:52.570 --> 00:10:55.360 align:middle line:84%
because it explains how you
can use it right over here

00:10:55.360 --> 00:10:57.290 align:middle line:84%
through the use
of some examples.

00:10:57.290 --> 00:11:00.730 align:middle line:84%
So for example, if we wanted
to enumerate the shares

00:11:00.730 --> 00:11:03.040 align:middle line:84%
on this particular
target system,

00:11:03.040 --> 00:11:07.270 align:middle line:84%
we can essentially say smbmap
and then specify the target

00:11:07.270 --> 00:11:09.340 align:middle line:90%
IP using the H option.

00:11:09.340 --> 00:11:11.470 align:middle line:84%
And I'll just clear
out the terminal there,

00:11:11.470 --> 00:11:15.250 align:middle line:84%
and I'll paste in the target
IP or change that to a 3.

00:11:15.250 --> 00:11:17.980 align:middle line:84%
And the username is
admin and the password

00:11:17.980 --> 00:11:21.170 align:middle line:84%
that we were able to
obtain is password1.

00:11:21.170 --> 00:11:21.670 align:middle line:90%
All right.

00:11:21.670 --> 00:11:22.973 align:middle line:90%
So I'll hit Enter.

00:11:22.973 --> 00:11:24.640 align:middle line:84%
So you can see it's
going to say finding

00:11:24.640 --> 00:11:29.660 align:middle line:84%
open SMB ports, user SMB session
established on the target IP.

00:11:29.660 --> 00:11:33.260 align:middle line:84%
And you can see the actual host
name of the system is target1.

00:11:33.260 --> 00:11:35.580 align:middle line:84%
It then provides you with
the actual disks here.

00:11:35.580 --> 00:11:36.580 align:middle line:90%
So these are the shares.

00:11:36.580 --> 00:11:40.270 align:middle line:84%
So you have Shawn,
Nancy, admin and IPC.

00:11:40.270 --> 00:11:43.450 align:middle line:84%
And in terms of Nancy,
this is a read-only share.

00:11:43.450 --> 00:11:46.430 align:middle line:84%
And then, of course, you
have Shawn, an admin.

00:11:46.430 --> 00:11:46.930 align:middle line:90%
All right.

00:11:46.930 --> 00:11:50.590 align:middle line:84%
So what if we wanted to access
any of these particular shares?

00:11:50.590 --> 00:11:53.590 align:middle line:84%
Well, we can do that through
the use of smbclient.

00:11:53.590 --> 00:11:57.280 align:middle line:84%
So we can say smbclient,
and I'll hit Enter.

00:11:57.280 --> 00:12:01.480 align:middle line:84%
And smbclient documentation
really isn't that good,

00:12:01.480 --> 00:12:04.540 align:middle line:84%
but you can get more by
opening the actual manpages

00:12:04.540 --> 00:12:07.930 align:middle line:84%
for smbclient so you
can say man smbclient

00:12:07.930 --> 00:12:10.150 align:middle line:84%
and you can see this
is an FTlike client

00:12:10.150 --> 00:12:13.910 align:middle line:84%
to access SMB/CIFS
resources on servers.

00:12:13.910 --> 00:12:14.410 align:middle line:90%
All right.

00:12:14.410 --> 00:12:17.050 align:middle line:84%
So this will provide us with
an FTP type interface that

00:12:17.050 --> 00:12:19.690 align:middle line:84%
will allow us to
dynamically navigate around

00:12:19.690 --> 00:12:21.200 align:middle line:90%
the actual shares.

00:12:21.200 --> 00:12:21.700 align:middle line:90%
OK.

00:12:21.700 --> 00:12:25.780 align:middle line:84%
So we can say
smbclient and then we

00:12:25.780 --> 00:12:28.000 align:middle line:84%
specify that we want
to list out the shares.

00:12:28.000 --> 00:12:30.190 align:middle line:90%
We paste in the target IP.

00:12:30.190 --> 00:12:32.200 align:middle line:84%
And then we can specify
the user that we would

00:12:32.200 --> 00:12:33.400 align:middle line:90%
like to authenticate with.

00:12:33.400 --> 00:12:37.322 align:middle line:84%
So we can say user
is admin, hit Enter.

00:12:37.322 --> 00:12:39.280 align:middle line:84%
It's going to ask us for
the admin's passwords.

00:12:39.280 --> 00:12:40.960 align:middle line:90%
I'll say password1.

00:12:40.960 --> 00:12:42.760 align:middle line:84%
And again, you can
see it provides us

00:12:42.760 --> 00:12:44.908 align:middle line:84%
with pretty much the
same information.

00:12:44.908 --> 00:12:46.450 align:middle line:84%
However, in this
case, it provides us

00:12:46.450 --> 00:12:47.620 align:middle line:90%
with the actual work group.

00:12:47.620 --> 00:12:51.590 align:middle line:84%
In this case, the name of
the work group is recon labs.

00:12:51.590 --> 00:12:52.090 align:middle line:90%
OK.

00:12:52.090 --> 00:12:57.700 align:middle line:84%
So if we wanted to gain
access to the actual smbclient

00:12:57.700 --> 00:13:01.990 align:middle line:84%
itself or rather the interface,
we can say smbclient,

00:13:01.990 --> 00:13:04.480 align:middle line:84%
and we then specify
the target IP.

00:13:04.480 --> 00:13:07.570 align:middle line:84%
So I'll change that to a 3 and
then specify the actual share

00:13:07.570 --> 00:13:09.620 align:middle line:84%
name that we would
like to access.

00:13:09.620 --> 00:13:12.320 align:middle line:84%
So in this case, I can
try Shawn or Nancy.

00:13:12.320 --> 00:13:14.980 align:middle line:84%
So for example, we can
start off with Shawn,

00:13:14.980 --> 00:13:17.920 align:middle line:84%
and then I can authenticate
as the user admin,

00:13:17.920 --> 00:13:19.030 align:middle line:90%
and I'll hit Enter.

00:13:19.030 --> 00:13:20.680 align:middle line:84%
It's going to ask
me for the password.

00:13:20.680 --> 00:13:21.880 align:middle line:90%
I'll type that in.

00:13:21.880 --> 00:13:25.270 align:middle line:84%
As you can see, it provides
you with the SMB console.

00:13:25.270 --> 00:13:28.150 align:middle line:84%
So we can utilize
the help command here

00:13:28.150 --> 00:13:30.940 align:middle line:84%
to display the list of
commands that we can run.

00:13:30.940 --> 00:13:33.850 align:middle line:84%
And these really
are just relative

00:13:33.850 --> 00:13:36.340 align:middle line:84%
or are essentially
used to navigate

00:13:36.340 --> 00:13:38.560 align:middle line:90%
around the actual shares.

00:13:38.560 --> 00:13:41.140 align:middle line:84%
So for example, I
can say dir and that

00:13:41.140 --> 00:13:43.690 align:middle line:84%
will list the actual
folders or directories

00:13:43.690 --> 00:13:45.640 align:middle line:90%
within the share Shawn.

00:13:45.640 --> 00:13:48.760 align:middle line:84%
So I can go into maybe
the dev directory.

00:13:48.760 --> 00:13:52.210 align:middle line:84%
So I can say cd dev, dir,
nothing within there.

00:13:52.210 --> 00:13:58.400 align:middle line:84%
I can take a step back, cd
run, dir, nothing in there.

00:13:58.400 --> 00:14:01.930 align:middle line:84%
And CD test, same thing,
dir, nothing in there.

00:14:01.930 --> 00:14:02.430 align:middle line:90%
OK.

00:14:02.430 --> 00:14:04.220 align:middle line:90%
So we've hit a dead end.

00:14:04.220 --> 00:14:06.420 align:middle line:84%
There really isn't
anything within that share.

00:14:06.420 --> 00:14:09.650 align:middle line:84%
So let's try the next share,
which, in this case, was Nancy.

00:14:09.650 --> 00:14:13.380 align:middle line:84%
And then we'll move
over to the admin share.

00:14:13.380 --> 00:14:13.880 align:middle line:90%
All.

00:14:13.880 --> 00:14:18.690 align:middle line:84%
Right so I'll say
Nancy, password1.

00:14:18.690 --> 00:14:19.290 align:middle line:90%
There we go.

00:14:19.290 --> 00:14:25.170 align:middle line:84%
Dir, we have a srv directory,
dir, nothing in there,

00:14:25.170 --> 00:14:28.830 align:middle line:84%
and cd dir, dir,
nothing in there.

00:14:28.830 --> 00:14:30.520 align:middle line:84%
It looks like we
have a flag here.

00:14:30.520 --> 00:14:31.020 align:middle line:90%
All right.

00:14:31.020 --> 00:14:34.800 align:middle line:84%
So we can get or download
a file from an SMB server

00:14:34.800 --> 00:14:36.240 align:middle line:90%
by using the Get command.

00:14:36.240 --> 00:14:38.730 align:middle line:90%
So we'll say get flag.

00:14:38.730 --> 00:14:39.360 align:middle line:90%
There we are.

00:14:39.360 --> 00:14:42.990 align:middle line:84%
It downloads successfully,
and then we can exit.

00:14:42.990 --> 00:14:45.780 align:middle line:84%
And we list out the contents of
our current working directory.

00:14:45.780 --> 00:14:46.890 align:middle line:90%
We have the first flag.

00:14:46.890 --> 00:14:48.390 align:middle line:90%
So we can say cat flag.

00:14:48.390 --> 00:14:50.860 align:middle line:84%
That's the first flag
right over there.

00:14:50.860 --> 00:14:51.360 align:middle line:90%
All right.

00:14:51.360 --> 00:14:53.800 align:middle line:84%
So now, let's try and
access the admin share.

00:14:53.800 --> 00:14:56.190 align:middle line:84%
So I'm going to say
smbclient target IP,

00:14:56.190 --> 00:14:58.620 align:middle line:84%
and we want to access
the admin share.

00:14:58.620 --> 00:14:59.680 align:middle line:90%
There we go.

00:14:59.680 --> 00:15:04.590 align:middle line:84%
And we'll hit Enter,
password1, dir,

00:15:04.590 --> 00:15:05.910 align:middle line:90%
we have a hidden directory.

00:15:05.910 --> 00:15:07.920 align:middle line:84%
So we can go into the
hidden directory here.

00:15:07.920 --> 00:15:11.220 align:middle line:84%
And it looks like we
have a flag or rather

00:15:11.220 --> 00:15:13.080 align:middle line:84%
an archive that
contains the flag.

00:15:13.080 --> 00:15:17.130 align:middle line:84%
So you can see it's called
flag.tar.gz or gzip.

00:15:17.130 --> 00:15:21.870 align:middle line:84%
We can get it by saying get
flag.tar.gzip, hit Enter.

00:15:21.870 --> 00:15:24.520 align:middle line:84%
It's going to download that,
and we're going to exit.

00:15:24.520 --> 00:15:28.080 align:middle line:84%
So I'm just going to remove the
flag that I downloaded earlier.

00:15:28.080 --> 00:15:34.680 align:middle line:84%
And we are going to extract
this with tar.xzf, flag.tar.gz

00:15:34.680 --> 00:15:37.050 align:middle line:90%
and a list of the contents here.

00:15:37.050 --> 00:15:39.840 align:middle line:84%
I can then cut out the content
of the extracted archive, which

00:15:39.840 --> 00:15:43.690 align:middle line:84%
is flag, hit Enter, and
we obtain the second flag.

00:15:43.690 --> 00:15:44.190 align:middle line:90%
All right.

00:15:44.190 --> 00:15:46.440 align:middle line:84%
So you can see that the
two flags are different.

00:15:46.440 --> 00:15:49.650 align:middle line:84%
And again, this lab environment
was set up to showcase

00:15:49.650 --> 00:15:53.510 align:middle line:84%
how you can perform a brute
force attack on SAMBA,

00:15:53.510 --> 00:15:55.740 align:middle line:84%
obtain the credentials,
and then enumerate shares.

00:15:55.740 --> 00:15:57.360 align:middle line:84%
And, of course, this
process can also

00:15:57.360 --> 00:16:00.150 align:middle line:90%
be done for Windows systems.

00:16:00.150 --> 00:16:03.660 align:middle line:84%
Now, the other utility
that I wanted to highlight

00:16:03.660 --> 00:16:05.460 align:middle line:90%
was enum4linux.

00:16:05.460 --> 00:16:08.190 align:middle line:84%
So I'll say enum4linux
and I'll use

00:16:08.190 --> 00:16:10.740 align:middle line:84%
the A option to enumerate
all information,

00:16:10.740 --> 00:16:13.230 align:middle line:90%
and I'll paste in the target IP.

00:16:13.230 --> 00:16:15.040 align:middle line:90%
Now, let's see what happens.

00:16:15.040 --> 00:16:15.540 align:middle line:90%
OK.

00:16:15.540 --> 00:16:19.890 align:middle line:84%
So you can see that it gets
basic target information right

00:16:19.890 --> 00:16:22.900 align:middle line:84%
over here, and it gives
us the actual work group,

00:16:22.900 --> 00:16:25.500 align:middle line:84%
and you can see right
over here looking up

00:16:25.500 --> 00:16:30.300 align:middle line:84%
the status of the
actual SMB or SAMBA

00:16:30.300 --> 00:16:32.140 align:middle line:90%
instance running on the target.

00:16:32.140 --> 00:16:34.470 align:middle line:84%
And you can see it tells
us right away the server

00:16:34.470 --> 00:16:38.040 align:middle line:84%
doesn't allow session using
a null username and password.

00:16:38.040 --> 00:16:42.840 align:middle line:84%
So that pretty much tells
us that SMB or SAMBA

00:16:42.840 --> 00:16:45.520 align:middle line:84%
has been configured correctly
and null sessions are not

00:16:45.520 --> 00:16:46.020 align:middle line:90%
allowed.

00:16:46.020 --> 00:16:48.450 align:middle line:84%
Now, if they were
allowed, we would

00:16:48.450 --> 00:16:51.780 align:middle line:84%
be able to enumerate
much more information

00:16:51.780 --> 00:16:53.800 align:middle line:90%
with this particular utility.

00:16:53.800 --> 00:16:56.610 align:middle line:84%
So let's learn a bit
more about enum4linux.

00:16:56.610 --> 00:16:58.120 align:middle line:90%
So I'll hit Enter.

00:16:58.120 --> 00:16:58.620 align:middle line:90%
All right.

00:16:58.620 --> 00:16:59.400 align:middle line:90%
So there we are.

00:16:59.400 --> 00:17:01.690 align:middle line:84%
You can see it'll give you
a bit of an idea as to what

00:17:01.690 --> 00:17:02.190 align:middle line:90%
it can do.

00:17:02.190 --> 00:17:04.980 align:middle line:84%
So simple wrapper around the
tools in the SAMBA package

00:17:04.980 --> 00:17:08.369 align:middle line:84%
to provide similar
functionality to enum.exe.

00:17:08.369 --> 00:17:10.560 align:middle line:84%
And what it does, it
allows you to enumerate

00:17:10.560 --> 00:17:14.710 align:middle line:84%
as much information as possible
from SAMBA running on a target.

00:17:14.710 --> 00:17:17.790 align:middle line:84%
So you can enumerate
information like you

00:17:17.790 --> 00:17:22.230 align:middle line:84%
can obtain a user list or a
list of users, the machine list,

00:17:22.230 --> 00:17:26.190 align:middle line:84%
you can also get a list of
shares, the password policy

00:17:26.190 --> 00:17:27.569 align:middle line:90%
information, et cetera.

00:17:27.569 --> 00:17:30.165 align:middle line:84%
And because in this
case, the null sessions

00:17:30.165 --> 00:17:32.070 align:middle line:84%
have not been
enabled, we'll need

00:17:32.070 --> 00:17:35.370 align:middle line:84%
to specify the credentials that
we obtain from the brute force.

00:17:35.370 --> 00:17:40.800 align:middle line:84%
So for example, I
can say enum4linux

00:17:40.800 --> 00:17:43.683 align:middle line:84%
and then I can say maybe I want
to enumerate all information

00:17:43.683 --> 00:17:44.350 align:middle line:90%
right over here.

00:17:44.350 --> 00:17:48.270 align:middle line:84%
So this will enumerate the
users, shares, et cetera.

00:17:48.270 --> 00:17:52.530 align:middle line:84%
And I can then specify that
I want to authenticate.

00:17:52.530 --> 00:17:57.450 align:middle line:84%
So I can say the user is admin
and the password is password1

00:17:57.450 --> 00:17:59.870 align:middle line:90%
and then the target IP.

00:17:59.870 --> 00:18:00.880 align:middle line:90%
I'll hit Enter.

00:18:00.880 --> 00:18:04.120 align:middle line:84%
And now, you can see it's going
to go through the entire gamut

00:18:04.120 --> 00:18:05.050 align:middle line:90%
of checks.

00:18:05.050 --> 00:18:09.450 align:middle line:84%
So we'll give this a couple
of seconds to complete.

00:18:09.450 --> 00:18:09.950 align:middle line:90%
All right.

00:18:09.950 --> 00:18:11.415 align:middle line:90%
So the checks have completed.

00:18:11.415 --> 00:18:13.040 align:middle line:84%
And as you can see
right at the bottom,

00:18:13.040 --> 00:18:15.140 align:middle line:84%
it'll also check for
printer information.

00:18:15.140 --> 00:18:18.560 align:middle line:84%
And it'll tell us no
printers returned.

00:18:18.560 --> 00:18:21.800 align:middle line:84%
And let's take a look at all of
the information displayed right

00:18:21.800 --> 00:18:22.880 align:middle line:90%
from the beginning.

00:18:22.880 --> 00:18:25.520 align:middle line:84%
Because again, this is
very, very comprehensive

00:18:25.520 --> 00:18:28.290 align:middle line:84%
in regards to the information
that it provides you with.

00:18:28.290 --> 00:18:31.460 align:middle line:84%
So we can see that we
authenticate successfully,

00:18:31.460 --> 00:18:34.500 align:middle line:84%
and it'll give you the
operating system information.

00:18:34.500 --> 00:18:36.327 align:middle line:84%
And in this case, it's
not really accurate,

00:18:36.327 --> 00:18:37.910 align:middle line:84%
because it's going
to assume that it's

00:18:37.910 --> 00:18:42.620 align:middle line:84%
running Windows NT 6.1, which
is not really a problem.

00:18:42.620 --> 00:18:44.670 align:middle line:84%
Now, the important
information is here.

00:18:44.670 --> 00:18:46.550 align:middle line:90%
So we have used an enumeration.

00:18:46.550 --> 00:18:49.340 align:middle line:84%
So it provides us with
the other user accounts

00:18:49.340 --> 00:18:50.240 align:middle line:90%
that we can access.

00:18:50.240 --> 00:18:52.610 align:middle line:84%
And we, of course,
gained access via admin.

00:18:52.610 --> 00:18:55.940 align:middle line:84%
As I said, we also have the
user Jane, Nancy, and Shawn.

00:18:55.940 --> 00:18:59.855 align:middle line:84%
Obviously, we were able to
enumerate that from the shares.

00:18:59.855 --> 00:19:01.730 align:middle line:84%
And then, of course, it
enumerates the shares

00:19:01.730 --> 00:19:04.310 align:middle line:84%
that we were able to obtain
with smbmap and, of course,

00:19:04.310 --> 00:19:06.170 align:middle line:90%
smbclient.

00:19:06.170 --> 00:19:08.510 align:middle line:84%
So it's going to attempt
to map the shares,

00:19:08.510 --> 00:19:12.490 align:middle line:84%
and it'll do that
successfully right over there.

00:19:12.490 --> 00:19:14.910 align:middle line:84%
And then, of course, it'll go
through the password policy

00:19:14.910 --> 00:19:19.350 align:middle line:84%
information here, which can
be quite important, especially

00:19:19.350 --> 00:19:21.750 align:middle line:90%
if SSH is running on the target.

00:19:21.750 --> 00:19:26.333 align:middle line:84%
And then it will obtain the SIDs
for the actual user accounts.

00:19:26.333 --> 00:19:27.750 align:middle line:84%
So right over here,
you can see it

00:19:27.750 --> 00:19:31.470 align:middle line:84%
obtains the actual SIDs
for all of the users,

00:19:31.470 --> 00:19:33.030 align:middle line:90%
so on, and so forth.

00:19:33.030 --> 00:19:37.590 align:middle line:84%
And you can see these
are the actual groups.

00:19:37.590 --> 00:19:38.410 align:middle line:90%
And there we are.

00:19:38.410 --> 00:19:42.450 align:middle line:84%
So that is how to use enum4linux
to perform enumeration

00:19:42.450 --> 00:19:43.720 align:middle line:90%
on SAMBA.

00:19:43.720 --> 00:19:44.220 align:middle line:90%
All right.

00:19:44.220 --> 00:19:47.910 align:middle line:84%
So now, that we've
explored these three tools,

00:19:47.910 --> 00:19:50.520 align:middle line:84%
this is going to conclude
the practical demonstration

00:19:50.520 --> 00:19:53.730 align:middle line:90%
side of this video.

00:19:53.730 --> 00:19:54.230 align:middle line:90%
All right.

00:19:54.230 --> 00:19:56.060 align:middle line:84%
So now that we've
taken a look at how

00:19:56.060 --> 00:19:58.940 align:middle line:84%
to exploit services
running on Linux

00:19:58.940 --> 00:20:02.820 align:middle line:84%
or some of the frequently
exploited Linux services,

00:20:02.820 --> 00:20:06.410 align:middle line:84%
we can now turn our attention to
performing privilege escalation

00:20:06.410 --> 00:20:09.920 align:middle line:84%
on Linux systems through
inherent vulnerabilities

00:20:09.920 --> 00:20:12.710 align:middle line:84%
or misconfigurations
that you will typically

00:20:12.710 --> 00:20:16.110 align:middle line:84%
find on a Linux system after
you have gained access.

00:20:16.110 --> 00:20:16.610 align:middle line:90%
All right.

00:20:16.610 --> 00:20:20.200 align:middle line:84%
So I'll be seeing you
in the next section.

00:20:20.200 --> 00:20:21.417 align:middle line:90%