WEBVTT

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


00:00:09.900 --> 00:00:12.360 align:middle line:90%
Access token impersonation.

00:00:12.360 --> 00:00:15.720 align:middle line:84%
Now that we've explored two
Windows privilege escalation

00:00:15.720 --> 00:00:17.610 align:middle line:84%
techniques that
essentially exploit

00:00:17.610 --> 00:00:21.510 align:middle line:84%
inherent vulnerabilities within
the Windows operating system,

00:00:21.510 --> 00:00:23.100 align:middle line:84%
and, of course, in
the case of kernel

00:00:23.100 --> 00:00:26.880 align:middle line:84%
exploits within the Windows
kernel or Windows NT,

00:00:26.880 --> 00:00:29.880 align:middle line:84%
we can turn our attention to
another privilege escalation

00:00:29.880 --> 00:00:33.780 align:middle line:84%
technique that takes advantage
of inherent vulnerabilities

00:00:33.780 --> 00:00:34.860 align:middle line:90%
within Windows.

00:00:34.860 --> 00:00:38.280 align:middle line:84%
And that, of course, involves
the Windows access tokens.

00:00:38.280 --> 00:00:40.320 align:middle line:84%
More specifically,
we'll be taking a look

00:00:40.320 --> 00:00:43.860 align:middle line:84%
at how we can impersonate
a Windows access token that

00:00:43.860 --> 00:00:46.830 align:middle line:84%
belongs to a privileged
user, therefore

00:00:46.830 --> 00:00:50.040 align:middle line:84%
essentially inheriting
the privileges associated

00:00:50.040 --> 00:00:53.440 align:middle line:84%
with that elevated or
privileged user account.

00:00:53.440 --> 00:00:53.940 align:middle line:90%
All right.

00:00:53.940 --> 00:00:57.690 align:middle line:84%
So before we get started with
the practical demonstration,

00:00:57.690 --> 00:01:00.870 align:middle line:84%
let's get an idea of what
Windows access tokens are.

00:01:00.870 --> 00:01:02.640 align:middle line:84%
All right, so
Windows access tokens

00:01:02.640 --> 00:01:04.980 align:middle line:84%
are a core element
of the authentication

00:01:04.980 --> 00:01:09.180 align:middle line:84%
process on Windows and
are created and managed

00:01:09.180 --> 00:01:12.120 align:middle line:84%
by the Local Security
Authority Subsystem Service,

00:01:12.120 --> 00:01:14.250 align:middle line:90%
also known as LSASS.

00:01:14.250 --> 00:01:16.830 align:middle line:84%
And again-- so if
you've ever opened up

00:01:16.830 --> 00:01:18.540 align:middle line:84%
the Task Manager
on a Windows system

00:01:18.540 --> 00:01:22.830 align:middle line:84%
and you see an application
or service called lsass.exe,

00:01:22.830 --> 00:01:26.070 align:middle line:84%
that is the Local Security
Authority Subsystem Service.

00:01:26.070 --> 00:01:26.700 align:middle line:90%
All right.

00:01:26.700 --> 00:01:30.390 align:middle line:84%
Now, a Windows access token
is responsible for identifying

00:01:30.390 --> 00:01:33.870 align:middle line:84%
and describing the security
context of a process

00:01:33.870 --> 00:01:35.760 align:middle line:90%
or thread running on a system.

00:01:35.760 --> 00:01:38.220 align:middle line:84%
Simply put, an
access token can be

00:01:38.220 --> 00:01:42.030 align:middle line:84%
thought of as a temporary
key akin to a web cookie that

00:01:42.030 --> 00:01:45.360 align:middle line:84%
provides users with access to
a system or network resource

00:01:45.360 --> 00:01:47.310 align:middle line:84%
without having to
provide credentials

00:01:47.310 --> 00:01:50.295 align:middle line:84%
each time a process is
started, or a system resource

00:01:50.295 --> 00:01:51.688 align:middle line:90%
is accessed.

00:01:51.688 --> 00:01:53.730 align:middle line:84%
All right, so you might
be a little bit confused.

00:01:53.730 --> 00:01:57.090 align:middle line:84%
Well, let me just
explain this or elaborate

00:01:57.090 --> 00:02:00.330 align:middle line:84%
further so that you can get a
clear idea of what an access

00:02:00.330 --> 00:02:01.440 align:middle line:90%
token is.

00:02:01.440 --> 00:02:04.050 align:middle line:84%
All right, so an access
token is generated

00:02:04.050 --> 00:02:07.770 align:middle line:84%
by the winlogon.exe
process every time

00:02:07.770 --> 00:02:09.960 align:middle line:84%
a user authenticates
successfully,

00:02:09.960 --> 00:02:13.740 align:middle line:84%
and that access token includes
the identity of the user

00:02:13.740 --> 00:02:16.560 align:middle line:84%
account that is
just authenticated

00:02:16.560 --> 00:02:18.870 align:middle line:84%
and the privileges
of the user account

00:02:18.870 --> 00:02:21.330 align:middle line:84%
associated with the
thread or process.

00:02:21.330 --> 00:02:24.870 align:middle line:84%
So whenever you start up your
Windows operating system,

