WEBVTT

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


00:00:09.810 --> 00:00:11.910 align:middle line:90%
Windows password hashes.

00:00:11.910 --> 00:00:14.820 align:middle line:84%
All right, so we're currently
within the Windows Credential

00:00:14.820 --> 00:00:18.690 align:middle line:84%
dumping section of this
course, where we are primarily

00:00:18.690 --> 00:00:21.690 align:middle line:84%
going to be taking a look
at how to dump credentials

00:00:21.690 --> 00:00:25.380 align:middle line:84%
or to find and dump credentials
and hashes from Windows

00:00:25.380 --> 00:00:26.460 align:middle line:90%
systems.

00:00:26.460 --> 00:00:28.980 align:middle line:84%
And to begin with,
we actually need

00:00:28.980 --> 00:00:32.610 align:middle line:84%
to get an understanding
of Windows password hashes

00:00:32.610 --> 00:00:36.000 align:middle line:84%
and where Windows password
hashes are stored.

00:00:36.000 --> 00:00:38.580 align:middle line:84%
So we'll be exploring the
various hashing algorithms

00:00:38.580 --> 00:00:41.970 align:middle line:84%
or the types of hashes that
you're likely to come across,

00:00:41.970 --> 00:00:44.700 align:middle line:84%
as well as the location
of these hashes

00:00:44.700 --> 00:00:47.840 align:middle line:84%
in regards to where they're
stored on a Windows system.

00:00:47.840 --> 00:00:48.340 align:middle line:90%
All right.

00:00:48.340 --> 00:00:51.510 align:middle line:84%
So starting off, let's
get an understanding

00:00:51.510 --> 00:00:54.180 align:middle line:84%
of where they're stored or
where password hashes are

00:00:54.180 --> 00:00:55.830 align:middle line:90%
stored on a Windows system.

00:00:55.830 --> 00:00:58.350 align:middle line:84%
All right, so the Windows
operating system stores

00:00:58.350 --> 00:01:02.850 align:middle line:84%
hashed user accounts passwords
locally in the SAM database.

00:01:02.850 --> 00:01:06.450 align:middle line:84%
SAM stands for the
security accounts manager.

00:01:06.450 --> 00:01:08.940 align:middle line:84%
Now, if you're a bit confused
as to what hashing is,

00:01:08.940 --> 00:01:11.130 align:middle line:84%
it's really very, very
simple, and it all

00:01:11.130 --> 00:01:14.100 align:middle line:84%
comes down to
avoiding or finding

00:01:14.100 --> 00:01:18.240 align:middle line:84%
a way to avoid storing
passwords in clear text, which

00:01:18.240 --> 00:01:20.580 align:middle line:90%
many operating systems do.

00:01:20.580 --> 00:01:24.120 align:middle line:84%
So hashing is the process of
converting a piece of data,

00:01:24.120 --> 00:01:27.900 align:middle line:84%
and in this case, a password
string, into another value.

00:01:27.900 --> 00:01:30.390 align:middle line:84%
A hashing function
or algorithm is

00:01:30.390 --> 00:01:32.310 align:middle line:90%
used to generate the new value.

00:01:32.310 --> 00:01:34.350 align:middle line:84%
The result of a
hashing algorithm

00:01:34.350 --> 00:01:37.060 align:middle line:84%
is known as a hash
or hash value.

00:01:37.060 --> 00:01:39.850 align:middle line:84%
So again, on modern
operating systems,

00:01:39.850 --> 00:01:43.020 align:middle line:84%
it really is a
huge security risk

00:01:43.020 --> 00:01:46.620 align:middle line:84%
to have user account passwords
stored locally irregardless

00:01:46.620 --> 00:01:48.570 align:middle line:90%
of where they're stored.

00:01:48.570 --> 00:01:53.370 align:middle line:84%
And as a result, early
on in the early 2000s,

00:01:53.370 --> 00:01:56.790 align:middle line:84%
the hashing process was revised,
or the encryption process

00:01:56.790 --> 00:02:01.740 align:middle line:84%
was revised, whereby whenever
a user account was created,

00:02:01.740 --> 00:02:03.870 align:middle line:84%
the password string
that they provided

00:02:03.870 --> 00:02:06.210 align:middle line:84%
was automatically
hashed and stored

