WEBVTT

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


00:00:10.200 --> 00:00:15.000 align:middle line:84%
Exploiting WinRM, also known as
the Windows Remote Management

00:00:15.000 --> 00:00:15.960 align:middle line:90%
Protocol.

00:00:15.960 --> 00:00:17.790 align:middle line:84%
In this video, we'll
be taking a look

00:00:17.790 --> 00:00:21.330 align:middle line:84%
at how to utilize the
Metasploit framework to exploit

00:00:21.330 --> 00:00:23.520 align:middle line:84%
the Windows Remote
Management Protocol.

00:00:23.520 --> 00:00:24.150 align:middle line:90%
All right.

00:00:24.150 --> 00:00:26.100 align:middle line:84%
However, before we
do that, we actually

00:00:26.100 --> 00:00:29.250 align:middle line:84%
need to get an understanding
of what WinRM is

00:00:29.250 --> 00:00:31.350 align:middle line:90%
and what it is used for.

00:00:31.350 --> 00:00:33.870 align:middle line:90%
So what is WinRM?

00:00:33.870 --> 00:00:37.620 align:middle line:84%
WinRM, as I said, stands for
the Windows Remote Management

00:00:37.620 --> 00:00:38.850 align:middle line:90%
Protocol.

00:00:38.850 --> 00:00:41.460 align:middle line:84%
This is a Windows Remote
Management Protocol

00:00:41.460 --> 00:00:44.280 align:middle line:84%
that can be utilized to
facilitate remote access

00:00:44.280 --> 00:00:46.020 align:middle line:90%
with Windows systems.

00:00:46.020 --> 00:00:48.660 align:middle line:84%
So again, it's very similar
to other remote management

00:00:48.660 --> 00:00:50.490 align:middle line:84%
protocols that
you'd come across.

00:00:50.490 --> 00:00:54.910 align:middle line:84%
Or one very simple
comparison is SSH.

00:00:54.910 --> 00:00:57.780 align:middle line:84%
However, they work
entirely differently.

00:00:57.780 --> 00:01:00.150 align:middle line:84%
The main objective
of this protocol

00:01:00.150 --> 00:01:04.230 align:middle line:84%
is to facilitate remote
access or the ability

00:01:04.230 --> 00:01:07.800 align:middle line:84%
to execute commands remotely
on a Windows system.

00:01:07.800 --> 00:01:11.520 align:middle line:84%
Now, when it comes down to the
deployment use case of WinRM

00:01:11.520 --> 00:01:14.760 align:middle line:84%
and how it is utilized, these
are the following reasons

00:01:14.760 --> 00:01:16.680 align:middle line:84%
or the following ways
that you'll typically

00:01:16.680 --> 00:01:20.950 align:middle line:84%
find WinRM being utilized
in a Windows environment.

00:01:20.950 --> 00:01:23.370 align:middle line:84%
So you know, WinRM
is typically used

00:01:23.370 --> 00:01:27.630 align:middle line:84%
to facilitate remote access and
interaction with Windows hosts

00:01:27.630 --> 00:01:28.900 align:middle line:90%
on a local network.

00:01:28.900 --> 00:01:32.280 align:middle line:84%
So again, if you're ever working
within a Windows Enterprise

00:01:32.280 --> 00:01:35.850 align:middle line:84%
environment, you may come
across systems that have

00:01:35.850 --> 00:01:37.870 align:middle line:90%
WinRM enabled or configured.

00:01:37.870 --> 00:01:41.730 align:middle line:84%
And that is essentially
used to facilitate or allow

00:01:41.730 --> 00:01:45.420 align:middle line:84%
administrators to essentially
remotely access those Windows

00:01:45.420 --> 00:01:49.110 align:middle line:84%
systems, and then, of course
execute commands or perform

00:01:49.110 --> 00:01:52.710 align:middle line:84%
various aspects of
functionality or execute

00:01:52.710 --> 00:01:56.380 align:middle line:84%
various types of commands
on these systems remotely.

00:01:56.380 --> 00:01:58.920 align:middle line:84%
It can also be utilized
to remotely access

00:01:58.920 --> 00:02:01.810 align:middle line:84%
and execute commands on Windows
systems on the internet.

00:02:01.810 --> 00:02:06.600 align:middle line:84%
So if you're-- again, you're
trying to perform some remote

00:02:06.600 --> 00:02:09.150 align:middle line:84%
tasks or commands, or you're
trying to perform some remote

00:02:09.150 --> 00:02:11.620 align:middle line:84%
functionality on
a Windows system,

00:02:11.620 --> 00:02:14.208 align:middle line:84%
you can utilize WinRM to do
this across the internet.

00:02:14.208 --> 00:02:15.750 align:middle line:84%
So again, if you
are trying to access

00:02:15.750 --> 00:02:19.080 align:middle line:84%
or if you're trying to execute
a command on a Windows server

00:02:19.080 --> 00:02:20.610 align:middle line:84%
that's probably
hosted in the cloud

