WEBVTT

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


00:00:03.000 --> 00:00:05.610 align:middle line:84%
Hi, in this video
lesson, we're going

00:00:05.610 --> 00:00:08.790 align:middle line:84%
to talk about lateral movement
with the local administrator

00:00:08.790 --> 00:00:11.740 align:middle line:84%
account, well we're
going to focus

00:00:11.740 --> 00:00:13.390 align:middle line:90%
on the local administrator.

00:00:13.390 --> 00:00:15.370 align:middle line:84%
This really is an
issue that will

00:00:15.370 --> 00:00:19.390 align:middle line:84%
exist with all local accounts
that have the same password set

00:00:19.390 --> 00:00:21.640 align:middle line:84%
across multiple
devices, we're going

00:00:21.640 --> 00:00:24.400 align:middle line:84%
to focus on the local
administrator account simply

00:00:24.400 --> 00:00:26.950 align:middle line:84%
because this is the
most common case,

00:00:26.950 --> 00:00:28.570 align:middle line:84%
and because this
account actually

00:00:28.570 --> 00:00:32.920 align:middle line:84%
existing environment by
default that half an enterprise

00:00:32.920 --> 00:00:35.920 align:middle line:90%
version of Windows.

00:00:35.920 --> 00:00:37.370 align:middle line:90%
So what is the problem.

00:00:37.370 --> 00:00:40.570 align:middle line:84%
The problem is that
an account ends up

00:00:40.570 --> 00:00:44.560 align:middle line:84%
having the same passwords
store across all workstations,

00:00:44.560 --> 00:00:46.990 align:middle line:84%
and potentially
across all servers,

00:00:46.990 --> 00:00:50.890 align:middle line:84%
I've seen a common approach
where workstations might have

00:00:50.890 --> 00:00:54.380 align:middle line:84%
one password, and servers might
have a different password,

00:00:54.380 --> 00:00:57.800 align:middle line:84%
but all servers will have one
password across all of them.

00:00:57.800 --> 00:01:01.120 align:middle line:84%
And all workstations
is just different.

00:01:01.120 --> 00:01:03.880 align:middle line:84%
And that is not really
fixing the issue.

00:01:03.880 --> 00:01:08.160 align:middle line:84%
And so the main issue,
here is that if we

00:01:08.160 --> 00:01:11.310 align:middle line:84%
compromise one workstation, take
workstations for example, let's

00:01:11.310 --> 00:01:13.980 align:middle line:84%
assume that the password
is used across workstations

00:01:13.980 --> 00:01:17.620 align:middle line:84%
and servers for simplicity to
understand the problem here.

00:01:17.620 --> 00:01:19.320 align:middle line:84%
If we compromise
one workstation,

00:01:19.320 --> 00:01:22.400 align:middle line:84%
or if an attacker
compromises one workstation,

00:01:22.400 --> 00:01:26.680 align:middle line:84%
and gains administrative
privileges on that workstation.

00:01:26.680 --> 00:01:31.290 align:middle line:84%
They will have the ability
to extract the password

00:01:31.290 --> 00:01:34.500 align:middle line:84%
hash of the account
court administrator

00:01:34.500 --> 00:01:37.530 align:middle line:84%
because password hashes
of local accounts

00:01:37.530 --> 00:01:41.780 align:middle line:84%
are stored in the registry
hive on the local machine.

00:01:41.780 --> 00:01:45.730 align:middle line:84%
So compromise is one machine,
this access compromise one

00:01:45.730 --> 00:01:49.090 align:middle line:84%
machine escalating to
administrative rights

00:01:49.090 --> 00:01:52.470 align:middle line:84%
we'll give you access to go
and extract this special hash.

00:01:52.470 --> 00:01:55.110 align:middle line:84%
Now in many organizations
the escalation part

00:01:55.110 --> 00:01:58.080 align:middle line:84%
is going to be needed
because many users furnace

00:01:58.080 --> 00:01:59.910 align:middle line:84%
administrators by
default. And there

00:01:59.910 --> 00:02:03.410 align:middle line:84%
is a massive, massive,
massive mistake as well.

00:02:03.410 --> 00:02:05.550 align:middle line:84%
You should not let
your normal users

