WEBVTT

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


00:00:03.395 --> 00:00:05.335 align:middle line:90%
[AUDIO LOGO]

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


00:00:10.200 --> 00:00:13.410 align:middle line:90%
Exploiting SMB with PsExec.

00:00:13.410 --> 00:00:15.000 align:middle line:84%
Now that we've
taken a look at how

00:00:15.000 --> 00:00:19.650 align:middle line:84%
to exploit WebDAV running on
a Microsoft IIS web server,

00:00:19.650 --> 00:00:23.850 align:middle line:84%
we can begin exploring the other
frequently exploited services

00:00:23.850 --> 00:00:25.830 align:middle line:90%
that we had explored previously.

00:00:25.830 --> 00:00:28.800 align:middle line:84%
And the next one, in this
case, is going to be SMB.

00:00:28.800 --> 00:00:30.750 align:middle line:84%
So to start off,
we are going to be

00:00:30.750 --> 00:00:33.360 align:middle line:84%
taking a look at how
we can exploit SMB

00:00:33.360 --> 00:00:37.020 align:middle line:84%
through the use of a
utility called PsExec.

00:00:37.020 --> 00:00:40.020 align:middle line:84%
However, before we get started
with the practical aspect

00:00:40.020 --> 00:00:42.240 align:middle line:84%
of this video, let's
get an understanding

00:00:42.240 --> 00:00:46.830 align:middle line:84%
of what SMB is and how it works
in terms of authentication

00:00:46.830 --> 00:00:50.250 align:middle line:84%
as well as what PsExec
is and how we can use it

00:00:50.250 --> 00:00:53.140 align:middle line:84%
to gain access to
a target system.

00:00:53.140 --> 00:00:57.390 align:middle line:84%
So starting off with SMB, SMB
stands for the Server Message

00:00:57.390 --> 00:01:01.290 align:middle line:84%
Block, and it is a network
file sharing protocol

00:01:01.290 --> 00:01:03.870 align:middle line:84%
that is used to facilitate
the sharing of files

00:01:03.870 --> 00:01:07.050 align:middle line:84%
and peripherals like
printers and serial ports

00:01:07.050 --> 00:01:11.550 align:middle line:84%
between computers on a local
network also known as a LAN.

00:01:11.550 --> 00:01:16.110 align:middle line:84%
Now, SMB utilizes
port 445 on TCP.

00:01:16.110 --> 00:01:22.230 align:middle line:84%
However, originally, SMB ran on
top of NetBIOS using port 139.

00:01:22.230 --> 00:01:25.170 align:middle line:84%
So if you've ever worked
within a Windows environment

00:01:25.170 --> 00:01:29.340 align:middle line:84%
or if you own a Windows system,
you'll know what SMB is.

00:01:29.340 --> 00:01:32.730 align:middle line:84%
In the standard context,
SMB is frequently

00:01:32.730 --> 00:01:36.930 align:middle line:84%
used to share printers
or, in certain scenarios,

00:01:36.930 --> 00:01:40.200 align:middle line:84%
you set up a file
share or a folder share

00:01:40.200 --> 00:01:43.620 align:middle line:84%
where other computers on that
particular local area network

00:01:43.620 --> 00:01:45.000 align:middle line:90%
can access that share.

00:01:45.000 --> 00:01:48.180 align:middle line:84%
And in order to access it, you
can disable authentication.

00:01:48.180 --> 00:01:50.950 align:middle line:84%
However, in most cases,
authentication is enabled.

00:01:50.950 --> 00:01:53.910 align:middle line:84%
And if enabled, a
user would typically

00:01:53.910 --> 00:01:56.850 align:middle line:84%
have to provide a
username and password that

00:01:56.850 --> 00:01:59.550 align:middle line:84%
is on the SMB server in
order to authenticate.

00:01:59.550 --> 00:02:01.950 align:middle line:84%
If it's a standard
file share or just

00:02:01.950 --> 00:02:04.710 align:middle line:84%
a standard share with
a restricted password,

00:02:04.710 --> 00:02:07.260 align:middle line:84%
then a user or a client
would essentially

00:02:07.260 --> 00:02:09.870 align:middle line:84%
have to provide a password
in order to gain access

00:02:09.870 --> 00:02:12.000 align:middle line:90%
to that particular share.

00:02:12.000 --> 00:02:13.920 align:middle line:84%
Now, there's one
key thing that you

00:02:13.920 --> 00:02:17.430 align:middle line:84%
need to note and take or
pay close attention to,

00:02:17.430 --> 00:02:18.720 align:middle line:90%
and that is SAMBA.

00:02:18.720 --> 00:02:21.900 align:middle line:84%
So when working within
different environments,

00:02:21.900 --> 00:02:25.440 align:middle line:84%
you may come across another
service or protocol running

00:02:25.440 --> 00:02:27.720 align:middle line:90%
on port 445, called SAMBA.

00:02:27.720 --> 00:02:32.010 align:middle line:84%
SAMBA is the open source
Linux implementation of SMB

00:02:32.010 --> 00:02:35.640 align:middle line:84%
and is used to allow Windows
systems to access Linux shares

00:02:35.640 --> 00:02:36.520 align:middle line:90%
and devices.

00:02:36.520 --> 00:02:39.150 align:middle line:84%
So again, it's very
important to know

00:02:39.150 --> 00:02:41.910 align:middle line:84%
that SMB is the
protocol on Windows

00:02:41.910 --> 00:02:44.640 align:middle line:84%
and SAMBA is the open
source implementation

00:02:44.640 --> 00:02:46.510 align:middle line:90%
of SMB for Linux systems.

00:02:46.510 --> 00:02:49.140 align:middle line:84%
So that's something that you
need to pay close attention to.

00:02:49.140 --> 00:02:50.970 align:middle line:84%
And of course, we'll
be taking a look

00:02:50.970 --> 00:02:55.320 align:middle line:84%
at how we can exploit SAMBA in
the Linux exploitation section.

00:02:55.320 --> 00:03:00.120 align:middle line:84%
For now, we are going to be
dealing exclusively with SMB.

00:03:00.120 --> 00:03:02.850 align:middle line:84%
So now that we have
an idea of what SMB is