00:02:06.210 --> 00:02:08.580 align:middle line:84%
and then authentication
would be compared

00:02:08.580 --> 00:02:10.560 align:middle line:84%
with that particular
hash as opposed

00:02:10.560 --> 00:02:12.490 align:middle line:90%
to the clear text password.

00:02:12.490 --> 00:02:12.990 align:middle line:90%
All right.

00:02:12.990 --> 00:02:15.420 align:middle line:84%
Now, authentication
and verification

00:02:15.420 --> 00:02:17.610 align:middle line:84%
of user credentials
is facilitated

00:02:17.610 --> 00:02:21.540 align:middle line:84%
by the local security
authority, also known as LSA.

00:02:21.540 --> 00:02:26.460 align:middle line:84%
And this all ties into the LSASS
process that runs on Windows,

00:02:26.460 --> 00:02:28.530 align:middle line:84%
and we'll get to that
in a few seconds.

00:02:28.530 --> 00:02:31.230 align:middle line:84%
Now, Windows Server--
or Windows versions

00:02:31.230 --> 00:02:35.700 align:middle line:84%
up to Windows Server 2003
utilize two different types

00:02:35.700 --> 00:02:36.780 align:middle line:90%
of hashes.

00:02:36.780 --> 00:02:39.870 align:middle line:84%
You have your LM hash
and your NTLM hash.

00:02:39.870 --> 00:02:41.590 align:middle line:90%
We'll get to these in a second.

00:02:41.590 --> 00:02:45.780 align:middle line:84%
Now, Windows disables LM hashing
and utilizes NTLM hashing

00:02:45.780 --> 00:02:47.730 align:middle line:84%
from Windows Vista
onwards, so I just

00:02:47.730 --> 00:02:50.460 align:middle line:84%
want you to be aware of
that, and this will give you

00:02:50.460 --> 00:02:54.600 align:middle line:84%
an idea of the types of hashes
or the format of the hash

00:02:54.600 --> 00:02:56.940 align:middle line:84%
that you're likely
to come across given

00:02:56.940 --> 00:02:58.470 align:middle line:90%
the current environment.

00:02:58.470 --> 00:03:01.770 align:middle line:84%
So it's very likely that
you will probably never

00:03:01.770 --> 00:03:05.670 align:middle line:84%
see an LM hash in the world or
within a Windows environment

00:03:05.670 --> 00:03:07.740 align:middle line:84%
unless the target
Windows system is

00:03:07.740 --> 00:03:10.140 align:middle line:84%
running a very old
version of Windows, which

00:03:10.140 --> 00:03:11.650 align:middle line:90%
is very unlikely.

00:03:11.650 --> 00:03:13.830 align:middle line:84%
So the hash that you're
likely to come across

00:03:13.830 --> 00:03:16.980 align:middle line:90%
is the NTLM hash or the NT hash.

00:03:16.980 --> 00:03:19.800 align:middle line:84%
And, of course, we also have
various versions of NTLM.

00:03:19.800 --> 00:03:23.160 align:middle line:84%
We have NTLM version
1 and NTLM version 2.

00:03:23.160 --> 00:03:25.710 align:middle line:84%
This is something that we'll
not be touching upon in terms

00:03:25.710 --> 00:03:28.980 align:middle line:84%
of the differences right now
because the differences will

00:03:28.980 --> 00:03:31.200 align:middle line:84%
really come into play
when it comes down

00:03:31.200 --> 00:03:33.150 align:middle line:84%
to cracking these
hashes, which we will

00:03:33.150 --> 00:03:35.800 align:middle line:90%
be exploring in another course.

00:03:35.800 --> 00:03:36.300 align:middle line:90%
All right.

00:03:36.300 --> 00:03:39.180 align:middle line:84%
So now that we have an
understanding of what

00:03:39.180 --> 00:03:42.580 align:middle line:84%
hashing is and you know
where the hashes are stored,

00:03:42.580 --> 00:03:44.850 align:middle line:84%
which again is the
SAM database, let's

00:03:44.850 --> 00:03:47.880 align:middle line:84%
understand the SAM database
a little bit better.

00:03:47.880 --> 00:03:51.060 align:middle line:84%
All right, so SAM, also known
as security account manager,

00:03:51.060 --> 00:03:54.750 align:middle line:84%
is a database file that is
responsible for managing

