WEBVTT

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


00:00:03.880 --> 00:00:07.760 align:middle line:90%
[MUSIC PLAYING]

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


00:00:10.200 --> 00:00:13.240 align:middle line:84%
Pass-The-Hash with
PsExec-- in this video,

00:00:13.240 --> 00:00:15.870 align:middle line:84%
we will be taking a look
at how to utilize the NTLM

00:00:15.870 --> 00:00:19.350 align:middle line:84%
hashes that we were able to
identify in the previous video

00:00:19.350 --> 00:00:23.430 align:middle line:84%
and utilize them with the
PsExec Metasploit module

00:00:23.430 --> 00:00:26.560 align:middle line:84%
to authenticate legitimately
with the target system.

00:00:26.560 --> 00:00:29.400 align:middle line:84%
So the reason this
technique is so important

00:00:29.400 --> 00:00:33.630 align:middle line:84%
is primarily because once
you've obtained the credentials

00:00:33.630 --> 00:00:36.090 align:middle line:84%
or hashes from a
target system, you

00:00:36.090 --> 00:00:39.360 align:middle line:84%
can utilize those credentials
to authenticate with the target

00:00:39.360 --> 00:00:41.860 align:middle line:84%
or to essentially
establish a meterpreter

00:00:41.860 --> 00:00:45.550 align:middle line:84%
decision on the target through
the use of these credentials.

00:00:45.550 --> 00:00:48.120 align:middle line:84%
So you can utilize them to
authenticate legitimately

00:00:48.120 --> 00:00:52.710 align:middle line:84%
with the target system,
consequently negating

00:00:52.710 --> 00:00:55.080 align:middle line:84%
or eliminating the
need to actually go

00:00:55.080 --> 00:00:58.950 align:middle line:84%
through the exploitation process
again in order to gain access.

00:00:58.950 --> 00:01:00.450 align:middle line:84%
In the next video,
we'll take a look

00:01:00.450 --> 00:01:02.160 align:middle line:84%
at how to establish
persistence, which

00:01:02.160 --> 00:01:04.890 align:middle line:84%
will ensure that we
always get a session

00:01:04.890 --> 00:01:08.100 align:middle line:84%
irregardless of whether
the system is shut down

00:01:08.100 --> 00:01:11.010 align:middle line:84%
or whether certain
aspects of the system

00:01:11.010 --> 00:01:12.630 align:middle line:84%
have been changed
or misconfigured.

00:01:12.630 --> 00:01:16.740 align:middle line:84%
So when we're talking about
a pass-the-hash attack,

00:01:16.740 --> 00:01:18.480 align:middle line:84%
a pass-the-hash
attack is essentially

00:01:18.480 --> 00:01:20.970 align:middle line:84%
an exploitation
technique that involves

00:01:20.970 --> 00:01:24.780 align:middle line:84%
capturing or harvesting NTLM
hashes or clear text passwords

00:01:24.780 --> 00:01:27.420 align:middle line:84%
and then utilizing these
credentials or hashes

00:01:27.420 --> 00:01:29.730 align:middle line:84%
to authenticate with
the target legitimately.

00:01:29.730 --> 00:01:32.130 align:middle line:84%
So we can utilize the
PsExec exact module

00:01:32.130 --> 00:01:35.820 align:middle line:84%
to legitimately authenticate
with the target system via SMB.

00:01:35.820 --> 00:01:38.370 align:middle line:84%
This technique will
allow us to obtain access

00:01:38.370 --> 00:01:40.710 align:middle line:84%
to the target system via
legitimate credentials

00:01:40.710 --> 00:01:44.200 align:middle line:84%
as opposed to obtaining access
via service exploitation.

00:01:44.200 --> 00:01:48.000 align:middle line:84%
So once you get the actual
NTLM hashes on a system,

00:01:48.000 --> 00:01:51.240 align:middle line:84%
you pretty much do not
need to exploit the system

00:01:51.240 --> 00:01:54.900 align:middle line:84%
or exploit a vulnerable service
on the target to gain access.

