WEBVTT

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


00:00:10.210 --> 00:00:12.250 align:middle line:90%
Windows Privilege Escalation.

00:00:12.250 --> 00:00:13.990 align:middle line:84%
In this video, we
will be exploring

00:00:13.990 --> 00:00:18.160 align:middle line:84%
the process of utilizing
the credentials we obtained

00:00:18.160 --> 00:00:21.130 align:middle line:84%
in the previous video when
we were taking a look at how

00:00:21.130 --> 00:00:24.730 align:middle line:84%
to identify Windows privilege
escalation vulnerabilities,

00:00:24.730 --> 00:00:26.560 align:middle line:84%
and we'll be
exploring how we can

00:00:26.560 --> 00:00:30.250 align:middle line:84%
use these credentials to
receive an elevated session

00:00:30.250 --> 00:00:33.170 align:middle line:84%
on the target system
that we have compromised.

00:00:33.170 --> 00:00:35.470 align:middle line:84%
So we're going to be
utilizing the same lab

00:00:35.470 --> 00:00:37.780 align:middle line:84%
environment that we used
in the previous video.

00:00:37.780 --> 00:00:41.020 align:middle line:84%
And again, you can follow
along with the steps that

00:00:41.020 --> 00:00:43.810 align:middle line:84%
are required to gain
access to the target system

00:00:43.810 --> 00:00:45.290 align:middle line:90%
from the previous video.

00:00:45.290 --> 00:00:47.890 align:middle line:84%
I'm going to be resuming
where we left off

00:00:47.890 --> 00:00:49.450 align:middle line:84%
at the end of the
previous video,

00:00:49.450 --> 00:00:52.090 align:middle line:84%
where we had already
performed the check

00:00:52.090 --> 00:00:57.130 align:middle line:84%
with the actual privilege
escalation check script.

00:00:57.130 --> 00:00:59.740 align:middle line:84%
And we are going
to head straight

00:00:59.740 --> 00:01:02.500 align:middle line:84%
into how to use these
credentials to obtain

00:01:02.500 --> 00:01:04.000 align:middle line:90%
an elevated session.

00:01:04.000 --> 00:01:06.730 align:middle line:84%
So I'll just switch over
to my lab environment,

00:01:06.730 --> 00:01:11.680 align:middle line:84%
and we can take a look
at how this can be done.

00:01:11.680 --> 00:01:13.720 align:middle line:84%
All right, so I'm back
in the lab environment,

00:01:13.720 --> 00:01:16.950 align:middle line:84%
and this is where we left off
from in the previous video.

00:01:16.950 --> 00:01:20.970 align:middle line:84%
And we identified that there
is a privilege escalation

00:01:20.970 --> 00:01:24.450 align:middle line:84%
vulnerability pertinent
to credentials

00:01:24.450 --> 00:01:27.570 align:middle line:84%
and, more specifically,
the WinLogon feature.

00:01:27.570 --> 00:01:30.840 align:middle line:84%
So the WinLogon feature
is a feature on Windows

00:01:30.840 --> 00:01:34.050 align:middle line:84%
that allows you to configure a
Windows system to automatically

00:01:34.050 --> 00:01:39.060 align:middle line:84%
log on, and the credentials for
this specific user to log on

00:01:39.060 --> 00:01:41.520 align:middle line:84%
are typically stored in
the Windows Registry.

00:01:41.520 --> 00:01:46.080 align:middle line:84%
Now, based on how a system
is configured and secured,

00:01:46.080 --> 00:01:48.780 align:middle line:84%
it is always
recommended to encrypt

00:01:48.780 --> 00:01:53.850 align:middle line:84%
these log on credentials or when
they're stored in the registry.

00:01:53.850 --> 00:01:55.380 align:middle line:84%
And in this case,
it doesn't look

00:01:55.380 --> 00:01:57.280 align:middle line:90%
like that was actually done.

00:01:57.280 --> 00:01:59.880 align:middle line:84%
So you can see under
the actual TEST

00:01:59.880 --> 00:02:02.572 align:middle line:84%
here, CREDS,
WinLogon, we actually

00:02:02.572 --> 00:02:03.780 align:middle line:90%
went through the description.

00:02:03.780 --> 00:02:06.280 align:middle line:84%
But let's just go
through it one more time.

00:02:06.280 --> 00:02:09.449 align:middle line:84%
So this will parse the
WinLogon registry keys

00:02:09.449 --> 00:02:11.400 align:middle line:84%
and check whether they
contain any clear text