00:02:20.610 --> 00:02:22.980 align:middle line:84%
or that is probably
in another continent,

00:02:22.980 --> 00:02:25.920 align:middle line:84%
you can utilize
WinRM to do this.

00:02:25.920 --> 00:02:28.770 align:middle line:84%
WinRM is also used
by administrators

00:02:28.770 --> 00:02:31.890 align:middle line:84%
to manage and configure
Windows systems remotely.

00:02:31.890 --> 00:02:33.720 align:middle line:84%
And again, as I
said, that can be

00:02:33.720 --> 00:02:36.960 align:middle line:84%
done both locally or
across the internet

00:02:36.960 --> 00:02:39.420 align:middle line:90%
or on a public network.

00:02:39.420 --> 00:02:44.760 align:middle line:84%
Now, WinRM typically
utilizes TCP port 5985

00:02:44.760 --> 00:02:47.430 align:middle line:84%
for a standard
unencrypted connection

00:02:47.430 --> 00:02:52.030 align:middle line:84%
and 5986 for an encrypted
HTTPS connection.

00:02:52.030 --> 00:02:52.530 align:middle line:90%
All right.

00:02:52.530 --> 00:02:55.950 align:middle line:84%
So that is what WinRM is,
and how it can be utilized,

00:02:55.950 --> 00:02:59.100 align:middle line:84%
and the ports that you'll
typically find WinRM

00:02:59.100 --> 00:03:01.240 align:middle line:90%
configured to run on.

00:03:01.240 --> 00:03:03.930 align:middle line:84%
Now, in regards to
exploiting WinRM,

00:03:03.930 --> 00:03:07.440 align:middle line:84%
we need to understand how WinRM
in regards to authentication.

00:03:07.440 --> 00:03:10.800 align:middle line:84%
Because given the fact that
it is a remote management

00:03:10.800 --> 00:03:14.430 align:middle line:84%
protocol, there needs to be
some form of authentication

00:03:14.430 --> 00:03:18.000 align:middle line:84%
or security behind the actual
connection between the client

00:03:18.000 --> 00:03:19.350 align:middle line:90%
and the server, right?

00:03:19.350 --> 00:03:23.010 align:middle line:84%
And that is typically
facilitated or implemented

00:03:23.010 --> 00:03:25.260 align:middle line:90%
in the form of authentication.

00:03:25.260 --> 00:03:28.470 align:middle line:84%
So again, you can either
utilize a username and password,

00:03:28.470 --> 00:03:30.270 align:middle line:84%
so on and so forth,
and we'll be exploring

00:03:30.270 --> 00:03:31.710 align:middle line:90%
this in a few seconds.

00:03:31.710 --> 00:03:34.170 align:middle line:84%
Now, we can utilize the
Metasploit framework

00:03:34.170 --> 00:03:36.810 align:middle line:84%
to identify WinRM users
and their passwords

00:03:36.810 --> 00:03:39.300 align:middle line:84%
by performing a
brute-force attack

00:03:39.300 --> 00:03:43.230 align:middle line:84%
as well as having the
ability to execute commands

00:03:43.230 --> 00:03:46.573 align:middle line:84%
on the target system once we
have obtained credentials.

00:03:46.573 --> 00:03:48.240 align:middle line:84%
So again, in this
video we're not really

00:03:48.240 --> 00:03:51.250 align:middle line:84%
looking at exploiting a
vulnerable version of WinRM.

00:03:51.250 --> 00:03:54.720 align:middle line:84%
We are trying to exploit WinRM
itself by, first and foremost,

00:03:54.720 --> 00:03:58.110 align:middle line:84%
identifying a username and
password combination that

00:03:58.110 --> 00:03:59.820 align:middle line:90%
can provide us with access.

00:03:59.820 --> 00:04:02.760 align:middle line:84%
And then we're going to take a
look at the various Metasploit

00:04:02.760 --> 00:04:05.880 align:middle line:84%
framework modules that can
allow us to execute commands

00:04:05.880 --> 00:04:09.390 align:middle line:84%
remotely on the target system
with the actual credentials.

00:04:09.390 --> 00:04:12.630 align:middle line:84%
And then we can also utilize
a Metasploit framework WinRM

00:04:12.630 --> 00:04:15.960 align:middle line:84%
exploit module that can be
used to obtain an Meterpreter

00:04:15.960 --> 00:04:17.640 align:middle line:84%
session on the target
system in order

00:04:17.640 --> 00:04:22.450 align:middle line:84%
to gain remote access to the
target system via a Meterpreter

00:04:22.450 --> 00:04:22.950 align:middle line:90%
session.

00:04:22.950 --> 00:04:25.170 align:middle line:84%
And of course, the
actual privileges

00:04:25.170 --> 00:04:28.795 align:middle line:84%
that we'll be able to obtain
will depend on the credentials

00:04:28.795 --> 00:04:31.170 align:middle line:84%
that we're able to discover
in regards to the permissions

00:04:31.170 --> 00:04:33.030 align:middle line:90%
associated with the user--