00:03:02.850 --> 00:03:04.710 align:middle line:84%
and what it can
be used for, let's

00:03:04.710 --> 00:03:06.870 align:middle line:90%
go back to SMB authentication.

00:03:06.870 --> 00:03:09.960 align:middle line:84%
So the SMB protocol
utilizes two levels

00:03:09.960 --> 00:03:14.040 align:middle line:84%
of authentication, namely,
user authentication and share

00:03:14.040 --> 00:03:15.210 align:middle line:90%
authentication.

00:03:15.210 --> 00:03:17.220 align:middle line:84%
In the case of user
authentication,

00:03:17.220 --> 00:03:19.890 align:middle line:84%
users must provide a
username and password

00:03:19.890 --> 00:03:22.860 align:middle line:84%
in order to authenticate
with the SMB server in order

00:03:22.860 --> 00:03:24.270 align:middle line:90%
to access a share.

00:03:24.270 --> 00:03:26.700 align:middle line:84%
In the case of share
authentication,

00:03:26.700 --> 00:03:28.800 align:middle line:84%
users must provide
a password in order

00:03:28.800 --> 00:03:30.750 align:middle line:90%
to access a restricted share.

00:03:30.750 --> 00:03:33.930 align:middle line:84%
It's important to note that both
of these authentication levels

00:03:33.930 --> 00:03:37.900 align:middle line:84%
or types utilize a challenge
response authentication system.

00:03:37.900 --> 00:03:40.320 align:middle line:84%
And I'll explain this
in a few seconds.

00:03:40.320 --> 00:03:42.340 align:middle line:84%
So if we take a look
at this diagram here,

00:03:42.340 --> 00:03:44.280 align:middle line:84%
we can see that we
have a client that's,

00:03:44.280 --> 00:03:48.120 align:middle line:84%
again, trying to connect to
a Windows system that has SMB

00:03:48.120 --> 00:03:48.780 align:middle line:90%
set up.

00:03:48.780 --> 00:03:52.290 align:middle line:84%
And it does not necessarily
have to be the case that they

00:03:52.290 --> 00:03:54.030 align:middle line:90%
want to access a share.

00:03:54.030 --> 00:03:56.910 align:middle line:84%
In the case of
exploitation, any system

00:03:56.910 --> 00:03:59.640 align:middle line:84%
running SMB or
any Windows system

00:03:59.640 --> 00:04:03.600 align:middle line:84%
running SMB for that matter can
actually be authenticated with.

00:04:03.600 --> 00:04:06.450 align:middle line:84%
Now, in order to authenticate
with an SMB server,

00:04:06.450 --> 00:04:11.220 align:middle line:84%
you need to provide the user
account credentials, really,

00:04:11.220 --> 00:04:12.870 align:middle line:84%
any user account
credentials that

00:04:12.870 --> 00:04:14.530 align:middle line:90%
are on that Windows system.

00:04:14.530 --> 00:04:16.320 align:middle line:84%
So again, that's
something that you

00:04:16.320 --> 00:04:17.910 align:middle line:90%
need to be very cognizant of.

00:04:17.910 --> 00:04:22.019 align:middle line:84%
So if I want to connect to a
Windows system that has SMB

00:04:22.019 --> 00:04:25.770 align:middle line:84%
set up, I would essentially
send an authentication request

00:04:25.770 --> 00:04:30.210 align:middle line:84%
with the username that I want to
authenticate as the server that

00:04:30.210 --> 00:04:33.510 align:middle line:84%
will essentially return a
response telling the client

00:04:33.510 --> 00:04:37.800 align:middle line:84%
to encrypt a random string
with the user's hash.

00:04:37.800 --> 00:04:39.600 align:middle line:84%
And they're referring
to the actual user

00:04:39.600 --> 00:04:41.340 align:middle line:84%
that we want to
authenticate with.

00:04:41.340 --> 00:04:44.790 align:middle line:84%
So the client will then encrypt
the string with the user's hash

00:04:44.790 --> 00:04:47.350 align:middle line:90%
and will then send a response.

00:04:47.350 --> 00:04:50.730 align:middle line:84%
And the response is going to
include the encrypted string.

00:04:50.730 --> 00:04:54.890 align:middle line:84%
The server will then check
and see whether the actual--

00:04:54.890 --> 00:04:57.660 align:middle line:84%
whether the actual encrypted
string value that they have,

00:04:57.660 --> 00:05:01.080 align:middle line:84%
that they obtained from the
user's hash on that system

00:05:01.080 --> 00:05:03.940 align:middle line:84%
is correct or matches
the encrypted string

00:05:03.940 --> 00:05:05.720 align:middle line:90%
that's been sent by the client.

00:05:05.720 --> 00:05:07.960 align:middle line:84%
If it does match,
access granted.

00:05:07.960 --> 00:05:11.020 align:middle line:84%
If it doesn't match,
then access is denied.

00:05:11.020 --> 00:05:14.320 align:middle line:84%
So that is, really at a
very basic level, how--

00:05:14.320 --> 00:05:16.810 align:middle line:84%
or really the process
of SMB authentication.

00:05:16.810 --> 00:05:19.990 align:middle line:84%
So again, we're not getting
into the nitty gritty of how

00:05:19.990 --> 00:05:21.970 align:middle line:84%
the protocol works,
but it's very important

00:05:21.970 --> 00:05:26.270 align:middle line:84%
that you understand how
authentication is performed.

00:05:26.270 --> 00:05:28.840 align:middle line:90%
Now, what is PsExec?

00:05:28.840 --> 00:05:32.110 align:middle line:84%
PsExec is a lightweight
telnet replacement

00:05:32.110 --> 00:05:34.540 align:middle line:84%
that was developed by
Microsoft, and allows

00:05:34.540 --> 00:05:37.990 align:middle line:84%
you to execute processes on
remote Windows systems using

00:05:37.990 --> 00:05:40.090 align:middle line:90%
any user's credentials.

00:05:40.090 --> 00:05:43.360 align:middle line:84%
And PsExec authentication
is performed via SMB.

00:05:43.360 --> 00:05:46.120 align:middle line:84%
So we can utilize
the PsExec utility

00:05:46.120 --> 00:05:48.250 align:middle line:84%
to authenticate with
the target system