00:02:05.550 --> 00:02:07.920 align:middle line:84%
have direct
administrative rights,

00:02:07.920 --> 00:02:09.340 align:middle line:90%
if they need to do that.

00:02:09.340 --> 00:02:12.180 align:middle line:84%
There's many solutions
that you can use instead,

00:02:12.180 --> 00:02:14.970 align:middle line:84%
which will elevate you for
one minute, for five minutes,

00:02:14.970 --> 00:02:19.500 align:middle line:84%
or some customer time
span that you might like

00:02:19.500 --> 00:02:20.790 align:middle line:90%
to set for your environment.

00:02:20.790 --> 00:02:23.730 align:middle line:84%
We can even provision a
second administrative account.

00:02:23.730 --> 00:02:26.910 align:middle line:84%
Where users, if they
require to be administrators

00:02:26.910 --> 00:02:28.530 align:middle line:84%
for one reason or
another, they need

00:02:28.530 --> 00:02:30.780 align:middle line:84%
to log into their second
administrative account

00:02:30.780 --> 00:02:34.050 align:middle line:84%
and use that one to perform
the administrative tasks,

00:02:34.050 --> 00:02:37.050 align:middle line:84%
but not do it with
the normal account

00:02:37.050 --> 00:02:39.336 align:middle line:84%
that they use on a daily
basis, they read emails,

00:02:39.336 --> 00:02:41.678 align:middle line:84%
they read the
Internet and so on.

00:02:41.678 --> 00:02:44.220 align:middle line:84%
So the issue with the password
hash that you can extract here

00:02:44.220 --> 00:02:44.970 align:middle line:90%
is that--

00:02:44.970 --> 00:02:47.350 align:middle line:90%
Well, the first one is obvious.

00:02:47.350 --> 00:02:51.940 align:middle line:84%
You can go and try to
break that password hash.

00:02:51.940 --> 00:02:57.340 align:middle line:84%
You can use better tracking
tools, such as Hashcat

00:02:57.340 --> 00:03:01.910 align:middle line:90%
or John the Ripper.

00:03:01.910 --> 00:03:04.550 align:middle line:84%
You can go try to
crack the password hash

00:03:04.550 --> 00:03:09.830 align:middle line:84%
and get the plaintext
password of that hash.

00:03:09.830 --> 00:03:11.330 align:middle line:84%
If they have the
plaintext password,

00:03:11.330 --> 00:03:13.640 align:middle line:84%
you can connect remotely
to other machines.

00:03:13.640 --> 00:03:16.100 align:middle line:84%
But the caveat here
is that you actually

00:03:16.100 --> 00:03:17.690 align:middle line:84%
don't need the
plaintext password

00:03:17.690 --> 00:03:19.550 align:middle line:84%
to connect remotely
to other machines,

00:03:19.550 --> 00:03:22.380 align:middle line:84%
you can use the
password hash as is.

00:03:22.380 --> 00:03:25.730 align:middle line:84%
And that is a technique
known as Pass the hash.

00:03:25.730 --> 00:03:28.820 align:middle line:84%
So by compromising
one workstation,

00:03:28.820 --> 00:03:32.690 align:middle line:84%
in theory, and extracting the
password hash from the Registry

00:03:32.690 --> 00:03:35.867 align:middle line:84%
Hive, in theory, you can
connect to any other system

00:03:35.867 --> 00:03:36.700 align:middle line:90%
in your environment.

00:03:36.700 --> 00:03:39.560 align:middle line:84%
And that sounds
absolutely crazy.

00:03:39.560 --> 00:03:43.680 align:middle line:84%
Because compromising
someone in any department--

00:03:43.680 --> 00:03:46.580 align:middle line:84%
Let's bring up HR, because HR
are people who are normally

00:03:46.580 --> 00:03:49.162 align:middle line:84%
targeted in targeted
phishing attempts,

00:03:49.162 --> 00:03:51.162 align:middle line:84%
and they're probably also
my favorite when we're

00:03:51.162 --> 00:03:53.150 align:middle line:90%
doing Red Team Engagements.

00:03:53.150 --> 00:03:57.650 align:middle line:84%
If you compromise an HR
person, that person's device