00:01:54.900 --> 00:01:57.900 align:middle line:84%
You can utilize the credentials
that you've been able to dump,

00:01:57.900 --> 00:02:02.040 align:middle line:84%
and you don't need to go through
the exploitation process again.

00:02:02.040 --> 00:02:05.140 align:middle line:84%
All right, so we are going to
be utilizing the lab environment

00:02:05.140 --> 00:02:06.490 align:middle line:90%
we used in the previous video.

00:02:06.490 --> 00:02:09.630 align:middle line:84%
So we'll sort of be continuing
from where we left off

00:02:09.630 --> 00:02:11.640 align:middle line:84%
and taking a look
at how to utilize

00:02:11.640 --> 00:02:15.630 align:middle line:84%
the dumped hashes to essentially
authenticate legitimately

00:02:15.630 --> 00:02:17.940 align:middle line:84%
with the target
system by leveraging

00:02:17.940 --> 00:02:19.530 align:middle line:90%
the PsExec exact module.

00:02:19.530 --> 00:02:24.650 align:middle line:84%
All right, so I'll see you
within the lab environment.

00:02:24.650 --> 00:02:27.440 align:middle line:84%
All right, so I'm back
within the lab environment.

00:02:27.440 --> 00:02:30.080 align:middle line:84%
And as we explored within
the previous video,

00:02:30.080 --> 00:02:33.420 align:middle line:84%
you have the ability to
access the target system here.

00:02:33.420 --> 00:02:35.750 align:middle line:84%
And again, that
can be very helpful

00:02:35.750 --> 00:02:39.102 align:middle line:84%
if you want to restart the
actual vulnerable service

00:02:39.102 --> 00:02:40.310 align:middle line:90%
that's running on the target.

00:02:40.310 --> 00:02:43.760 align:middle line:84%
In this case, we're just going
to copy the target IP address

00:02:43.760 --> 00:02:46.330 align:middle line:90%
and start up msfconsole.

00:02:46.330 --> 00:02:48.080 align:middle line:84%
However, before we do
that, we, of course,

00:02:48.080 --> 00:02:50.630 align:middle line:84%
want to start up the
PostgreSQL database service.

00:02:50.630 --> 00:02:55.430 align:middle line:84%
And we can then also launch
msfconsole while we're at it.

00:02:55.430 --> 00:02:57.800 align:middle line:84%
All right, so we'll just
wait for that to start up.

00:02:57.800 --> 00:03:05.430 align:middle line:90%


00:03:05.430 --> 00:03:07.830 align:middle line:84%
All right, I'm going
to create a workspace.

00:03:07.830 --> 00:03:12.330 align:middle line:84%
And we will just call
it psexec, right?

00:03:12.330 --> 00:03:15.930 align:middle line:84%
And we will set up the global
variable for the RHOSTS option.

00:03:15.930 --> 00:03:18.090 align:middle line:90%
And that will be the target IP.

00:03:18.090 --> 00:03:20.730 align:middle line:84%
That will save us from having
to type in the target IP

00:03:20.730 --> 00:03:23.100 align:middle line:90%
whenever we load a module.

00:03:23.100 --> 00:03:25.380 align:middle line:84%
What we can do now
is because we already

00:03:25.380 --> 00:03:28.560 align:middle line:84%
know what service is vulnerable
on the target system,

00:03:28.560 --> 00:03:31.660 align:middle line:84%
we can directly search for
the actual exploit module.

00:03:31.660 --> 00:03:35.790 align:middle line:84%
And in this case, we're looking
for the badblue exploit module

00:03:35.790 --> 00:03:37.970 align:middle line:90%
right over here.

00:03:37.970 --> 00:03:41.520 align:middle line:84%
That's the buffer
overflow exploit module.

00:03:41.520 --> 00:03:42.880 align:middle line:90%
So we're going to say use.

00:03:42.880 --> 00:03:44.650 align:middle line:90%
Paste it in there.

00:03:44.650 --> 00:03:48.090 align:middle line:84%
And we can then show
the options here.

