WEBVTT

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


00:00:10.260 --> 00:00:12.340 align:middle line:90%
Dumping Linux password hashes.

00:00:12.340 --> 00:00:12.840 align:middle line:90%
All right.

00:00:12.840 --> 00:00:16.210 align:middle line:84%
So this is the final
section of this course.

00:00:16.210 --> 00:00:20.280 align:middle line:84%
We will be exploring the process
of dumping Linux password

00:00:20.280 --> 00:00:21.210 align:middle line:90%
hashes.

00:00:21.210 --> 00:00:24.360 align:middle line:84%
And again, we've already
done the same for Windows.

00:00:24.360 --> 00:00:26.580 align:middle line:84%
And of course, in the we--
in the case of Windows,

00:00:26.580 --> 00:00:30.390 align:middle line:84%
we were able to
utilize the NTLM hashes

00:00:30.390 --> 00:00:33.210 align:middle line:84%
for authentication or
legitimate authentication,

00:00:33.210 --> 00:00:34.440 align:middle line:90%
for that matter.

00:00:34.440 --> 00:00:38.100 align:middle line:84%
However, with Linux, we really
cannot do much with password

00:00:38.100 --> 00:00:41.190 align:middle line:84%
hashes apart from cracking them,
which is something that I will

00:00:41.190 --> 00:00:43.530 align:middle line:84%
be exploring in a
password cracking course.

00:00:43.530 --> 00:00:45.520 align:middle line:90%
So do stay tuned for that.

00:00:45.520 --> 00:00:47.160 align:middle line:84%
But again, in this
video, I'm really

00:00:47.160 --> 00:00:50.310 align:middle line:84%
just going to be focusing
on the actual Linux password

00:00:50.310 --> 00:00:55.590 align:middle line:84%
hashes, where they're stored,
and the different hash formats

00:00:55.590 --> 00:01:00.090 align:middle line:84%
or algorithms that are used to
encrypt the Linux passwords.

00:01:00.090 --> 00:01:04.349 align:middle line:84%
So let's get started, firstly,
by getting an understanding

00:01:04.349 --> 00:01:06.600 align:middle line:90%
of how Linux stores passwords.

00:01:06.600 --> 00:01:09.180 align:middle line:84%
So it's very important
to know that Linux has

00:01:09.180 --> 00:01:11.200 align:middle line:90%
multi-user support, of course.

00:01:11.200 --> 00:01:14.310 align:middle line:84%
And as a result, multiple
users can access the system

00:01:14.310 --> 00:01:15.210 align:middle line:90%
simultaneously.

00:01:15.210 --> 00:01:18.840 align:middle line:84%
This can be seen as both an
advantage and disadvantage

00:01:18.840 --> 00:01:22.320 align:middle line:84%
from a security perspective,
in that multiple accounts offer

00:01:22.320 --> 00:01:24.420 align:middle line:84%
multiple access
vectors for attackers

00:01:24.420 --> 00:01:27.670 align:middle line:84%
and therefore increase the
overall risk of the server.

00:01:27.670 --> 00:01:31.740 align:middle line:84%
So again, this is
something that is also

00:01:31.740 --> 00:01:33.810 align:middle line:84%
common on Windows
systems, where you

00:01:33.810 --> 00:01:35.900 align:middle line:90%
can create more than one user.

00:01:35.900 --> 00:01:38.260 align:middle line:84%
And if you create
too many users,

00:01:38.260 --> 00:01:42.190 align:middle line:84%
these are all access vectors
that attackers can use.

00:01:42.190 --> 00:01:46.740 align:middle line:84%
So in the case of Linux, all the
account information is stored

00:01:46.740 --> 00:01:49.710 align:middle line:84%
in the passwd file
located under /etc/passwd.

00:01:49.710 --> 00:01:52.950 align:middle line:84%
And of course, you can display
the contents of this file using

00:01:52.950 --> 00:01:54.180 align:middle line:90%
the cat command.

00:01:54.180 --> 00:01:57.060 align:middle line:84%
And you can essentially
get a rundown

00:01:57.060 --> 00:01:59.670 align:middle line:84%
of the list of user
accounts that are currently

