WEBVTT

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


00:00:03.458 --> 00:00:06.916 align:middle line:90%
[THEME TUNE PLAYING]

00:00:06.916 --> 00:00:10.380 align:middle line:90%


00:00:10.380 --> 00:00:12.960 align:middle line:90%
Dumping Hashes with Hashdump.

00:00:12.960 --> 00:00:16.050 align:middle line:84%
Now that we've explored
the process of elevating

00:00:16.050 --> 00:00:17.850 align:middle line:84%
our privileges on
a Linux system,

00:00:17.850 --> 00:00:21.780 align:middle line:84%
we can begin exploring the
process of dumping Linux user

00:00:21.780 --> 00:00:25.110 align:middle line:84%
count hashes through the
use of the hashdump module

00:00:25.110 --> 00:00:27.130 align:middle line:90%
within the Metasploit framework.

00:00:27.130 --> 00:00:27.630 align:middle line:90%
All right.

00:00:27.630 --> 00:00:29.320 align:middle line:90%
So what is Hashdump.

00:00:29.320 --> 00:00:32.700 align:middle line:84%
Well, hashdump is a
post exploitation module

00:00:32.700 --> 00:00:37.380 align:middle line:84%
that, again, is utilized to
dump the hashes of both Windows

00:00:37.380 --> 00:00:39.420 align:middle line:90%
and the Linux operating systems.

00:00:39.420 --> 00:00:43.080 align:middle line:84%
And typically, when you're
utilizing a Meterpreter session

00:00:43.080 --> 00:00:45.960 align:middle line:84%
on a Windows target,
the hashdump command

00:00:45.960 --> 00:00:47.730 align:middle line:84%
is built right in,
as we've explored.

00:00:47.730 --> 00:00:52.710 align:middle line:84%
However, when we're utilizing a
Meterpreter session on a Linux

00:00:52.710 --> 00:00:55.110 align:middle line:84%
target, we will need
to utilize the hashdump

00:00:55.110 --> 00:00:58.620 align:middle line:84%
or we'll need to load up the
hashdump post exploitation

00:00:58.620 --> 00:00:59.970 align:middle line:90%
module manually.

00:00:59.970 --> 00:01:02.160 align:middle line:84%
So this module
essentially allows

00:01:02.160 --> 00:01:04.890 align:middle line:84%
us to dump the Linux
user account hashes.

00:01:04.890 --> 00:01:08.200 align:middle line:84%
And again, in order to
understand how this is done,

00:01:08.200 --> 00:01:10.440 align:middle line:84%
we need to understand
where the Linux

00:01:10.440 --> 00:01:11.820 align:middle line:90%
user account hashes are stored.

00:01:11.820 --> 00:01:15.060 align:middle line:84%
So the Linux user account
password hashes are

00:01:15.060 --> 00:01:16.750 align:middle line:90%
stored in the etc shadow file.

00:01:16.750 --> 00:01:17.250 align:middle line:90%
Right?

00:01:17.250 --> 00:01:20.220 align:middle line:84%
And this file can only be
accessed by the root user

00:01:20.220 --> 00:01:21.900 align:middle line:90%
or a user with root privileges.

00:01:21.900 --> 00:01:25.860 align:middle line:84%
So again, in order to access
the hashes of a Linux system

00:01:25.860 --> 00:01:28.410 align:middle line:84%
or the user account
hashes on a Linux system,

00:01:28.410 --> 00:01:30.570 align:middle line:84%
you need to have root
privileges or you

00:01:30.570 --> 00:01:32.310 align:middle line:84%
need to have an
elevated session, which

00:01:32.310 --> 00:01:34.960 align:middle line:84%
is why we covered
privilege escalation first.

00:01:34.960 --> 00:01:35.460 align:middle line:90%
All right.

00:01:35.460 --> 00:01:39.210 align:middle line:84%
Now the hashdump module can be
used to dump the user account

00:01:39.210 --> 00:01:42.450 align:middle line:84%
hashes from the etc shadow
file, and can consequently

00:01:42.450 --> 00:01:44.850 align:middle line:84%
be used to unshadow
the files or unshadow

00:01:44.850 --> 00:01:48.010 align:middle line:84%
the hashes for password
cracking with John the Ripper.

00:01:48.010 --> 00:01:50.220 align:middle line:84%
Now we are not going to
be exploring password

00:01:50.220 --> 00:01:52.020 align:middle line:90%
cracking with John the Ripper.

00:01:52.020 --> 00:01:54.930 align:middle line:84%
But in essence, the only
thing you can really

00:01:54.930 --> 00:01:59.010 align:middle line:84%
do with a Linux hash is either
crack it or you essentially