00:04:33.030 --> 00:04:35.310 align:middle line:84%
with the username
and the password.

00:04:35.310 --> 00:04:37.470 align:middle line:84%
So it's going to be
very interesting.

00:04:37.470 --> 00:04:40.440 align:middle line:84%
And in this case, we're going to
be utilizing a lab environment

00:04:40.440 --> 00:04:42.630 align:middle line:84%
to conduct these
techniques and to go

00:04:42.630 --> 00:04:45.720 align:middle line:84%
through the process
of exploiting WinRM.

00:04:45.720 --> 00:04:48.280 align:middle line:84%
So start up your
lab environment,

00:04:48.280 --> 00:04:50.110 align:middle line:84%
and we'll be able
to get started.

00:04:50.110 --> 00:04:54.070 align:middle line:84%
So I'm going to see you
within the lab environment.

00:04:54.070 --> 00:04:54.570 align:middle line:90%
All right.

00:04:54.570 --> 00:04:56.980 align:middle line:84%
So I am back in the
lab environment.

00:04:56.980 --> 00:04:59.648 align:middle line:84%
And it provides us with
the target IP address,

00:04:59.648 --> 00:05:00.690 align:middle line:90%
which is very convenient.

00:05:00.690 --> 00:05:02.982 align:middle line:84%
And of course, in your case
it's going to be different.

00:05:02.982 --> 00:05:04.090 align:middle line:90%
So just keep that in mind.

00:05:04.090 --> 00:05:06.850 align:middle line:84%
I'm going to copy the
target IP address.

00:05:06.850 --> 00:05:09.670 align:middle line:84%
And then I'm going to
open up a terminal here.

00:05:09.670 --> 00:05:10.270 align:middle line:90%
There we are.

00:05:10.270 --> 00:05:12.780 align:middle line:84%
And I'm going to
zoom in a little bit

00:05:12.780 --> 00:05:15.042 align:middle line:84%
here so you can see
what's going on.

00:05:15.042 --> 00:05:16.500 align:middle line:84%
And the first thing
I'm going to do

00:05:16.500 --> 00:05:19.170 align:middle line:84%
is, of course, make sure
that the PostgreSQL database

00:05:19.170 --> 00:05:20.220 align:middle line:90%
service is started.

00:05:20.220 --> 00:05:23.838 align:middle line:90%
So service postgresql start.

00:05:23.838 --> 00:05:24.880 align:middle line:90%
That's going to start it.

00:05:24.880 --> 00:05:27.850 align:middle line:84%
And that will, again, help
us or will essentially

00:05:27.850 --> 00:05:30.520 align:middle line:84%
allow us to communicate and
interact with the Metasploit

00:05:30.520 --> 00:05:31.450 align:middle line:90%
framework database.

00:05:31.450 --> 00:05:36.025 align:middle line:84%
I'm now going to start up the
Metasploit Framework Console.

00:05:36.025 --> 00:05:37.650 align:middle line:84%
We're going to give
that a few seconds.

00:05:37.650 --> 00:05:41.600 align:middle line:90%


00:05:41.600 --> 00:05:44.200 align:middle line:84%
We are then going to
create a workspace.

00:05:44.200 --> 00:05:47.378 align:middle line:84%
And in this case, we're
just going to call it WinRM.

00:05:47.378 --> 00:05:47.920 align:middle line:90%
There we are.

00:05:47.920 --> 00:05:50.200 align:middle line:84%
And we're currently working
within that workspace.

00:05:50.200 --> 00:05:53.380 align:middle line:84%
We're now going to perform an
Nmap scan on the target system.

00:05:53.380 --> 00:05:57.100 align:middle line:84%
And we're going to utilize
the db_nmap command here

00:05:57.100 --> 00:05:59.890 align:middle line:84%
to essentially perform the
Nmap scan within the Metasploit

00:05:59.890 --> 00:06:02.200 align:middle line:84%
framework console
and consequently save

00:06:02.200 --> 00:06:05.410 align:middle line:84%
all of the results into the
Metasploit framework database

00:06:05.410 --> 00:06:07.870 align:middle line:84%
in this particular
workspace to be specific.

00:06:07.870 --> 00:06:11.830 align:middle line:84%
So we'll perform a SYN scan,
some service version detection,

00:06:11.830 --> 00:06:14.590 align:middle line:84%
as well as operating
system detection.

00:06:14.590 --> 00:06:18.190 align:middle line:84%
We'll then paste in the IP
there, the IP of the target.

00:06:18.190 --> 00:06:19.390 align:middle line:90%
And then we'll hit Enter.

00:06:19.390 --> 00:06:22.630 align:middle line:84%
And that is going to
start up the Nmap scan,

00:06:22.630 --> 00:06:25.150 align:middle line:84%
and it's going to save the
results into the Metasploit

00:06:25.150 --> 00:06:27.970 align:middle line:84%
framework database so that we
can access the results whenever

00:06:27.970 --> 00:06:28.610 align:middle line:90%
we want.

