WEBVTT

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


00:00:03.010 --> 00:00:03.890 align:middle line:90%
Hi.

00:00:03.890 --> 00:00:07.990 align:middle line:84%
Welcome to this video lesson
on group policy preferences,

00:00:07.990 --> 00:00:10.930 align:middle line:84%
where we're going to discuss
one of the vulnerabilities which

00:00:10.930 --> 00:00:14.860 align:middle line:84%
exists here that could be
exploited by attackers who have

00:00:14.860 --> 00:00:17.580 align:middle line:90%
gained access to our network.

00:00:17.580 --> 00:00:20.850 align:middle line:84%
Group policy preferences
is a policy maker

00:00:20.850 --> 00:00:24.600 align:middle line:84%
of some sort with one of
its most useful features

00:00:24.600 --> 00:00:27.990 align:middle line:84%
being the ability to
store and use credentials.

00:00:27.990 --> 00:00:31.020 align:middle line:84%
Some examples of
when GPP is useful

00:00:31.020 --> 00:00:34.950 align:middle line:84%
are schedule tasks, mapping
drives, or changing local user

00:00:34.950 --> 00:00:36.370 align:middle line:90%
passwords.

00:00:36.370 --> 00:00:39.600 align:middle line:84%
Now, scheduled tasks and
changing local user passwords

00:00:39.600 --> 00:00:42.930 align:middle line:84%
are interesting because
the password to be set

00:00:42.930 --> 00:00:46.080 align:middle line:84%
will be stored in group
policy preferences, the domain

00:00:46.080 --> 00:00:47.580 align:middle line:90%
SYSVOL folder.

00:00:47.580 --> 00:00:52.350 align:middle line:84%
These passwords are
encrypted with AES-256 bits.

00:00:52.350 --> 00:00:55.020 align:middle line:84%
However, this
encryption key, which

00:00:55.020 --> 00:00:57.810 align:middle line:84%
was meant to be known
only by active directory

00:00:57.810 --> 00:01:03.180 align:middle line:84%
was potentially unwittingly
released on Microsoft's MSDN.

00:01:03.180 --> 00:01:07.710 align:middle line:84%
The problem here arises that
since every domain user can

00:01:07.710 --> 00:01:11.270 align:middle line:84%
read GPP files, they
can use this key

00:01:11.270 --> 00:01:13.590 align:middle line:84%
to decrypt encrypted
data in them.

00:01:13.590 --> 00:01:16.770 align:middle line:84%
From experience on
different penetration tests,

00:01:16.770 --> 00:01:19.470 align:middle line:84%
I have seen very privileged
domain credentials

00:01:19.470 --> 00:01:22.890 align:middle line:84%
being stored in here,
and in many cases, those

00:01:22.890 --> 00:01:25.290 align:middle line:84%
who are of service
accounts that were members

00:01:25.290 --> 00:01:28.450 align:middle line:90%
of the domain admin's group.

00:01:28.450 --> 00:01:31.910 align:middle line:84%
If you look into the next
slide, on this image,

00:01:31.910 --> 00:01:35.800 align:middle line:84%
we can see an example of a file
containing encrypted passwords.

00:01:35.800 --> 00:01:39.250 align:middle line:84%
That is indicated in
the cpassword parameter.

00:01:39.250 --> 00:01:41.390 align:middle line:84%
There are many tools
now that exist,

00:01:41.390 --> 00:01:44.950 align:middle line:84%
which will automate the process
of searching and decrypting

00:01:44.950 --> 00:01:47.020 align:middle line:90%
the cpassword parameter.

00:01:47.020 --> 00:01:49.900 align:middle line:84%
These tools make it
trivial to exploit,

00:01:49.900 --> 00:01:53.530 align:middle line:84%
because all they require is to
run the script or program that

00:01:53.530 --> 00:01:55.430 align:middle line:90%
has this capability.

00:01:55.430 --> 00:01:57.910 align:middle line:84%
The approach on the
slide is a bit more

00:01:57.910 --> 00:02:00.340 align:middle line:84%
manual to outline
the decryption step

00:02:00.340 --> 00:02:04.970 align:middle line:84%
by using Get-DecryptedCpassword
on the bottom image, which