00:03:57.650 --> 00:03:59.900 align:middle line:84%
will give you access to the
rest of the environment.

00:03:59.900 --> 00:04:02.460 align:middle line:84%
And of course, we
should not have this.

00:04:02.460 --> 00:04:03.920 align:middle line:90%
The exposure is too massive.

00:04:03.920 --> 00:04:07.890 align:middle line:84%
We can't have one device
being single point of failure.

00:04:07.890 --> 00:04:12.260 align:middle line:84%
And definitely not just
a regular workstation.

00:04:12.260 --> 00:04:15.370 align:middle line:84%
So here's an example of
how we can abuse this.

00:04:15.370 --> 00:04:19.790 align:middle line:90%


00:04:19.790 --> 00:04:24.206 align:middle line:84%
We are running on a
machine called WS10-001.

00:04:24.206 --> 00:04:28.700 align:middle line:84%
I'm assuming this stands
for workstation 10,

00:04:28.700 --> 00:04:32.750 align:middle line:90%
referring to Windows 10, 001.

00:04:32.750 --> 00:04:36.860 align:middle line:84%
The next step is, we're
downloading Mimikatz,

00:04:36.860 --> 00:04:40.055 align:middle line:84%
or the partial version
of Mimikatz called Invoke

00:04:40.055 --> 00:04:45.290 align:middle line:84%
Mimikatz, into memory, and
then executing a custom command

00:04:45.290 --> 00:04:46.940 align:middle line:90%
lsadump::sam.

00:04:46.940 --> 00:04:51.260 align:middle line:84%
This custom command will
locate the Registry Hives

00:04:51.260 --> 00:04:53.240 align:middle line:84%
from the computer and
extract the password

00:04:53.240 --> 00:04:56.480 align:middle line:84%
hash of all local
accounts into text.

00:04:56.480 --> 00:04:58.760 align:middle line:84%
And in this case, what
I have highlighted

00:04:58.760 --> 00:05:03.080 align:middle line:84%
is the password hash of
the account administrator.

00:05:03.080 --> 00:05:05.120 align:middle line:90%
It's really that simple.

00:05:05.120 --> 00:05:07.160 align:middle line:84%
Getting a tool, such as
Mimikatz, running it,

00:05:07.160 --> 00:05:08.900 align:middle line:84%
and then you have
the password hash.

00:05:08.900 --> 00:05:11.450 align:middle line:84%
And if anyone is not
familiar with Mimikatz.

00:05:11.450 --> 00:05:14.100 align:middle line:84%
This is probably the
most common hacking tool,

00:05:14.100 --> 00:05:18.080 align:middle line:84%
which I'm just assuming that
everyone is familiar these days

00:05:18.080 --> 00:05:18.710 align:middle line:90%
with.

00:05:18.710 --> 00:05:22.970 align:middle line:84%
But other than this capability,
it became really famous

00:05:22.970 --> 00:05:26.330 align:middle line:84%
because of its ability to
extract plaintext passwords

00:05:26.330 --> 00:05:29.090 align:middle line:84%
directly from the
member of the computer.

00:05:29.090 --> 00:05:32.990 align:middle line:84%
Or essentially, these passwords
are stored into the process

00:05:32.990 --> 00:05:36.980 align:middle line:84%
LSASS, that Mimikatz debugs
and locates, extracts

00:05:36.980 --> 00:05:39.530 align:middle line:90%
and then gives to an attacker.

00:05:39.530 --> 00:05:41.720 align:middle line:84%
But in our case, we're
getting the hashes.

00:05:41.720 --> 00:05:43.220 align:middle line:90%
Now we have these hashes.

00:05:43.220 --> 00:05:44.780 align:middle line:90%
They're available to us.

00:05:44.780 --> 00:05:47.750 align:middle line:84%
We can point them
to any other system,

00:05:47.750 --> 00:05:51.140 align:middle line:84%
authenticate to it as the
account local administrator.

00:05:51.140 --> 00:05:52.710 align:middle line:90%
And why would we do that?

00:05:52.710 --> 00:05:54.170 align:middle line:90%
Well, first we want to--

00:05:54.170 --> 00:05:55.580 align:middle line:84%
Or, not we, but
an attacker would