00:01:59.670 --> 00:02:03.120 align:middle line:84%
on the system, their user
IDs, their home directories,

00:02:03.120 --> 00:02:06.480 align:middle line:84%
as well as the shell that has
been configured for that user

00:02:06.480 --> 00:02:07.080 align:middle line:90%
account.

00:02:07.080 --> 00:02:07.710 align:middle line:90%
All right.

00:02:07.710 --> 00:02:10.199 align:middle line:84%
Now, we cannot view the
passwords for the users

00:02:10.199 --> 00:02:12.750 align:middle line:84%
in the passwd file because
they are encrypted,

00:02:12.750 --> 00:02:16.560 align:middle line:84%
and the passwd file is readable
by any user on the system.

00:02:16.560 --> 00:02:19.290 align:middle line:84%
So you can essentially
access the passwd file

00:02:19.290 --> 00:02:21.060 align:middle line:90%
as a non-privileged user.

00:02:21.060 --> 00:02:23.370 align:middle line:84%
All the encrypted
passwords for the users

00:02:23.370 --> 00:02:25.150 align:middle line:90%
are stored in the shadow file.

00:02:25.150 --> 00:02:27.240 align:middle line:84%
So if you remember, in
the previous set of videos

00:02:27.240 --> 00:02:29.010 align:middle line:90%
during the Linux ex--

00:02:29.010 --> 00:02:31.770 align:middle line:84%
the Linux privilege
escalation section, I actually

00:02:31.770 --> 00:02:33.030 align:middle line:90%
displayed the shadow file.

00:02:33.030 --> 00:02:36.090 align:middle line:84%
And you may have noticed that
we can only access the shadow

00:02:36.090 --> 00:02:38.250 align:middle line:90%
file as the root user.

00:02:38.250 --> 00:02:42.030 align:middle line:84%
Now, as I said, the shadow
file can be accessed under

00:02:42.030 --> 00:02:45.090 align:middle line:84%
the /etc/shadow or
rather the ETC directory.

00:02:45.090 --> 00:02:47.490 align:middle line:84%
And the name of the
file is simply shadow.

00:02:47.490 --> 00:02:50.790 align:middle line:84%
And the shadow file can only be
accessed by the root account.

00:02:50.790 --> 00:02:53.490 align:middle line:84%
And this is a very
important security feature

00:02:53.490 --> 00:02:55.380 align:middle line:84%
as it prevents other
accounts on the system

00:02:55.380 --> 00:02:57.560 align:middle line:84%
from accessing the
hashed password.

00:02:57.560 --> 00:03:00.167 align:middle line:84%
So if you list out
of the shadow--

00:03:00.167 --> 00:03:02.250 align:middle line:84%
if you list out of the
shadow file or the contents

00:03:02.250 --> 00:03:05.250 align:middle line:84%
of the shadow file after you've
elevated your privileges,

00:03:05.250 --> 00:03:07.980 align:middle line:84%
you'll actually get a
list of user accounts

00:03:07.980 --> 00:03:11.160 align:middle line:84%
and their password hashes
in encrypted format.

00:03:11.160 --> 00:03:14.640 align:middle line:84%
Now, whenever you list out the
contents of the shadow file,

00:03:14.640 --> 00:03:16.590 align:middle line:84%
you'll get the actual
hashed password.

00:03:16.590 --> 00:03:19.470 align:middle line:84%
But the hashed
password will have

00:03:19.470 --> 00:03:23.852 align:middle line:84%
a prefix that is going
to be encapsulated,

00:03:23.852 --> 00:03:25.560 align:middle line:84%
or rather, it's going
to be a prefix that

00:03:25.560 --> 00:03:27.563 align:middle line:90%
contains the dollar symbol.

00:03:27.563 --> 00:03:28.980 align:middle line:84%
And then after
that, there's going

00:03:28.980 --> 00:03:31.320 align:middle line:84%
to be a value that
will actually tell you

00:03:31.320 --> 00:03:33.600 align:middle line:84%
what type of hashing
algorithm was

00:03:33.600 --> 00:03:35.280 align:middle line:90%
used to encrypt that password.

00:03:35.280 --> 00:03:41.640 align:middle line:84%
And it's different, really
based on many distributions