00:05:48.250 --> 00:05:51.820 align:middle line:84%
legitimately and run arbitrary
commands on the Windows system

00:05:51.820 --> 00:05:54.070 align:middle line:84%
or launch a remote
command prompt,

00:05:54.070 --> 00:05:55.780 align:middle line:90%
which we'll be exploring.

00:05:55.780 --> 00:05:58.900 align:middle line:84%
And the key thing that you
need to be aware of here

00:05:58.900 --> 00:06:01.300 align:middle line:84%
is that it's very
similar to RDP,

00:06:01.300 --> 00:06:04.060 align:middle line:84%
however, instead of
controlling the remote system

00:06:04.060 --> 00:06:07.090 align:middle line:84%
via graphical user
interface, PsExec

00:06:07.090 --> 00:06:10.120 align:middle line:84%
essentially allows you
to send commands via CMD

00:06:10.120 --> 00:06:13.000 align:middle line:84%
or send singular commands
that are executed,

00:06:13.000 --> 00:06:15.760 align:middle line:84%
after which the output
is then provided to us.

00:06:15.760 --> 00:06:19.510 align:middle line:84%
Or you can launch a CMD session
and obtain a command prompt

00:06:19.510 --> 00:06:21.280 align:middle line:90%
on the target system remotely.

00:06:21.280 --> 00:06:24.550 align:middle line:84%
In order to utilize
PsExec, you need

00:06:24.550 --> 00:06:27.160 align:middle line:84%
to provide legitimate
credentials, as I've mentioned.

00:06:27.160 --> 00:06:31.090 align:middle line:84%
And before we actually
start using PsExec,

00:06:31.090 --> 00:06:32.530 align:middle line:84%
we need to obtain
this credential.

00:06:32.530 --> 00:06:36.160 align:middle line:84%
So in order to utilize PsExec
to gain access to a Windows

00:06:36.160 --> 00:06:39.100 align:middle line:84%
target, we will need to identify
legitimate user accounts

00:06:39.100 --> 00:06:40.580 align:middle line:90%
and their perspective--

00:06:40.580 --> 00:06:43.300 align:middle line:84%
their respective passwords
or password hashes.

00:06:43.300 --> 00:06:46.910 align:middle line:84%
This can be done by leveraging
various tools and techniques.

00:06:46.910 --> 00:06:48.910 align:middle line:84%
However, the most
common technique

00:06:48.910 --> 00:06:52.990 align:middle line:84%
will involve performing an
SMB login brute force attack.

00:06:52.990 --> 00:06:54.355 align:middle line:90%
So that's right.

00:06:54.355 --> 00:06:56.020 align:middle line:84%
You might be
wondering to yourself,

00:06:56.020 --> 00:06:58.150 align:middle line:90%
could we ever brute force SMB?

00:06:58.150 --> 00:06:59.020 align:middle line:90%
Indeed, you can.

00:06:59.020 --> 00:07:03.790 align:middle line:84%
So if we are trying to perform
user authentication with SMB,

00:07:03.790 --> 00:07:07.360 align:middle line:84%
we can utilize the protocol to
perform a brute force attack.

00:07:07.360 --> 00:07:09.820 align:middle line:84%
And we can narrow down
our brute force attack

00:07:09.820 --> 00:07:12.250 align:middle line:84%
to only include common
Windows user accounts

00:07:12.250 --> 00:07:14.020 align:middle line:90%
like the administrator account.

00:07:14.020 --> 00:07:16.720 align:middle line:84%
And that's very important
because a Windows account

00:07:16.720 --> 00:07:18.460 align:middle line:84%
can have multiple
accounts configured

00:07:18.460 --> 00:07:19.870 align:middle line:90%
with different names.

00:07:19.870 --> 00:07:22.180 align:middle line:84%
But the only constant
on a Windows system

00:07:22.180 --> 00:07:25.840 align:middle line:84%
is the administrator account
because every Windows operating

00:07:25.840 --> 00:07:28.330 align:middle line:84%
system has an
administrator account,

00:07:28.330 --> 00:07:31.465 align:middle line:84%
and this administrator
grant is the first account

00:07:31.465 --> 00:07:32.920 align:middle line:90%
that is created.

00:07:32.920 --> 00:07:35.230 align:middle line:84%
So we can narrow down
our brute force attack

00:07:35.230 --> 00:07:38.650 align:middle line:84%
to only target the administrator
username, after which we

00:07:38.650 --> 00:07:41.740 align:middle line:84%
can perform a brute force
with a password list,

00:07:41.740 --> 00:07:44.800 align:middle line:84%
and hopefully, identify
credentials that we can then

00:07:44.800 --> 00:07:46.060 align:middle line:90%
use with PsExec.

00:07:46.060 --> 00:07:49.030 align:middle line:84%
So after we've obtained
a legitimate user

00:07:49.030 --> 00:07:51.850 align:middle line:84%
account and password, we
can use the credentials

00:07:51.850 --> 00:07:54.910 align:middle line:84%
to authenticate with the
target system via PsExec,

00:07:54.910 --> 00:07:57.130 align:middle line:84%
and execute arbitrary
system commands,

00:07:57.130 --> 00:08:00.010 align:middle line:84%
or obtain a reverse shell
or an Meterpreter session

00:08:00.010 --> 00:08:00.970 align:middle line:90%
for that matter.

00:08:00.970 --> 00:08:02.380 align:middle line:84%
And of course,
this is what we're

00:08:02.380 --> 00:08:04.690 align:middle line:84%
going to be exploring within
the practical section.

00:08:04.690 --> 00:08:07.255 align:middle line:84%
So start up your
lab environment,

00:08:07.255 --> 00:08:09.490 align:middle line:84%
as will I. And we
can get started

00:08:09.490 --> 00:08:11.290 align:middle line:84%
with the practical
demonstration.

00:08:11.290 --> 00:08:15.990 align:middle line:84%
And I'll see you within
the lab environment.

00:08:15.990 --> 00:08:18.190 align:middle line:84%
All right, so I'm in
the lab environment.

00:08:18.190 --> 00:08:21.042 align:middle line:84%
And you will be provided
with the target IP address.

00:08:21.042 --> 00:08:22.750 align:middle line:84%
In your case, it's
going to be different.