00:02:24.870 --> 00:02:28.050 align:middle line:84%
you will be prompted
with a login page that

00:02:28.050 --> 00:02:29.940 align:middle line:90%
is handled by winlogon.exe.

00:02:29.940 --> 00:02:34.410 align:middle line:84%
So whenever you type in the
password for the user account

00:02:34.410 --> 00:02:39.720 align:middle line:84%
that you're logging into,
winlogon.exe will essentially

00:02:39.720 --> 00:02:43.140 align:middle line:84%
generate an access token,
and this access token

00:02:43.140 --> 00:02:45.990 align:middle line:84%
includes the identity
of the user account

00:02:45.990 --> 00:02:48.810 align:middle line:84%
as well as the privileges
associated with that user

00:02:48.810 --> 00:02:50.080 align:middle line:90%
account.

00:02:50.080 --> 00:02:55.350 align:middle line:84%
Now, this token is then attached
to the userinit.exe process,

00:02:55.350 --> 00:02:58.770 align:middle line:84%
after which all child
processes started by a user

00:02:58.770 --> 00:03:02.250 align:middle line:84%
will inherit a copy of the
access token from their creator

00:03:02.250 --> 00:03:04.920 align:middle line:84%
and will run under the
privileges of the same access

00:03:04.920 --> 00:03:05.460 align:middle line:90%
token.

00:03:05.460 --> 00:03:09.510 align:middle line:84%
So access tokens are essentially
used to restrict access

00:03:09.510 --> 00:03:12.990 align:middle line:84%
in terms of what users can
execute and what they cannot

00:03:12.990 --> 00:03:18.450 align:middle line:84%
execute primarily because they
essentially specify that these

00:03:18.450 --> 00:03:21.480 align:middle line:84%
are the privileges associated
with this particular user

00:03:21.480 --> 00:03:22.050 align:middle line:90%
account.

00:03:22.050 --> 00:03:25.530 align:middle line:84%
So again, going back to
the userinit process here,

00:03:25.530 --> 00:03:28.080 align:middle line:84%
you can see that the token
is attached to userinit.

00:03:28.080 --> 00:03:30.450 align:middle line:84%
Now, userinit is
the process that is

00:03:30.450 --> 00:03:32.110 align:middle line:90%
used to create other processes.

00:03:32.110 --> 00:03:36.510 align:middle line:84%
So, for example, if I log
on to a Windows system,

00:03:36.510 --> 00:03:39.600 align:middle line:84%
Windows will generate or
rather user-- or winlogon.exe

00:03:39.600 --> 00:03:44.100 align:middle line:84%
will generate an access
token, and it will then

00:03:44.100 --> 00:03:46.210 align:middle line:90%
be attached to userinit.exe.

00:03:46.210 --> 00:03:51.270 align:middle line:84%
So whenever I try and open up a
browser, for example, Firefox,

00:03:51.270 --> 00:03:54.630 align:middle line:84%
that process will be
executed with the access

00:03:54.630 --> 00:03:57.330 align:middle line:84%
token or the privileges
associated with that access

00:03:57.330 --> 00:03:59.910 align:middle line:84%
token, and that
essentially prevents me

00:03:59.910 --> 00:04:04.650 align:middle line:84%
from accessing Firefox
under any other privileges.

00:04:04.650 --> 00:04:09.990 align:middle line:84%
So in terms of how they
work and their categories,

00:04:09.990 --> 00:04:12.060 align:middle line:84%
Windows access tokens
are categorized

00:04:12.060 --> 00:04:14.950 align:middle line:84%
based on varying security
levels assigned to them.

00:04:14.950 --> 00:04:17.040 align:middle line:84%
These security levels
are used to determine

00:04:17.040 --> 00:04:20.190 align:middle line:84%
the privileges that are
assigned to a specific token.

00:04:20.190 --> 00:04:22.200 align:middle line:84%
So an access token
will typically

00:04:22.200 --> 00:04:24.720 align:middle line:84%
be assigned one of the
following security levels.

00:04:24.720 --> 00:04:27.990 align:middle line:84%
So you will typically see that
you have two types of Windows

00:04:27.990 --> 00:04:28.980 align:middle line:90%
access tokens.

00:04:28.980 --> 00:04:31.620 align:middle line:84%
You have your
impersonate-level tokens

00:04:31.620 --> 00:04:33.420 align:middle line:90%
and your delegate-level tokens.

00:04:33.420 --> 00:04:36.060 align:middle line:84%
So your impersonate-level
tokens are

00:04:36.060 --> 00:04:40.200 align:middle line:84%
created as a direct result
of a non-interactive login

00:04:40.200 --> 00:04:45.120 align:middle line:84%
or logon a Windows
system, typically

00:04:45.120 --> 00:04:49.620 align:middle line:84%
through specific system
services or domain logons.

00:04:49.620 --> 00:04:53.460 align:middle line:84%
So whenever you see an
impersonate Windows access

00:04:53.460 --> 00:04:55.200 align:middle line:84%
token, just know that
they were created

00:04:55.200 --> 00:04:58.290 align:middle line:84%
as a direct result of
a non-interactive logon