00:03:41.640 --> 00:03:45.330 align:middle line:84%
or on the type of distribution
that you're dealing with.

00:03:45.330 --> 00:03:49.020 align:middle line:84%
However, modern systems or
modern Linux distributions

00:03:49.020 --> 00:03:51.820 align:middle line:84%
typically utilize the
strongest hashing algorithm,

00:03:51.820 --> 00:03:53.620 align:middle line:90%
which is SHA-512.

00:03:53.620 --> 00:03:54.120 align:middle line:90%
All right.

00:03:54.120 --> 00:03:56.520 align:middle line:84%
So the passwd file gives
us information in regards

00:03:56.520 --> 00:03:58.680 align:middle line:84%
to the hashing
algorithm that is used.

00:03:58.680 --> 00:04:01.290 align:middle line:84%
And the password hash,
this is very helpful

00:04:01.290 --> 00:04:04.140 align:middle line:84%
as we're able to determine the
type of hashing algorithm that

00:04:04.140 --> 00:04:06.930 align:middle line:84%
is being used and its
strength, consequently telling

00:04:06.930 --> 00:04:09.300 align:middle line:84%
us or giving us an idea
as to whether or not

00:04:09.300 --> 00:04:12.640 align:middle line:84%
we can actually crack that
particular hash successfully.

00:04:12.640 --> 00:04:15.480 align:middle line:84%
And as I said, we can determine
this by looking at the number

00:04:15.480 --> 00:04:19.410 align:middle line:84%
after the username encapsulated
by the dollar symbol.

00:04:19.410 --> 00:04:21.790 align:middle line:84%
So whenever you open
up the passwd file,

00:04:21.790 --> 00:04:24.250 align:middle line:84%
you'll be able to see or
rather the shadow file,

00:04:24.250 --> 00:04:28.710 align:middle line:84%
you'll be able to see the
actual password hash as well

00:04:28.710 --> 00:04:30.900 align:middle line:90%
as the actual dollar symbol.

00:04:30.900 --> 00:04:33.600 align:middle line:84%
And then, the value that comes
after the dollar symbol tells

00:04:33.600 --> 00:04:36.340 align:middle line:84%
you what hashing
algorithm is being used.

00:04:36.340 --> 00:04:39.390 align:middle line:84%
So again, if you take a look
at the value $1, for example,

00:04:39.390 --> 00:04:41.730 align:middle line:84%
that's typical on
older distributions

00:04:41.730 --> 00:04:43.500 align:middle line:90%
and on older versions of Linux.

00:04:43.500 --> 00:04:45.720 align:middle line:84%
That is the MD5
hashing algorithm.

00:04:45.720 --> 00:04:48.180 align:middle line:84%
That is relatively
easy to crack.

00:04:48.180 --> 00:04:50.460 align:middle line:84%
You then have your
value $2, which

00:04:50.460 --> 00:04:53.880 align:middle line:84%
is Blowfish, which, again,
is relatively easy to crack.

00:04:53.880 --> 00:04:55.830 align:middle line:84%
And then when it
gets to $5 and $6,

00:04:55.830 --> 00:04:58.830 align:middle line:84%
this is where you get into
the really, really complex

00:04:58.830 --> 00:05:04.590 align:middle line:84%
or powerful hashing algorithms
like SHA-256 and SHA-512.

00:05:04.590 --> 00:05:06.960 align:middle line:84%
Now, that doesn't mean that
they cannot be cracked.

00:05:06.960 --> 00:05:09.780 align:middle line:84%
It just means that it's
going to be even more

00:05:09.780 --> 00:05:12.030 align:middle line:90%
difficult than, say, MD5.

00:05:12.030 --> 00:05:14.850 align:middle line:84%
So on modern Linux
systems, you will typically

00:05:14.850 --> 00:05:18.870 align:middle line:84%
find that the hashing
algorithm being used

00:05:18.870 --> 00:05:22.810 align:middle line:90%
is either SHA-256 or SHA-512.

00:05:22.810 --> 00:05:23.310 align:middle line:90%
All right.

00:05:23.310 --> 00:05:26.690 align:middle line:84%
So let's actually take a look
at how we can dump hashes,