00:02:11.400 --> 00:02:14.610 align:middle line:84%
password, entries that have
an empty password field

00:02:14.610 --> 00:02:16.560 align:middle line:90%
or filtered out right.

00:02:16.560 --> 00:02:18.510 align:middle line:84%
So in this case,
we've pretty much

00:02:18.510 --> 00:02:21.330 align:middle line:84%
hit the holy grail in
that we've identified

00:02:21.330 --> 00:02:25.050 align:middle line:84%
the credentials or the password
for the administrator account

00:02:25.050 --> 00:02:25.960 align:middle line:90%
on the system.

00:02:25.960 --> 00:02:28.740 align:middle line:84%
And as we know, the
administrator account

00:02:28.740 --> 00:02:31.170 align:middle line:84%
on a Windows system
is pretty much

00:02:31.170 --> 00:02:34.380 align:middle line:84%
the user account that has the
highest level of privileges

00:02:34.380 --> 00:02:35.460 align:middle line:90%
available, right?

00:02:35.460 --> 00:02:37.590 align:middle line:84%
And we have the clear text
password, which means,

00:02:37.590 --> 00:02:42.270 align:middle line:84%
in this case, we really do not
even need to crack any hashes.

00:02:42.270 --> 00:02:44.670 align:middle line:84%
We pretty much have
got the credentials

00:02:44.670 --> 00:02:45.850 align:middle line:90%
that we're looking for.

00:02:45.850 --> 00:02:48.300 align:middle line:84%
So you might be asking
yourself, what can we

00:02:48.300 --> 00:02:49.870 align:middle line:90%
do with this information?

00:02:49.870 --> 00:02:51.610 align:middle line:84%
How do we elevate
our privileges?

00:02:51.610 --> 00:02:54.960 align:middle line:84%
How do we switch to
the administrator user?

00:02:54.960 --> 00:02:58.110 align:middle line:84%
So let's get started with
the first technique, right?

00:02:58.110 --> 00:03:01.530 align:middle line:84%
And we'll explore how to do this
with and without Meterpreter

00:03:01.530 --> 00:03:03.130 align:middle line:90%
or the Metasploit framework.

00:03:03.130 --> 00:03:05.560 align:middle line:84%
So let me just paste in the
password that I copy this,

00:03:05.560 --> 00:03:08.310 align:middle line:90%
so that I have it on hand here.

00:03:08.310 --> 00:03:10.660 align:middle line:84%
And I'll zoom in so you
can actually see it.

00:03:10.660 --> 00:03:13.010 align:middle line:84%
So I've pasted it in the
password for the administrator

00:03:13.010 --> 00:03:13.510 align:middle line:90%
user.

00:03:13.510 --> 00:03:16.080 align:middle line:84%
So once you have gathered
these credentials,

00:03:16.080 --> 00:03:19.860 align:middle line:84%
you know that every Windows
system will have SMB running.

00:03:19.860 --> 00:03:26.310 align:middle line:84%
And as part of the wide variety
of features that Windows has,

00:03:26.310 --> 00:03:28.710 align:middle line:84%
one of the features that
it has is the ability

00:03:28.710 --> 00:03:30.930 align:middle line:90%
to authenticate with SMB, right?

00:03:30.930 --> 00:03:34.170 align:middle line:84%
And we can utilize a
Python implementation

00:03:34.170 --> 00:03:39.270 align:middle line:84%
of the PsExec utility to
log in to the target system

00:03:39.270 --> 00:03:42.150 align:middle line:84%
and obtain an elevated
session because we

00:03:42.150 --> 00:03:44.110 align:middle line:90%
have administrator credentials.

00:03:44.110 --> 00:03:46.980 align:middle line:84%
So what I'll do is, I'll just
right click on my terminal,

00:03:46.980 --> 00:03:48.540 align:middle line:90%
and I'll open up a new tab.

00:03:48.540 --> 00:03:50.670 align:middle line:84%
And this Kali Linux
system already

00:03:50.670 --> 00:03:52.690 align:middle line:90%
has the PsExec Python script.

00:03:52.690 --> 00:03:56.760 align:middle line:84%
So if I just type in psexec,
you can see it'll auto complete,

00:03:56.760 --> 00:03:59.370 align:middle line:84%
and the script
name is psexec.py.

00:03:59.370 --> 00:04:01.530 align:middle line:84%
So how can you log in
to the target system?

00:04:01.530 --> 00:04:03.450 align:middle line:84%
We're logging into
the target system

00:04:03.450 --> 00:04:05.430 align:middle line:84%
or authenticating
with the target system