00:06:28.610 --> 00:06:32.250 align:middle line:84%
So I'm just going to wait
for the scan to complete.

00:06:32.250 --> 00:06:32.750 align:middle line:90%
All right.

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

00:06:34.380 --> 00:06:37.400 align:middle line:84%
And as you can see, we
aren't able to identify

00:06:37.400 --> 00:06:41.060 align:middle line:90%
the WinRM service running here.

00:06:41.060 --> 00:06:44.700 align:middle line:84%
And that is primarily because we
did not specify the actual port

00:06:44.700 --> 00:06:45.500 align:middle line:90%
range to use.

00:06:45.500 --> 00:06:49.430 align:middle line:84%
And by default, Nmap will scan
1,000 of the most commonly

00:06:49.430 --> 00:06:50.090 align:middle line:90%
used ports.

00:06:50.090 --> 00:06:53.330 align:middle line:84%
So we actually need
to specify to Nmap

00:06:53.330 --> 00:06:56.150 align:middle line:84%
that we want to scan the
entire TCP port range, which

00:06:56.150 --> 00:06:59.540 align:middle line:90%
is about 65,535 ports.

00:06:59.540 --> 00:07:03.180 align:middle line:84%
And that will, again, help us
identify the actual service.

00:07:03.180 --> 00:07:04.700 align:middle line:84%
So again, we're
going to give that

00:07:04.700 --> 00:07:07.580 align:middle line:84%
a few seconds to a couple of
minutes, because, again, we're

00:07:07.580 --> 00:07:11.610 align:middle line:84%
going through the
entire TCP port range.

00:07:11.610 --> 00:07:12.210 align:middle line:90%
Right.

00:07:12.210 --> 00:07:15.360 align:middle line:84%
Once the scan is complete,
we can list out the services

00:07:15.360 --> 00:07:17.230 align:middle line:90%
by typing in services.

00:07:17.230 --> 00:07:21.300 align:middle line:84%
And as you can see,
on port 5985 we

00:07:21.300 --> 00:07:24.160 align:middle line:90%
have the WinRM service running.

00:07:24.160 --> 00:07:27.090 align:middle line:84%
However, the actual banner
provided to us by Nmap

00:07:27.090 --> 00:07:28.210 align:middle line:90%
doesn't indicate that.

00:07:28.210 --> 00:07:32.520 align:middle line:84%
However, we do know that port
5985 is set up for WinRM.

00:07:32.520 --> 00:07:35.880 align:middle line:84%
So the next option
or the first order

00:07:35.880 --> 00:07:38.460 align:middle line:84%
of business in regards
to actually confirming

00:07:38.460 --> 00:07:42.000 align:middle line:84%
whether we do have a WinRM
service running on the target

00:07:42.000 --> 00:07:45.840 align:middle line:84%
is to actually check out the
authentication methods that

00:07:45.840 --> 00:07:48.850 align:middle line:84%
are supported by
WinRM on the target.

00:07:48.850 --> 00:07:51.373 align:middle line:84%
And in order to do this, we're
going to search for a module.

00:07:51.373 --> 00:07:53.040 align:middle line:84%
So I'm going to say
search, and the type

00:07:53.040 --> 00:07:56.210 align:middle line:90%
is going to be auxiliary.

00:07:56.210 --> 00:08:00.170 align:middle line:84%
And the name of the module
or the actual module

00:08:00.170 --> 00:08:02.060 align:middle line:90%
itself is going to be WinRM.

00:08:02.060 --> 00:08:03.650 align:middle line:90%
So we can just say winrm.

00:08:03.650 --> 00:08:07.670 align:middle line:84%
And we are looking for the
winrm_auth_methods module here.

00:08:07.670 --> 00:08:10.610 align:middle line:84%
That will tell us whether,
first and foremost,

00:08:10.610 --> 00:08:14.660 align:middle line:84%
whether WinRM is actually
enabled on the target

00:08:14.660 --> 00:08:16.190 align:middle line:90%
system, which we do know it is.

00:08:16.190 --> 00:08:19.670 align:middle line:84%
And it's also going to tell
us the actual authentication

00:08:19.670 --> 00:08:22.590 align:middle line:84%
method supported by the
WinRM service on the target.

00:08:22.590 --> 00:08:26.592 align:middle line:84%
So we're going to say
use, show the options.

00:08:26.592 --> 00:08:28.050 align:middle line:84%
And what we're
going to do is we're

00:08:28.050 --> 00:08:30.990 align:middle line:84%
going to set up the global
variable for the RHOSTS value,

00:08:30.990 --> 00:08:32.429 align:middle line:90%
as we didn't do that already.

00:08:32.429 --> 00:08:38.400 align:middle line:84%
So I'm going to say setg RHOSTS,
and paste in the target IP.

00:08:38.400 --> 00:08:41.640 align:middle line:84%
And if we show the options
now, that should be set.

00:08:41.640 --> 00:08:42.299 align:middle line:90%
There we are.

00:08:42.299 --> 00:08:44.650 align:middle line:84%
As you can see, that
is set correctly.