00:05:26.690 --> 00:05:29.190 align:middle line:84%
the various Linux
password hashes,

00:05:29.190 --> 00:05:31.110 align:middle line:84%
through the use
of just displaying

00:05:31.110 --> 00:05:33.660 align:middle line:84%
the contents of the
shadow file as well

00:05:33.660 --> 00:05:36.960 align:middle line:84%
as a few other utilities within
the Metasploit framework.

00:05:36.960 --> 00:05:40.050 align:middle line:84%
So this video has a lab
environment attached to it.

00:05:40.050 --> 00:05:42.690 align:middle line:84%
All you need to do is fire
it up and just follow along

00:05:42.690 --> 00:05:44.620 align:middle line:90%
with my actual demonstration.

00:05:44.620 --> 00:05:46.690 align:middle line:84%
So I'll fire up my
lab environment,

00:05:46.690 --> 00:05:51.320 align:middle line:84%
and I'll see you within
the lab environment.

00:05:51.320 --> 00:05:51.820 align:middle line:90%
All right.

00:05:51.820 --> 00:05:53.870 align:middle line:84%
So I'm back within
the lab environment.

00:05:53.870 --> 00:05:57.250 align:middle line:84%
And in this case, we will need
to exploit a target in order

00:05:57.250 --> 00:05:59.380 align:middle line:90%
to gain initial access.

00:05:59.380 --> 00:06:01.480 align:middle line:84%
So again, the first
step will involve

00:06:01.480 --> 00:06:04.480 align:middle line:84%
identifying the target
IP, which you can identify

00:06:04.480 --> 00:06:07.870 align:middle line:84%
by typing in ifconfig and then
taking a look at the IP address

00:06:07.870 --> 00:06:11.515 align:middle line:84%
or the subnet associated with
the interface Ethernet 1.

00:06:11.515 --> 00:06:14.320 align:middle line:84%
So this is the IP address
of our Kali Linux system,

00:06:14.320 --> 00:06:16.420 align:middle line:84%
and the target IP
or the target system

00:06:16.420 --> 00:06:19.940 align:middle line:84%
is going to be on the next IP
within this particular subnet.

00:06:19.940 --> 00:06:21.640 align:middle line:84%
And of course, in
your case, the subnet

00:06:21.640 --> 00:06:23.180 align:middle line:90%
is going to be different.

00:06:23.180 --> 00:06:25.300 align:middle line:84%
However, you can see
that the Kali Linux

00:06:25.300 --> 00:06:27.430 align:middle line:90%
system is on the IP address 2.

00:06:27.430 --> 00:06:30.380 align:middle line:84%
The target system is going
to be on the IP address 3.

00:06:30.380 --> 00:06:30.880 align:middle line:90%
All right.

00:06:30.880 --> 00:06:33.760 align:middle line:84%
So just copy the subnet
there, and just remember

00:06:33.760 --> 00:06:36.770 align:middle line:84%
to change the 2 to a 3,
and that's the target IP.

00:06:36.770 --> 00:06:37.270 align:middle line:90%
All right.

00:06:37.270 --> 00:06:39.460 align:middle line:84%
We can then perform an
Nmap scan to identify

00:06:39.460 --> 00:06:41.350 align:middle line:84%
what vulnerable service
is running on it

00:06:41.350 --> 00:06:42.580 align:middle line:90%
that we can exploit.

00:06:42.580 --> 00:06:45.100 align:middle line:84%
So I'm going to just
type in nmap -sV

00:06:45.100 --> 00:06:47.350 align:middle line:84%
to perform some service
version detection,

00:06:47.350 --> 00:06:50.110 align:middle line:84%
and I'll, of course,
change the 2 to a 3 there.

00:06:50.110 --> 00:06:51.370 align:middle line:90%
And I'll hit Enter.

00:06:51.370 --> 00:06:54.470 align:middle line:84%
And you can see the Nmap scan
is complete relatively quickly.

00:06:54.470 --> 00:06:56.290 align:middle line:84%
And we have an FTP
server running,

00:06:56.290 --> 00:07:01.750 align:middle line:84%
and the service version
is ProFTPD version 1.3.3c.

00:07:01.750 --> 00:07:05.590 align:middle line:84%
So we can actually identify
or take a look at--