00:04:05.430 --> 00:04:08.820 align:middle line:90%
with psexec is fairly simple.

00:04:08.820 --> 00:04:13.860 align:middle line:84%
It's quite familiar to
logging in to a system via SSH

00:04:13.860 --> 00:04:15.630 align:middle line:90%
or through the SSH client.

00:04:15.630 --> 00:04:18.209 align:middle line:84%
We specify the
PsExec Python script,

00:04:18.209 --> 00:04:20.190 align:middle line:84%
and then we specify
the user that we

00:04:20.190 --> 00:04:22.079 align:middle line:90%
want to authenticate as.

00:04:22.079 --> 00:04:25.590 align:middle line:84%
So in this case, the user
account is administrator.

00:04:25.590 --> 00:04:29.530 align:middle line:84%
And then, we say, @ and
specify the target IP address.

00:04:29.530 --> 00:04:34.290 align:middle line:84%
So this is the system we would
like to authenticate with.

00:04:34.290 --> 00:04:36.240 align:middle line:90%
I'll just paste that in there.

00:04:36.240 --> 00:04:38.040 align:middle line:84%
And then, we need
the password on hand,

00:04:38.040 --> 00:04:40.530 align:middle line:90%
so I'll also copy that there.

00:04:40.530 --> 00:04:42.030 align:middle line:90%
And we can then hit Enter.

00:04:42.030 --> 00:04:43.890 align:middle line:84%
This is going to
prompt you to enter

00:04:43.890 --> 00:04:45.640 align:middle line:90%
the password for the user.

00:04:45.640 --> 00:04:47.380 align:middle line:90%
So I'll paste it in there.

00:04:47.380 --> 00:04:50.550 align:middle line:84%
And if I hit Enter, you can see
it's going to request shares.

00:04:50.550 --> 00:04:52.420 align:middle line:84%
It's going to find
a writable share,

00:04:52.420 --> 00:04:53.730 align:middle line:90%
and this is the admin share.

00:04:53.730 --> 00:04:57.840 align:middle line:84%
It's then going to upload the
payload and open up SVCManager.

00:04:57.840 --> 00:04:59.670 align:middle line:84%
And it's then going
to create the service,

00:04:59.670 --> 00:05:02.770 align:middle line:84%
and we are provided with
a command shell session.

00:05:02.770 --> 00:05:05.500 align:middle line:84%
So you might be
asking yourself, well,

00:05:05.500 --> 00:05:07.140 align:middle line:84%
what privileges do
I currently have?

00:05:07.140 --> 00:05:10.290 align:middle line:84%
Or what user do I currently have
access on the target system as?

00:05:10.290 --> 00:05:14.430 align:middle line:84%
By typing whoamI, can
see nt authority system,

00:05:14.430 --> 00:05:17.880 align:middle line:84%
which is the highest privileges
available on a Windows system.

00:05:17.880 --> 00:05:21.960 align:middle line:84%
And you know, I can say
net user, for example.

00:05:21.960 --> 00:05:24.280 align:middle line:84%
And these are all the user
accounts on the system.

00:05:24.280 --> 00:05:28.830 align:middle line:84%
So I can say,
whoamI priv, and we

00:05:28.830 --> 00:05:31.110 align:middle line:84%
should have all the
privileges that you typically

00:05:31.110 --> 00:05:34.740 align:middle line:84%
have if you gained
access to a target system

00:05:34.740 --> 00:05:36.130 align:middle line:90%
as the administrator user.

00:05:36.130 --> 00:05:39.450 align:middle line:84%
So we have essentially
elevated our privileges,

00:05:39.450 --> 00:05:42.480 align:middle line:84%
and this was all
facilitated through the use

00:05:42.480 --> 00:05:47.050 align:middle line:84%
of the priv check script,
which is fantastic.

00:05:47.050 --> 00:05:49.530 align:middle line:84%
So this is one way you
can use the credentials.

00:05:49.530 --> 00:05:53.220 align:middle line:84%
And of course, this
PsExec authenticates

00:05:53.220 --> 00:05:55.380 align:middle line:90%
to the target system via SMB.

00:05:55.380 --> 00:05:57.360 align:middle line:84%
And remember, the
great thing about this

00:05:57.360 --> 00:06:00.210 align:middle line:84%
is, we are not
exploiting the system.

00:06:00.210 --> 00:06:02.400 align:middle line:84%
We're just authenticating
legitimately

00:06:02.400 --> 00:06:05.050 align:middle line:84%
because we have obtained
legitimate credentials.