00:03:48.090 --> 00:03:50.970 align:middle line:84%
And we have pretty much
all the options set apart

00:03:50.970 --> 00:03:52.630 align:middle line:90%
from the actual target.

00:03:52.630 --> 00:03:54.960 align:middle line:90%
So I'm going to set the target.

00:03:54.960 --> 00:04:00.300 align:middle line:84%
As we are going to say, this is
badblue Enterprise Edition 2.7

00:04:00.300 --> 00:04:03.045 align:middle line:90%
universal and then hit Exploit.

00:04:03.045 --> 00:04:05.600 align:middle line:90%


00:04:05.600 --> 00:04:06.142 align:middle line:90%
There we are.

00:04:06.142 --> 00:04:10.600 align:middle line:84%
We get a meterpreter session
on the target system.

00:04:10.600 --> 00:04:14.170 align:middle line:84%
Fantastic-- OK, so if we get
our current privileges here,

00:04:14.170 --> 00:04:16.899 align:middle line:84%
you can see that we have
administrator access.

00:04:16.899 --> 00:04:22.160 align:middle line:84%
And if we list out the
sysinfo, or System Information,

00:04:22.160 --> 00:04:25.220 align:middle line:84%
we can see that we have a
32-bit meterpreter payload.

00:04:25.220 --> 00:04:30.050 align:middle line:84%
So we can locate the LSASS
process or lsass.exe.

00:04:30.050 --> 00:04:33.730 align:middle line:90%
So we say pgrep and then LSASS.

00:04:33.730 --> 00:04:36.030 align:middle line:84%
And we can migrate into
that particular process.

00:04:36.030 --> 00:04:42.230 align:middle line:84%
So we are going to
say Migrate 788.

00:04:42.230 --> 00:04:45.690 align:middle line:84%
All right, we can now get
our privileges or list

00:04:45.690 --> 00:04:47.220 align:middle line:84%
out the current
access that we have.

00:04:47.220 --> 00:04:49.960 align:middle line:84%
And we have a NT
AUTHORITY/SYSTEM privileges.

00:04:49.960 --> 00:04:53.280 align:middle line:84%
So what we can do now is
use the hashdump command

00:04:53.280 --> 00:04:56.340 align:middle line:84%
or utilize the Mimikatz
or Kiwi module.

00:04:56.340 --> 00:04:59.790 align:middle line:84%
In this case, I'll just use the
hashdump command as it actually

00:04:59.790 --> 00:05:01.750 align:middle line:90%
prints it out rather quickly.

00:05:01.750 --> 00:05:04.272 align:middle line:84%
So we have all of
these hashes here.

00:05:04.272 --> 00:05:05.730 align:middle line:84%
So what I'm going
to do is I'm just

00:05:05.730 --> 00:05:07.470 align:middle line:90%
going to copy these hashes.

00:05:07.470 --> 00:05:10.210 align:middle line:84%
And we are going to
save them within a file.

00:05:10.210 --> 00:05:13.367 align:middle line:84%
So let me open up
this text editor here.

00:05:13.367 --> 00:05:15.450 align:middle line:84%
And I'm going to paste
them in there because we'll

00:05:15.450 --> 00:05:16.530 align:middle line:90%
need them in a second.

00:05:16.530 --> 00:05:19.360 align:middle line:84%
And let me just make sure that
that's formatted correctly.

00:05:19.360 --> 00:05:20.190 align:middle line:90%
There we are.

00:05:20.190 --> 00:05:24.210 align:middle line:84%
OK, so we can pretty much
obtain a meterpreter session

00:05:24.210 --> 00:05:27.510 align:middle line:84%
on the target through the
use of these hashes alone.

00:05:27.510 --> 00:05:30.080 align:middle line:84%
So we actually do not need
to exploit any service.

00:05:30.080 --> 00:05:32.070 align:middle line:84%
So I'll give you
an example of this.

00:05:32.070 --> 00:05:35.290 align:middle line:84%
So let's say we exit from
our meterpreter session.