00:08:22.750 --> 00:08:24.670 align:middle line:84%
So I'm just going
to copy this here.

00:08:24.670 --> 00:08:27.360 align:middle line:84%
And the first step in
the exploitation process

00:08:27.360 --> 00:08:29.850 align:middle line:84%
will essentially involve
identifying open ports

00:08:29.850 --> 00:08:31.890 align:middle line:90%
and services with Nmap.

00:08:31.890 --> 00:08:35.010 align:middle line:84%
So I'll just open up a
terminal and I'll Zoom in here.

00:08:35.010 --> 00:08:37.409 align:middle line:84%
And we can perform an
Nmap scan on the target

00:08:37.409 --> 00:08:40.980 align:middle line:84%
by saying Nmap sV so to perform
service version detection.

00:08:40.980 --> 00:08:44.159 align:middle line:84%
We can also run the
default Nmap scripts

00:08:44.159 --> 00:08:46.260 align:middle line:84%
through the use
of the sC command.

00:08:46.260 --> 00:08:49.090 align:middle line:84%
And then we can paste in
the target IP address here.

00:08:49.090 --> 00:08:50.340 align:middle line:90%
So I'm going to hit Enter.

00:08:50.340 --> 00:08:52.257 align:middle line:84%
And I'm going to give
this a couple of seconds

00:08:52.257 --> 00:08:55.330 align:middle line:90%
to a couple of minutes.

00:08:55.330 --> 00:08:57.560 align:middle line:84%
All right, the Nmap
scan is complete.

00:08:57.560 --> 00:09:01.540 align:middle line:84%
And as you can see here we
have SMB running on port 445.

00:09:01.540 --> 00:09:05.210 align:middle line:84%
And again, as for the
host script results,

00:09:05.210 --> 00:09:08.320 align:middle line:84%
we can see that it is
running SMB version 2.

00:09:08.320 --> 00:09:11.290 align:middle line:84%
And message signing is
enabled but not required.

00:09:11.290 --> 00:09:13.900 align:middle line:84%
So that means that
we can authenticate

00:09:13.900 --> 00:09:16.000 align:middle line:90%
with this system via PsExec.

00:09:16.000 --> 00:09:20.350 align:middle line:84%
So the next step, of course will
involve a performing the SMB

00:09:20.350 --> 00:09:21.190 align:middle line:90%
brute force.

00:09:21.190 --> 00:09:24.130 align:middle line:84%
And this can be automated
through the use of a Metasploit

00:09:24.130 --> 00:09:26.572 align:middle line:84%
module, which I'm going
to show you right now.

00:09:26.572 --> 00:09:28.780 align:middle line:84%
So to start up Metasploit,
we're going to say service

00:09:28.780 --> 00:09:30.970 align:middle line:90%
postgresql start.

00:09:30.970 --> 00:09:33.370 align:middle line:84%
And we can then
launch MSF console.

00:09:33.370 --> 00:09:35.110 align:middle line:84%
And the reason I'm
starting postgresql

00:09:35.110 --> 00:09:37.030 align:middle line:84%
is because the Metasploit
framework console

00:09:37.030 --> 00:09:39.820 align:middle line:84%
utilizes a database
that is configured

00:09:39.820 --> 00:09:41.470 align:middle line:90%
to run with postgresql.

00:09:41.470 --> 00:09:42.850 align:middle line:90%
So we'll hit Enter.

00:09:42.850 --> 00:09:44.800 align:middle line:84%
That's going to
start postgresql.

00:09:44.800 --> 00:09:47.230 align:middle line:84%
And it's then going to
start up MSF console.

00:09:47.230 --> 00:09:49.630 align:middle line:84%
So we'll give this a couple
of seconds to start up.

00:09:49.630 --> 00:09:52.440 align:middle line:90%


00:09:52.440 --> 00:09:54.690 align:middle line:84%
All right, so MSF
console is started up,

00:09:54.690 --> 00:09:57.310 align:middle line:84%
and we can now search for the
module that we're looking for.

00:09:57.310 --> 00:09:58.470 align:middle line:90%
So I'm going to say search.

00:09:58.470 --> 00:10:02.530 align:middle line:84%
And we are looking for
SMB underscore login.

00:10:02.530 --> 00:10:04.280 align:middle line:84%
There we are, and
that's the module there.

00:10:04.280 --> 00:10:05.840 align:middle line:84%
This is an auxiliary
module, which

00:10:05.840 --> 00:10:08.450 align:middle line:84%
means it's pretty much used
for information gathering

00:10:08.450 --> 00:10:09.860 align:middle line:90%
or for brute forcing.

00:10:09.860 --> 00:10:11.720 align:middle line:84%
So we'll copy that,
and we can then

00:10:11.720 --> 00:10:15.180 align:middle line:90%
say use, paste that in there.

00:10:15.180 --> 00:10:17.910 align:middle line:84%
We can then show the
options for this module.

00:10:17.910 --> 00:10:19.760 align:middle line:90%
And we have quite a few options.

00:10:19.760 --> 00:10:21.950 align:middle line:84%
The ones that we are
going to be essentially

00:10:21.950 --> 00:10:25.220 align:middle line:84%
setting or configuring is going
to be the RHOSTS option, which

00:10:25.220 --> 00:10:26.570 align:middle line:90%
is the target IP.

00:10:26.570 --> 00:10:29.300 align:middle line:84%
The RPORT option has been
configured correctly,

00:10:29.300 --> 00:10:30.800 align:middle line:90%
which is port 445.

00:10:30.800 --> 00:10:34.640 align:middle line:84%
That is indeed the port that
SMB is running on on the target.

00:10:34.640 --> 00:10:37.190 align:middle line:84%
You can also specify
the SMB domain

00:10:37.190 --> 00:10:39.440 align:middle line:84%
if the target system
is part of a domain.

00:10:39.440 --> 00:10:40.760 align:middle line:90%
So that's very important.

00:10:40.760 --> 00:10:44.250 align:middle line:84%
In this case, the target system
is not part of any domain.

00:10:44.250 --> 00:10:48.620 align:middle line:84%
And then you can specify the
SMB password or the SMB user

00:10:48.620 --> 00:10:50.390 align:middle line:84%
in order to verify
authentication.