00:01:59.010 --> 00:02:00.810 align:middle line:90%
just store it for later use.

00:02:00.810 --> 00:02:02.520 align:middle line:84%
And of course,
I'll be explaining

00:02:02.520 --> 00:02:06.010 align:middle line:84%
how the hashes can be used
for cracking in the video

00:02:06.010 --> 00:02:09.210 align:middle line:84%
once we've actually dumped
the actual Linux user account

00:02:09.210 --> 00:02:09.880 align:middle line:90%
hashes.

00:02:09.880 --> 00:02:10.380 align:middle line:90%
All right.

00:02:10.380 --> 00:02:13.270 align:middle line:84%
So let's get started with
dumping hashes with hashdump.

00:02:13.270 --> 00:02:15.600 align:middle line:84%
So just fire up the
lab environment,

00:02:15.600 --> 00:02:17.350 align:middle line:90%
and we should be good to go.

00:02:17.350 --> 00:02:21.990 align:middle line:84%
So I'll see you within
the lab environment.

00:02:21.990 --> 00:02:22.490 align:middle line:90%
All right.

00:02:22.490 --> 00:02:24.380 align:middle line:84%
So I'm back within
the lab environment.

00:02:24.380 --> 00:02:26.030 align:middle line:84%
And of course, the
first step involves

00:02:26.030 --> 00:02:28.250 align:middle line:84%
identifying the target
IP address, which we

00:02:28.250 --> 00:02:30.650 align:middle line:90%
can do by typing in ifconfig.

00:02:30.650 --> 00:02:34.160 align:middle line:84%
And we want to head over to
the interface Ethernet 1.

00:02:34.160 --> 00:02:36.080 align:middle line:84%
And you just want
to copy this IP

00:02:36.080 --> 00:02:38.390 align:middle line:84%
and change the
last digit to a 3.

00:02:38.390 --> 00:02:41.030 align:middle line:84%
So again, the target
IP or the target server

00:02:41.030 --> 00:02:43.520 align:middle line:84%
is on the same subnet
on the next IP.

00:02:43.520 --> 00:02:45.628 align:middle line:84%
So of course in your
case, the subnet

00:02:45.628 --> 00:02:46.670 align:middle line:90%
is going to be different.

00:02:46.670 --> 00:02:48.650 align:middle line:84%
All you need to do is
just copy the entire IP

00:02:48.650 --> 00:02:50.490 align:middle line:90%
and change the 2 to a 3.

00:02:50.490 --> 00:02:50.990 align:middle line:90%
All right.

00:02:50.990 --> 00:02:51.800 align:middle line:90%
So I'll copy that.

00:02:51.800 --> 00:02:54.530 align:middle line:84%
We can then start up the
PostgreSQL database service,

00:02:54.530 --> 00:02:57.650 align:middle line:84%
as we will be requiring it to
store all of the information

00:02:57.650 --> 00:03:01.260 align:middle line:84%
that we gather with the post
exploitation module hashdump.

00:03:01.260 --> 00:03:01.760 align:middle line:90%
All right.

00:03:01.760 --> 00:03:03.920 align:middle line:84%
So I'm going to say
service PostgreSQL Start,

00:03:03.920 --> 00:03:06.960 align:middle line:84%
and we can also start up MSF
console while we're at it.

00:03:06.960 --> 00:03:07.460 align:middle line:90%
All right.

00:03:07.460 --> 00:03:09.085 align:middle line:84%
So we'll give that
a couple of seconds.

00:03:09.085 --> 00:03:13.050 align:middle line:90%


00:03:13.050 --> 00:03:13.550 align:middle line:90%
All right.

00:03:13.550 --> 00:03:14.600 align:middle line:90%
So there we are.

00:03:14.600 --> 00:03:16.340 align:middle line:90%
We are back in MSF console.

00:03:16.340 --> 00:03:18.230 align:middle line:84%
And we can create
a workspace here.

00:03:18.230 --> 00:03:20.390 align:middle line:84%
And I'm just going
to call it hashdump.

00:03:20.390 --> 00:03:21.260 align:middle line:90%
All right.

00:03:21.260 --> 00:03:22.380 align:middle line:90%
There we go.

00:03:22.380 --> 00:03:25.100 align:middle line:84%
And we can then set up the
global variable for the RHost

00:03:25.100 --> 00:03:27.320 align:middle line:84%
option, and we'll set
that to the target IP.

00:03:27.320 --> 00:03:30.888 align:middle line:84%
In this case, we just need
to change the 2 to a 3.

00:03:30.888 --> 00:03:31.430 align:middle line:90%
There we are.

00:03:31.430 --> 00:03:34.100 align:middle line:84%
And this, again, will
eliminate or save us