00:07:05.590 --> 00:07:08.350 align:middle line:84%
we can actually check
whether this specific version

00:07:08.350 --> 00:07:12.790 align:middle line:84%
of ProFTPD is vulnerable to
an exploit that can provide us

00:07:12.790 --> 00:07:14.350 align:middle line:90%
with the Meterpreter session.

00:07:14.350 --> 00:07:17.920 align:middle line:84%
So I'll just use the
searchsploit utility.

00:07:17.920 --> 00:07:22.390 align:middle line:84%
And we can then say ProFTPD,
and we can hit Enter.

00:07:22.390 --> 00:07:25.720 align:middle line:90%
And we're looking for 1.3.3c.

00:07:25.720 --> 00:07:27.820 align:middle line:84%
And it looks like we
have a backdoor command

00:07:27.820 --> 00:07:30.850 align:middle line:84%
execution module available
within the Metasploit

00:07:30.850 --> 00:07:31.730 align:middle line:90%
framework.

00:07:31.730 --> 00:07:34.070 align:middle line:84%
So what I'll do is I'll
just start up the PostgreSQL

00:07:34.070 --> 00:07:35.613 align:middle line:90%
Database Service.

00:07:35.613 --> 00:07:36.280 align:middle line:90%
So there we are.

00:07:36.280 --> 00:07:41.270 align:middle line:84%
Service postgresql
start and msfconsole.

00:07:41.270 --> 00:07:43.790 align:middle line:84%
And we'll give that a couple
of seconds to start up.

00:07:43.790 --> 00:07:47.300 align:middle line:84%
After which, we can search for
the appropriate exploit module.

00:07:47.300 --> 00:07:50.918 align:middle line:84%
So we'll give this
a couple of seconds.

00:07:50.918 --> 00:07:51.460 align:middle line:90%
There we are.

00:07:51.460 --> 00:07:53.710 align:middle line:84%
It's starting up the
Metasploit framework.

00:07:53.710 --> 00:07:56.650 align:middle line:84%
I'm going to set the global
variable for the RHOSTS option

00:07:56.650 --> 00:07:58.090 align:middle line:90%
to the target IP.

00:07:58.090 --> 00:08:00.670 align:middle line:84%
So let me just get rid
of that panel there.

00:08:00.670 --> 00:08:02.860 align:middle line:90%
And let me copy the target IP.

00:08:02.860 --> 00:08:05.920 align:middle line:84%
So I'll just type in
ifconfig, and I'll just

00:08:05.920 --> 00:08:07.550 align:middle line:90%
copy the subnet there.

00:08:07.550 --> 00:08:10.720 align:middle line:84%
So I'll set the global
variable for the RHOSTS option

00:08:10.720 --> 00:08:13.090 align:middle line:84%
to the target IP so
that I don't have

00:08:13.090 --> 00:08:16.720 align:middle line:84%
to keep on typing the target
IP whenever I load a module.

00:08:16.720 --> 00:08:18.260 align:middle line:90%
So I'll hit Enter.

00:08:18.260 --> 00:08:18.760 align:middle line:90%
All right.

00:08:18.760 --> 00:08:22.120 align:middle line:84%
So if I search
for proftpd, we'll

00:08:22.120 --> 00:08:24.280 align:middle line:90%
look for the appropriate module.

00:08:24.280 --> 00:08:29.050 align:middle line:84%
And we are looking for the
ProFTPD 1.3.3c backdoor command

00:08:29.050 --> 00:08:30.310 align:middle line:90%
execution module.

00:08:30.310 --> 00:08:32.500 align:middle line:84%
So I'll copy that
there, and I'll

00:08:32.500 --> 00:08:35.409 align:middle line:84%
say, use, and paste in
the module name there.

00:08:35.409 --> 00:08:37.960 align:middle line:84%
If I show the
options here, you can

00:08:37.960 --> 00:08:40.270 align:middle line:84%
see that the target IP has
already been specified.

00:08:40.270 --> 00:08:43.179 align:middle line:84%
That's because I set up the
global variable for the RHOSTS

00:08:43.179 --> 00:08:45.710 align:middle line:84%
option, and I set
it to the target IP.