00:08:44.650 --> 00:08:48.060 align:middle line:84%
And we can then
specify the target URI

00:08:48.060 --> 00:08:49.540 align:middle line:90%
of the WinRM service.

00:08:49.540 --> 00:08:51.630 align:middle line:84%
So to actually confirm
this, we can actually

00:08:51.630 --> 00:08:53.790 align:middle line:90%
open this up in our browser.

00:08:53.790 --> 00:08:56.940 align:middle line:84%
And we can then paste in
the target IP as well as

00:08:56.940 --> 00:08:59.961 align:middle line:84%
the actual port, which
in this case is 5985.

00:08:59.961 --> 00:09:04.870 align:middle line:90%
So 5985, hit Enter.

00:09:04.870 --> 00:09:07.990 align:middle line:84%
As you can see, it tells us that
the requested resource is not

00:09:07.990 --> 00:09:08.510 align:middle line:90%
found.

00:09:08.510 --> 00:09:12.940 align:middle line:84%
And then of course, if we try
and access the WSMan service

00:09:12.940 --> 00:09:14.590 align:middle line:84%
or the actual
directory, we can see

00:09:14.590 --> 00:09:18.010 align:middle line:84%
that it doesn't respond or
provide us with any output.

00:09:18.010 --> 00:09:20.870 align:middle line:84%
And that is perfectly fine,
as that's how it works.

00:09:20.870 --> 00:09:22.780 align:middle line:90%
So we'll just hit Run here.

00:09:22.780 --> 00:09:25.510 align:middle line:84%
As you can see it tells
us that, indeed, WinRM

00:09:25.510 --> 00:09:27.370 align:middle line:90%
is running on the target system.

00:09:27.370 --> 00:09:31.240 align:middle line:84%
And the two authentication
methods that are supported

00:09:31.240 --> 00:09:35.440 align:middle line:84%
are the Negotiate protocol
and the Basic protocol.

00:09:35.440 --> 00:09:39.250 align:middle line:84%
So that means we can perform
a brute-force on WinRM

00:09:39.250 --> 00:09:42.370 align:middle line:84%
on the target in order to
identify both the username

00:09:42.370 --> 00:09:45.280 align:middle line:84%
and password that can
consequently give us access

00:09:45.280 --> 00:09:47.950 align:middle line:84%
to the target system and,
again, consequently allow us

00:09:47.950 --> 00:09:49.930 align:middle line:90%
to execute commands remotely.

00:09:49.930 --> 00:09:51.430 align:middle line:84%
Now, the name of
the module that we

00:09:51.430 --> 00:09:54.970 align:middle line:84%
are going to be utilizing to do
this is the WinRM login module.

00:09:54.970 --> 00:09:56.830 align:middle line:84%
So you can just
search for it here,

00:09:56.830 --> 00:10:01.350 align:middle line:90%
that is winrm_login, hit Enter.

00:10:01.350 --> 00:10:03.750 align:middle line:84%
And that's the
auxiliary module there.

00:10:03.750 --> 00:10:06.120 align:middle line:84%
And like previous
services, we can utilize

00:10:06.120 --> 00:10:07.590 align:middle line:90%
this to perform a brute-force.

00:10:07.590 --> 00:10:09.510 align:middle line:90%
So I'm going to say use.

00:10:09.510 --> 00:10:11.190 align:middle line:90%
And we'll clear the terminal.

00:10:11.190 --> 00:10:15.420 align:middle line:84%
If I show the
options, you can see

00:10:15.420 --> 00:10:17.760 align:middle line:84%
that we can specify the
brute-force speed, which

00:10:17.760 --> 00:10:19.500 align:middle line:90%
we'll leave at 5.

00:10:19.500 --> 00:10:21.270 align:middle line:84%
And then of course,
we need to specify

00:10:21.270 --> 00:10:25.020 align:middle line:84%
the target IP, which is done, as
well as the target port, which

00:10:25.020 --> 00:10:26.460 align:middle line:90%
is 5985.

00:10:26.460 --> 00:10:30.930 align:middle line:84%
And the target URI is set to
the default, which is WSMan.

00:10:30.930 --> 00:10:33.030 align:middle line:84%
So as you can see,
this is used to specify

00:10:33.030 --> 00:10:35.510 align:middle line:90%
the URI of the WinRM service.

00:10:35.510 --> 00:10:38.100 align:middle line:84%
Now, we are going to be
utilizing a few wordlists

00:10:38.100 --> 00:10:41.100 align:middle line:84%
for the user file, because we
don't know what the username is

00:10:41.100 --> 00:10:42.220 align:middle line:90%
and the password is.

00:10:42.220 --> 00:10:44.940 align:middle line:84%
So we're going to perform
a brute-force for both

00:10:44.940 --> 00:10:46.890 align:middle line:90%
the username and password.

00:10:46.890 --> 00:10:51.080 align:middle line:84%
In order to do that, we're
going to set the user file