00:03:54.750 --> 00:03:57.690 align:middle line:84%
user accounts and
passwords on Windows.

00:03:57.690 --> 00:04:00.510 align:middle line:84%
All user account passwords
stored in the SAM database are

00:04:00.510 --> 00:04:04.020 align:middle line:84%
hashed by default. So this is
where the password hashes are

00:04:04.020 --> 00:04:07.650 align:middle line:84%
stored, and it's very important
to note that the SAM database

00:04:07.650 --> 00:04:11.020 align:middle line:84%
file cannot be copied while the
operating system is running.

00:04:11.020 --> 00:04:13.500 align:middle line:84%
So this is a
security feature that

00:04:13.500 --> 00:04:15.330 align:middle line:84%
was implemented by
Windows, where--

00:04:15.330 --> 00:04:17.279 align:middle line:84%
they, of course,
realized that this could

00:04:17.279 --> 00:04:21.450 align:middle line:84%
be a problem if someone got
access to the SAM database

00:04:21.450 --> 00:04:25.050 align:middle line:84%
while the system was running,
then they would essentially

00:04:25.050 --> 00:04:27.870 align:middle line:84%
be able to dump the contents
of the SAM database.

00:04:27.870 --> 00:04:30.120 align:middle line:84%
Now, the Windows
NT kernel does this

00:04:30.120 --> 00:04:34.230 align:middle line:84%
by keeping the SAM database
file locked, and as a result,

00:04:34.230 --> 00:04:37.560 align:middle line:84%
attackers will typically utilize
in-memory techniques and tools

00:04:37.560 --> 00:04:41.370 align:middle line:84%
to dump the SAM hashes from
the LSASS process memory.

00:04:41.370 --> 00:04:45.570 align:middle line:84%
All right, so remember the LSA,
the local security authority

00:04:45.570 --> 00:04:49.080 align:middle line:84%
or the LSASS process, the local
security Authority Subsystem,

00:04:49.080 --> 00:04:52.140 align:middle line:84%
is responsible for
authentication on Windows,

00:04:52.140 --> 00:04:56.670 align:middle line:84%
and this particular service
also has a cache of memory

00:04:56.670 --> 00:04:59.130 align:middle line:84%
that will again
typically contain

00:04:59.130 --> 00:05:02.850 align:middle line:84%
these hashes as it interacts
with the SAM database.

00:05:02.850 --> 00:05:05.260 align:middle line:84%
So tools like
Mimikatz essentially

00:05:05.260 --> 00:05:08.530 align:middle line:84%
utilize or interact
with the LSASS process

00:05:08.530 --> 00:05:11.890 align:middle line:84%
and try and dump the actual
cache of this process in order

00:05:11.890 --> 00:05:16.030 align:middle line:84%
to identify the NTLM
hashes, for example.

00:05:16.030 --> 00:05:18.160 align:middle line:84%
Now, in modern
versions of Windows,

00:05:18.160 --> 00:05:21.160 align:middle line:84%
the SAM database is
encrypted with a syskey,

00:05:21.160 --> 00:05:22.930 align:middle line:84%
and this is something
that I'll actually

00:05:22.930 --> 00:05:25.930 align:middle line:84%
demonstrate as we move
along within this section.

00:05:25.930 --> 00:05:30.070 align:middle line:84%
It's also important to note
that elevated or administrative

00:05:30.070 --> 00:05:33.550 align:middle line:84%
privileges are required in
order to access and interact

00:05:33.550 --> 00:05:36.640 align:middle line:84%
with the LSASS
process, which means

00:05:36.640 --> 00:05:39.730 align:middle line:84%
that you need to have an
elevated session on the target

00:05:39.730 --> 00:05:44.560 align:middle line:84%
system in order to dump
hashes from memory or anything

00:05:44.560 --> 00:05:48.220 align:middle line:84%
like that and that is why
this particular section comes

00:05:48.220 --> 00:05:50.590 align:middle line:84%
after the Windows privilege
escalation section

00:05:50.590 --> 00:05:51.800 align:middle line:90%
within this course.

00:05:51.800 --> 00:05:55.660 align:middle line:84%
So you need an elevated session
in order to dump hashes,

00:05:55.660 --> 00:05:58.660 align:middle line:84%
and that's something
very important.