00:03:34.100 --> 00:03:36.620 align:middle line:84%
from having to type
in the target IP

00:03:36.620 --> 00:03:38.370 align:middle line:90%
whenever we load a module.

00:03:38.370 --> 00:03:38.870 align:middle line:90%
Right?

00:03:38.870 --> 00:03:41.240 align:middle line:84%
So now that that is
done, we can actually

00:03:41.240 --> 00:03:44.750 align:middle line:84%
begin the process of exploiting
the target system in order

00:03:44.750 --> 00:03:46.880 align:middle line:84%
to gain initial
access, after which,

00:03:46.880 --> 00:03:48.330 align:middle line:90%
we can then dump the hashes.

00:03:48.330 --> 00:03:50.060 align:middle line:84%
So in order to do
this, we're going

00:03:50.060 --> 00:03:52.940 align:middle line:84%
to utilize the DB Nmap
command to perform an Nmap

00:03:52.940 --> 00:03:54.680 align:middle line:90%
scan from within MSF console.

00:03:54.680 --> 00:03:58.490 align:middle line:84%
And again, the DB Nmap command
will also save the Nmap scan

00:03:58.490 --> 00:04:01.040 align:middle line:84%
results into the Metasploit
framework database,

00:04:01.040 --> 00:04:02.970 align:middle line:90%
which is exactly what we want.

00:04:02.970 --> 00:04:05.810 align:middle line:84%
So we'll perform a service
version detection scan,

00:04:05.810 --> 00:04:07.550 align:middle line:90%
and I'll paste in the target IP.

00:04:07.550 --> 00:04:09.470 align:middle line:90%
Remember to change the 2 to a 3.

00:04:09.470 --> 00:04:10.400 align:middle line:90%
And we'll hit Enter.

00:04:10.400 --> 00:04:13.070 align:middle line:84%
So I'm going to give this a few
seconds to a couple of minutes

00:04:13.070 --> 00:04:14.960 align:middle line:90%
to complete.

00:04:14.960 --> 00:04:15.460 align:middle line:90%
All right.

00:04:15.460 --> 00:04:17.089 align:middle line:90%
So the Nmap scan is complete.

00:04:17.089 --> 00:04:19.420 align:middle line:84%
And as you can see, the
target is running SMB.

00:04:19.420 --> 00:04:20.380 align:middle line:90%
It's a Linux target.

00:04:20.380 --> 00:04:22.420 align:middle line:84%
It's running Samba
to be specific,

00:04:22.420 --> 00:04:25.750 align:middle line:84%
and the service version is
anywhere between 3 and 4.

00:04:25.750 --> 00:04:27.700 align:middle line:84%
And of course,
we've taken a look

00:04:27.700 --> 00:04:30.050 align:middle line:84%
at how to exploit Samba
on the Linux system.

00:04:30.050 --> 00:04:33.130 align:middle line:84%
So what we can do is search
for the Samba exploits.

00:04:33.130 --> 00:04:36.880 align:middle line:84%
And I'm going to say Search
Samba, and the type is Exploit,

00:04:36.880 --> 00:04:39.370 align:middle line:84%
and we're going to be
utilizing the Is Known pipe

00:04:39.370 --> 00:04:41.228 align:middle line:90%
name exploit module.

00:04:41.228 --> 00:04:41.770 align:middle line:90%
There we are.

00:04:41.770 --> 00:04:44.140 align:middle line:84%
So I'm going to
say Copy and Use.

00:04:44.140 --> 00:04:47.570 align:middle line:84%
And we can then show the options
here that we need to set up.

00:04:47.570 --> 00:04:50.260 align:middle line:84%
And in this case, the only
options that we need to set up

00:04:50.260 --> 00:04:52.600 align:middle line:84%
are the target IP, which
we have done already,

00:04:52.600 --> 00:04:54.100 align:middle line:90%
and the target port.

00:04:54.100 --> 00:04:56.050 align:middle line:84%
And then we can just
type in Exploit,

00:04:56.050 --> 00:04:58.445 align:middle line:84%
and that should give us
a Meterpreter session.

00:04:58.445 --> 00:05:00.070 align:middle line:84%
So we'll give this
a couple of seconds.

00:05:00.070 --> 00:05:02.800 align:middle line:90%


00:05:02.800 --> 00:05:03.300 align:middle line:90%
All right.

00:05:03.300 --> 00:05:05.070 align:middle line:84%
So we get a command
shell session,

00:05:05.070 --> 00:05:06.760 align:middle line:90%
but we can still upgrade this.

00:05:06.760 --> 00:05:08.490 align:middle line:84%
So again, if I type
in PWD, you can

00:05:08.490 --> 00:05:10.170 align:middle line:90%
see that that works just fine.