00:06:05.050 --> 00:06:08.640 align:middle line:84%
Now, if you want to obtain an
elevated Meterpreter session,

00:06:08.640 --> 00:06:12.840 align:middle line:84%
and you have the
administrators credentials,

00:06:12.840 --> 00:06:16.230 align:middle line:84%
you can also do this within the
Metasploit framework, right?

00:06:16.230 --> 00:06:20.190 align:middle line:84%
So I'll just terminate this
particular channel here,

00:06:20.190 --> 00:06:23.260 align:middle line:84%
and I'll put my Meterpreter
session in the background.

00:06:23.260 --> 00:06:25.430 align:middle line:84%
Remember, this is the
unprivileged Meterpreter

00:06:25.430 --> 00:06:25.930 align:middle line:90%
session.

00:06:25.930 --> 00:06:29.100 align:middle line:84%
So if I list out my sessions,
we have the standard command

00:06:29.100 --> 00:06:31.370 align:middle line:84%
shell, and then we have the
unprivileged Meterpreter

00:06:31.370 --> 00:06:31.870 align:middle line:90%
session.

00:06:31.870 --> 00:06:34.980 align:middle line:84%
And you can see, we had access
through the student user.

00:06:34.980 --> 00:06:38.090 align:middle line:84%
We can search for the
PsExec Metasploit modules.

00:06:38.090 --> 00:06:41.820 align:middle line:84%
So I'll say, search
psexec, and we are looking

00:06:41.820 --> 00:06:43.423 align:middle line:90%
for the following module.

00:06:43.423 --> 00:06:44.590 align:middle line:90%
Let me see if I can find it.

00:06:44.590 --> 00:06:45.160 align:middle line:90%
There it is.

00:06:45.160 --> 00:06:48.870 align:middle line:84%
So this is the one here--
exploit/windows/smb/psexec.

00:06:48.870 --> 00:06:52.350 align:middle line:84%
So this is the Microsoft
Windows authenticated user code

00:06:52.350 --> 00:06:53.140 align:middle line:90%
execution.

00:06:53.140 --> 00:06:55.110 align:middle line:84%
So in order to use
this module, you

00:06:55.110 --> 00:06:56.610 align:middle line:90%
need legitimate credentials.

00:06:56.610 --> 00:07:00.240 align:middle line:84%
So I'll say, use, and I'll
paste the actual module name

00:07:00.240 --> 00:07:01.720 align:middle line:90%
in there.

00:07:01.720 --> 00:07:03.370 align:middle line:84%
And it'll set the
default payload

00:07:03.370 --> 00:07:05.980 align:middle line:84%
to
windows/meterpreter/reverse_tcp.

00:07:05.980 --> 00:07:08.920 align:middle line:84%
This is the 32-bit
Meterpreter payload.

00:07:08.920 --> 00:07:12.080 align:middle line:84%
That's fine for now because we
can always migrate our process.

00:07:12.080 --> 00:07:14.110 align:middle line:90%
So let's show the options.

00:07:14.110 --> 00:07:15.790 align:middle line:84%
For the payload
options, make sure

00:07:15.790 --> 00:07:18.520 align:middle line:84%
that the LHOST is set
to your Kali Linux IP,

00:07:18.520 --> 00:07:20.410 align:middle line:84%
and make sure that
you set L port

00:07:20.410 --> 00:07:23.230 align:middle line:84%
to a port that is not--
that will not conflict

00:07:23.230 --> 00:07:24.610 align:middle line:90%
with your current sessions.

00:07:24.610 --> 00:07:29.230 align:middle line:84%
So in my case, I know that
both port 4444 is being

00:07:29.230 --> 00:07:31.780 align:middle line:90%
used as well as port 4433.

00:07:31.780 --> 00:07:34.510 align:middle line:90%
So I'll set the L port to 4422.

00:07:34.510 --> 00:07:37.970 align:middle line:84%
We then need to specify
the target IP address.

00:07:37.970 --> 00:07:40.107 align:middle line:84%
So we'll just copy
the target IP here.

00:07:40.107 --> 00:07:42.190 align:middle line:84%
And in your case, this
will be different, but just

00:07:42.190 --> 00:07:43.270 align:middle line:90%
copy the value.

00:07:43.270 --> 00:07:48.130 align:middle line:84%
We'll say set RHOSTS,
paste that in there,

00:07:48.130 --> 00:07:50.050 align:middle line:90%
and we then need to set--

00:07:50.050 --> 00:07:53.345 align:middle line:84%
we then need to set the SMB
user and the SMB password.