00:04:58.290 --> 00:04:59.950 align:middle line:90%
onto the Windows system.

00:04:59.950 --> 00:05:02.560 align:middle line:84%
You then have your
delegate-level tokens,

00:05:02.560 --> 00:05:06.250 align:middle line:84%
and these are typically created
through an interactive login

00:05:06.250 --> 00:05:09.280 align:middle line:84%
on Windows, primarily
through a traditional login

00:05:09.280 --> 00:05:12.400 align:middle line:84%
through winlogon.exe or
through remote access

00:05:12.400 --> 00:05:14.785 align:middle line:90%
protocols such as RDP.

00:05:14.785 --> 00:05:15.370 align:middle line:90%
All right.

00:05:15.370 --> 00:05:17.920 align:middle line:84%
Now, impersonate-level
tokens can

00:05:17.920 --> 00:05:20.470 align:middle line:84%
be used to impersonate a
token on a local system

00:05:20.470 --> 00:05:24.160 align:middle line:84%
and not on any external
systems that utilize the token,

00:05:24.160 --> 00:05:26.830 align:middle line:84%
whereas delegate-level
tokens pose the largest

00:05:26.830 --> 00:05:29.320 align:middle line:84%
threat as they can be
used to impersonate tokens

00:05:29.320 --> 00:05:30.970 align:middle line:90%
on any system.

00:05:30.970 --> 00:05:32.540 align:middle line:84%
All right, so just
keep that in mind.

00:05:32.540 --> 00:05:34.490 align:middle line:84%
And, as I said, you might
be a little bit confused,

00:05:34.490 --> 00:05:36.220 align:middle line:84%
but this will make
sense as we progress

00:05:36.220 --> 00:05:38.600 align:middle line:84%
through the practical
demonstration.

00:05:38.600 --> 00:05:41.590 align:middle line:84%
All right, so now that we have
an idea of what Windows access

00:05:41.590 --> 00:05:43.960 align:middle line:84%
tokens are and how
they work, let's

00:05:43.960 --> 00:05:47.170 align:middle line:84%
take a look at a closer
look at Windows privileges.

00:05:47.170 --> 00:05:50.140 align:middle line:84%
So every user account
has Windows privileges

00:05:50.140 --> 00:05:52.420 align:middle line:84%
or privileges assigned to
them, and these privileges

00:05:52.420 --> 00:05:55.930 align:middle line:84%
essentially determine what
this user can do or can't do,

00:05:55.930 --> 00:06:00.100 align:middle line:84%
and, of course, we've explored
this in previous videos.

00:06:00.100 --> 00:06:02.800 align:middle line:84%
For example, whenever we
got a Meterpreter session

00:06:02.800 --> 00:06:05.560 align:middle line:84%
on the target, and
we typed in getprivs,

00:06:05.560 --> 00:06:08.320 align:middle line:84%
this would display the list
of Windows privileges assigned

00:06:08.320 --> 00:06:10.930 align:middle line:84%
to this account, and
from those privileges,

00:06:10.930 --> 00:06:14.500 align:middle line:84%
we were able to identify
what we can and cannot do.

00:06:14.500 --> 00:06:17.050 align:middle line:84%
Now, the process of
impersonating access tokens

00:06:17.050 --> 00:06:19.570 align:middle line:84%
in order to elevate our
privileges on a system

00:06:19.570 --> 00:06:22.360 align:middle line:84%
will primarily depend on
the privileges assigned

00:06:22.360 --> 00:06:26.200 align:middle line:84%
to the account that has been
exploited in order to gain

00:06:26.200 --> 00:06:28.630 align:middle line:84%
initial access, as well
as the impersonation

00:06:28.630 --> 00:06:32.320 align:middle line:90%
or delegation tokens available.

00:06:32.320 --> 00:06:34.900 align:middle line:84%
So the following
are the privileges

00:06:34.900 --> 00:06:37.470 align:middle line:84%
that are required for a
successful impersonation

00:06:37.470 --> 00:06:37.970 align:middle line:90%
attack.

00:06:37.970 --> 00:06:40.540 align:middle line:84%
So in order for you to
impersonate another Windows

00:06:40.540 --> 00:06:44.050 align:middle line:84%
access token, you need to
have one of the following,

00:06:44.050 --> 00:06:48.850 align:middle line:84%
but primarily the Se impersonate
privilege assigned to the user

00:06:48.850 --> 00:06:51.070 align:middle line:84%
account that you
currently have access to.

00:06:51.070 --> 00:06:54.350 align:middle line:84%
So you have the
SeAssignPrimaryToken privilege.

00:06:54.350 --> 00:06:57.220 align:middle line:84%
This essentially allows a
user to impersonate tokens.

00:06:57.220 --> 00:07:00.700 align:middle line:84%
SeCreateToken allows the user
to create an arbitrary token

00:07:00.700 --> 00:07:02.500 align:middle line:90%
with administrative privileges.

00:07:02.500 --> 00:07:05.080 align:middle line:84%
And then
SeImpersonatePrivilege, this

00:07:05.080 --> 00:07:07.600 align:middle line:84%
allows a user to create a
process under the security

00:07:07.600 --> 00:07:09.490 align:middle line:84%
context of another
user, typically