00:10:50.390 --> 00:10:53.090 align:middle line:84%
But in this, case because we
are performing a brute force

00:10:53.090 --> 00:10:55.670 align:middle line:84%
attack, we need to specify
the user file, which

00:10:55.670 --> 00:10:58.220 align:middle line:84%
is a file that contains
a list of usernames

00:10:58.220 --> 00:11:01.250 align:middle line:84%
that we want to brute force or
perform the brute force with.

00:11:01.250 --> 00:11:04.160 align:middle line:84%
And we also need to provide
the password file right

00:11:04.160 --> 00:11:07.040 align:middle line:84%
over here which contains
a list of passwords

00:11:07.040 --> 00:11:09.710 align:middle line:84%
that we want to perform
the brute force with.

00:11:09.710 --> 00:11:12.290 align:middle line:84%
So again, as I said,
we can narrow down

00:11:12.290 --> 00:11:16.140 align:middle line:84%
the actual brute force by
specifying the username.

00:11:16.140 --> 00:11:19.790 align:middle line:84%
So for example, we can specify
the actual username alone

00:11:19.790 --> 00:11:21.650 align:middle line:84%
and say that we only
want to brute force

00:11:21.650 --> 00:11:23.940 align:middle line:84%
the passwords for
one user account.

00:11:23.940 --> 00:11:26.970 align:middle line:84%
However, in this case, I want to
show you something interesting.

00:11:26.970 --> 00:11:30.290 align:middle line:84%
So the first option we'll
set is the user file option.

00:11:30.290 --> 00:11:31.550 align:middle line:90%
So user file.

00:11:31.550 --> 00:11:34.280 align:middle line:84%
And the word list
that we'll be using

00:11:34.280 --> 00:11:37.910 align:middle line:84%
is on the user share
Metasploit framework.

00:11:37.910 --> 00:11:41.330 align:middle line:84%
And we are going to be utilizing
the word lists on the data,

00:11:41.330 --> 00:11:42.920 align:middle line:90%
so data word lists.

00:11:42.920 --> 00:11:47.300 align:middle line:84%
And we are looking for common
underscore users dot txt.

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

00:11:48.410 --> 00:11:51.170 align:middle line:84%
We then want to set up the
password file, which again,

00:11:51.170 --> 00:11:53.480 align:middle line:84%
contains the passes
that we want to perform

00:11:53.480 --> 00:11:54.620 align:middle line:90%
the brute force with.

00:11:54.620 --> 00:12:00.750 align:middle line:84%
And that is on the user share
Metasploit framework data word

00:12:00.750 --> 00:12:02.150 align:middle line:90%
lists.

00:12:02.150 --> 00:12:06.030 align:middle line:84%
And in this case, we will use
Unix underscore passwords.

00:12:06.030 --> 00:12:08.810 align:middle line:84%
Now, as I said, this is for
the purpose of demonstration.

00:12:08.810 --> 00:12:10.940 align:middle line:84%
In your case, you
may want to utilize

00:12:10.940 --> 00:12:14.190 align:middle line:84%
another word list or another
collection of word lists.

00:12:14.190 --> 00:12:15.860 align:middle line:84%
And of course, you
have the ability

00:12:15.860 --> 00:12:17.630 align:middle line:84%
to create your own
word lists based

00:12:17.630 --> 00:12:21.860 align:middle line:84%
on some of the individuals
working on these computers

00:12:21.860 --> 00:12:25.010 align:middle line:84%
or identifying common
usernames that you can

00:12:25.010 --> 00:12:26.720 align:middle line:90%
perform the brute force with.

00:12:26.720 --> 00:12:28.370 align:middle line:84%
However, the success
of this attack

00:12:28.370 --> 00:12:30.350 align:middle line:84%
will depend on the
password list that you

00:12:30.350 --> 00:12:33.770 align:middle line:84%
choose to use because the
password list that you choose

00:12:33.770 --> 00:12:35.840 align:middle line:84%
to use will
essentially determine

00:12:35.840 --> 00:12:37.730 align:middle line:90%
your chances of success.

00:12:37.730 --> 00:12:39.020 align:middle line:90%
So we'll enter.

00:12:39.020 --> 00:12:41.810 align:middle line:84%
And now that is set,
we can then set up

00:12:41.810 --> 00:12:45.110 align:middle line:84%
the target IP, which is done
by saying set our hosts.

00:12:45.110 --> 00:12:48.180 align:middle line:84%
And I'll just copy
the target IP here.

00:12:48.180 --> 00:12:49.610 align:middle line:90%
There we go, copy.

00:12:49.610 --> 00:12:51.620 align:middle line:90%
And we'll paste it in here.

00:12:51.620 --> 00:12:53.240 align:middle line:90%
And we can then hit Run.

00:12:53.240 --> 00:12:56.240 align:middle line:84%
However, there are a few options
that we can also configure here

00:12:56.240 --> 00:12:59.040 align:middle line:84%
to limit the output of
this particular module.

00:12:59.040 --> 00:13:02.430 align:middle line:84%
And in this case, the option
that we are going to change--

00:13:02.430 --> 00:13:06.640 align:middle line:84%
and if I can just Zoom
out a little bit here--

00:13:06.640 --> 00:13:09.180 align:middle line:84%
there we go, we should get
that data displayed correctly.

00:13:09.180 --> 00:13:12.120 align:middle line:84%
The option that we can change
here is the verbose option.

00:13:12.120 --> 00:13:14.280 align:middle line:84%
The verbose option
will essentially

00:13:14.280 --> 00:13:17.200 align:middle line:84%
determine whether or not to
print out the output for all

00:13:17.200 --> 00:13:17.700 align:middle line:90%
attempts.

00:13:17.700 --> 00:13:20.040 align:middle line:84%
In our case, we
want to only display

00:13:20.040 --> 00:13:22.260 align:middle line:84%
the successful
authentication attempts.

00:13:22.260 --> 00:13:25.530 align:middle line:84%
Therefore, display
the actual credentials

00:13:25.530 --> 00:13:28.740 align:middle line:84%
that have successfully
been able to authenticate

00:13:28.740 --> 00:13:30.880 align:middle line:90%
with SMB on the target system.