00:05:10.170 --> 00:05:12.900 align:middle line:84%
I'll put this in the
background, and I

00:05:12.900 --> 00:05:14.280 align:middle line:90%
will upgrade this session.

00:05:14.280 --> 00:05:15.792 align:middle line:90%
So I'll say Sessions.

00:05:15.792 --> 00:05:17.250 align:middle line:84%
Let me just type
that in correctly.

00:05:17.250 --> 00:05:18.120 align:middle line:90%
Sessions.

00:05:18.120 --> 00:05:22.652 align:middle line:84%
And we can then say Sessions
Upgrade 1 and hit Enter.

00:05:22.652 --> 00:05:24.360 align:middle line:84%
And that's going to
give us a Meterpreter

00:05:24.360 --> 00:05:29.800 align:middle line:84%
session on the target system,
which is required in this case.

00:05:29.800 --> 00:05:30.300 align:middle line:90%
All right.

00:05:30.300 --> 00:05:32.250 align:middle line:84%
So we'll open up
Sessions 2 here.

00:05:32.250 --> 00:05:34.620 align:middle line:84%
And again, if I try
and type in hashdump

00:05:34.620 --> 00:05:36.840 align:middle line:84%
similar to what we
had done on Windows,

00:05:36.840 --> 00:05:39.390 align:middle line:84%
you can see that'll tell us
unknown command hashdump.

00:05:39.390 --> 00:05:41.970 align:middle line:84%
So given that that is
the case, we actually

00:05:41.970 --> 00:05:45.090 align:middle line:84%
need to load in the
actual hashdump module

00:05:45.090 --> 00:05:47.880 align:middle line:84%
or we need to utilize
the post exploitation

00:05:47.880 --> 00:05:48.850 align:middle line:90%
module called hashdump.

00:05:48.850 --> 00:05:49.350 align:middle line:90%
Right?

00:05:49.350 --> 00:05:51.990 align:middle line:84%
So again, the first
thing we want to do

00:05:51.990 --> 00:05:53.490 align:middle line:90%
is perform some enumeration.

00:05:53.490 --> 00:05:55.950 align:middle line:84%
So we are running
on Debian 8 system,

00:05:55.950 --> 00:05:59.310 align:middle line:90%
running the Linux kernel 5.4.0.

00:05:59.310 --> 00:06:02.100 align:middle line:84%
And if we enumerate our
current permissions or the user

00:06:02.100 --> 00:06:03.570 align:middle line:84%
that we currently
have access to,

00:06:03.570 --> 00:06:06.690 align:middle line:84%
you can see we have the user ID
of 0, which means we are root.

00:06:06.690 --> 00:06:08.250 align:middle line:84%
And of course, we
can confirm this

00:06:08.250 --> 00:06:10.890 align:middle line:84%
by saying Shell, and
then saying, Who am I.

00:06:10.890 --> 00:06:12.460 align:middle line:84%
And as you can
see, it says Root.

00:06:12.460 --> 00:06:15.550 align:middle line:84%
So that means we can, again,
dump the actual Linux user

00:06:15.550 --> 00:06:17.310 align:middle line:90%
account hashes.

00:06:17.310 --> 00:06:20.220 align:middle line:84%
And what I'll do is I'll
terminate this channel.

00:06:20.220 --> 00:06:22.110 align:middle line:84%
And then I'll put our
Meterpreter session

00:06:22.110 --> 00:06:22.860 align:middle line:90%
in the background.

00:06:22.860 --> 00:06:25.080 align:middle line:84%
And for some reason,
that actually dies.

00:06:25.080 --> 00:06:27.990 align:middle line:84%
So we are just going
to terminate or exit

00:06:27.990 --> 00:06:28.980 align:middle line:90%
from this session.

00:06:28.980 --> 00:06:31.440 align:middle line:84%
And we're just going to upgrade
our previous command shell

00:06:31.440 --> 00:06:33.960 align:middle line:90%
session again.

00:06:33.960 --> 00:06:34.830 align:middle line:90%
There we are.

00:06:34.830 --> 00:06:37.245 align:middle line:84%
And that should give us
another Meterpreter session.

00:06:37.245 --> 00:06:42.010 align:middle line:90%


00:06:42.010 --> 00:06:42.510 align:middle line:90%
All right.

00:06:42.510 --> 00:06:44.850 align:middle line:84%
So now that we have the
Meterpreter session established

00:06:44.850 --> 00:06:46.350 align:middle line:84%
again, we can search
for the module.

00:06:46.350 --> 00:06:48.250 align:middle line:90%
It is called hashdump.

00:06:48.250 --> 00:06:48.750 align:middle line:90%
Right.