00:07:09.490 --> 00:07:11.620 align:middle line:90%
with administrative privileges.

00:07:11.620 --> 00:07:13.840 align:middle line:84%
All right, so these
are the privileges

00:07:13.840 --> 00:07:15.430 align:middle line:84%
that are required
in order for you

00:07:15.430 --> 00:07:18.340 align:middle line:84%
to impersonate a
Windows access token.

00:07:18.340 --> 00:07:20.290 align:middle line:84%
And, of course, in this
case, we are primarily

00:07:20.290 --> 00:07:23.500 align:middle line:84%
looking for access tokens
with administrative privileges

00:07:23.500 --> 00:07:25.960 align:middle line:84%
or access tokens
that belong to users

00:07:25.960 --> 00:07:28.130 align:middle line:90%
with administrative privileges.

00:07:28.130 --> 00:07:28.630 align:middle line:90%
All right.

00:07:28.630 --> 00:07:32.500 align:middle line:84%
Now, in order to perform
access token impersonation,

00:07:32.500 --> 00:07:34.990 align:middle line:84%
we are going to be
utilizing a Meterpreter

00:07:34.990 --> 00:07:37.630 align:middle line:84%
session on a target, and
more specifically, we

00:07:37.630 --> 00:07:39.910 align:middle line:84%
will be utilizing an
inbuilt Meterpreter

00:07:39.910 --> 00:07:41.830 align:middle line:90%
module called incognito.

00:07:41.830 --> 00:07:44.320 align:middle line:84%
All right, so incognito
was originally

00:07:44.320 --> 00:07:47.320 align:middle line:84%
a standalone application,
and what it does

00:07:47.320 --> 00:07:49.300 align:middle line:84%
or the way it works
is it essentially

00:07:49.300 --> 00:07:54.010 align:middle line:84%
allows you to list the available
impersonation or other access

00:07:54.010 --> 00:07:56.590 align:middle line:84%
tokens available that
you can impersonate,

00:07:56.590 --> 00:07:59.080 align:middle line:84%
after which you can also
use it to impersonate

00:07:59.080 --> 00:08:01.040 align:middle line:90%
a specific access token.

00:08:01.040 --> 00:08:04.910 align:middle line:84%
Now, it's very important
to actually specify this.

00:08:04.910 --> 00:08:07.990 align:middle line:84%
In this particular demonstration
or in this scenario,

00:08:07.990 --> 00:08:10.510 align:middle line:84%
we are only going
to be taking a look

00:08:10.510 --> 00:08:14.230 align:middle line:84%
at how to list the available
access tokens available

00:08:14.230 --> 00:08:16.210 align:middle line:90%
and how to impersonate them.

00:08:16.210 --> 00:08:20.080 align:middle line:84%
And the whole process
of token impersonation

00:08:20.080 --> 00:08:22.763 align:middle line:90%
really involves two techniques.

00:08:22.763 --> 00:08:24.430 align:middle line:84%
The first technique
we will be exploring

00:08:24.430 --> 00:08:26.440 align:middle line:84%
in this video and
the second technique

00:08:26.440 --> 00:08:28.600 align:middle line:84%
will essentially
involve utilizing

00:08:28.600 --> 00:08:32.230 align:middle line:84%
exploit code or an executable,
or really, the attack,

00:08:32.230 --> 00:08:34.299 align:middle line:84%
as it's called, is
the potato attack,

00:08:34.299 --> 00:08:39.400 align:middle line:84%
in order to get an NT authority
system access token generated

00:08:39.400 --> 00:08:41.179 align:middle line:90%
so that you can impersonate it.

00:08:41.179 --> 00:08:42.770 align:middle line:84%
However, in this
case, as I said,

00:08:42.770 --> 00:08:45.940 align:middle line:84%
we're only going to be utilizing
the currently available access

00:08:45.940 --> 00:08:49.360 align:middle line:84%
tokens, and we're going to be
impersonating them in order

00:08:49.360 --> 00:08:50.800 align:middle line:90%
to elevate our privileges.

00:08:50.800 --> 00:08:53.740 align:middle line:84%
We will be covering potato
attacks in the privilege

00:08:53.740 --> 00:08:55.750 align:middle line:84%
escalation course
because we will

00:08:55.750 --> 00:08:58.240 align:middle line:84%
be diving deeper into
these privilege escalation

00:08:58.240 --> 00:08:59.858 align:middle line:90%
techniques in that course.

00:08:59.858 --> 00:09:01.900 align:middle line:84%
But for now, we're only
going to be taking a look

00:09:01.900 --> 00:09:03.380 align:middle line:90%
at one of these techniques.

00:09:03.380 --> 00:09:06.560 align:middle line:84%
All right, so this particular
video has a lab environment,

00:09:06.560 --> 00:09:08.440 align:middle line:84%
so fire it up, and
you can follow along

00:09:08.440 --> 00:09:09.790 align:middle line:90%
with the demonstrations.

00:09:09.790 --> 00:09:12.230 align:middle line:84%
So I'm going to fire
up my lab environment,

00:09:12.230 --> 00:09:16.590 align:middle line:90%
and I'll see you within the lab.