00:02:04.970 --> 00:02:07.900 align:middle line:84%
returns the plaintext
value once decrypted.

00:02:07.900 --> 00:02:10.570 align:middle line:84%
As you can see on the
image, the last value

00:02:10.570 --> 00:02:12.580 align:middle line:90%
is the decrypted password.

00:02:12.580 --> 00:02:15.700 align:middle line:84%
When we talk about
protection, well, Microsoft

00:02:15.700 --> 00:02:18.940 align:middle line:84%
released a patch
back in 2014 which

00:02:18.940 --> 00:02:22.240 align:middle line:84%
will prevent administrators from
being able to store credentials

00:02:22.240 --> 00:02:24.220 align:middle line:90%
in group policy preferences.

00:02:24.220 --> 00:02:27.160 align:middle line:84%
And while that is really
great because it will not

00:02:27.160 --> 00:02:30.610 align:middle line:84%
happen in the future,
they didn't really

00:02:30.610 --> 00:02:33.580 align:middle line:84%
release anything that can
take care of credentials

00:02:33.580 --> 00:02:34.990 align:middle line:90%
which are currently exposed.

00:02:34.990 --> 00:02:38.470 align:middle line:84%
And it's really up to you to
go and scan your environment

00:02:38.470 --> 00:02:41.230 align:middle line:84%
to find out whether
there are any credentials

00:02:41.230 --> 00:02:44.020 align:middle line:84%
such as these ones being exposed
in group policy preferences

00:02:44.020 --> 00:02:45.610 align:middle line:90%
files or not.

00:02:45.610 --> 00:02:47.080 align:middle line:84%
And the interesting
thing here is

00:02:47.080 --> 00:02:49.600 align:middle line:84%
that if you find the
credentials being exposed,

00:02:49.600 --> 00:02:54.670 align:middle line:84%
they must have been exposed in
those files from at least 2014.

00:02:54.670 --> 00:02:58.095 align:middle line:84%
That's a massive gap that
we're looking at right here.

00:02:58.095 --> 00:02:59.470 align:middle line:84%
So what you really
have to do now

00:02:59.470 --> 00:03:01.120 align:middle line:90%
is go and scan your environment.

00:03:01.120 --> 00:03:03.640 align:middle line:84%
Utilize any of the
available tools.

00:03:03.640 --> 00:03:06.160 align:middle line:84%
You can start using
just find string,

00:03:06.160 --> 00:03:10.840 align:middle line:84%
a basic Windows command to
scan XML files in group policy

00:03:10.840 --> 00:03:13.780 align:middle line:84%
preferences that contain
the parameter cpassword.

00:03:13.780 --> 00:03:16.790 align:middle line:84%
Or use one of the
automated tools,

00:03:16.790 --> 00:03:19.630 align:middle line:84%
whether it's a partial
script or a different tool.

00:03:19.630 --> 00:03:23.650 align:middle line:84%
A partial script that comes
to mind is Get-GPPPassword.

00:03:23.650 --> 00:03:26.050 align:middle line:84%
And a tool that can
do this is PingCastle.

00:03:26.050 --> 00:03:29.990 align:middle line:84%
We'll look into PingCastle in
detail in a further module.

00:03:29.990 --> 00:03:32.163 align:middle line:84%
But for now, it's very
important to ensure

00:03:32.163 --> 00:03:33.580 align:middle line:84%
that there's nothing
that is being

00:03:33.580 --> 00:03:35.260 align:middle line:90%
exposed in your environment.

00:03:35.260 --> 00:03:37.510 align:middle line:84%
And again, this can
be local credentials.

00:03:37.510 --> 00:03:40.090 align:middle line:84%
It might as well be domain
credentials as well.

00:03:40.090 --> 00:03:42.832 align:middle line:84%
We need to clean them
ourselves and make sure

00:03:42.832 --> 00:03:45.040 align:middle line:84%
that this patch is installed
so that no passwords are

00:03:45.040 --> 00:03:48.480 align:middle line:84%
going to be stored in this
location in the future.

00:03:48.480 --> 00:03:49.000 align:middle line:90%