00:06:48.750 --> 00:06:50.100 align:middle line:90%
And I'll say hashdump.

00:06:50.100 --> 00:06:51.090 align:middle line:90%
There we are.

00:06:51.090 --> 00:06:54.300 align:middle line:84%
And we are looking for
the Linux hashdump module.

00:06:54.300 --> 00:06:56.190 align:middle line:84%
So post to Linux
gather hashdump.

00:06:56.190 --> 00:06:57.540 align:middle line:90%
That's the module there.

00:06:57.540 --> 00:06:59.850 align:middle line:90%
And let me just hit Enter.

00:06:59.850 --> 00:07:02.970 align:middle line:84%
And as you can see, this
will gather and dump

00:07:02.970 --> 00:07:05.440 align:middle line:84%
the password hashes
for Linux systems.

00:07:05.440 --> 00:07:06.720 align:middle line:90%
So I'll copy that.

00:07:06.720 --> 00:07:08.310 align:middle line:90%
And we'll say Use.

00:07:08.310 --> 00:07:09.990 align:middle line:90%
Paste that in there.

00:07:09.990 --> 00:07:13.050 align:middle line:90%
Show the Options.

00:07:13.050 --> 00:07:16.060 align:middle line:84%
The only option that we need
to specify is the session ID.

00:07:16.060 --> 00:07:18.720 align:middle line:84%
So we'll set session to 3,
because that's our Meterpreter

00:07:18.720 --> 00:07:19.590 align:middle line:90%
session.

00:07:19.590 --> 00:07:22.082 align:middle line:90%
And we can then Run.

00:07:22.082 --> 00:07:23.790 align:middle line:84%
And as you can see,
it's going to tell us

00:07:23.790 --> 00:07:25.950 align:middle line:84%
the unshadowed
password file is going

00:07:25.950 --> 00:07:30.450 align:middle line:84%
to be stored under the
following directory,

00:07:30.450 --> 00:07:32.610 align:middle line:84%
and it will then provide
us with the actual path

00:07:32.610 --> 00:07:34.500 align:middle line:84%
to the file as well
as the file name.

00:07:34.500 --> 00:07:36.450 align:middle line:84%
And of course, you can
access this information

00:07:36.450 --> 00:07:37.860 align:middle line:90%
by typing in Loot.

00:07:37.860 --> 00:07:41.160 align:middle line:84%
And as you can see it's going
to display the actual Linux

00:07:41.160 --> 00:07:44.820 align:middle line:84%
password file which is used to
store the Linux user account

00:07:44.820 --> 00:07:48.150 align:middle line:84%
details, like their
username, the actual home

00:07:48.150 --> 00:07:51.150 align:middle line:84%
directory, the shell that they
have actually been configured

00:07:51.150 --> 00:07:52.980 align:middle line:90%
to use, et cetera, et cetera.

00:07:52.980 --> 00:07:55.110 align:middle line:84%
And then you have the
shadow file, which

00:07:55.110 --> 00:07:56.370 align:middle line:90%
we mentioned in the slides.

00:07:56.370 --> 00:07:59.130 align:middle line:84%
This is where you'll actually
find the encrypted passwords.

00:07:59.130 --> 00:08:01.420 align:middle line:84%
So we can try and access
all of these files.

00:08:01.420 --> 00:08:03.930 align:middle line:84%
So let's open up the
password file first.

00:08:03.930 --> 00:08:06.510 align:middle line:84%
I'm just going to
copy that and say cat.

00:08:06.510 --> 00:08:07.810 align:middle line:90%
Paste that in there.

00:08:07.810 --> 00:08:09.930 align:middle line:84%
And as you can see,
this will list out

00:08:09.930 --> 00:08:12.280 align:middle line:84%
all of the user
accounts on the system.

00:08:12.280 --> 00:08:14.580 align:middle line:84%
So we only have the root
user and a few other service

00:08:14.580 --> 00:08:15.330 align:middle line:90%
accounts.

00:08:15.330 --> 00:08:18.480 align:middle line:84%
If we list out the actual
shadow file or the contents

00:08:18.480 --> 00:08:23.530 align:middle line:84%
of the shadow file
that was dumped,

00:08:23.530 --> 00:08:26.330 align:middle line:84%
we can see that it lists
out the user accounts.

00:08:26.330 --> 00:08:28.900 align:middle line:84%
However, in the place of the
password, which is directly

00:08:28.900 --> 00:08:31.150 align:middle line:84%
after the username
is specified, you

00:08:31.150 --> 00:08:33.200 align:middle line:84%
can see that
there's an asterisk.

00:08:33.200 --> 00:08:35.080 align:middle line:84%
Which means, in this
case, the target system

00:08:35.080 --> 00:08:37.120 align:middle line:84%
does not have a
password specified