00:10:51.080 --> 00:11:01.350 align:middle line:84%
to /usr/share/metasploit
framework/data/wordlists,

00:11:01.350 --> 00:11:05.730 align:middle line:84%
and we are going to utilize
the common_users wordlist here,

00:11:05.730 --> 00:11:08.450 align:middle line:90%
or userlist, if you will.

00:11:08.450 --> 00:11:09.530 align:middle line:90%
We hit Enter.

00:11:09.530 --> 00:11:13.810 align:middle line:84%
And then we're going to
set the password file

00:11:13.810 --> 00:11:21.520 align:middle line:84%
to /usr/share/metasploit
framework/data/wordlists

00:11:21.520 --> 00:11:25.680 align:middle line:90%
and unix_passwords.

00:11:25.680 --> 00:11:27.320 align:middle line:84%
Once we're ready,
we can just hit

00:11:27.320 --> 00:11:29.270 align:middle line:90%
Run to perform the brute-force.

00:11:29.270 --> 00:11:32.165 align:middle line:84%
As you can see, it'll go
through all combinations here.

00:11:32.165 --> 00:11:33.290 align:middle line:90%
So we'll let that complete.

00:11:33.290 --> 00:11:35.990 align:middle line:90%


00:11:35.990 --> 00:11:38.990 align:middle line:84%
After a few minutes,
we're able to identify

00:11:38.990 --> 00:11:40.580 align:middle line:90%
some legitimate credentials.

00:11:40.580 --> 00:11:44.000 align:middle line:84%
As you can see, it says right
over here, login successful.

00:11:44.000 --> 00:11:46.250 align:middle line:84%
We get the username,
which is "administrator,"

00:11:46.250 --> 00:11:48.390 align:middle line:84%
and the password,
which is "tinkerbell."

00:11:48.390 --> 00:11:48.890 align:middle line:90%
All right.

00:11:48.890 --> 00:11:50.598 align:middle line:84%
So what I'm going to
do is just terminate

00:11:50.598 --> 00:11:51.980 align:middle line:90%
the current brute-force.

00:11:51.980 --> 00:11:55.340 align:middle line:84%
And again, let's just crawl
over to the actual results

00:11:55.340 --> 00:11:58.400 align:middle line:84%
here, which was, again, under
the username administrator

00:11:58.400 --> 00:12:00.020 align:middle line:90%
and the password tinkerbell.

00:12:00.020 --> 00:12:03.350 align:middle line:84%
So now that we've identified
the actual credentials

00:12:03.350 --> 00:12:05.750 align:middle line:84%
that we can utilize,
we can test out

00:12:05.750 --> 00:12:10.610 align:middle line:84%
whether these credentials work
by utilizing another WinRM

00:12:10.610 --> 00:12:12.710 align:middle line:90%
module that's afforded to us.

00:12:12.710 --> 00:12:15.840 align:middle line:84%
And that is the
WinRM CMD module.

00:12:15.840 --> 00:12:18.740 align:middle line:84%
So we can search for that
by saying search and then

00:12:18.740 --> 00:12:21.170 align:middle line:84%
specifying the
type as auxiliary.

00:12:21.170 --> 00:12:22.610 align:middle line:84%
However, in this
case, because we

00:12:22.610 --> 00:12:25.820 align:middle line:84%
know the exact name of the
module, which is winrm_cmd,

00:12:25.820 --> 00:12:27.830 align:middle line:84%
we don't need to
specify the type.

00:12:27.830 --> 00:12:29.730 align:middle line:90%
This is an auxiliary module.

00:12:29.730 --> 00:12:30.230 align:middle line:90%
All right.

00:12:30.230 --> 00:12:32.090 align:middle line:90%
So I'm just going to copy that.

00:12:32.090 --> 00:12:34.110 align:middle line:84%
And we're going to
utilize this module.

00:12:34.110 --> 00:12:36.110 align:middle line:84%
So I'm going to paste in
the actual module name.

00:12:36.110 --> 00:12:39.050 align:middle line:84%
If we show the options,
we have the ability

00:12:39.050 --> 00:12:42.050 align:middle line:84%
to specify the target IP,
as well as the target port,

00:12:42.050 --> 00:12:46.490 align:middle line:84%
and the target URI specified as
the default, which is, again,

00:12:46.490 --> 00:12:49.370 align:middle line:84%
exactly how the target
system is configured.

00:12:49.370 --> 00:12:51.530 align:middle line:84%
So we can set up
the username here

00:12:51.530 --> 00:12:54.350 align:middle line:84%
that we were able to identify,
which is administrator.

00:12:54.350 --> 00:12:57.340 align:middle line:90%


00:12:57.340 --> 00:13:03.360 align:middle line:84%
We can then set the
password to tinkerbell,

00:13:03.360 --> 00:13:08.220 align:middle line:84%
which is exactly what we were
able to identify previously.

00:13:08.220 --> 00:13:10.350 align:middle line:84%
And then we can specify
the actual command

00:13:10.350 --> 00:13:13.380 align:middle line:84%
to run on the target system to
confirm whether this, indeed,