00:05:35.290 --> 00:05:37.770 align:middle line:84%
And as you can see, we don't
have any more meterpreter

00:05:37.770 --> 00:05:38.610 align:middle line:90%
sessions.

00:05:38.610 --> 00:05:42.780 align:middle line:84%
What we can do is search
for a module called PsExec.

00:05:42.780 --> 00:05:44.460 align:middle line:90%
And this is an exploit module.

00:05:44.460 --> 00:05:45.370 align:middle line:90%
This is the one here.

00:05:45.370 --> 00:05:51.660 align:middle line:84%
So exploit/Windows/SMB/psexec,
this is the Microsoft Windows

00:05:51.660 --> 00:05:53.650 align:middle line:84%
authenticated user
code execution.

00:05:53.650 --> 00:05:56.130 align:middle line:84%
So it actually requires
authentication.

00:05:56.130 --> 00:05:59.170 align:middle line:84%
So we can utilize the
hashes that we have.

00:05:59.170 --> 00:06:00.510 align:middle line:90%
So I'm going to say use.

00:06:00.510 --> 00:06:02.650 align:middle line:90%
Paste that in there.

00:06:02.650 --> 00:06:05.950 align:middle line:84%
It's going to set the
default payload to Windows

00:06:05.950 --> 00:06:08.200 align:middle line:90%
32-bit meterpreter payload.

00:06:08.200 --> 00:06:17.100 align:middle line:84%
So we'll change that to Windows
x64 meterpreter reverse TCP,

00:06:17.100 --> 00:06:17.600 align:middle line:90%
right?

00:06:17.600 --> 00:06:20.540 align:middle line:84%
And the reason we are
doing that is primarily

00:06:20.540 --> 00:06:23.820 align:middle line:84%
because the target system is
a 64-bit operating system.

00:06:23.820 --> 00:06:26.508 align:middle line:84%
So we're going to
say payload instead.

00:06:26.508 --> 00:06:27.050 align:middle line:90%
There we are.

00:06:27.050 --> 00:06:28.310 align:middle line:90%
So that's set correctly now.

00:06:28.310 --> 00:06:30.530 align:middle line:90%
So we can say show options.

00:06:30.530 --> 00:06:33.470 align:middle line:84%
And we have the RHOSTS
value specified for us.

00:06:33.470 --> 00:06:37.790 align:middle line:84%
And authentication via PsExec
is done through TCP port

00:06:37.790 --> 00:06:39.740 align:middle line:90%
445, which is SMB, right?

00:06:39.740 --> 00:06:45.290 align:middle line:84%
So it's going to ask us for the
SMB user and the SMB password.

00:06:45.290 --> 00:06:48.510 align:middle line:84%
So we can specify
the hashes here.

00:06:48.510 --> 00:06:51.560 align:middle line:84%
And we can also
specify the SMB domain

00:06:51.560 --> 00:06:54.390 align:middle line:84%
if the actual system is
connected to a domain.

00:06:54.390 --> 00:06:56.900 align:middle line:84%
So that's something that
you want to keep in mind.

00:06:56.900 --> 00:06:59.000 align:middle line:84%
We'll leave the LHOSTS
and LPORT options

00:06:59.000 --> 00:07:00.500 align:middle line:84%
as they are because
we terminated

00:07:00.500 --> 00:07:03.030 align:middle line:84%
our previous
meterpreter session.

00:07:03.030 --> 00:07:05.840 align:middle line:84%
So if we wanted to
get a meterpreter

00:07:05.840 --> 00:07:09.710 align:middle line:84%
session as the administrator
user, we would copy the hash.

00:07:09.710 --> 00:07:11.970 align:middle line:84%
And the hash ends
right over here.

00:07:11.970 --> 00:07:14.880 align:middle line:84%
So you want to make sure
you don't copy the colons.

00:07:14.880 --> 00:07:16.920 align:middle line:84%
So I'm just going
to copy that there.

00:07:16.920 --> 00:07:22.280 align:middle line:84%
And we're going to set the SMB
user value to administrator,