00:05:55.580 --> 00:06:00.290 align:middle line:84%
want to go and identify
what files and data is

00:06:00.290 --> 00:06:01.670 align:middle line:90%
stored in those systems.

00:06:01.670 --> 00:06:03.530 align:middle line:84%
But potentially,
they'll also want

00:06:03.530 --> 00:06:07.590 align:middle line:84%
to perform or utilize to
Mimikatz again, especially

00:06:07.590 --> 00:06:11.210 align:middle line:84%
on servers, and try to extract
more privileged credentials

00:06:11.210 --> 00:06:12.470 align:middle line:90%
from those servers.

00:06:12.470 --> 00:06:15.470 align:middle line:84%
And most likely, the credentials
that they'll be looking for

00:06:15.470 --> 00:06:20.150 align:middle line:84%
are those of domain
administrators.

00:06:20.150 --> 00:06:21.830 align:middle line:84%
And of course,
that is really bad.

00:06:21.830 --> 00:06:23.810 align:middle line:84%
Because from one
system, you might end up

00:06:23.810 --> 00:06:29.820 align:middle line:84%
into a position
to move laterally

00:06:29.820 --> 00:06:33.920 align:middle line:84%
across your environment,
and essentially

00:06:33.920 --> 00:06:36.650 align:middle line:84%
perform credential
theft to obtain

00:06:36.650 --> 00:06:40.600 align:middle line:84%
credentials of higher privileged
users, such as domain admins.

00:06:40.600 --> 00:06:45.460 align:middle line:84%
So here's an example of using a
tool called crackmapexec, where

00:06:45.460 --> 00:06:48.460 align:middle line:84%
we're specifying the user
administrator and the password

00:06:48.460 --> 00:06:51.430 align:middle line:90%
hash that we have just obtained.

00:06:51.430 --> 00:06:53.403 align:middle line:84%
The X parameter
specifies the command

00:06:53.403 --> 00:06:55.570 align:middle line:84%
that we want to execute,
in this case it's hostname.

00:06:55.570 --> 00:06:57.242 align:middle line:90%
We just want to run hostname.

00:06:57.242 --> 00:06:58.700 align:middle line:84%
Then we are specifying
that we want

00:06:58.700 --> 00:07:01.283 align:middle line:84%
to authenticate with the local
user towards the remote server,

00:07:01.283 --> 00:07:03.370 align:middle line:84%
so that this is the
administrator account that

00:07:03.370 --> 00:07:06.520 align:middle line:84%
is local to the system, and not
the account administrator that

00:07:06.520 --> 00:07:08.560 align:middle line:90%
is part of the domain.

00:07:08.560 --> 00:07:11.800 align:middle line:84%
And what we can see in
here is that the tools--

00:07:11.800 --> 00:07:15.280 align:middle line:84%
One of the messages that comes
to us in a different color

00:07:15.280 --> 00:07:18.940 align:middle line:84%
is Pwn3d, which
identifies or outlines

00:07:18.940 --> 00:07:20.800 align:middle line:84%
that we have
successfully connected

00:07:20.800 --> 00:07:24.040 align:middle line:84%
remotely to this machine
and we executed the command.

00:07:24.040 --> 00:07:26.190 align:middle line:90%
The command returned Server01.

00:07:26.190 --> 00:07:29.020 align:middle line:84%
So we actually successful
connected to Server01

00:07:29.020 --> 00:07:31.480 align:middle line:84%
with the account
administrator and executed

00:07:31.480 --> 00:07:35.500 align:middle line:84%
this hostname command, which
returned Server01 back to us.

00:07:35.500 --> 00:07:38.030 align:middle line:90%


00:07:38.030 --> 00:07:42.500 align:middle line:84%
Well, there are multiple
solutions to this issue.

00:07:42.500 --> 00:07:45.590 align:middle line:84%
Some of us, or some
of you, might simply

00:07:45.590 --> 00:07:47.720 align:middle line:84%
disable the account
called administrator

00:07:47.720 --> 00:07:49.710 align:middle line:90%
because it's not being used.

00:07:49.710 --> 00:07:51.980 align:middle line:84%
But one of the
concepts that we're