00:13:13.380 --> 00:13:14.400 align:middle line:90%
works.

00:13:14.400 --> 00:13:16.440 align:middle line:84%
We can change this to
something a little bit

00:13:16.440 --> 00:13:18.900 align:middle line:84%
interesting like,
again, we can set it

00:13:18.900 --> 00:13:21.960 align:middle line:84%
to the whoami command, which
will essentially tell us

00:13:21.960 --> 00:13:24.990 align:middle line:84%
what permissions we have with
the username administrator.

00:13:24.990 --> 00:13:27.960 align:middle line:84%
But of course, that is
really easy to understand,

00:13:27.960 --> 00:13:29.610 align:middle line:90%
or that is self-explanatory.

00:13:29.610 --> 00:13:32.040 align:middle line:84%
We should be able
to, again, identify

00:13:32.040 --> 00:13:34.690 align:middle line:84%
or have administrator
access, which is great.

00:13:34.690 --> 00:13:37.230 align:middle line:84%
So I'm going to
set CMD to whoami.

00:13:37.230 --> 00:13:39.480 align:middle line:90%
And then we're going to hit Run.

00:13:39.480 --> 00:13:41.790 align:middle line:84%
As you can see, it says
right over here the output

00:13:41.790 --> 00:13:44.280 align:middle line:84%
of the command that we run
tells us that we are currently

00:13:44.280 --> 00:13:46.210 align:middle line:90%
the server administrator.

00:13:46.210 --> 00:13:48.660 align:middle line:84%
So we should have
administrative privileges

00:13:48.660 --> 00:13:52.150 align:middle line:84%
if we are able to obtain
a Meterpreter session.

00:13:52.150 --> 00:13:55.380 align:middle line:84%
So in order to execute or to
obtain a Meterpreter session

00:13:55.380 --> 00:13:58.680 align:middle line:84%
through WinRM, we can
utilize another module.

00:13:58.680 --> 00:14:00.600 align:middle line:84%
And this is going to
be an exploit module.

00:14:00.600 --> 00:14:05.560 align:middle line:84%
So we're going to search
for the module winrm_script.

00:14:05.560 --> 00:14:06.880 align:middle line:90%
And this is the model here.

00:14:06.880 --> 00:14:08.660 align:middle line:84%
As you can see, that's
an exploit module.

00:14:08.660 --> 00:14:11.530 align:middle line:84%
This will allow us to perform
remote code execution.

00:14:11.530 --> 00:14:13.400 align:middle line:84%
And in this case,
we'll be able to,

00:14:13.400 --> 00:14:15.610 align:middle line:84%
again, obtain a
Meterpreter session.

00:14:15.610 --> 00:14:19.820 align:middle line:84%
So I'm going to say use,
paste that in there.

00:14:19.820 --> 00:14:21.380 align:middle line:84%
It's going to set
the default payload

00:14:21.380 --> 00:14:23.870 align:middle line:84%
to
windows/meterpreter/reverse_tcp,

00:14:23.870 --> 00:14:27.200 align:middle line:84%
which is fine, because we really
don't have an idea of what

00:14:27.200 --> 00:14:30.050 align:middle line:84%
the target operating
system architecture is.

00:14:30.050 --> 00:14:32.890 align:middle line:84%
If we show the
options here, you can

00:14:32.890 --> 00:14:35.650 align:middle line:84%
see that we need to
specify first and foremost

00:14:35.650 --> 00:14:38.590 align:middle line:84%
the actual password, the
username and password

00:14:38.590 --> 00:14:40.990 align:middle line:84%
for WinRM that we
were able to identify.

00:14:40.990 --> 00:14:43.930 align:middle line:84%
The target IP and port
is specified, as well as

00:14:43.930 --> 00:14:45.220 align:middle line:90%
the target URI.

00:14:45.220 --> 00:14:47.410 align:middle line:84%
You can then specify
the LHOST option--

00:14:47.410 --> 00:14:50.020 align:middle line:84%
this is going to be your
Kali Linux IP address--

00:14:50.020 --> 00:14:52.090 align:middle line:84%
as well as any
open port that you

00:14:52.090 --> 00:14:55.340 align:middle line:84%
want to utilize to receive
the reverse connection on.

00:14:55.340 --> 00:15:01.600 align:middle line:84%
So we will set the
username to administrator,

00:15:01.600 --> 00:15:05.540 align:middle line:84%
and we'll set the
password to tinkerbell.

00:15:05.540 --> 00:15:08.170 align:middle line:90%


00:15:08.170 --> 00:15:11.510 align:middle line:90%
And we can hit Run.

00:15:11.510 --> 00:15:14.420 align:middle line:84%
As you can see, it's going
to tell us right over here

00:15:14.420 --> 00:15:18.150 align:middle line:84%
that we have an issue
with the actual runtime.

00:15:18.150 --> 00:15:20.450 align:middle line:84%
So it's going to tell
us, unexpected node test.