00:08:37.120 --> 00:08:39.070 align:middle line:90%
for any of the user accounts.

00:08:39.070 --> 00:08:42.440 align:middle line:84%
And that makes sense
in some scenarios,

00:08:42.440 --> 00:08:45.110 align:middle line:84%
especially in the case
of the service accounts.

00:08:45.110 --> 00:08:47.020 align:middle line:84%
However, just to show
you that this indeed

00:08:47.020 --> 00:08:50.350 align:middle line:84%
does work, what I'll do is
I'll open up Sessions 3.

00:08:50.350 --> 00:08:53.230 align:middle line:84%
And I will open up
a shell session.

00:08:53.230 --> 00:08:57.940 align:middle line:84%
And I'll say bin/bash
I. And I will

00:08:57.940 --> 00:08:59.680 align:middle line:84%
change the password
of the root user,

00:08:59.680 --> 00:09:02.330 align:middle line:84%
or rather, I will provide the
root user with the password.

00:09:02.330 --> 00:09:04.540 align:middle line:90%
So I'll say Password Root.

00:09:04.540 --> 00:09:08.560 align:middle line:84%
And I'll say something
like password123.

00:09:08.560 --> 00:09:10.570 align:middle line:90%
Password123.

00:09:10.570 --> 00:09:11.350 align:middle line:90%
There we are.

00:09:11.350 --> 00:09:13.810 align:middle line:84%
So we've changed the
password for the root user.

00:09:13.810 --> 00:09:15.550 align:middle line:90%
And then we can add a few users.

00:09:15.550 --> 00:09:17.290 align:middle line:90%
So I'm going to say User Add.

00:09:17.290 --> 00:09:20.890 align:middle line:84%
And we can specify that we want
to create a home directory.

00:09:20.890 --> 00:09:23.020 align:middle line:84%
And the name of the
user will probably

00:09:23.020 --> 00:09:24.280 align:middle line:90%
be something like Alexis.

00:09:24.280 --> 00:09:26.590 align:middle line:84%
And then I can specify
the actual shell

00:09:26.590 --> 00:09:28.160 align:middle line:90%
I want the user to use.

00:09:28.160 --> 00:09:30.040 align:middle line:84%
So I'll say the
shell is bin/bash.

00:09:30.040 --> 00:09:33.280 align:middle line:84%
And then I can specify the
password for the user Alexis.

00:09:33.280 --> 00:09:36.610 align:middle line:90%
So I'll say a password321.

00:09:36.610 --> 00:09:38.230 align:middle line:90%
Password321.

00:09:38.230 --> 00:09:39.790 align:middle line:90%
Of course, this is not the--

00:09:39.790 --> 00:09:42.970 align:middle line:84%
I'm not really following any
password security guidelines

00:09:42.970 --> 00:09:44.980 align:middle line:84%
here, but I'm just doing
this to demonstrate

00:09:44.980 --> 00:09:46.540 align:middle line:90%
that this does indeed work.

00:09:46.540 --> 00:09:49.030 align:middle line:84%
I'll terminate the
session or that channel.

00:09:49.030 --> 00:09:52.057 align:middle line:84%
And again, we'll need to
upgrade our Meterpreter session.

00:09:52.057 --> 00:09:53.890 align:middle line:84%
So I'm just going to
do that right now using

00:09:53.890 --> 00:09:56.500 align:middle line:90%
the Sessions Upgrade 1.

00:09:56.500 --> 00:09:58.790 align:middle line:90%
There we are.

00:09:58.790 --> 00:10:00.858 align:middle line:84%
And that will open up
the Meterpreter session

00:10:00.858 --> 00:10:01.400 align:middle line:90%
on Sessios 4.

00:10:01.400 --> 00:10:03.750 align:middle line:90%
For some reason, it keeps dying.

00:10:03.750 --> 00:10:05.990 align:middle line:84%
But what we've done is we
have created a new user,

00:10:05.990 --> 00:10:09.270 align:middle line:84%
set the password, and change
the password for the root user.

00:10:09.270 --> 00:10:11.240 align:middle line:84%
So let's see or
let's take a look

00:10:11.240 --> 00:10:13.520 align:middle line:84%
at what happens when
we run hashdump now.

00:10:13.520 --> 00:10:15.810 align:middle line:84%
So I'll Show the
Options again here.

00:10:15.810 --> 00:10:19.070 align:middle line:84%
And we'll set session to 4,
because the Meterpreter session

00:10:19.070 --> 00:10:20.300 align:middle line:90%
is now changed.

00:10:20.300 --> 00:10:23.360 align:middle line:90%
And I'll then hit Run.