00:13:30.880 --> 00:13:34.650 align:middle line:84%
So we will set the
verbose option to false,

00:13:34.650 --> 00:13:36.432 align:middle line:90%
and we can then hit Run.

00:13:36.432 --> 00:13:37.890 align:middle line:84%
So what I'm going
to do is I'm just

00:13:37.890 --> 00:13:40.890 align:middle line:84%
going to Zoom in a little bit
here and I'm going to hit Run.

00:13:40.890 --> 00:13:43.590 align:middle line:84%
And we'll give this a couple of
seconds to a couple of minutes.

00:13:43.590 --> 00:13:45.090 align:middle line:84%
And of course,
already, we have been

00:13:45.090 --> 00:13:48.960 align:middle line:84%
able to identify an account
called sysadmin on the target,

00:13:48.960 --> 00:13:50.580 align:middle line:90%
and the password is samantha.

00:13:50.580 --> 00:13:54.380 align:middle line:84%
So again, I'm just going to
wait for this to complete.

00:13:54.380 --> 00:13:56.320 align:middle line:84%
All right, so the brute
force is complete.

00:13:56.320 --> 00:13:58.180 align:middle line:84%
That took a few
minutes, so don't worry

00:13:58.180 --> 00:13:59.830 align:middle line:90%
if it takes time on yours.

00:13:59.830 --> 00:14:03.280 align:middle line:84%
And you can see we've identified
about four user accounts

00:14:03.280 --> 00:14:04.510 align:middle line:90%
with their passwords.

00:14:04.510 --> 00:14:07.060 align:middle line:84%
And the one that we're
interested in particular

00:14:07.060 --> 00:14:09.010 align:middle line:84%
here is the
administrator account.

00:14:09.010 --> 00:14:12.100 align:middle line:84%
So on our first try, we've
been able to identify

00:14:12.100 --> 00:14:14.320 align:middle line:84%
the administrator password,
which in this case

00:14:14.320 --> 00:14:20.040 align:middle line:84%
is qwertyuiop, which is
a very simple password.

00:14:20.040 --> 00:14:21.790 align:middle line:84%
But again, this was
set up for the purpose

00:14:21.790 --> 00:14:24.070 align:middle line:90%
of demonstrating this attack.

00:14:24.070 --> 00:14:26.770 align:middle line:84%
So we can utilize
these credentials

00:14:26.770 --> 00:14:31.210 align:middle line:84%
in order to authenticate with
the target system via PsExec.

00:14:31.210 --> 00:14:33.340 align:middle line:90%
So let's open up a new tab here.

00:14:33.340 --> 00:14:37.960 align:middle line:84%
And again, the PsExec
utility is a Windows utility

00:14:37.960 --> 00:14:40.240 align:middle line:90%
or a portable executable.

00:14:40.240 --> 00:14:45.160 align:middle line:84%
However, we can't execute
executables on a Linux system.

00:14:45.160 --> 00:14:47.920 align:middle line:84%
Of course, we can do this
through the use of Wine.

00:14:47.920 --> 00:14:52.690 align:middle line:84%
However, there is a really nifty
tool or Python script rather

00:14:52.690 --> 00:14:55.150 align:middle line:90%
called exactly psexec.py.

00:14:55.150 --> 00:14:57.400 align:middle line:84%
And if I can just find
it here-- there we are.

00:14:57.400 --> 00:15:00.010 align:middle line:84%
So psexec.py, that
is essentially

00:15:00.010 --> 00:15:03.190 align:middle line:84%
a Python implementation of
the PsExec exec utility,

00:15:03.190 --> 00:15:05.980 align:middle line:84%
and essentially allows us to
authenticate with a target

00:15:05.980 --> 00:15:07.790 align:middle line:84%
system, and it's
really very simple.

00:15:07.790 --> 00:15:13.450 align:middle line:84%
So what we can do is, we can
say psexec.py administrator.

00:15:13.450 --> 00:15:15.070 align:middle line:90%
So we provide the username.

00:15:15.070 --> 00:15:17.560 align:middle line:84%
We then need to
provide the target IP.

00:15:17.560 --> 00:15:19.700 align:middle line:84%
So I'm just going
to copy that there.

00:15:19.700 --> 00:15:23.680 align:middle line:84%
And we're going to say
administrator@ the target IP.

00:15:23.680 --> 00:15:26.440 align:middle line:84%
We can then provide
the actual executable

00:15:26.440 --> 00:15:28.390 align:middle line:84%
or command that we
would like to execute.

00:15:28.390 --> 00:15:31.810 align:middle line:84%
In this case, we want
to obtain a command

00:15:31.810 --> 00:15:34.520 align:middle line:84%
prompt or a command shell
session on the target system.

00:15:34.520 --> 00:15:35.990 align:middle line:90%
So we will say cmd.exe.

00:15:35.990 --> 00:15:39.700 align:middle line:84%
So we're essentially
executing cmd.exe.

00:15:39.700 --> 00:15:41.290 align:middle line:90%
I'm going to hit Enter.

00:15:41.290 --> 00:15:44.620 align:middle line:84%
It's then going to ask you for
the password for that user.

00:15:44.620 --> 00:15:47.240 align:middle line:84%
In this case, we know
what the password is.

00:15:47.240 --> 00:15:50.170 align:middle line:90%
So we'll say qwertyuiop.

00:15:50.170 --> 00:15:51.460 align:middle line:90%
And I'll hit Enter.

00:15:51.460 --> 00:15:55.060 align:middle line:84%
And you can see that it
tells us status logon

00:15:55.060 --> 00:15:58.400 align:middle line:84%
failure, the attempted
log on is invalid.

00:15:58.400 --> 00:16:02.360 align:middle line:84%
Let's see if I have
everything set up correctly.

00:16:02.360 --> 00:16:04.370 align:middle line:90%
So we have psexec.py.

00:16:04.370 --> 00:16:06.560 align:middle line:84%
So I'm just going to type
in the password again.

00:16:06.560 --> 00:16:08.400 align:middle line:90%
So qwertyuiop.

00:16:08.400 --> 00:16:11.260 align:middle line:90%


00:16:11.260 --> 00:16:11.920 align:middle line:90%
There we are.