00:09:16.590 --> 00:09:19.180 align:middle line:84%
All right, so I'm back
within the lab environment,

00:09:19.180 --> 00:09:21.528 align:middle line:84%
and I already have the
target IP provided for me,

00:09:21.528 --> 00:09:24.070 align:middle line:84%
so I'm just going to copy that,
and, of course, in your case,

00:09:24.070 --> 00:09:25.450 align:middle line:90%
it will be different.

00:09:25.450 --> 00:09:27.220 align:middle line:84%
And the first step
will, of course,

00:09:27.220 --> 00:09:30.580 align:middle line:84%
involve obtaining initial
access on the target system

00:09:30.580 --> 00:09:32.250 align:middle line:84%
and, in this case,
we're also going

00:09:32.250 --> 00:09:35.850 align:middle line:84%
to be exploiting the Rejetto
HTTP file server service that's

00:09:35.850 --> 00:09:38.860 align:middle line:90%
running as we did previously.

00:09:38.860 --> 00:09:41.490 align:middle line:84%
So we can perform an
Nmap scan on the target

00:09:41.490 --> 00:09:46.410 align:middle line:84%
in order to identify or verify
that the HTTP file server is

00:09:46.410 --> 00:09:48.180 align:middle line:90%
indeed running on port 80.

00:09:48.180 --> 00:09:50.068 align:middle line:84%
So I'll give this a
couple of seconds.

00:09:50.068 --> 00:09:50.610 align:middle line:90%
There we are.

00:09:50.610 --> 00:09:53.790 align:middle line:84%
You can see that we have
a web server on port 80.

00:09:53.790 --> 00:09:58.030 align:middle line:84%
So we can open that up
within our web browser.

00:09:58.030 --> 00:09:59.940 align:middle line:84%
So I'll paste the
target IP there,

00:09:59.940 --> 00:10:03.390 align:middle line:84%
and you can see on port 80,
we have the Rejetto HTTP file

00:10:03.390 --> 00:10:07.800 align:middle line:84%
server version 2.3 running,
which already has a very, very

00:10:07.800 --> 00:10:10.800 align:middle line:84%
powerful Metasploit
module that we

00:10:10.800 --> 00:10:13.500 align:middle line:84%
can use to exploit it and
gain a Meterpreter session.

00:10:13.500 --> 00:10:18.640 align:middle line:84%
So I'll start up the
PostgreSQL Database Service,

00:10:18.640 --> 00:10:21.290 align:middle line:84%
and I'll also start
up MSF console.

00:10:21.290 --> 00:10:21.790 align:middle line:90%
All right.

00:10:21.790 --> 00:10:22.570 align:middle line:90%
There we are.

00:10:22.570 --> 00:10:25.225 align:middle line:84%
And, of course, this will
just take a couple of seconds.

00:10:25.225 --> 00:10:31.160 align:middle line:90%


00:10:31.160 --> 00:10:31.970 align:middle line:90%
OK.

00:10:31.970 --> 00:10:35.578 align:middle line:84%
And we can search for the
module, so it's Rejetto,

00:10:35.578 --> 00:10:37.620 align:middle line:84%
and we are going to use
this one right over here,

00:10:37.620 --> 00:10:41.280 align:middle line:84%
so exploit/windows/http/rejetto
hfs exec.

00:10:41.280 --> 00:10:45.060 align:middle line:84%
All right, so we'll
say use module 0,

00:10:45.060 --> 00:10:46.890 align:middle line:84%
and the default
payload is set to

00:10:46.890 --> 00:10:49.140 align:middle line:90%
windows/meterpreter/reverse_tcp.

00:10:49.140 --> 00:10:51.935 align:middle line:84%
You can change that to a
64-bit payload if you want.

00:10:51.935 --> 00:10:53.310 align:middle line:84%
However, in this
case, we'll just

00:10:53.310 --> 00:10:55.300 align:middle line:90%
use the default configuration.

00:10:55.300 --> 00:10:56.730 align:middle line:90%
So I'll say show options.

00:10:56.730 --> 00:10:58.750 align:middle line:84%
We need to configure
the payload option,

00:10:58.750 --> 00:11:02.610 align:middle line:84%
so you'll need to set up your
Kali Linux IP address, which

00:11:02.610 --> 00:11:06.060 align:middle line:84%
is already set in my case,
and the port or L port

00:11:06.060 --> 00:11:08.050 align:middle line:84%
option, which
again, in this case,

00:11:08.050 --> 00:11:10.980 align:middle line:84%
I'll leave it as the default. We
then need to set up the target

00:11:10.980 --> 00:11:15.570 align:middle line:84%
IP, so we can say set RHOSTS
and paste in the target IP.

00:11:15.570 --> 00:11:17.220 align:middle line:84%
And that's pretty
much it in regards

00:11:17.220 --> 00:11:20.740 align:middle line:84%
to customizing this module or
preparing it for exploitation.

00:11:20.740 --> 00:11:24.180 align:middle line:84%
So I'll just hit exploit,
and this should provide us

00:11:24.180 --> 00:11:26.460 align:middle line:90%
with a Meterpreter session.