00:08:45.710 --> 00:08:46.210 align:middle line:90%
All right.

00:08:46.210 --> 00:08:48.310 align:middle line:84%
So we really don't
need to do much here.

00:08:48.310 --> 00:08:52.330 align:middle line:84%
You can change the target port
if the target system is running

00:08:52.330 --> 00:08:54.260 align:middle line:90%
FTP on a different port.

00:08:54.260 --> 00:08:56.740 align:middle line:84%
However, in this case, it's
running it on the default port.

00:08:56.740 --> 00:08:59.900 align:middle line:90%
So I'll just hit Exploit.

00:08:59.900 --> 00:09:01.400 align:middle line:84%
We'll give this a
couple of seconds.

00:09:01.400 --> 00:09:01.942 align:middle line:90%
There we are.

00:09:01.942 --> 00:09:04.760 align:middle line:84%
It's going to send
it backdoor command,

00:09:04.760 --> 00:09:06.560 align:middle line:84%
and we should obtain
a command shell

00:09:06.560 --> 00:09:09.020 align:middle line:84%
session, which we can then
upgrade to a Meterpreter

00:09:09.020 --> 00:09:09.888 align:middle line:90%
session.

00:09:09.888 --> 00:09:10.430 align:middle line:90%
There we are.

00:09:10.430 --> 00:09:12.380 align:middle line:84%
So we get a command
shell session.

00:09:12.380 --> 00:09:16.670 align:middle line:84%
So I can say /bin/bash -i
to obtain a bash session.

00:09:16.670 --> 00:09:19.080 align:middle line:84%
And we already have
elevated privileges.

00:09:19.080 --> 00:09:21.650 align:middle line:84%
So this particular
exploit essentially

00:09:21.650 --> 00:09:23.690 align:middle line:84%
provided us with
elevated privileges,

00:09:23.690 --> 00:09:25.980 align:middle line:84%
and of course, I can
verify that there.

00:09:25.980 --> 00:09:28.890 align:middle line:84%
So I can put this
in the background,

00:09:28.890 --> 00:09:31.380 align:middle line:84%
and I can then list
out my sessions here.

00:09:31.380 --> 00:09:34.500 align:middle line:84%
And I can upgrade that session
to a Meterpreter session

00:09:34.500 --> 00:09:37.890 align:middle line:84%
using the command
sessions upgrade 1.

00:09:37.890 --> 00:09:39.390 align:middle line:90%
That's the session ID.

00:09:39.390 --> 00:09:41.370 align:middle line:84%
I'll hit Enter, and
let's see whether we're

00:09:41.370 --> 00:09:43.590 align:middle line:84%
able to upgrade it to
a Meterpreter session

00:09:43.590 --> 00:09:47.182 align:middle line:84%
as that will make
things much easier.

00:09:47.182 --> 00:09:49.265 align:middle line:84%
All right, so we'll give
that a couple of seconds.

00:09:49.265 --> 00:10:00.640 align:middle line:90%


00:10:00.640 --> 00:10:01.140 align:middle line:90%
All right.

00:10:01.140 --> 00:10:03.780 align:middle line:84%
So it looks like we obtained
a Meterpreter session,

00:10:03.780 --> 00:10:05.400 align:middle line:90%
and we got an error.

00:10:05.400 --> 00:10:08.520 align:middle line:84%
But I guess that is fine
as long as we obtain

00:10:08.520 --> 00:10:10.570 align:middle line:90%
the actual Meterpreter session.

00:10:10.570 --> 00:10:12.870 align:middle line:84%
So I'm going to say
sessions, and as you can see,

00:10:12.870 --> 00:10:14.463 align:middle line:90%
we have a Meterpreter session--

00:10:14.463 --> 00:10:15.630 align:middle line:90%
there we are-- on session 2.

00:10:15.630 --> 00:10:17.760 align:middle line:90%
So I can say sessions 2.

00:10:17.760 --> 00:10:20.160 align:middle line:90%
There we go, and I sysinfo.

00:10:20.160 --> 00:10:24.900 align:middle line:84%
This is running Ubuntu 18.04,
and it's a 64-bit operating

00:10:24.900 --> 00:10:25.480 align:middle line:90%
system.