00:16:11.920 --> 00:16:14.200 align:middle line:84%
And you can see it's
going to request shares.

00:16:14.200 --> 00:16:17.020 align:middle line:84%
It's going to find a
writable share admin.

00:16:17.020 --> 00:16:21.640 align:middle line:84%
It's then going to upload an exe
file, open the service manager,

00:16:21.640 --> 00:16:23.170 align:middle line:90%
and create a new service.

00:16:23.170 --> 00:16:26.020 align:middle line:84%
And we are now working
within that service.

00:16:26.020 --> 00:16:29.180 align:middle line:84%
So we get a command prompt
session on the target system.

00:16:29.180 --> 00:16:32.200 align:middle line:90%
So I can say who am I, like so.

00:16:32.200 --> 00:16:35.050 align:middle line:84%
Nt authority system, so we
have the highest privileges.

00:16:35.050 --> 00:16:37.450 align:middle line:84%
So again, in most
cases, you will always

00:16:37.450 --> 00:16:40.150 align:middle line:84%
want to target the administrator
account because that gives you

00:16:40.150 --> 00:16:41.110 align:middle line:90%
the most access.

00:16:41.110 --> 00:16:44.830 align:middle line:84%
Now of course, we were able to
identify other user accounts

00:16:44.830 --> 00:16:48.160 align:middle line:84%
like auditor, demo, and
sysadmin, which again, will all

00:16:48.160 --> 00:16:50.390 align:middle line:84%
give you a certain
level of access.

00:16:50.390 --> 00:16:53.110 align:middle line:84%
However, that access
will be unprivileged.

00:16:53.110 --> 00:16:55.360 align:middle line:84%
And in this case, we've
been able to gain access

00:16:55.360 --> 00:16:56.650 align:middle line:90%
to the administrator account.

00:16:56.650 --> 00:16:58.610 align:middle line:90%
So this is great.

00:16:58.610 --> 00:17:01.210 align:middle line:84%
And we can utilize this
particular command prompt

00:17:01.210 --> 00:17:02.710 align:middle line:90%
session to do anything we want.

00:17:02.710 --> 00:17:04.660 align:middle line:84%
And the great thing
about this technique

00:17:04.660 --> 00:17:07.404 align:middle line:84%
is, we're not launching any
exploit on the target system.

00:17:07.404 --> 00:17:09.910 align:middle line:90%


00:17:09.910 --> 00:17:13.990 align:middle line:84%
We're utilizing Windows tools,
and utilities, and protocols,

00:17:13.990 --> 00:17:16.510 align:middle line:84%
in order to perform
legitimate authentication

00:17:16.510 --> 00:17:19.750 align:middle line:84%
because we are authenticating
with the actual credentials.

00:17:19.750 --> 00:17:23.349 align:middle line:84%
And that means that we're
not running any exploits

00:17:23.349 --> 00:17:27.220 align:middle line:84%
or uploading any malicious
files to the target system that

00:17:27.220 --> 00:17:28.300 align:middle line:90%
could be detected.

00:17:28.300 --> 00:17:31.240 align:middle line:84%
So this is a very, very
effective exploitation

00:17:31.240 --> 00:17:31.930 align:middle line:90%
technique.

00:17:31.930 --> 00:17:34.930 align:middle line:84%
And of course, if we want
to extend this attack

00:17:34.930 --> 00:17:38.260 align:middle line:84%
to essentially provide us
with a Meterpreter session,

00:17:38.260 --> 00:17:42.682 align:middle line:84%
we can utilize a Metasploit
module right over here.

00:17:42.682 --> 00:17:44.140 align:middle line:84%
I'm just going to
open up that tab,

00:17:44.140 --> 00:17:45.390 align:middle line:90%
and we can search for it here.

00:17:45.390 --> 00:17:48.610 align:middle line:84%
So I'm just going to
say search PsExec.

00:17:48.610 --> 00:17:53.350 align:middle line:84%
And this is a PsExec module
that works essentially on SMB,

00:17:53.350 --> 00:17:54.880 align:middle line:90%
or utilizes SMB.

00:17:54.880 --> 00:17:58.180 align:middle line:84%
And what this module will
do is it will essentially

00:17:58.180 --> 00:18:02.860 align:middle line:84%
authenticate to the target
system via SMB through PsExec.

00:18:02.860 --> 00:18:06.220 align:middle line:84%
It will then upload
a Meterpreter payload

00:18:06.220 --> 00:18:09.970 align:middle line:84%
and execute it, and then provide
us with a Meterpreter session.

00:18:09.970 --> 00:18:11.950 align:middle line:84%
So again, you want to
be cognizant of the fact

00:18:11.950 --> 00:18:15.430 align:middle line:84%
that this is indeed running a
malicious file on the target.

00:18:15.430 --> 00:18:19.240 align:middle line:84%
And you have to be cognizant of
antivirus solutions installed

00:18:19.240 --> 00:18:20.800 align:middle line:84%
on the target that
could detect this.

00:18:20.800 --> 00:18:23.830 align:middle line:84%
So be very careful with
what modules you use.

00:18:23.830 --> 00:18:26.705 align:middle line:84%
As I said, if you're
utilizing PsExec,

00:18:26.705 --> 00:18:28.330 align:middle line:84%
then it's perfectly
fine because you're

00:18:28.330 --> 00:18:31.030 align:middle line:84%
utilizing the credentials, and
we haven't uploaded anything

00:18:31.030 --> 00:18:31.600 align:middle line:90%
yet.

00:18:31.600 --> 00:18:33.640 align:middle line:90%
So I can say use.

00:18:33.640 --> 00:18:37.380 align:middle line:84%
I'll just copy the
module name and say use.

00:18:37.380 --> 00:18:38.010 align:middle line:90%
There we go.

00:18:38.010 --> 00:18:40.530 align:middle line:84%
And it's going to set the
default payload to Windows

00:18:40.530 --> 00:18:42.040 align:middle line:90%
Meterpreter reverse tcp.

00:18:42.040 --> 00:18:45.480 align:middle line:84%
So this is a 32-bit payload,
which in this case, is fine.

00:18:45.480 --> 00:18:49.002 align:middle line:84%
And we can then
say show options.

00:18:49.002 --> 00:18:50.460 align:middle line:84%
And there are a
few options that we