00:11:26.460 --> 00:11:28.500 align:middle line:84%
So we'll give this
a couple of seconds.

00:11:28.500 --> 00:11:29.070 align:middle line:90%
There we are.

00:11:29.070 --> 00:11:33.960 align:middle line:84%
Sending stage, and you can see
we get a Meterpreter session

00:11:33.960 --> 00:11:34.980 align:middle line:90%
immediately.

00:11:34.980 --> 00:11:37.080 align:middle line:84%
All right, so now
that we've obtained

00:11:37.080 --> 00:11:40.890 align:middle line:84%
a Meterpreter session, what we
can do is if we say sysinfo,

00:11:40.890 --> 00:11:44.460 align:middle line:84%
you can see that this is a--
the target is running Windows

00:11:44.460 --> 00:11:46.680 align:middle line:84%
Server 2016, and
the build number

00:11:46.680 --> 00:11:48.870 align:middle line:90%
is provided right over here.

00:11:48.870 --> 00:11:52.110 align:middle line:84%
The operating system
architecture is 64-bit,

00:11:52.110 --> 00:11:55.140 align:middle line:84%
and we currently have a
32-bit Meterpreter session.

00:11:55.140 --> 00:12:01.950 align:middle line:84%
So, in addition to this, we can
also migrate our Meterpreter

00:12:01.950 --> 00:12:04.890 align:middle line:84%
session into a different
process, and, of course,

00:12:04.890 --> 00:12:07.500 align:middle line:84%
in this case, I would
typically recommend Explorer.

00:12:07.500 --> 00:12:11.640 align:middle line:84%
So I can look for the process
ID for the explorer.exe process,

00:12:11.640 --> 00:12:17.100 align:middle line:84%
and I can say migrate,
so migrate 3512.

00:12:17.100 --> 00:12:18.000 align:middle line:90%
There we go.

00:12:18.000 --> 00:12:20.978 align:middle line:84%
And in this case, you can see
it tells us access is denied,

00:12:20.978 --> 00:12:22.770 align:middle line:84%
and that's because we
currently have access

00:12:22.770 --> 00:12:24.630 align:middle line:90%
to an unprivileged user account.

00:12:24.630 --> 00:12:26.610 align:middle line:90%
So I can say get user ID.

00:12:26.610 --> 00:12:29.680 align:middle line:84%
You can see we are currently NT
authority local service, so we

00:12:29.680 --> 00:12:32.100 align:middle line:84%
currently have access via
service account, which

00:12:32.100 --> 00:12:35.460 align:middle line:84%
is, by default, unprivileged,
and we can confirm this

00:12:35.460 --> 00:12:37.790 align:middle line:90%
by saying getprivs.

00:12:37.790 --> 00:12:40.250 align:middle line:84%
There we are, and you can see
these are the only privileges

00:12:40.250 --> 00:12:40.950 align:middle line:90%
that we have.

00:12:40.950 --> 00:12:43.610 align:middle line:84%
However, if you pay
close attention,

00:12:43.610 --> 00:12:46.880 align:middle line:84%
you can see that we have the
SeImpersonatePrivilege, which

00:12:46.880 --> 00:12:49.760 align:middle line:84%
pretty much means we can
utilize this Meterpreter

00:12:49.760 --> 00:12:52.250 align:middle line:84%
session or this
particular user account

00:12:52.250 --> 00:12:56.120 align:middle line:84%
to, essentially, impersonate
other access tokens available.

00:12:56.120 --> 00:12:57.680 align:middle line:84%
All right, so as I
said, we are going

00:12:57.680 --> 00:13:00.320 align:middle line:84%
to be using the
incognito module.

00:13:00.320 --> 00:13:02.930 align:middle line:84%
So you can load the
incognito module

00:13:02.930 --> 00:13:05.710 align:middle line:90%
by saying load incognito.

00:13:05.710 --> 00:13:07.760 align:middle line:84%
That is going to load
it, and, in this case,

00:13:07.760 --> 00:13:09.940 align:middle line:84%
it tells me that my
Meterpreter session has died,

00:13:09.940 --> 00:13:12.190 align:middle line:84%
so I'll run the
exploit one more time.

00:13:12.190 --> 00:13:15.670 align:middle line:84%
That is primarily because I
tried to migrate to a process.

00:13:15.670 --> 00:13:18.290 align:middle line:84%
So we'll give this
a couple of seconds,

00:13:18.290 --> 00:13:20.620 align:middle line:84%
and we should receive the
second Meterpreter session.

00:13:20.620 --> 00:13:21.820 align:middle line:90%
There we are.

00:13:21.820 --> 00:13:25.848 align:middle line:84%
And I'll just say
load incognito.

00:13:25.848 --> 00:13:26.390 align:middle line:90%
There we are.

00:13:26.390 --> 00:13:31.460 align:middle line:84%
Load incognito was successful,
and now we can say list tokens,

00:13:31.460 --> 00:13:33.380 align:middle line:84%
and we'll use the
user option here

00:13:33.380 --> 00:13:37.010 align:middle line:84%
to list the user
account access tokens.

00:13:37.010 --> 00:13:39.350 align:middle line:84%
And you can see that we
have delegation tokens