00:10:25.480 --> 00:10:29.520 align:middle line:84%
I can say get user ID to verify
that we have root access.

00:10:29.520 --> 00:10:32.340 align:middle line:84%
The user ID is set to 0,
which is the root user, which

00:10:32.340 --> 00:10:33.640 align:middle line:90%
is fantastic.

00:10:33.640 --> 00:10:36.510 align:middle line:84%
So, as I said, the first
technique that we can use

00:10:36.510 --> 00:10:40.200 align:middle line:84%
is the ability to
dump the actual

00:10:40.200 --> 00:10:42.690 align:middle line:84%
or to actually display the
contents of the shadow file.

00:10:42.690 --> 00:10:44.850 align:middle line:84%
So I'll just open
up a shell session,

00:10:44.850 --> 00:10:47.670 align:middle line:84%
or we can utilize the
Meterpreter session directly.

00:10:47.670 --> 00:10:51.242 align:middle line:90%
So I'll say cat /etc/shadow.

00:10:51.242 --> 00:10:52.700 align:middle line:84%
And because we're
the root user, we

00:10:52.700 --> 00:10:54.950 align:middle line:84%
should be able to dump
the actual hashes.

00:10:54.950 --> 00:10:58.610 align:middle line:84%
And you can see because the root
user account is the only user

00:10:58.610 --> 00:10:59.990 align:middle line:90%
account on the system--

00:10:59.990 --> 00:11:02.720 align:middle line:84%
the rest of them are
service accounts--

00:11:02.720 --> 00:11:05.840 align:middle line:84%
the root user account is
really the only account

00:11:05.840 --> 00:11:07.070 align:middle line:90%
with a password hash.

00:11:07.070 --> 00:11:11.000 align:middle line:84%
And this is the password
hash right over here.

00:11:11.000 --> 00:11:13.220 align:middle line:84%
And you can see that I
mentioned that it will

00:11:13.220 --> 00:11:14.750 align:middle line:90%
be encapsulated in symbols.

00:11:14.750 --> 00:11:18.230 align:middle line:84%
The hashing algorithm value
will be encapsulated in symbols.

00:11:18.230 --> 00:11:19.970 align:middle line:90%
And in this case, it is 6.

00:11:19.970 --> 00:11:23.420 align:middle line:84%
The value is 6, which tells us
that this particular password

00:11:23.420 --> 00:11:27.300 align:middle line:84%
has been encrypted using the
SHA-512 hashing algorithm.

00:11:27.300 --> 00:11:27.800 align:middle line:90%
All right.

00:11:27.800 --> 00:11:29.480 align:middle line:84%
So that's one way of
dumping the hashes.

00:11:29.480 --> 00:11:31.970 align:middle line:84%
And of course, you can
save this directly.

00:11:31.970 --> 00:11:33.440 align:middle line:84%
In the password
cracking course, I

00:11:33.440 --> 00:11:35.240 align:middle line:84%
will be covering the
process of cracking

00:11:35.240 --> 00:11:38.120 align:middle line:84%
these hashes irregardless
of their hashing algorithm

00:11:38.120 --> 00:11:40.890 align:middle line:84%
or the hashing algorithm
used to encrypt the password.

00:11:40.890 --> 00:11:42.428 align:middle line:90%
So that's one technique.

00:11:42.428 --> 00:11:44.720 align:middle line:84%
The other technique that we
can use with the Metasploit

00:11:44.720 --> 00:11:46.980 align:middle line:84%
framework is the
hashdump module.

00:11:46.980 --> 00:11:50.310 align:middle line:84%
So what I'll do is I'll just
put this in the background.

00:11:50.310 --> 00:11:51.120 align:middle line:90%
There we go.

00:11:51.120 --> 00:11:54.200 align:middle line:84%
And I can search for
the hashdump module.

00:11:54.200 --> 00:11:54.980 align:middle line:90%
There we go.

00:11:54.980 --> 00:11:57.960 align:middle line:84%
And we are looking for
the Linux hashdump module.

00:11:57.960 --> 00:11:58.675 align:middle line:90%
So there we are.

00:11:58.675 --> 00:11:59.550 align:middle line:90%
That's the one there.