00:05:58.660 --> 00:06:01.060 align:middle line:84%
All right, so let's start off
by getting an understanding

00:06:01.060 --> 00:06:03.940 align:middle line:90%
of the LM hash or LanMan hash.

00:06:03.940 --> 00:06:06.730 align:middle line:84%
So LM is the default
hashing algorithm

00:06:06.730 --> 00:06:09.820 align:middle line:84%
that was implemented in the
Windows operating system

00:06:09.820 --> 00:06:14.680 align:middle line:84%
prior to versions that
ran the kernel NT 4.0.

00:06:14.680 --> 00:06:17.080 align:middle line:84%
The protocol is used
to hash user passwords,

00:06:17.080 --> 00:06:19.060 align:middle line:84%
and the hashing process
can be broken down

00:06:19.060 --> 00:06:20.710 align:middle line:90%
into the following steps.

00:06:20.710 --> 00:06:22.990 align:middle line:84%
All right, so the
password is broken down

00:06:22.990 --> 00:06:26.720 align:middle line:84%
into two seven-character chunks,
so that's very important,

00:06:26.720 --> 00:06:28.610 align:middle line:84%
and I'll illustrate
this in a second.

00:06:28.610 --> 00:06:31.720 align:middle line:84%
And then all characters
of this password string

00:06:31.720 --> 00:06:34.000 align:middle line:84%
are then converted
into uppercase,

00:06:34.000 --> 00:06:38.260 align:middle line:84%
which means that the LM hash
really does not support or is

00:06:38.260 --> 00:06:40.120 align:middle line:84%
not case sensitive,
so that means

00:06:40.120 --> 00:06:43.900 align:middle line:84%
even if you specify a password
that is case sensitive,

00:06:43.900 --> 00:06:48.310 align:middle line:84%
LM will automatically convert
that password to uppercase

00:06:48.310 --> 00:06:51.340 align:middle line:90%
and then hash those two chunks.

00:06:51.340 --> 00:06:53.800 align:middle line:84%
So each chunk is then
hashed separately

00:06:53.800 --> 00:06:56.840 align:middle line:84%
with the DES algorithm,
which is relatively weak.

00:06:56.840 --> 00:06:59.170 align:middle line:84%
So LM hashing is
generally considered

00:06:59.170 --> 00:07:02.650 align:middle line:84%
to be a weak protocol and can
easily be cracked primarily

00:07:02.650 --> 00:07:06.460 align:middle line:84%
because the password hash does
not include salts, consequently

00:07:06.460 --> 00:07:08.620 align:middle line:84%
making brute-force and
rainbow table attacks

00:07:08.620 --> 00:07:10.970 align:middle line:90%
effective against LM hashes.

00:07:10.970 --> 00:07:11.470 align:middle line:90%
All right.

00:07:11.470 --> 00:07:13.240 align:middle line:84%
And as I said, we're
not really going

00:07:13.240 --> 00:07:16.810 align:middle line:84%
to be focusing on LM hashes
because, again, they are very

00:07:16.810 --> 00:07:18.850 align:middle line:90%
outdated and extremely weak.

00:07:18.850 --> 00:07:21.580 align:middle line:84%
We are primarily
interested in NTLM.

00:07:21.580 --> 00:07:24.820 align:middle line:84%
So let's get an understanding
of how LM hashing works.

00:07:24.820 --> 00:07:27.712 align:middle line:84%
So you can see that a user
specifies a password when

00:07:27.712 --> 00:07:29.170 align:middle line:84%
they're creating
an account, and it

00:07:29.170 --> 00:07:33.280 align:middle line:84%
could be a very simple
password like password123.

00:07:33.280 --> 00:07:34.930 align:middle line:84%
And irregardless
of whether or not

00:07:34.930 --> 00:07:38.070 align:middle line:84%
they've made the
password case sensitive,

00:07:38.070 --> 00:07:40.800 align:middle line:84%
LM will essentially
split it into two chunks,

00:07:40.800 --> 00:07:43.620 align:middle line:84%
into two seven-character
chunks right over here

00:07:43.620 --> 00:07:46.350 align:middle line:84%
and then convert those
two chunks into uppercase,

00:07:46.350 --> 00:07:47.520 align:middle line:90%
as you can see here.