00:13:39.350 --> 00:13:40.760 align:middle line:90%
and impersonation tokens.

00:13:40.760 --> 00:13:43.250 align:middle line:84%
So remember,
delegation tokens were

00:13:43.250 --> 00:13:47.180 align:middle line:84%
created as a direct result
of an interactive logon,

00:13:47.180 --> 00:13:50.900 align:middle line:84%
and impersonation tokens were
created as a direct result

00:13:50.900 --> 00:13:52.590 align:middle line:90%
of a non-interactive logon.

00:13:52.590 --> 00:13:55.430 align:middle line:84%
So in terms of the
access tokens available,

00:13:55.430 --> 00:13:57.530 align:middle line:84%
we have the administrator
account access

00:13:57.530 --> 00:14:00.710 align:middle line:84%
token, which again, will provide
us with elevated privileges,

00:14:00.710 --> 00:14:03.680 align:middle line:84%
and then we have the
current user account access

00:14:03.680 --> 00:14:06.480 align:middle line:84%
token, which is NT
authority local service.

00:14:06.480 --> 00:14:10.310 align:middle line:84%
So in order to impersonate this
particular access token here,

00:14:10.310 --> 00:14:12.650 align:middle line:84%
we can copy the name
of the access token,

00:14:12.650 --> 00:14:15.230 align:middle line:84%
and we can say
impersonate token.

00:14:15.230 --> 00:14:19.010 align:middle line:84%
I'm just going to put in
the name of the token into--

00:14:19.010 --> 00:14:22.100 align:middle line:84%
or I'm just going to encapsulate
the name with double quotation

00:14:22.100 --> 00:14:25.100 align:middle line:84%
marks, and we can say
impersonate token,

00:14:25.100 --> 00:14:26.480 align:middle line:90%
and we hit Enter.

00:14:26.480 --> 00:14:28.730 align:middle line:84%
And you can see delegation
token available.

00:14:28.730 --> 00:14:31.890 align:middle line:84%
Successfully impersonated
this particular user account.

00:14:31.890 --> 00:14:33.860 align:middle line:84%
And if I say get
user ID, you can

00:14:33.860 --> 00:14:36.800 align:middle line:84%
see we currently have elevated
our privileges to that

00:14:36.800 --> 00:14:38.420 align:middle line:90%
of the administrator account.

00:14:38.420 --> 00:14:41.480 align:middle line:84%
If I say getprivs,
you can see that it'll

00:14:41.480 --> 00:14:43.130 align:middle line:90%
tell us operation failed.

00:14:43.130 --> 00:14:44.610 align:middle line:90%
Access is denied.

00:14:44.610 --> 00:14:47.660 align:middle line:84%
So I can, again, just search
for the Explorer process,

00:14:47.660 --> 00:14:55.998 align:middle line:84%
so pgrep explorer and
I can migrate to 3512.

00:14:55.998 --> 00:14:56.540 align:middle line:90%
There we are.

00:14:56.540 --> 00:15:02.330 align:middle line:84%
So let me just type
that in correctly, 3512.

00:15:02.330 --> 00:15:04.790 align:middle line:84%
All right, so if I
say getprivs now,

00:15:04.790 --> 00:15:07.970 align:middle line:84%
you can see that we have an
elevated session because we

00:15:07.970 --> 00:15:10.580 align:middle line:84%
have additional privileges
that are associated

00:15:10.580 --> 00:15:13.310 align:middle line:90%
with an administrative account.

00:15:13.310 --> 00:15:16.380 align:middle line:84%
And, of course, I can say get
user ID and, in this case,

00:15:16.380 --> 00:15:19.490 align:middle line:84%
we still have access to
the administrator account.

00:15:19.490 --> 00:15:21.350 align:middle line:84%
All right, so we
have successfully

00:15:21.350 --> 00:15:23.840 align:middle line:84%
been able to elevate
our privileges

00:15:23.840 --> 00:15:27.320 align:middle line:84%
through the use
of access tokens,

00:15:27.320 --> 00:15:30.380 align:middle line:84%
and we've taken a look at how
to impersonate access tokens.

00:15:30.380 --> 00:15:32.990 align:middle line:84%
Now, as I said
within the slides,

00:15:32.990 --> 00:15:36.380 align:middle line:84%
if you are ever in a
situation, and you will be,

00:15:36.380 --> 00:15:39.620 align:middle line:84%
where-- if I list out
the tokens available,

00:15:39.620 --> 00:15:43.220 align:middle line:84%
you will be in a situation where
you will not be able to have--

00:15:43.220 --> 00:15:46.310 align:middle line:84%
or you will not find
any privileged access

00:15:46.310 --> 00:15:49.190 align:middle line:84%
tokens available irregardless
of whether they are delegation

00:15:49.190 --> 00:15:51.710 align:middle line:90%
tokens or impersonation tokens.

00:15:51.710 --> 00:15:54.080 align:middle line:84%
In that case, you will
need to use the potato

00:15:54.080 --> 00:15:57.360 align:middle line:90%
attack in order for you to--

00:15:57.360 --> 00:16:00.530 align:middle line:84%
I'll not get into
the nitty-gritty