00:10:23.360 --> 00:10:26.780 align:middle line:84%
As you can see, now it's
going to actually display

00:10:26.780 --> 00:10:29.480 align:middle line:84%
the actual hashes that
it was able to identify.

00:10:29.480 --> 00:10:32.360 align:middle line:84%
So you can see it got
the root user hash.

00:10:32.360 --> 00:10:35.030 align:middle line:84%
And this is the hash
right over here.

00:10:35.030 --> 00:10:35.630 align:middle line:90%
There we go.

00:10:35.630 --> 00:10:40.510 align:middle line:84%
And then after the hash, the
user ID as well as the group ID

00:10:40.510 --> 00:10:44.800 align:middle line:84%
specified, and then the actual
home directory and the shell

00:10:44.800 --> 00:10:46.370 align:middle line:90%
specified for that user.

00:10:46.370 --> 00:10:48.310 align:middle line:84%
So the same thing goes
for the user Alexis.

00:10:48.310 --> 00:10:50.680 align:middle line:84%
You can see that we
have the hash here.

00:10:50.680 --> 00:10:54.370 align:middle line:84%
And then you have the user
ID as well as the group ID.

00:10:54.370 --> 00:10:56.830 align:middle line:84%
And then the actual home
directory as well as

00:10:56.830 --> 00:10:59.600 align:middle line:84%
the shell that has been
specified for that user.

00:10:59.600 --> 00:11:02.110 align:middle line:84%
And then it'll tell you
that the unshadowed file

00:11:02.110 --> 00:11:04.790 align:middle line:84%
or the unshadowed password
file has been stored here.

00:11:04.790 --> 00:11:07.210 align:middle line:84%
So again, we can open
that up by saying Loot.

00:11:07.210 --> 00:11:12.040 align:middle line:84%
And we can say we are
looking for the actual Linux

00:11:12.040 --> 00:11:14.350 align:middle line:90%
unshadowed password file.

00:11:14.350 --> 00:11:17.410 align:middle line:84%
And we know that
this ends in 851.

00:11:17.410 --> 00:11:18.920 align:middle line:90%
So this is the file here.

00:11:18.920 --> 00:11:21.320 align:middle line:90%
So we can cat that.

00:11:21.320 --> 00:11:22.300 align:middle line:90%
So I'll copy that.

00:11:22.300 --> 00:11:23.170 align:middle line:90%
And we'll say cat.

00:11:23.170 --> 00:11:26.160 align:middle line:90%


00:11:26.160 --> 00:11:28.610 align:middle line:84%
And for some reason,
it doesn't actually

00:11:28.610 --> 00:11:31.050 align:middle line:84%
copy, so let me just
specify that again.

00:11:31.050 --> 00:11:32.360 align:middle line:90%
So I'll say Copy.

00:11:32.360 --> 00:11:34.200 align:middle line:90%
And I'll say cat.

00:11:34.200 --> 00:11:34.920 align:middle line:90%
There we are.

00:11:34.920 --> 00:11:37.950 align:middle line:84%
And for some reason, it doesn't
look like it's opening that.

00:11:37.950 --> 00:11:41.810 align:middle line:84%
But what we can do is
just specify the actual--

00:11:41.810 --> 00:11:44.480 align:middle line:84%
we can actually just specify
the path to the file,

00:11:44.480 --> 00:11:46.520 align:middle line:84%
and that will
essentially display

00:11:46.520 --> 00:11:51.110 align:middle line:84%
the contents of the
unshadowed password file.

00:11:51.110 --> 00:11:54.920 align:middle line:84%
And in the case of the
unshadowed file, what it really

00:11:54.920 --> 00:11:58.760 align:middle line:84%
does is it just prepares the
user accounts and the hashes

00:11:58.760 --> 00:11:59.840 align:middle line:90%
for password cracking.

00:11:59.840 --> 00:12:02.600 align:middle line:84%
So it will get rid of
the other information

00:12:02.600 --> 00:12:05.900 align:middle line:84%
like the actual user
ID as well as the group

00:12:05.900 --> 00:12:10.010 align:middle line:84%
ID, and the home directory
as well as the shell session.

00:12:10.010 --> 00:12:12.230 align:middle line:84%
And what you'll be
left with is really

00:12:12.230 --> 00:12:16.010 align:middle line:84%
just going to be the
actual username and then

00:12:16.010 --> 00:12:17.010 align:middle line:90%
the hash here.

00:12:17.010 --> 00:12:17.510 align:middle line:90%
All right.

00:12:17.510 --> 00:12:20.930 align:middle line:84%
Now when we talk about this
little encapsulated value

00:12:20.930 --> 00:12:24.740 align:middle line:84%
that's been encapsulated
in the dollar signs,