00:07:51.980 --> 00:07:54.620 align:middle line:84%
going to be discussing
in a future video

00:07:54.620 --> 00:07:56.780 align:middle line:90%
is Active Directory Tiering.

00:07:56.780 --> 00:07:59.060 align:middle line:84%
And if we implement
the tiering model,

00:07:59.060 --> 00:08:01.070 align:middle line:84%
this local
administrator is going

00:08:01.070 --> 00:08:03.530 align:middle line:84%
to be extremely handy
to prevent credential

00:08:03.530 --> 00:08:04.990 align:middle line:90%
theft in our environment.

00:08:04.990 --> 00:08:08.270 align:middle line:84%
But what we want to achieve
with this account administrator,

00:08:08.270 --> 00:08:11.420 align:middle line:84%
is that we want it to
have a unique password

00:08:11.420 --> 00:08:14.180 align:middle line:90%
for each device.

00:08:14.180 --> 00:08:16.610 align:middle line:84%
And some of you might have
already created some scripts

00:08:16.610 --> 00:08:17.930 align:middle line:90%
that will perform this.

00:08:17.930 --> 00:08:20.030 align:middle line:84%
Microsoft came up with
the solution, which

00:08:20.030 --> 00:08:25.670 align:middle line:84%
is a tool called LAPS, it
stands for Local Administrator

00:08:25.670 --> 00:08:28.070 align:middle line:84%
Password Solution,
and it can set

00:08:28.070 --> 00:08:31.340 align:middle line:84%
the password uniquely for each
device in the entire Active

00:08:31.340 --> 00:08:32.390 align:middle line:90%
Directory.

00:08:32.390 --> 00:08:36.350 align:middle line:84%
And it will manage the password
by occasionally setting it

00:08:36.350 --> 00:08:43.188 align:middle line:84%
to a unique value on a
predefined time base, by you.

00:08:43.188 --> 00:08:44.980 align:middle line:84%
It will change and it
will set the password

00:08:44.980 --> 00:08:47.140 align:middle line:90%
on an ongoing basis.

00:08:47.140 --> 00:08:50.050 align:middle line:84%
Normally, I'd recommend
this to be on a daily basis,

00:08:50.050 --> 00:08:51.742 align:middle line:84%
because there's no
reason really to keep

00:08:51.742 --> 00:08:53.200 align:middle line:84%
the password for
more than one day,

00:08:53.200 --> 00:08:55.220 align:middle line:90%
and one day is the minimum.

00:08:55.220 --> 00:09:00.750 align:middle line:84%
So LAPS is one of those really
good solutions in this case.

00:09:00.750 --> 00:09:02.600 align:middle line:90%
It's very easy to implement.

00:09:02.600 --> 00:09:07.340 align:middle line:84%
It does require a change into
the Active Directory schema,

00:09:07.340 --> 00:09:10.040 align:middle line:84%
because the passwords that
each computer is going

00:09:10.040 --> 00:09:12.530 align:middle line:84%
to have set to it's
administrator account

00:09:12.530 --> 00:09:15.710 align:middle line:84%
is going to be set actually
in Active Directory.

00:09:15.710 --> 00:09:17.275 align:middle line:84%
So what LAPS is
going to do is, it

00:09:17.275 --> 00:09:20.820 align:middle line:84%
will create a new attribute
for each computer object,

00:09:20.820 --> 00:09:22.940 align:middle line:84%
and then store the
password inside there.

00:09:22.940 --> 00:09:25.460 align:middle line:84%
By default, only
domain administrators

00:09:25.460 --> 00:09:27.470 align:middle line:84%
will be able to
read this password,

00:09:27.470 --> 00:09:31.790 align:middle line:84%
but you'll be free and able to
perform any kind of delegations

00:09:31.790 --> 00:09:32.510 align:middle line:90%
you like.

00:09:32.510 --> 00:09:34.550 align:middle line:84%
To give, for
example, service desk

00:09:34.550 --> 00:09:38.750 align:middle line:84%
or any other person of interest
access to these passwords

00:09:38.750 --> 00:09:40.450 align:middle line:90%
as well.

00:09:40.450 --> 00:09:41.000 align:middle line:90%