00:07:22.280 --> 00:07:24.890 align:middle line:84%
or the user that you want
to authenticate as, so

00:07:24.890 --> 00:07:26.420 align:middle line:90%
administrator.

00:07:26.420 --> 00:07:28.290 align:middle line:90%
There we are.

00:07:28.290 --> 00:07:33.240 align:middle line:84%
And we're then going to set
SMB password to the actual hash

00:07:33.240 --> 00:07:33.790 align:middle line:90%
here.

00:07:33.790 --> 00:07:37.770 align:middle line:84%
And of course, if you also
obtain clear text credentials,

00:07:37.770 --> 00:07:42.250 align:middle line:84%
then you can also just paste the
clear text credential in here.

00:07:42.250 --> 00:07:43.440 align:middle line:90%
So I'll hit Enter.

00:07:43.440 --> 00:07:45.870 align:middle line:90%
And we can then hit Exploit.

00:07:45.870 --> 00:07:48.240 align:middle line:90%
Give that a few seconds.

00:07:48.240 --> 00:07:50.670 align:middle line:84%
So first of all, it'll
say connecting to server,

00:07:50.670 --> 00:07:54.390 align:middle line:84%
authenticating to the target
as the user administrator,

00:07:54.390 --> 00:07:57.240 align:middle line:84%
selecting the partial target,
executing the payload,

00:07:57.240 --> 00:07:59.040 align:middle line:84%
and we get a
meterpreter session.

00:07:59.040 --> 00:08:02.700 align:middle line:84%
So is I say sysinfo, you can
see it's a 64-bit meterpreter

00:08:02.700 --> 00:08:03.420 align:middle line:90%
session.

00:08:03.420 --> 00:08:06.240 align:middle line:84%
Get user ID, NT/AUTHORITY
SYSTEM, right?

00:08:06.240 --> 00:08:08.670 align:middle line:84%
So let me put this
in the background.

00:08:08.670 --> 00:08:09.300 align:middle line:90%
There we are.

00:08:09.300 --> 00:08:11.280 align:middle line:90%
And let's list out our sessions.

00:08:11.280 --> 00:08:13.420 align:middle line:84%
You can see this is
NT AUTHORITY SYSTEM.

00:08:13.420 --> 00:08:16.650 align:middle line:84%
So because we authenticated
with the administrator user,

00:08:16.650 --> 00:08:19.770 align:middle line:84%
we get the NT AUTHORITY
SYSTEM privileges.

00:08:19.770 --> 00:08:22.930 align:middle line:84%
We can also authenticate
as the student account.

00:08:22.930 --> 00:08:25.600 align:middle line:84%
So we also got the
student hash here.

00:08:25.600 --> 00:08:29.520 align:middle line:84%
So let me just copy the
actual student hash.

00:08:29.520 --> 00:08:31.620 align:middle line:84%
And I'll show you that
does, indeed, work.

00:08:31.620 --> 00:08:36.210 align:middle line:84%
So I'll set the SMB
user to student.

00:08:36.210 --> 00:08:39.148 align:middle line:84%
Let me just make sure I get
the actual syntax correctly.

00:08:39.148 --> 00:08:39.690 align:middle line:90%
There we are.

00:08:39.690 --> 00:08:41.460 align:middle line:90%
So the user is student.

00:08:41.460 --> 00:08:48.000 align:middle line:84%
And then set the SMB password
to the actual student password

00:08:48.000 --> 00:08:48.850 align:middle line:90%
hash.

00:08:48.850 --> 00:08:51.690 align:middle line:84%
And then we can simply
type in exploit.

00:08:51.690 --> 00:08:55.320 align:middle line:84%
And in this case, it
tells us that is failed,

00:08:55.320 --> 00:08:57.660 align:middle line:84%
primarily because
I think we need

00:08:57.660 --> 00:08:59.610 align:middle line:84%
to specify the
actual LPORT option,

00:08:59.610 --> 00:09:02.860 align:middle line:84%
because port 4444 is
currently being used.

00:09:02.860 --> 00:09:07.213 align:middle line:84%
So I'll say 4433
and then exploit.