00:16:00.530 --> 00:16:03.590 align:middle line:84%
of this particular attack,
but what it will do

00:16:03.590 --> 00:16:08.600 align:middle line:84%
is it will essentially get
you or generate a NT authority

00:16:08.600 --> 00:16:13.610 align:middle line:84%
system access token that you
can then impersonate and obtain

00:16:13.610 --> 00:16:17.240 align:middle line:84%
the privileges associated with
the NT authority system access

00:16:17.240 --> 00:16:20.090 align:middle line:84%
token or in the case
of the administrator

00:16:20.090 --> 00:16:23.540 align:middle line:84%
user, the privileges associated
with the administrator user.

00:16:23.540 --> 00:16:27.770 align:middle line:84%
Now, given the fact that I've
already elevated my privileges,

00:16:27.770 --> 00:16:30.320 align:middle line:84%
you can see that I
have additional access

00:16:30.320 --> 00:16:32.780 align:middle line:84%
tokens available that
I can impersonate.

00:16:32.780 --> 00:16:36.530 align:middle line:84%
So, for example, I have the NT
authority system token right

00:16:36.530 --> 00:16:38.940 align:middle line:84%
over here, so if I wanted
to impersonate it as well,

00:16:38.940 --> 00:16:39.840 align:middle line:90%
I can also do that.

00:16:39.840 --> 00:16:42.680 align:middle line:84%
So I can say impersonate token,
and I'll paste in the name

00:16:42.680 --> 00:16:44.240 align:middle line:90%
there and hit Enter.

00:16:44.240 --> 00:16:46.340 align:middle line:84%
And you can see,
successfully impersonated

00:16:46.340 --> 00:16:48.030 align:middle line:90%
NT authority system.

00:16:48.030 --> 00:16:50.660 align:middle line:84%
If I say get user
ID, there we are.

00:16:50.660 --> 00:16:53.130 align:middle line:90%
And getprivs, there we go.

00:16:53.130 --> 00:16:55.940 align:middle line:84%
So we have successfully
elevated our privileges.

00:16:55.940 --> 00:16:59.840 align:middle line:84%
And as I said, this
particular attack

00:16:59.840 --> 00:17:02.820 align:middle line:84%
will essentially depend
on a few factors.

00:17:02.820 --> 00:17:07.579 align:middle line:84%
Number one, what user accounts
are currently on the system

00:17:07.579 --> 00:17:12.020 align:middle line:84%
and which of these user accounts
has admin access or admin

00:17:12.020 --> 00:17:14.630 align:middle line:84%
privileges, or
what user accounts

00:17:14.630 --> 00:17:17.270 align:middle line:84%
are part of the local
administrators' group?

00:17:17.270 --> 00:17:21.200 align:middle line:84%
And if you can find an access
token that is available

00:17:21.200 --> 00:17:22.700 align:middle line:84%
that you can
impersonate, then you

00:17:22.700 --> 00:17:26.569 align:middle line:84%
can essentially impersonate
or essentially obtain

00:17:26.569 --> 00:17:30.770 align:middle line:84%
the privileges associated with
that particular access token.

00:17:30.770 --> 00:17:36.080 align:middle line:84%
And as I said, it does not need
to belong to a particular user.

00:17:36.080 --> 00:17:38.690 align:middle line:84%
It could also belong
to NT authority system

00:17:38.690 --> 00:17:42.800 align:middle line:84%
or, in this particular case, NT
authority local service, which

00:17:42.800 --> 00:17:44.780 align:middle line:84%
again, there's not
really much sense

00:17:44.780 --> 00:17:49.538 align:middle line:84%
in impersonating an account
with lower privileges than what

00:17:49.538 --> 00:17:50.330 align:middle line:90%
you currently have.

00:17:50.330 --> 00:17:52.670 align:middle line:84%
But you can also do
that if you want.

00:17:52.670 --> 00:17:55.040 align:middle line:84%
All right, so that
is going to conclude

00:17:55.040 --> 00:17:59.050 align:middle line:84%
the practical demonstration
side of this video.

00:17:59.050 --> 00:18:02.010 align:middle line:84%
All right, so now that we've
explored all of the privilege

00:18:02.010 --> 00:18:05.220 align:middle line:84%
escalation techniques that
we can utilize on a Windows

00:18:05.220 --> 00:18:09.210 align:middle line:84%
system, we can now turn our
attention to Windows file

00:18:09.210 --> 00:18:12.030 align:middle line:84%
system vulnerabilities,
more specifically,

00:18:12.030 --> 00:18:15.540 align:middle line:84%
we will be exploring
alternate data streams

00:18:15.540 --> 00:18:18.630 align:middle line:84%
and how they can be used
by attackers to conceal

00:18:18.630 --> 00:18:22.270 align:middle line:84%
files, et cetera, et
cetera in the next section.

00:18:22.270 --> 00:18:25.560 align:middle line:84%
So we are now moving on to a new
section, which is Windows file

00:18:25.560 --> 00:18:28.620 align:middle line:84%
system vulnerabilities,
and I'll be seeing you

00:18:28.620 --> 00:18:30.668 align:middle line:90%
in the next video.

00:18:30.668 --> 00:18:31.168 align:middle line:90%