00:18:50.460 --> 00:18:52.530 align:middle line:84%
need to configure
like the target IP.

00:18:52.530 --> 00:18:54.820 align:middle line:84%
The target port is
set up correctly.

00:18:54.820 --> 00:18:57.390 align:middle line:84%
So I'm just going to
copy the target IP here.

00:18:57.390 --> 00:19:01.950 align:middle line:84%
I'm going to say set
RHOSTS to the target IP.

00:19:01.950 --> 00:19:04.800 align:middle line:84%
And we then need to
set up the SMB password

00:19:04.800 --> 00:19:07.630 align:middle line:84%
and username that we,
of course, obtained.

00:19:07.630 --> 00:19:10.460 align:middle line:90%
So we can say set SMB user.

00:19:10.460 --> 00:19:13.750 align:middle line:90%
And this is administrator.

00:19:13.750 --> 00:19:18.820 align:middle line:84%
And we can then say set
SMB pass to qwertyuiop.

00:19:18.820 --> 00:19:22.050 align:middle line:90%


00:19:22.050 --> 00:19:24.270 align:middle line:84%
And we can then hit
Exploit and Run.

00:19:24.270 --> 00:19:26.010 align:middle line:84%
However, before we
do that, you also

00:19:26.010 --> 00:19:28.960 align:middle line:84%
have the ability to configure
the payload options here.

00:19:28.960 --> 00:19:31.830 align:middle line:84%
So I would recommend setting
up the LHOST option, which

00:19:31.830 --> 00:19:33.510 align:middle line:90%
is your Kali Linux IP.

00:19:33.510 --> 00:19:36.850 align:middle line:84%
So that's already set for
me, and the LPORT option,

00:19:36.850 --> 00:19:39.780 align:middle line:84%
which in this case,
the default is 4444.

00:19:39.780 --> 00:19:42.100 align:middle line:84%
So we'll use the
default options here.

00:19:42.100 --> 00:19:44.860 align:middle line:90%
And then we can it Exploit.

00:19:44.860 --> 00:19:45.860 align:middle line:90%
It's going to hit Enter.

00:19:45.860 --> 00:19:46.760 align:middle line:90%
I'm just going to Enter.

00:19:46.760 --> 00:19:48.927 align:middle line:84%
And you can see it's going
to connect to the server.

00:19:48.927 --> 00:19:52.160 align:middle line:84%
It's then going to authenticate
to the server as administrator.

00:19:52.160 --> 00:19:54.380 align:middle line:84%
It will then select
it the partial target

00:19:54.380 --> 00:19:55.880 align:middle line:90%
and execute the payload.

00:19:55.880 --> 00:19:58.710 align:middle line:84%
And as you can see, we get
a Meterpreter session right

00:19:58.710 --> 00:19:59.210 align:middle line:90%
over here.

00:19:59.210 --> 00:20:02.780 align:middle line:84%
And of course, this particular
attack or exploitation

00:20:02.780 --> 00:20:05.730 align:middle line:84%
technique is utilizing
legitimate credentials.

00:20:05.730 --> 00:20:09.230 align:middle line:84%
So the only malicious aspect
of this particular model

00:20:09.230 --> 00:20:12.350 align:middle line:84%
is the fact that it uploads
a malicious payload.

00:20:12.350 --> 00:20:15.630 align:middle line:90%
So we can say sysinfo.

00:20:15.630 --> 00:20:17.730 align:middle line:84%
And you can see
this-- the target is

00:20:17.730 --> 00:20:21.850 align:middle line:84%
running Windows Server 2016
and it is a 64-bit operating

00:20:21.850 --> 00:20:22.350 align:middle line:90%
system.

00:20:22.350 --> 00:20:24.360 align:middle line:84%
And then, of course,
we can say who am I,

00:20:24.360 --> 00:20:27.210 align:middle line:84%
and/or rather get
user ID because we're

00:20:27.210 --> 00:20:28.380 align:middle line:90%
working within Meterpreter.

00:20:28.380 --> 00:20:30.120 align:middle line:84%
And you can see
these our privilege--

00:20:30.120 --> 00:20:33.480 align:middle line:84%
these are our privileges
nt authority system, which

00:20:33.480 --> 00:20:37.500 align:middle line:84%
is the highest privilege level
available on a Windows system.

00:20:37.500 --> 00:20:41.250 align:middle line:84%
So that is going to conclude
the practical demonstration

00:20:41.250 --> 00:20:44.260 align:middle line:90%
side of this video.

00:20:44.260 --> 00:20:46.920 align:middle line:84%
In the next video,
we will be exploring

00:20:46.920 --> 00:20:50.160 align:middle line:84%
the process of exploiting
an inherent vulnerability

00:20:50.160 --> 00:20:51.360 align:middle line:90%
within SMB.

00:20:51.360 --> 00:20:53.440 align:middle line:84%
Some of you may
have heard of it.

00:20:53.440 --> 00:20:56.130 align:middle line:84%
It's called the
EternalBlue exploit.

00:20:56.130 --> 00:20:59.670 align:middle line:84%
This is a remote code
execution vulnerability

00:20:59.670 --> 00:21:02.280 align:middle line:84%
or exploit that we
can use to exploit SMB

00:21:02.280 --> 00:21:03.840 align:middle line:90%
running on a Windows system.

00:21:03.840 --> 00:21:05.820 align:middle line:84%
And of course, this
particular attack

00:21:05.820 --> 00:21:08.970 align:middle line:84%
will not involve the use
of legitimate credentials.

00:21:08.970 --> 00:21:11.010 align:middle line:90%
Instead, as I said, it--

00:21:11.010 --> 00:21:13.710 align:middle line:84%
we can essentially perform
the exploit or attack

00:21:13.710 --> 00:21:14.610 align:middle line:90%
through Metasploit.

00:21:14.610 --> 00:21:17.400 align:middle line:84%
And we can also explore
the various scripts

00:21:17.400 --> 00:21:20.770 align:middle line:84%
or exploit code that can be used
to exploit this vulnerability.

00:21:20.770 --> 00:21:24.200 align:middle line:84%
So I'll see you
in the next video.

00:21:24.200 --> 00:21:25.000 align:middle line:90%