00:11:59.550 --> 00:12:02.890 align:middle line:84%
So post-- this is a post
exploitation module,

00:12:02.890 --> 00:12:04.150 align:middle line:90%
and I'll copy the name there.

00:12:04.150 --> 00:12:06.520 align:middle line:84%
And I'll say use and
paste that in there.

00:12:06.520 --> 00:12:09.210 align:middle line:90%
We can show the options here.

00:12:09.210 --> 00:12:11.990 align:middle line:84%
And we can set the session
to session 2, which

00:12:11.990 --> 00:12:15.320 align:middle line:84%
is our Meterpreter session,
and we just Hit Run.

00:12:15.320 --> 00:12:17.210 align:middle line:84%
All right, and this
will automatically

00:12:17.210 --> 00:12:21.800 align:middle line:84%
get the-- all the user
accounts that have passwords,

00:12:21.800 --> 00:12:26.000 align:middle line:84%
and it'll essentially provide
you with the hashed passwords.

00:12:26.000 --> 00:12:30.110 align:middle line:84%
And it'll save them for you
within the following file here.

00:12:30.110 --> 00:12:32.570 align:middle line:84%
So it's going to unshadow
the password file.

00:12:32.570 --> 00:12:35.030 align:middle line:84%
As I said, I'll be
explaining what unshadowing

00:12:35.030 --> 00:12:38.270 align:middle line:84%
is in the password cracking--
in the password cracking course.

00:12:38.270 --> 00:12:40.880 align:middle line:84%
For now, just know that
the unshadowed password

00:12:40.880 --> 00:12:46.070 align:middle line:84%
file essentially means that
this module has set up the--

00:12:46.070 --> 00:12:49.850 align:middle line:84%
it has essentially formatted
this particular hashed password

00:12:49.850 --> 00:12:51.650 align:middle line:84%
into a format that
can be cracked

00:12:51.650 --> 00:12:53.400 align:middle line:90%
or that is ready to be cracked.

00:12:53.400 --> 00:12:53.900 align:middle line:90%
All right.

00:12:53.900 --> 00:12:56.630 align:middle line:84%
So that-- these
really are the two

00:12:56.630 --> 00:12:57.900 align:middle line:90%
techniques that you can use.

00:12:57.900 --> 00:13:00.110 align:middle line:84%
And as I said, if you have
an Meterpreter session,

00:13:00.110 --> 00:13:02.090 align:middle line:84%
you can utilize
the hashdump module

00:13:02.090 --> 00:13:05.510 align:middle line:84%
as it is very, very helpful,
or you can dump the hashes

00:13:05.510 --> 00:13:08.390 align:middle line:84%
manually by simply displaying
the contents of the shadow

00:13:08.390 --> 00:13:08.970 align:middle line:90%
file.

00:13:08.970 --> 00:13:09.470 align:middle line:90%
All right.

00:13:09.470 --> 00:13:12.230 align:middle line:84%
So that is going to conclude
the practical demonstration

00:13:12.230 --> 00:13:14.640 align:middle line:90%
side of this video.

00:13:14.640 --> 00:13:15.140 align:middle line:90%
All right.

00:13:15.140 --> 00:13:18.320 align:middle line:84%
So that concludes the final
section of this course.

00:13:18.320 --> 00:13:21.620 align:middle line:84%
And we've essentially
gone through the process

00:13:21.620 --> 00:13:24.920 align:middle line:84%
of exploiting inherent
vulnerabilities in both Windows

00:13:24.920 --> 00:13:27.020 align:middle line:84%
and Linux and
taking a look at how

00:13:27.020 --> 00:13:29.450 align:middle line:84%
we can use these
vulnerabilities to gain access

00:13:29.450 --> 00:13:33.560 align:middle line:84%
to elevate our privileges and
of course, to dump credentials,

00:13:33.560 --> 00:13:34.770 align:middle line:90%
so on and so forth.

00:13:34.770 --> 00:13:38.150 align:middle line:84%
So this is the last
video within this course.

00:13:38.150 --> 00:13:42.700 align:middle line:84%
And hopefully, I'll be seeing
you in the next course.

00:13:42.700 --> 00:13:44.000 align:middle line:90%