00:07:53.345 --> 00:07:55.220 align:middle line:84%
So this is where you
put in your credentials.

00:07:55.220 --> 00:08:00.490 align:middle line:84%
I'm going to say, set SMBUser
to administrator because that's

00:08:00.490 --> 00:08:02.140 align:middle line:84%
the account we
authenticating with,

00:08:02.140 --> 00:08:07.770 align:middle line:84%
and then set SMBPass
to the password

00:08:07.770 --> 00:08:09.780 align:middle line:90%
that we identified, right?

00:08:09.780 --> 00:08:13.350 align:middle line:90%
So I'll just copy that there.

00:08:13.350 --> 00:08:18.630 align:middle line:84%
And I'll paste that in there,
and we can hit exploit.

00:08:18.630 --> 00:08:21.688 align:middle line:84%
And we should receive an
elevated Meterpreter session.

00:08:21.688 --> 00:08:22.230 align:middle line:90%
There we are.

00:08:22.230 --> 00:08:24.270 align:middle line:84%
Almost immediately, you
can see that it will

00:08:24.270 --> 00:08:26.970 align:middle line:90%
connect to the target system.

00:08:26.970 --> 00:08:29.340 align:middle line:84%
It is then going to authenticate
to the target system

00:08:29.340 --> 00:08:31.170 align:middle line:90%
as the user administrator.

00:08:31.170 --> 00:08:33.030 align:middle line:84%
It's going to select
the partial target.

00:08:33.030 --> 00:08:34.890 align:middle line:84%
It's going to
execute the payload,

00:08:34.890 --> 00:08:37.659 align:middle line:84%
and the Meterpreter
session will be opened up.

00:08:37.659 --> 00:08:39.720 align:middle line:90%
So we can say, sysinfo.

00:08:39.720 --> 00:08:42.090 align:middle line:84%
You can see we're still
on the same target system.

00:08:42.090 --> 00:08:45.720 align:middle line:84%
If I say getuid, NT
AUTHORITY SYSTEM.

00:08:45.720 --> 00:08:49.830 align:middle line:84%
And we have successfully been
able to elevate our privileges

00:08:49.830 --> 00:08:52.120 align:middle line:90%
on a Windows system.

00:08:52.120 --> 00:08:55.140 align:middle line:84%
So that is going to conclude
the practical demonstration

00:08:55.140 --> 00:08:57.460 align:middle line:90%
side of this video.

00:08:57.460 --> 00:09:01.110 align:middle line:84%
All right, so that concludes
the Windows privilege escalation

00:09:01.110 --> 00:09:03.400 align:middle line:90%
section of this course.

00:09:03.400 --> 00:09:06.480 align:middle line:84%
As I said, these are going to
be relatively short, primarily

00:09:06.480 --> 00:09:09.360 align:middle line:84%
because I've covered
other privilege escalation

00:09:09.360 --> 00:09:12.420 align:middle line:84%
techniques within the system
and host-based attacks course

00:09:12.420 --> 00:09:15.120 align:middle line:84%
in addition to the
Metasploit framework course.

00:09:15.120 --> 00:09:16.980 align:middle line:84%
What I was really
focused on here

00:09:16.980 --> 00:09:21.030 align:middle line:84%
is the process of identifying
Windows privilege escalation

00:09:21.030 --> 00:09:22.380 align:middle line:90%
vulnerabilities, right?

00:09:22.380 --> 00:09:25.920 align:middle line:84%
And we've been able to take
a look at a good example that

00:09:25.920 --> 00:09:28.500 align:middle line:84%
highlights the
importance of these tools

00:09:28.500 --> 00:09:33.240 align:middle line:84%
and the importance of performing
checks based on all the Windows

00:09:33.240 --> 00:09:36.090 align:middle line:84%
features configuration
files in order

00:09:36.090 --> 00:09:39.930 align:middle line:84%
to identify privilege
escalation vulnerabilities that

00:09:39.930 --> 00:09:41.100 align:middle line:90%
can be exploited.

00:09:41.100 --> 00:09:42.750 align:middle line:84%
With that being said,
we are now going

00:09:42.750 --> 00:09:44.460 align:middle line:84%
to move on to the
next section, which

00:09:44.460 --> 00:09:48.840 align:middle line:84%
is going to involve performing
privilege escalation on Linux.

00:09:48.840 --> 00:09:52.654 align:middle line:84%
So I'll be seeing you
in the next video.

00:09:52.654 --> 00:09:53.154 align:middle line:90%