00:07:47.520 --> 00:07:49.080 align:middle line:84%
And then these two
chunks are then

00:07:49.080 --> 00:07:51.030 align:middle line:90%
hashed using the DES algorithm.

00:07:51.030 --> 00:07:53.850 align:middle line:84%
And then you finally have
the LM hash right over here

00:07:53.850 --> 00:07:56.940 align:middle line:84%
that is comprised of two
separate chunks that have both

00:07:56.940 --> 00:07:59.910 align:middle line:84%
been hashed by
the DES algorithm.

00:07:59.910 --> 00:08:04.530 align:middle line:84%
All right, and that
is really what it is--

00:08:04.530 --> 00:08:06.210 align:middle line:84%
or what it comes
down to when you're

00:08:06.210 --> 00:08:08.130 align:middle line:90%
talking about an LM hash.

00:08:08.130 --> 00:08:10.560 align:middle line:84%
Now, let's move on
to the NTLM hash,

00:08:10.560 --> 00:08:13.350 align:middle line:84%
also known as the
NT hash, not to be

00:08:13.350 --> 00:08:17.010 align:middle line:84%
confused with NTLM
version 1 and version 2.

00:08:17.010 --> 00:08:18.510 align:middle line:84%
All right, so let
me explain what

00:08:18.510 --> 00:08:20.450 align:middle line:90%
NTLM is at a very basic level.

00:08:20.450 --> 00:08:23.790 align:middle line:84%
NTLM is a collection of
authentication protocols

00:08:23.790 --> 00:08:26.940 align:middle line:84%
that are utilized in Windows
to facilitate authentication

00:08:26.940 --> 00:08:28.200 align:middle line:90%
between computers.

00:08:28.200 --> 00:08:30.000 align:middle line:84%
The authentication
process involves

00:08:30.000 --> 00:08:32.070 align:middle line:84%
using a valid username
and password in order

00:08:32.070 --> 00:08:33.850 align:middle line:90%
to authenticate successfully.

00:08:33.850 --> 00:08:38.340 align:middle line:84%
So from Windows Vista onwards,
Windows disables LM hashing

00:08:38.340 --> 00:08:40.230 align:middle line:84%
and utilizes NTLM
hashing, so that

00:08:40.230 --> 00:08:42.570 align:middle line:84%
means that you
will typically find

00:08:42.570 --> 00:08:45.600 align:middle line:84%
that passwords on modern
versions of Windows

00:08:45.600 --> 00:08:50.100 align:middle line:84%
like Windows 7 onwards
are using NTLM hashing,

00:08:50.100 --> 00:08:53.880 align:middle line:84%
so all the passwords will
be in the NTLM hash format

00:08:53.880 --> 00:08:55.350 align:middle line:90%
unless specified otherwise.

00:08:55.350 --> 00:08:57.810 align:middle line:84%
And, of course, you
will run into systems

00:08:57.810 --> 00:09:02.490 align:middle line:84%
that are using NTLM version
1, NTLM version 2, et cetera.

00:09:02.490 --> 00:09:03.060 align:middle line:90%
All right.

00:09:03.060 --> 00:09:04.870 align:middle line:84%
So when a user
account is created,

00:09:04.870 --> 00:09:07.350 align:middle line:84%
it is encrypted-- the
password is encrypted

00:09:07.350 --> 00:09:11.280 align:middle line:84%
using the MD4 hashing algorithm
while the original password is

00:09:11.280 --> 00:09:12.000 align:middle line:90%
disposed of.

00:09:12.000 --> 00:09:13.860 align:middle line:84%
So the clear text
password is disposed

00:09:13.860 --> 00:09:15.420 align:middle line:90%
of for obvious reasons.

00:09:15.420 --> 00:09:19.000 align:middle line:84%
And NTLM improves upon
LM in the following way.

00:09:19.000 --> 00:09:21.570 align:middle line:84%
So it does not split the
hash into two chunks,

00:09:21.570 --> 00:09:24.600 align:middle line:84%
for one, which is,
again, it really

00:09:24.600 --> 00:09:27.450 align:middle line:84%
doesn't make a difference,
but in terms of security

00:09:27.450 --> 00:09:30.270 align:middle line:84%
and cracking, this
will become much more