00:15:20.450 --> 00:15:24.410 align:middle line:84%
And the reason it's doing that
is because we didn't actually

00:15:24.410 --> 00:15:28.920 align:middle line:84%
set the force VBS, or
Visual Basic Script, option.

00:15:28.920 --> 00:15:31.820 align:middle line:84%
So I'm going to show
the options again.

00:15:31.820 --> 00:15:33.710 align:middle line:84%
And if we take a
look at the options,

00:15:33.710 --> 00:15:36.950 align:middle line:84%
you can see we have the ability
to force the module to utilize

00:15:36.950 --> 00:15:40.460 align:middle line:84%
the VBS command stager, which
in this case, we need to do,

00:15:40.460 --> 00:15:43.160 align:middle line:84%
instead of utilizing the
PowerShell command stager.

00:15:43.160 --> 00:15:50.467 align:middle line:84%
So we are going to set
the FORCE_VBS option.

00:15:50.467 --> 00:15:53.050 align:middle line:84%
And we're going to set that to
true, because that is a Boolean

00:15:53.050 --> 00:15:53.890 align:middle line:90%
value.

00:15:53.890 --> 00:15:56.310 align:middle line:90%
And we're going to hit Run.

00:15:56.310 --> 00:16:00.370 align:middle line:84%
And it's going to send
the command stager.

00:16:00.370 --> 00:16:02.960 align:middle line:84%
So it's going to tell us or
provide us with the status.

00:16:02.960 --> 00:16:05.140 align:middle line:84%
So we're going to give
this a few seconds.

00:16:05.140 --> 00:16:08.395 align:middle line:84%
And once it reaches
100%, we should be OK.

00:16:08.395 --> 00:16:25.360 align:middle line:90%


00:16:25.360 --> 00:16:28.900 align:middle line:84%
Once the command stager is
sent, it'll then send the stage,

00:16:28.900 --> 00:16:31.150 align:middle line:84%
and we'll get a
Meterpreter session.

00:16:31.150 --> 00:16:34.840 align:middle line:84%
It is then going to attempt to
migrate to a specified system

00:16:34.840 --> 00:16:37.270 align:middle line:84%
level process in
order to achieve

00:16:37.270 --> 00:16:39.010 align:middle line:90%
administrative privileges.

00:16:39.010 --> 00:16:41.860 align:middle line:84%
And in this case, you can see
it tells us that the session is

00:16:41.860 --> 00:16:43.490 align:middle line:90%
admin but not system.

00:16:43.490 --> 00:16:46.600 align:middle line:84%
So it's going to get us NT
authority system privileges.

00:16:46.600 --> 00:16:48.640 align:middle line:84%
As you can see, it
does that by migrating

00:16:48.640 --> 00:16:51.250 align:middle line:90%
to the svchost process.

00:16:51.250 --> 00:16:54.550 align:middle line:84%
And if we, again,
type in sysinfo,

00:16:54.550 --> 00:16:57.670 align:middle line:84%
you can see that we are running
on a Windows Server 2016

00:16:57.670 --> 00:16:58.270 align:middle line:90%
system.

00:16:58.270 --> 00:17:01.510 align:middle line:84%
And we obtain a 64-bit
Meterpreter session,

00:17:01.510 --> 00:17:06.040 align:middle line:84%
not really because we utilized
the 64-bit interpreter payload,

00:17:06.040 --> 00:17:10.270 align:middle line:84%
but because we migrated, or this
particular module automatically

00:17:10.270 --> 00:17:12.849 align:middle line:84%
migrates, to the
svchost process,

00:17:12.849 --> 00:17:15.130 align:middle line:90%
which is a 64-bit process.

00:17:15.130 --> 00:17:18.650 align:middle line:84%
If we type in get user
ID, you see that we now

00:17:18.650 --> 00:17:20.869 align:middle line:84%
have NT authority
system privileges, which

00:17:20.869 --> 00:17:23.810 align:middle line:84%
are the highest level of
privileges on a Windows system,

00:17:23.810 --> 00:17:25.760 align:middle line:84%
which consequently
means that we don't

00:17:25.760 --> 00:17:27.589 align:middle line:90%
need to elevate our privileges.

00:17:27.589 --> 00:17:30.920 align:middle line:84%
So that is how to exploit
the WinRM service that's

00:17:30.920 --> 00:17:32.480 align:middle line:90%
running on a target system.

00:17:32.480 --> 00:17:35.450 align:middle line:84%
And that is going to conclude
the practical demonstration

00:17:35.450 --> 00:17:37.930 align:middle line:90%
of this video.

00:17:37.930 --> 00:17:38.430 align:middle line:90%
All right.

00:17:38.430 --> 00:17:40.890 align:middle line:84%
In the next video, we
are going to be exploring

00:17:40.890 --> 00:17:44.490 align:middle line:84%
the process of exploiting a
vulnerable Apache Tomcat web

00:17:44.490 --> 00:17:45.000 align:middle line:90%
server.

00:17:45.000 --> 00:17:47.810 align:middle line:90%
So I'll see you there.

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