00:12:24.740 --> 00:12:28.040 align:middle line:84%
that is referring to the hashing
algorithm or the encryption

00:12:28.040 --> 00:12:31.580 align:middle line:84%
algorithm that was used to
essentially encrypt or hash

00:12:31.580 --> 00:12:33.350 align:middle line:90%
these passwords.

00:12:33.350 --> 00:12:37.390 align:middle line:84%
So the higher the number, the
stronger the hashing algorithm

00:12:37.390 --> 00:12:37.890 align:middle line:90%
used.

00:12:37.890 --> 00:12:40.500 align:middle line:84%
So if you're working on
an older Linux system,

00:12:40.500 --> 00:12:42.950 align:middle line:84%
then you'll find that
that may be encapsulated

00:12:42.950 --> 00:12:46.370 align:middle line:84%
or the value may
be 1, instead of 6.

00:12:46.370 --> 00:12:49.880 align:middle line:84%
And if it is 1, it means that
that password has been hashed

00:12:49.880 --> 00:12:52.550 align:middle line:90%
with the MD5 hashing algorithm.

00:12:52.550 --> 00:12:55.760 align:middle line:84%
If it's 2, it means it's
been hashed with Blowfish.

00:12:55.760 --> 00:13:00.260 align:middle line:84%
If it's 3 or 5, that means that
it's been hashed or encrypted

00:13:00.260 --> 00:13:03.050 align:middle line:90%
with the SHA-256 algorithm.

00:13:03.050 --> 00:13:06.950 align:middle line:84%
And if it's 6, it's
utilizing the strongest

00:13:06.950 --> 00:13:09.530 align:middle line:84%
hashing algorithm,
which is SHA-512.

00:13:09.530 --> 00:13:13.880 align:middle line:84%
So again, given that that is
the case, if the passwords have

00:13:13.880 --> 00:13:18.290 align:middle line:84%
been set or if the passwords
are created following

00:13:18.290 --> 00:13:21.860 align:middle line:84%
or in accordance with
password security guidelines,

00:13:21.860 --> 00:13:25.370 align:middle line:84%
then, again, it may be very
difficult to actually crack

00:13:25.370 --> 00:13:28.890 align:middle line:84%
those passwords or those
hashes for that matter.

00:13:28.890 --> 00:13:31.677 align:middle line:84%
And if they are simple, then,
again, there is a chance

00:13:31.677 --> 00:13:32.760 align:middle line:90%
that you could crack them.

00:13:32.760 --> 00:13:35.150 align:middle line:84%
But again, when it comes
down to Linux and hashes,

00:13:35.150 --> 00:13:37.820 align:middle line:84%
and again, the
functionality of hashes

00:13:37.820 --> 00:13:40.010 align:middle line:84%
in regards to post
exploitation, there's

00:13:40.010 --> 00:13:42.000 align:middle line:90%
very little that can be done.

00:13:42.000 --> 00:13:43.550 align:middle line:84%
Unlike Windows,
where we actually

00:13:43.550 --> 00:13:46.010 align:middle line:84%
took a look at how
to utilize the hashes

00:13:46.010 --> 00:13:49.850 align:middle line:84%
for legitimate authentication
or authenticated

00:13:49.850 --> 00:13:51.620 align:middle line:90%
command execution.

00:13:51.620 --> 00:13:53.390 align:middle line:84%
With Linux, we
really can't do that.

00:13:53.390 --> 00:13:55.070 align:middle line:84%
But that's primarily
because once you

00:13:55.070 --> 00:13:57.560 align:middle line:84%
have root access
on a Linux system,

00:13:57.560 --> 00:13:59.490 align:middle line:84%
you can pretty much
do whatever you want.

00:13:59.490 --> 00:14:02.780 align:middle line:84%
So you can create another
user, specify a password,

00:14:02.780 --> 00:14:05.390 align:middle line:84%
and of course, enable
SSH so that you

00:14:05.390 --> 00:14:07.735 align:middle line:90%
can maintain access via SSH.

00:14:07.735 --> 00:14:09.110 align:middle line:84%
And of course,
we'll be exploring

00:14:09.110 --> 00:14:11.130 align:middle line:90%
that in the persistence video.

00:14:11.130 --> 00:14:13.790 align:middle line:84%
So that's going to
be it in regards

00:14:13.790 --> 00:14:18.770 align:middle line:84%
to the practical demonstration
side of this video.

00:14:18.770 --> 00:14:20.680 align:middle line:84%
In the next video,
we will be exploring

00:14:20.680 --> 00:14:24.380 align:middle line:84%
the process of establishing
persistence on a Linux system.

00:14:24.380 --> 00:14:27.090 align:middle line:90%
So I'll see you there.