00:09:07.213 --> 00:09:09.630 align:middle line:84%
And in this case again, it
tells us that we have an error.

00:09:09.630 --> 00:09:13.380 align:middle line:84%
The server is pointed to the
next unexpected status code.

00:09:13.380 --> 00:09:14.730 align:middle line:90%
Access denied.

00:09:14.730 --> 00:09:17.220 align:middle line:84%
So for some reason,
it looks like we

00:09:17.220 --> 00:09:20.280 align:middle line:84%
aren't able to authenticate
as the student.

00:09:20.280 --> 00:09:22.560 align:middle line:84%
And I copied the
actual hash there.

00:09:22.560 --> 00:09:24.930 align:middle line:84%
But again, in this case,
it looks like we cannot

00:09:24.930 --> 00:09:26.290 align:middle line:90%
authenticate as the student.

00:09:26.290 --> 00:09:30.120 align:middle line:84%
So that's perfectly fine
as long as we have access

00:09:30.120 --> 00:09:33.660 align:middle line:84%
with or through the
administrator credentials.

00:09:33.660 --> 00:09:36.540 align:middle line:84%
Then we pretty much have
administrative access

00:09:36.540 --> 00:09:37.350 align:middle line:90%
on the target.

00:09:37.350 --> 00:09:40.000 align:middle line:84%
And of course, we can do this
as many times as we want.

00:09:40.000 --> 00:09:42.420 align:middle line:84%
So we head over
into sessions 2, you

00:09:42.420 --> 00:09:44.280 align:middle line:84%
can see I still have
access to the session.

00:09:44.280 --> 00:09:48.480 align:middle line:84%
And if I then exit and if
I use the previous command

00:09:48.480 --> 00:09:54.690 align:middle line:84%
where we had set the actual SMB
password to the administrator

00:09:54.690 --> 00:10:00.668 align:middle line:84%
hash and we set the SMB
user to administrator,

00:10:00.668 --> 00:10:02.210 align:middle line:84%
we'll be able to
get another session.

00:10:02.210 --> 00:10:03.830 align:middle line:90%
So I'll say exploit.

00:10:03.830 --> 00:10:04.430 align:middle line:90%
There we are.

00:10:04.430 --> 00:10:05.900 align:middle line:84%
And we get another
session, right?

00:10:05.900 --> 00:10:08.910 align:middle line:84%
So it looks like,
for some reason,

00:10:08.910 --> 00:10:11.450 align:middle line:84%
only the administrator
account works.

00:10:11.450 --> 00:10:13.280 align:middle line:84%
And we can't log
in as the student

00:10:13.280 --> 00:10:15.350 align:middle line:90%
account for whatever reason.

00:10:15.350 --> 00:10:18.740 align:middle line:84%
But that's one of the great
things about gathering

00:10:18.740 --> 00:10:21.290 align:middle line:84%
hashes or credentials
is that you can use them

00:10:21.290 --> 00:10:25.220 align:middle line:84%
to authenticate legitimately
or to essentially perform

00:10:25.220 --> 00:10:28.160 align:middle line:84%
authenticated code
execution, and in this case,

00:10:28.160 --> 00:10:30.240 align:middle line:90%
obtain a meterpreter session.

00:10:30.240 --> 00:10:33.410 align:middle line:84%
So that is how to perform
the pass-the-hash attack

00:10:33.410 --> 00:10:36.200 align:middle line:84%
with PsExec or with
the PsExec module.

00:10:36.200 --> 00:10:39.230 align:middle line:84%
And that is going to
conclude the practical side

00:10:39.230 --> 00:10:42.150 align:middle line:90%
of this video.

00:10:42.150 --> 00:10:44.270 align:middle line:84%
In the next video,
we will be exploring

00:10:44.270 --> 00:10:48.060 align:middle line:84%
the process of establishing
persistence on Windows systems.

00:10:48.060 --> 00:10:50.500 align:middle line:90%
So I'll see you there.

00:10:50.500 --> 00:10:51.000 align:middle line:90%