00:09:30.270 --> 00:09:33.607 align:middle line:84%
clear as we move into the
password cracking course.

00:09:33.607 --> 00:09:35.190 align:middle line:84%
But for now, just
know that it doesn't

00:09:35.190 --> 00:09:38.250 align:middle line:84%
split the hash or the
password into two chunks.

00:09:38.250 --> 00:09:40.080 align:middle line:84%
It is also case
sensitive, which means

00:09:40.080 --> 00:09:42.960 align:middle line:84%
if a user account
specifies the password

00:09:42.960 --> 00:09:45.960 align:middle line:84%
and makes it case
sensitive, then

00:09:45.960 --> 00:09:49.050 align:middle line:84%
it will be hashed in
that particular format.

00:09:49.050 --> 00:09:53.100 align:middle line:84%
And it also allows the use of
symbols and Unicode characters.

00:09:53.100 --> 00:09:56.970 align:middle line:84%
It's also important to know that
NTLM or NT hashes are stored

00:09:56.970 --> 00:09:59.280 align:middle line:84%
within the SAM
database, obviously,

00:09:59.280 --> 00:10:02.910 align:middle line:84%
but they really do not
have password salts, which

00:10:02.910 --> 00:10:06.630 align:middle line:84%
means that they can
be cracked relatively

00:10:06.630 --> 00:10:10.890 align:middle line:84%
easily through a brute force
attack or a rainbow table

00:10:10.890 --> 00:10:11.940 align:middle line:90%
attack.

00:10:11.940 --> 00:10:16.700 align:middle line:84%
All right, so that
is NTLM or NT hash.

00:10:16.700 --> 00:10:17.200 align:middle line:90%
All right.

00:10:17.200 --> 00:10:19.750 align:middle line:84%
So this diagram
explains the process

00:10:19.750 --> 00:10:23.840 align:middle line:84%
or rather encapsulates
the NTLM hashing process.

00:10:23.840 --> 00:10:28.000 align:middle line:84%
So a user specifies a password
that contains symbols and is

00:10:28.000 --> 00:10:32.650 align:middle line:84%
case sensitive, and that is then
hashed using the MD4 algorithm.

00:10:32.650 --> 00:10:34.900 align:middle line:84%
And, of course, you then
have your NTLM hash,

00:10:34.900 --> 00:10:36.520 align:middle line:84%
so it's fairly
simple to understand.

00:10:36.520 --> 00:10:37.937 align:middle line:84%
And, of course,
I'll be taking you

00:10:37.937 --> 00:10:41.740 align:middle line:84%
through the process of
identifying these hashes as we

00:10:41.740 --> 00:10:44.200 align:middle line:90%
progress through this section.

00:10:44.200 --> 00:10:47.740 align:middle line:84%
OK, so that really is all that
I wanted to cover in this video.

00:10:47.740 --> 00:10:49.240 align:middle line:84%
I wanted to give
you an introduction

00:10:49.240 --> 00:10:52.300 align:middle line:84%
into Windows password
hashes, where they're stored,

00:10:52.300 --> 00:10:55.060 align:middle line:84%
and the types of hashes that
you're likely to encounter.

00:10:55.060 --> 00:10:58.930 align:middle line:84%
And this will set up the premise
for the next set of videos

00:10:58.930 --> 00:11:01.720 align:middle line:84%
within this section, where we
will be taking a look at how

00:11:01.720 --> 00:11:05.260 align:middle line:84%
to dump NTLM hashes
on a Windows system

00:11:05.260 --> 00:11:09.130 align:middle line:84%
through the use of Mimikatz and
the Windows Credential Editor.

00:11:09.130 --> 00:11:11.140 align:middle line:84%
And we will also be
exploring the process

00:11:11.140 --> 00:11:13.840 align:middle line:84%
of finding a legitimate
credentials-- or credentials

00:11:13.840 --> 00:11:16.240 align:middle line:84%
stored in Windows
configuration files

00:11:16.240 --> 00:11:20.630 align:middle line:84%
as that is a Windows
vulnerability in and of itself.

00:11:20.630 --> 00:11:22.540 align:middle line:84%
So that's going to
be it for this video,

00:11:22.540 --> 00:11:25.500 align:middle line:84%
and I'll be seeing
you in the next video.

00:11:25.500 --> 00:11:26.000 align:middle line:90%