WEBVTT

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


00:00:03.388 --> 00:00:07.260 align:middle line:90%
[MUSIC PLAYING]

00:00:07.260 --> 00:00:10.170 align:middle line:90%


00:00:10.170 --> 00:00:12.360 align:middle line:84%
Linux Post
Exploitation Modules--

00:00:12.360 --> 00:00:14.790 align:middle line:84%
welcome to the Linux
post exploitation

00:00:14.790 --> 00:00:16.239 align:middle line:90%
section of this course.

00:00:16.239 --> 00:00:18.930 align:middle line:84%
Now that we've covered the
process of performing post

00:00:18.930 --> 00:00:20.850 align:middle line:84%
exploitation on
Windows systems, we

00:00:20.850 --> 00:00:23.730 align:middle line:84%
can begin exploring the
various post exploitation

00:00:23.730 --> 00:00:26.640 align:middle line:84%
techniques that we can
perform on Linux systems.

00:00:26.640 --> 00:00:28.350 align:middle line:84%
And first and
foremost, we're going

00:00:28.350 --> 00:00:31.200 align:middle line:84%
to start off by taking a
look at the various post

00:00:31.200 --> 00:00:35.050 align:middle line:84%
exploitation modules available
for the Linux operating system,

00:00:35.050 --> 00:00:37.020 align:middle line:84%
or rather, the
Linux kernel, right?

00:00:37.020 --> 00:00:40.950 align:middle line:84%
So first and foremost, what
are we trying to do here?

00:00:40.950 --> 00:00:43.050 align:middle line:84%
What's the objective
with these modules?

00:00:43.050 --> 00:00:45.700 align:middle line:84%
Well, similarly to
the Windows video,

00:00:45.700 --> 00:00:47.820 align:middle line:84%
what we're trying to
do here is to enumerate

00:00:47.820 --> 00:00:52.080 align:middle line:84%
as much information as possible
from the Linux target system.

00:00:52.080 --> 00:00:56.340 align:middle line:84%
And of course, we're not really
performing service enumeration

00:00:56.340 --> 00:00:58.740 align:middle line:90%
before exploitation.

00:00:58.740 --> 00:01:01.140 align:middle line:84%
When we obtain access
to a target system,

00:01:01.140 --> 00:01:03.150 align:middle line:84%
and in this case,
a Linux target,

00:01:03.150 --> 00:01:06.067 align:middle line:84%
we can utilize that access
to enumerate more information

00:01:06.067 --> 00:01:07.900 align:middle line:84%
about the target that
we otherwise couldn't.

00:01:07.900 --> 00:01:09.870 align:middle line:84%
So we can enumerate
the users that

00:01:09.870 --> 00:01:11.700 align:middle line:90%
are on the system, the groups.

00:01:11.700 --> 00:01:14.400 align:middle line:84%
We can identify the kernel
version, the distribution

00:01:14.400 --> 00:01:16.050 align:middle line:90%
release version, et cetera.

00:01:16.050 --> 00:01:19.560 align:middle line:84%
And we can utilize the various
Linux post exploitation modules

00:01:19.560 --> 00:01:21.570 align:middle line:84%
afforded to us by the
Metasploit Framework

00:01:21.570 --> 00:01:24.780 align:middle line:84%
to enumerate the
system configuration,

00:01:24.780 --> 00:01:26.880 align:middle line:84%
to enumerate
environment variables,

00:01:26.880 --> 00:01:29.130 align:middle line:84%
enumerate the
network configuration

00:01:29.130 --> 00:01:30.300 align:middle line:90%
on the Linux system.

00:01:30.300 --> 00:01:33.330 align:middle line:84%
We can also check as to whether
the target system is indeed

00:01:33.330 --> 00:01:34.560 align:middle line:90%
a virtual machine.

00:01:34.560 --> 00:01:38.400 align:middle line:84%
And we can also enumerate
the user history for the user

00:01:38.400 --> 00:01:40.020 align:middle line:84%
that we currently
have access to.

00:01:40.020 --> 00:01:42.450 align:middle line:84%
And of course, that just
involves downloading the bash

00:01:42.450 --> 00:01:43.170 align:middle line:90%
history file.

00:01:43.170 --> 00:01:45.420 align:middle line:84%
And we can get an
idea of what commands

00:01:45.420 --> 00:01:48.870 align:middle line:84%
the user accounts on the
system have been typing in.

00:01:48.870 --> 00:01:50.670 align:middle line:84%
So again, there's a
lot that we can do.

00:01:50.670 --> 00:01:53.790 align:middle line:84%
And as I said, this is fairly
similar to the Windows video

00:01:53.790 --> 00:01:55.290 align:middle line:84%
with a few
exceptions, of course,

00:01:55.290 --> 00:01:59.010 align:middle line:84%
because Linux is slightly
or quite a bit different

00:01:59.010 --> 00:02:01.540 align:middle line:84%
in terms of the way it's
developed and its architecture.

00:02:01.540 --> 00:02:02.940 align:middle line:84%
So again, that's
what we're going

00:02:02.940 --> 00:02:04.900 align:middle line:90%
to be exploring in this video.

00:02:04.900 --> 00:02:07.740 align:middle line:84%
So all you need to do is just
fire up the lab environment.

00:02:07.740 --> 00:02:09.810 align:middle line:84%
And I'll see you within
the lab environment,

00:02:09.810 --> 00:02:11.055 align:middle line:90%
and then we can get started.

00:02:11.055 --> 00:02:13.940 align:middle line:90%


00:02:13.940 --> 00:02:16.280 align:middle line:84%
All right, so I'm back
within the lab environment.

00:02:16.280 --> 00:02:18.190 align:middle line:84%
And the first step
in this case is

00:02:18.190 --> 00:02:20.020 align:middle line:84%
to identify the
target IP address

00:02:20.020 --> 00:02:22.790 align:middle line:84%
because we need to gain
access to the Linux target.

00:02:22.790 --> 00:02:25.000 align:middle line:84%
So we're going to
type in ifconfig.

00:02:25.000 --> 00:02:25.750 align:middle line:90%
There we are.

00:02:25.750 --> 00:02:28.300 align:middle line:84%
And we'll head over to
the Ethernet 1 interface.

00:02:28.300 --> 00:02:30.220 align:middle line:84%
And the target IP
address is going

00:02:30.220 --> 00:02:33.470 align:middle line:84%
to be on the same subnet
on the next IP address.

00:02:33.470 --> 00:02:36.140 align:middle line:84%
So again, in your case, the
subnet will be different.

00:02:36.140 --> 00:02:39.190 align:middle line:84%
And again, all you need to
do is just copy this IP.

00:02:39.190 --> 00:02:41.470 align:middle line:84%
And of course, the
target IP address

00:02:41.470 --> 00:02:43.070 align:middle line:90%
will be on the third IP address.

00:02:43.070 --> 00:02:45.250 align:middle line:84%
So you just copy the
subnet or this IP address

00:02:45.250 --> 00:02:47.830 align:middle line:84%
here and change the
last value to a 3.

00:02:47.830 --> 00:02:49.330 align:middle line:84%
All right, I'm now
going to start up

00:02:49.330 --> 00:02:52.690 align:middle line:84%
the PostgreSQL Database
Service as well as msfconsole.

00:02:52.690 --> 00:02:55.870 align:middle line:84%
So I'm going to say
service Postgresql start

00:02:55.870 --> 00:02:57.880 align:middle line:90%
and msfconsole.

00:02:57.880 --> 00:02:59.680 align:middle line:84%
That will save us a
little bit of time.

00:02:59.680 --> 00:03:01.380 align:middle line:90%
There we are.

00:03:01.380 --> 00:03:04.190 align:middle line:84%
And the reason we're starting
the PostgreSQL Database Service

00:03:04.190 --> 00:03:07.790 align:middle line:84%
is so that we can interact
with the Metasploit Framework

00:03:07.790 --> 00:03:11.660 align:middle line:84%
database and consequently
save data within our workspace

00:03:11.660 --> 00:03:14.420 align:middle line:84%
and within the Metasploit
Framework database.

00:03:14.420 --> 00:03:16.580 align:middle line:84%
All right, now that
we're within msfconsole,

00:03:16.580 --> 00:03:17.990 align:middle line:90%
we can create a workspace.

00:03:17.990 --> 00:03:21.890 align:middle line:84%
And I'm just going to
call this workspace Linux,

00:03:21.890 --> 00:03:24.050 align:middle line:84%
or we can just call
it-- yeah, we'll

00:03:24.050 --> 00:03:27.570 align:middle line:90%
call it Linux post exploitation.

00:03:27.570 --> 00:03:29.840 align:middle line:90%
So Linux_PE, there we are.

00:03:29.840 --> 00:03:33.590 align:middle line:84%
And we'll then set the global
variable for the RHOSTS option

00:03:33.590 --> 00:03:36.840 align:middle line:84%
to the value or to the
IP address of the target.

00:03:36.840 --> 00:03:40.160 align:middle line:84%
So again, just paste in the
IP and change the 2 to a 3

00:03:40.160 --> 00:03:41.420 align:middle line:90%
and hit Enter.

00:03:41.420 --> 00:03:43.310 align:middle line:84%
All right, now that
is done, we actually

00:03:43.310 --> 00:03:46.040 align:middle line:84%
need to perform an Nmap
scan on the target system

00:03:46.040 --> 00:03:48.080 align:middle line:84%
to identify what
services are running

00:03:48.080 --> 00:03:50.240 align:middle line:84%
and consequently what
vulnerable services

00:03:50.240 --> 00:03:53.510 align:middle line:84%
we can actually exploit in
order to gain initial access.

00:03:53.510 --> 00:03:56.450 align:middle line:84%
All right, so I'm just going
to use the db_nmap command

00:03:56.450 --> 00:03:59.570 align:middle line:84%
to perform the Nmap scan
from within msfconsole

00:03:59.570 --> 00:04:04.370 align:middle line:84%
and consequently save the Nmap
scan results in the Metasploit

00:04:04.370 --> 00:04:05.280 align:middle line:90%
Framework database.

00:04:05.280 --> 00:04:08.300 align:middle line:84%
So I'll perform some
service version detection.

00:04:08.300 --> 00:04:11.180 align:middle line:84%
And I'll just paste in the
IP address of the target.

00:04:11.180 --> 00:04:11.780 align:middle line:90%
There we are.

00:04:11.780 --> 00:04:14.270 align:middle line:84%
And I'll hit Enter,
and I will give this

00:04:14.270 --> 00:04:17.990 align:middle line:84%
a couple of seconds to a
couple of minutes to complete.

00:04:17.990 --> 00:04:19.730 align:middle line:84%
All right, the Nmap
scan is complete.

00:04:19.730 --> 00:04:22.750 align:middle line:84%
And as you can see, we have SMB
running on the Linux target.

00:04:22.750 --> 00:04:25.360 align:middle line:90%
And it's running SMB version 3.

00:04:25.360 --> 00:04:26.920 align:middle line:84%
And of course,
we've explored how

00:04:26.920 --> 00:04:30.490 align:middle line:84%
to exploit Samba in
the previous sections

00:04:30.490 --> 00:04:33.200 align:middle line:84%
where we were covering
Linux exploitation.

00:04:33.200 --> 00:04:34.690 align:middle line:84%
So it's fairly
simple to exploit.

00:04:34.690 --> 00:04:36.760 align:middle line:84%
In this case, we
will be utilizing

00:04:36.760 --> 00:04:38.980 align:middle line:90%
a Samba exploit module.

00:04:38.980 --> 00:04:40.480 align:middle line:84%
I'm just going to
say search, and we

00:04:40.480 --> 00:04:44.110 align:middle line:84%
can specify the type of module
or limit the results to exploit

00:04:44.110 --> 00:04:45.910 align:middle line:90%
modules and then say samba.

00:04:45.910 --> 00:04:50.780 align:middle line:84%
And we'll be utilizing the
is_known_pipename exploit

00:04:50.780 --> 00:04:51.280 align:middle line:90%
module.

00:04:51.280 --> 00:04:51.940 align:middle line:90%
There we are.

00:04:51.940 --> 00:04:54.980 align:middle line:84%
Let me just zoom out
here so you can see that.

00:04:54.980 --> 00:04:57.160 align:middle line:84%
So we're going to be
utilizing this module here.

00:04:57.160 --> 00:04:58.660 align:middle line:90%
And I'm just going to say use.

00:04:58.660 --> 00:05:00.070 align:middle line:90%
Paste that in there.

00:05:00.070 --> 00:05:02.698 align:middle line:84%
And we really don't
need to configure much.

00:05:02.698 --> 00:05:04.240 align:middle line:84%
The only option you
need to configure

00:05:04.240 --> 00:05:07.120 align:middle line:84%
is the target IP address, which
should be set because we set up

00:05:07.120 --> 00:05:11.770 align:middle line:84%
the global variable for RHOSTS,
and we set it to the target IP.

00:05:11.770 --> 00:05:13.790 align:middle line:90%
And we then have RPORT.

00:05:13.790 --> 00:05:15.610 align:middle line:84%
We don't need to
change the payload.

00:05:15.610 --> 00:05:18.530 align:middle line:84%
It'll probably give us a
command PowerShell session.

00:05:18.530 --> 00:05:20.740 align:middle line:84%
So again, we can upgrade
that to a meterpreter

00:05:20.740 --> 00:05:22.040 align:middle line:90%
session in a few seconds.

00:05:22.040 --> 00:05:23.582 align:middle line:84%
So I'm just going
to type in exploit.

00:05:23.582 --> 00:05:30.610 align:middle line:90%


00:05:30.610 --> 00:05:32.680 align:middle line:84%
All right, so we get a
command shell session,

00:05:32.680 --> 00:05:33.640 align:middle line:90%
as you can see here.

00:05:33.640 --> 00:05:36.190 align:middle line:84%
And we can type in
a command like pwd

00:05:36.190 --> 00:05:37.820 align:middle line:90%
to print our working directory.

00:05:37.820 --> 00:05:41.270 align:middle line:84%
And as you can see, we actually
are in the temp directory.

00:05:41.270 --> 00:05:43.960 align:middle line:84%
So I'll put this in the
background using the Control

00:05:43.960 --> 00:05:46.360 align:middle line:90%
and Z keyboard combination.

00:05:46.360 --> 00:05:48.100 align:middle line:84%
There we are,
background session.

00:05:48.100 --> 00:05:52.580 align:middle line:84%
If I list out the sessions, you
can see that we have session 1.

00:05:52.580 --> 00:05:54.410 align:middle line:84%
And that is a command
shell session.

00:05:54.410 --> 00:05:55.100 align:middle line:90%
There we are.

00:05:55.100 --> 00:05:57.590 align:middle line:84%
So we want to upgrade this
to a meterpreter session.

00:05:57.590 --> 00:05:59.330 align:middle line:84%
So we'll use the
sessions command.

00:05:59.330 --> 00:06:01.730 align:middle line:90%
And we'll say -u to upgrade.

00:06:01.730 --> 00:06:04.880 align:middle line:84%
And we specify the
session ID, which is 1.

00:06:04.880 --> 00:06:06.710 align:middle line:84%
And that's going to
give us a meterpreter

00:06:06.710 --> 00:06:08.160 align:middle line:90%
session on the target system.

00:06:08.160 --> 00:06:11.030 align:middle line:84%
So we'll give that a couple
of seconds to complete.

00:06:11.030 --> 00:06:13.400 align:middle line:84%
There we are, meterpreter
session 2 opened.

00:06:13.400 --> 00:06:16.260 align:middle line:84%
If we list out our sessions,
we can see it right over here.

00:06:16.260 --> 00:06:18.900 align:middle line:84%
So we have a meterpreter
session on the target.

00:06:18.900 --> 00:06:21.770 align:middle line:84%
So if we say sessions
2, there we are.

00:06:21.770 --> 00:06:24.660 align:middle line:84%
And we now have access to the
target system via meterpreter,

00:06:24.660 --> 00:06:25.160 align:middle line:90%
right?

00:06:25.160 --> 00:06:30.860 align:middle line:84%
So we can, firstly, start off
with some local enumeration

00:06:30.860 --> 00:06:37.130 align:middle line:84%
using the meterpreter session as
well as a native shell session

00:06:37.130 --> 00:06:38.280 align:middle line:90%
on the target system.

00:06:38.280 --> 00:06:40.850 align:middle line:84%
So again, we've explored
the fundamentals

00:06:40.850 --> 00:06:41.930 align:middle line:90%
of using meterpreter.

00:06:41.930 --> 00:06:46.340 align:middle line:84%
So we can type in sysinfo to get
some basic system information

00:06:46.340 --> 00:06:48.860 align:middle line:84%
like the target IP
address or the host name

00:06:48.860 --> 00:06:50.490 align:middle line:90%
as well as the operating system.

00:06:50.490 --> 00:06:52.580 align:middle line:84%
In this case, the target
is running Debian 8,

00:06:52.580 --> 00:06:55.160 align:middle line:90%
and the kernel is 5.4.0.

00:06:55.160 --> 00:06:58.940 align:middle line:84%
The architecture is 64-bit,
and our meterpreter session

00:06:58.940 --> 00:07:02.070 align:middle line:84%
is 32-bit, which, again,
is fine in this case.

00:07:02.070 --> 00:07:04.070 align:middle line:84%
All right, we can also
get our current user

00:07:04.070 --> 00:07:07.550 align:middle line:84%
ID or the current user
that we have access to.

00:07:07.550 --> 00:07:09.160 align:middle line:84%
And in this case,
it says the user ID

00:07:09.160 --> 00:07:12.900 align:middle line:84%
is 0, which on Linux means
that we are the root user.

00:07:12.900 --> 00:07:17.630 align:middle line:84%
So again, that's some basic
enumeration with meterpreter.

00:07:17.630 --> 00:07:21.650 align:middle line:84%
Now, we can perform most of the
local enumeration on a Linux

00:07:21.650 --> 00:07:23.600 align:middle line:84%
system by typing
in shell to give us

00:07:23.600 --> 00:07:27.690 align:middle line:90%
a native terminal on the system.

00:07:27.690 --> 00:07:30.980 align:middle line:84%
And in this case, we can
spawn a bash session by typing

00:07:30.980 --> 00:07:32.688 align:middle line:90%
in /bin/bash -i.

00:07:32.688 --> 00:07:33.230 align:middle line:90%
There we are.

00:07:33.230 --> 00:07:34.757 align:middle line:90%
So we get a bash session.

00:07:34.757 --> 00:07:36.590 align:middle line:84%
And as you can see, we
have root privileges.

00:07:36.590 --> 00:07:39.080 align:middle line:84%
So in this case, we don't need
to elevate our privileges.

00:07:39.080 --> 00:07:42.270 align:middle line:84%
But again, we'll be covering
that when we get there.

00:07:42.270 --> 00:07:45.440 align:middle line:84%
So you can type in whoami to
identify the user that you

00:07:45.440 --> 00:07:46.500 align:middle line:90%
currently have access to.

00:07:46.500 --> 00:07:49.032 align:middle line:84%
And again, in this case,
it tells us its root.

00:07:49.032 --> 00:07:50.990 align:middle line:84%
If you want to list out
the other user accounts

00:07:50.990 --> 00:07:55.448 align:middle line:84%
on the system, that can be done
by typing in cat /etc/passwd.

00:07:55.448 --> 00:07:55.990 align:middle line:90%
There we are.

00:07:55.990 --> 00:07:58.840 align:middle line:84%
As you can see, we have various
user accounts on the system,

00:07:58.840 --> 00:08:01.720 align:middle line:90%
like for example, let's see--

00:08:01.720 --> 00:08:04.750 align:middle line:84%
in terms of user accounts,
we have only the root user.

00:08:04.750 --> 00:08:06.970 align:middle line:84%
The rest of them look
like service accounts

00:08:06.970 --> 00:08:08.200 align:middle line:90%
apart from maybe a few.

00:08:08.200 --> 00:08:10.660 align:middle line:84%
But yeah, they all look
like service accounts

00:08:10.660 --> 00:08:12.380 align:middle line:90%
with no home directory.

00:08:12.380 --> 00:08:14.890 align:middle line:84%
So the service
accounts are primarily

00:08:14.890 --> 00:08:17.710 align:middle line:84%
used to manage services
like the web server,

00:08:17.710 --> 00:08:21.160 align:middle line:84%
as you can see, for www-data,
et cetera, et cetera, right?

00:08:21.160 --> 00:08:26.980 align:middle line:84%
So that's how to enumerate
the actual users on the Linux

00:08:26.980 --> 00:08:27.680 align:middle line:90%
system.

00:08:27.680 --> 00:08:30.250 align:middle line:84%
You can find out what
groups your current user

00:08:30.250 --> 00:08:33.650 align:middle line:84%
is a part of by typing groups
and then the name of the user.

00:08:33.650 --> 00:08:36.640 align:middle line:84%
So in this case, we can
see that the user root

00:08:36.640 --> 00:08:39.340 align:middle line:84%
is part of the root group,
which, again, makes sense

00:08:39.340 --> 00:08:41.320 align:middle line:84%
because the root group
is used to assign

00:08:41.320 --> 00:08:44.450 align:middle line:84%
administrative privileges
to members of that group.

00:08:44.450 --> 00:08:46.940 align:middle line:84%
And in this case, we don't
have any other users.

00:08:46.940 --> 00:08:49.750 align:middle line:84%
Now, if we want to enumerate
the actual distribution release

00:08:49.750 --> 00:08:53.590 align:middle line:84%
version, we can type
in cat /etc/*issue.

00:08:53.590 --> 00:08:56.050 align:middle line:84%
Make sure you specify
the asterisk there.

00:08:56.050 --> 00:08:58.898 align:middle line:84%
And in this case,
it says Debian 8.

00:08:58.898 --> 00:08:59.440 align:middle line:90%
There we are.

00:08:59.440 --> 00:09:01.400 align:middle line:84%
And if you want to get
the kernel version,

00:09:01.400 --> 00:09:02.980 align:middle line:90%
we can say uname -r.

00:09:02.980 --> 00:09:05.800 align:middle line:84%
And as you can see,
it'll say 5.4.0.

00:09:05.800 --> 00:09:11.140 align:middle line:84%
We can also uname -a command
to get additional information

00:09:11.140 --> 00:09:13.510 align:middle line:84%
like the host name,
the kernel version,

00:09:13.510 --> 00:09:16.390 align:middle line:84%
as well as some
additional information

00:09:16.390 --> 00:09:18.250 align:middle line:90%
like the architecture there.

00:09:18.250 --> 00:09:20.740 align:middle line:84%
All right, now, if you want
to perform some network

00:09:20.740 --> 00:09:23.200 align:middle line:84%
enumeration, you can
type in ifconfig.

00:09:23.200 --> 00:09:26.510 align:middle line:84%
In this case, it'll tell you
that ifconfig is not found.

00:09:26.510 --> 00:09:28.630 align:middle line:84%
So we can use the
ip a s command.

00:09:28.630 --> 00:09:30.670 align:middle line:84%
And that will list
out all the interfaces

00:09:30.670 --> 00:09:31.850 align:middle line:90%
on the target system.

00:09:31.850 --> 00:09:36.470 align:middle line:84%
And as you can see, this is the
primary network interface here.

00:09:36.470 --> 00:09:38.890 align:middle line:90%
So that's Ethernet 0, right?

00:09:38.890 --> 00:09:42.280 align:middle line:84%
So you can get the
actual subnet here

00:09:42.280 --> 00:09:43.570 align:middle line:90%
if you're performing pivoting.

00:09:43.570 --> 00:09:44.770 align:middle line:90%
So that's how to do it.

00:09:44.770 --> 00:09:47.770 align:middle line:84%
We can also list out the various
services that are currently

00:09:47.770 --> 00:09:50.030 align:middle line:90%
listening on open ports.

00:09:50.030 --> 00:09:54.140 align:middle line:84%
There we are, so netstat
-antp, and in this case,

00:09:54.140 --> 00:09:56.600 align:middle line:84%
it says that netstat
is not found.

00:09:56.600 --> 00:09:59.590 align:middle line:84%
So again, in this case, because
we cannot utilize netstat,

00:09:59.590 --> 00:10:01.990 align:middle line:90%
we'll have to skip through that.

00:10:01.990 --> 00:10:04.210 align:middle line:84%
If we want to list all the
processes on the system,

00:10:04.210 --> 00:10:06.700 align:middle line:90%
we can use the ps aux command.

00:10:06.700 --> 00:10:09.680 align:middle line:84%
And these are all the
processes on the system.

00:10:09.680 --> 00:10:13.090 align:middle line:84%
As you can see, it sorts them
based on the user, the process

00:10:13.090 --> 00:10:18.010 align:middle line:84%
ID, CPU and memory consumption,
as well as the actual start

00:10:18.010 --> 00:10:22.760 align:middle line:84%
time and the command or the
binary that's been executed.

00:10:22.760 --> 00:10:24.910 align:middle line:84%
We can also enumerate
the environment variables

00:10:24.910 --> 00:10:27.822 align:middle line:84%
by typing in env for
this particular user.

00:10:27.822 --> 00:10:30.280 align:middle line:84%
And as you can see, these are
all the environment variables

00:10:30.280 --> 00:10:31.190 align:middle line:90%
for the root user.

00:10:31.190 --> 00:10:33.760 align:middle line:84%
So it tells us the
actual path that it

00:10:33.760 --> 00:10:36.550 align:middle line:84%
will use to look for
binaries, in this case.

00:10:36.550 --> 00:10:38.680 align:middle line:84%
And then the
working directory is

00:10:38.680 --> 00:10:42.100 align:middle line:84%
set to the temp directory
for some reason.

00:10:42.100 --> 00:10:43.840 align:middle line:84%
The home directory
is set to root,

00:10:43.840 --> 00:10:47.260 align:middle line:84%
which makes sense, et
cetera, et cetera, right?

00:10:47.260 --> 00:10:50.650 align:middle line:84%
OK, so that's some
local enumeration

00:10:50.650 --> 00:10:52.450 align:middle line:90%
within a Linux terminal.

00:10:52.450 --> 00:10:55.270 align:middle line:84%
Right now, let's take a look
at the various Linux post

00:10:55.270 --> 00:10:57.110 align:middle line:84%
exploitation modules
that we can use.

00:10:57.110 --> 00:10:59.380 align:middle line:84%
So I'm going to
terminate this channel.

00:10:59.380 --> 00:11:01.235 align:middle line:90%
And I will then--

00:11:01.235 --> 00:11:02.860 align:middle line:84%
as you can see, the
meterpreter session

00:11:02.860 --> 00:11:04.220 align:middle line:90%
closed here for some reason.

00:11:04.220 --> 00:11:07.580 align:middle line:84%
So I'm just going to upgrade
our session once again.

00:11:07.580 --> 00:11:09.490 align:middle line:84%
So I'll just say
sessions upgrade 1

00:11:09.490 --> 00:11:11.080 align:middle line:84%
to get another
meterpreter session.

00:11:11.080 --> 00:11:15.450 align:middle line:90%


00:11:15.450 --> 00:11:17.580 align:middle line:84%
All right, so we get
another meterpreter session.

00:11:17.580 --> 00:11:20.450 align:middle line:90%
So now it is the session 3.

00:11:20.450 --> 00:11:21.720 align:middle line:90%
OK, so that's fine.

00:11:21.720 --> 00:11:24.890 align:middle line:84%
So let's explore the various
Linux post exploitation modules

00:11:24.890 --> 00:11:27.370 align:middle line:90%
that we can use.

00:11:27.370 --> 00:11:30.870 align:middle line:84%
The first post exploitation
model we can check out

00:11:30.870 --> 00:11:32.610 align:middle line:90%
is the enum configs module.

00:11:32.610 --> 00:11:37.000 align:middle line:84%
So I'm just going to say
search and enum_configs.

00:11:37.000 --> 00:11:37.660 align:middle line:90%
There we are.

00:11:37.660 --> 00:11:40.060 align:middle line:84%
And I should have
spaced that out there.

00:11:40.060 --> 00:11:43.088 align:middle line:84%
So I'm just going to say
search and enum_configs.

00:11:43.088 --> 00:11:43.630 align:middle line:90%
There we are.

00:11:43.630 --> 00:11:46.180 align:middle line:84%
So this is a Linux post
exploitation module.

00:11:46.180 --> 00:11:48.910 align:middle line:84%
And this will gather all
the Linux configurations.

00:11:48.910 --> 00:11:52.570 align:middle line:84%
So we'll say use and
then paste that in there.

00:11:52.570 --> 00:11:54.730 align:middle line:90%
Show options.

00:11:54.730 --> 00:11:56.080 align:middle line:90%
And we can set this session.

00:11:56.080 --> 00:11:58.600 align:middle line:84%
In this case, we'll set
the session to session 3

00:11:58.600 --> 00:12:02.170 align:middle line:84%
because that's the session ID
for the meterpreter session.

00:12:02.170 --> 00:12:03.910 align:middle line:90%
And then we'll hit Run.

00:12:03.910 --> 00:12:07.100 align:middle line:84%
As you can see, this will get
all the Linux configuration

00:12:07.100 --> 00:12:07.600 align:middle line:90%
files.

00:12:07.600 --> 00:12:09.730 align:middle line:84%
Now, of course,
if it fails, that

00:12:09.730 --> 00:12:13.820 align:middle line:84%
means that configuration
file probably doesn't exist.

00:12:13.820 --> 00:12:16.720 align:middle line:84%
So in this case, it
enumerates the actual shells

00:12:16.720 --> 00:12:20.650 align:middle line:84%
available on the system
as well as the authority

00:12:20.650 --> 00:12:23.620 align:middle line:90%
certificates, access.conf.

00:12:23.620 --> 00:12:26.950 align:middle line:84%
We also have ldap.conf
and sysctl.conf,

00:12:26.950 --> 00:12:28.540 align:middle line:90%
or system control.conf.

00:12:28.540 --> 00:12:31.750 align:middle line:84%
And it then provides you
with the actual directory

00:12:31.750 --> 00:12:34.825 align:middle line:84%
under which or where you
can find this information.

00:12:34.825 --> 00:12:36.200 align:middle line:84%
And they're stored
in text files.

00:12:36.200 --> 00:12:39.250 align:middle line:84%
So again, if you're utilizing
the Metasploit Framework

00:12:39.250 --> 00:12:42.490 align:middle line:84%
database within your workspace,
you can type in loot.

00:12:42.490 --> 00:12:45.440 align:middle line:84%
And that will tell you where all
of this information is saved.

00:12:45.440 --> 00:12:48.400 align:middle line:84%
So if I wanted to identify
the shells that are currently

00:12:48.400 --> 00:12:51.040 align:middle line:84%
on the system, I can
copy the name or the path

00:12:51.040 --> 00:12:52.300 align:middle line:90%
to the actual file.

00:12:52.300 --> 00:12:54.220 align:middle line:90%
And I can just say cat.

00:12:54.220 --> 00:12:55.220 align:middle line:90%
Paste it in there.

00:12:55.220 --> 00:12:57.830 align:middle line:84%
And as you can see, these
are the shells on the system.

00:12:57.830 --> 00:13:00.490 align:middle line:84%
So it looks like we have a
Bourne shell, dash, bash,

00:13:00.490 --> 00:13:01.750 align:middle line:90%
rbash, et cetera.

00:13:01.750 --> 00:13:06.010 align:middle line:84%
And you can do that for the
rest of the other configuration

00:13:06.010 --> 00:13:08.270 align:middle line:84%
files that have been
found and stored.

00:13:08.270 --> 00:13:10.870 align:middle line:84%
So that's one of the great
things about the Metasploit

00:13:10.870 --> 00:13:13.600 align:middle line:84%
Framework database
and workspaces

00:13:13.600 --> 00:13:15.550 align:middle line:84%
is that it allows you
to save your data.

00:13:15.550 --> 00:13:19.810 align:middle line:84%
And all of this data will
remain even after you shut down

00:13:19.810 --> 00:13:21.700 align:middle line:90%
your msfconsole session.

00:13:21.700 --> 00:13:24.610 align:middle line:84%
All right, so that is how
to gather or enumerate

00:13:24.610 --> 00:13:27.370 align:middle line:84%
the configuration files
from a Linux system.

00:13:27.370 --> 00:13:31.490 align:middle line:84%
Now let's take a look at the
Environment Variable Module.

00:13:31.490 --> 00:13:34.180 align:middle line:84%
So in this case, I'm
just going to say search.

00:13:34.180 --> 00:13:35.440 align:middle line:90%
And we'll say env.

00:13:35.440 --> 00:13:39.670 align:middle line:84%
And the platform is
going to be Linux.

00:13:39.670 --> 00:13:42.400 align:middle line:84%
And the module that we
are looking for here is

00:13:42.400 --> 00:13:44.320 align:middle line:90%
the post/multi/gather/env.

00:13:44.320 --> 00:13:46.362 align:middle line:90%
So this will perform--

00:13:46.362 --> 00:13:48.820 align:middle line:84%
it will essentially gather the
operating system environment

00:13:48.820 --> 00:13:51.340 align:middle line:84%
settings or the environment
variables, right?

00:13:51.340 --> 00:13:54.070 align:middle line:90%
So we'll say use.

00:13:54.070 --> 00:13:55.750 align:middle line:90%
Paste that in there.

00:13:55.750 --> 00:13:57.610 align:middle line:90%
Show the options.

00:13:57.610 --> 00:14:01.368 align:middle line:84%
And again, we'll set
the session to 3.

00:14:01.368 --> 00:14:01.910 align:middle line:90%
There we are.

00:14:01.910 --> 00:14:03.450 align:middle line:90%
And hit Run.

00:14:03.450 --> 00:14:04.890 align:middle line:84%
And as you can
see, in this case,

00:14:04.890 --> 00:14:07.610 align:middle line:84%
it only tells us the
actual version of Debian

00:14:07.610 --> 00:14:09.110 align:middle line:84%
that's running as
well as the kernel

00:14:09.110 --> 00:14:10.940 align:middle line:84%
version, so nothing
that we haven't

00:14:10.940 --> 00:14:12.650 align:middle line:90%
been able to gather so far.

00:14:12.650 --> 00:14:15.680 align:middle line:84%
Now, because we couldn't
enumerate the network

00:14:15.680 --> 00:14:18.320 align:middle line:84%
information, we can
actually utilize a module

00:14:18.320 --> 00:14:20.670 align:middle line:84%
to do that for us or to
automate that for us.

00:14:20.670 --> 00:14:25.460 align:middle line:84%
So we can search for
the enum_network module.

00:14:25.460 --> 00:14:28.160 align:middle line:84%
And of course, that is a
Linux post exploitation module

00:14:28.160 --> 00:14:30.180 align:middle line:84%
that's used to gather
network information.

00:14:30.180 --> 00:14:31.340 align:middle line:90%
So we can say use.

00:14:31.340 --> 00:14:32.880 align:middle line:90%
Paste that in there.

00:14:32.880 --> 00:14:34.520 align:middle line:90%
Show the options.

00:14:34.520 --> 00:14:39.845 align:middle line:84%
We can set the session
to session 3 and hit Run.

00:14:39.845 --> 00:14:41.220 align:middle line:84%
All right, so it's
going to begin

00:14:41.220 --> 00:14:42.850 align:middle line:90%
collecting all the information.

00:14:42.850 --> 00:14:47.340 align:middle line:84%
So it'll essentially try and
open up the SSH configuration

00:14:47.340 --> 00:14:48.060 align:middle line:90%
file.

00:14:48.060 --> 00:14:49.860 align:middle line:84%
That says that the
operation failed,

00:14:49.860 --> 00:14:52.410 align:middle line:84%
unable to get the data for
the network configuration

00:14:52.410 --> 00:14:54.060 align:middle line:90%
as well as the routing table.

00:14:54.060 --> 00:14:56.700 align:middle line:84%
It gets the firewall
configuration, the DNS

00:14:56.700 --> 00:14:59.730 align:middle line:84%
configuration, the HOSTS
file, the SSH keys,

00:14:59.730 --> 00:15:01.860 align:middle line:90%
as well as ifup and ifdown.

00:15:01.860 --> 00:15:05.820 align:middle line:84%
So again, if we type in
the loot command here,

00:15:05.820 --> 00:15:08.290 align:middle line:84%
we can, again, get all
of this information.

00:15:08.290 --> 00:15:10.510 align:middle line:84%
So this will tell us
where the file is stored.

00:15:10.510 --> 00:15:13.530 align:middle line:84%
So if we want to enumerate
the firewall configuration,

00:15:13.530 --> 00:15:18.210 align:middle line:84%
we can just copy the path to the
file and say cat and hit Enter.

00:15:18.210 --> 00:15:20.310 align:middle line:84%
And as you can see,
it tells us that it

00:15:20.310 --> 00:15:22.500 align:middle line:90%
tried to open up iptables.

00:15:22.500 --> 00:15:25.950 align:middle line:84%
And in this case, it says
iptables cannot initialize.

00:15:25.950 --> 00:15:27.580 align:middle line:84%
All right, so
nothing useful there,

00:15:27.580 --> 00:15:30.120 align:middle line:84%
let's try the DNS
configuration just

00:15:30.120 --> 00:15:31.840 align:middle line:90%
to see what it actually found.

00:15:31.840 --> 00:15:32.670 align:middle line:90%
So I'll say cat.

00:15:32.670 --> 00:15:33.850 align:middle line:90%
Paste that in there.

00:15:33.850 --> 00:15:39.870 align:middle line:84%
And in this case, it says that
the actual primary DNS server

00:15:39.870 --> 00:15:42.900 align:middle line:84%
is members.linode.com,
which means

00:15:42.900 --> 00:15:45.240 align:middle line:84%
that this particular
target system is being

00:15:45.240 --> 00:15:49.990 align:middle line:84%
hosted on Linode, which is quite
a bit of important information.

00:15:49.990 --> 00:15:52.110 align:middle line:84%
So we get the cloud
service provider.

00:15:52.110 --> 00:15:55.800 align:middle line:84%
As opposed to AWS, we now
know it's running on Linode.

00:15:55.800 --> 00:15:59.310 align:middle line:84%
All right, so that's how
to utilize the enum network

00:15:59.310 --> 00:16:00.550 align:middle line:90%
module.

00:16:00.550 --> 00:16:05.580 align:middle line:84%
We can also check for
the various protection

00:16:05.580 --> 00:16:08.760 align:middle line:84%
systems that have been put
in place on the Linux system.

00:16:08.760 --> 00:16:11.220 align:middle line:84%
Now, when I'm referring
to the protection systems,

00:16:11.220 --> 00:16:13.440 align:middle line:84%
I'm simply referring
to the various security

00:16:13.440 --> 00:16:15.000 align:middle line:84%
features or modules
that may have

00:16:15.000 --> 00:16:19.148 align:middle line:84%
been enabled, like
SELinux, iptables, et

00:16:19.148 --> 00:16:20.190 align:middle line:90%
cetera, et cetera, right?

00:16:20.190 --> 00:16:21.930 align:middle line:84%
So we can search for
the module by saying

00:16:21.930 --> 00:16:24.050 align:middle line:90%
search enum_protections.

00:16:24.050 --> 00:16:26.960 align:middle line:90%


00:16:26.960 --> 00:16:28.850 align:middle line:90%
And I'll type that in correctly.

00:16:28.850 --> 00:16:31.480 align:middle line:90%


00:16:31.480 --> 00:16:32.120 align:middle line:90%
There we are.

00:16:32.120 --> 00:16:34.370 align:middle line:90%
And that's the module there.

00:16:34.370 --> 00:16:36.800 align:middle line:90%
So we'll say copy and use.

00:16:36.800 --> 00:16:39.150 align:middle line:84%
And if we show the
information for this model,

00:16:39.150 --> 00:16:41.660 align:middle line:84%
you can see that this module
checks whether popular system

00:16:41.660 --> 00:16:46.130 align:middle line:84%
hardening mechanisms are in
place, such as SMEP, SMAP,

00:16:46.130 --> 00:16:48.770 align:middle line:84%
SELinux, PaX, and
grsecurity, right?

00:16:48.770 --> 00:16:50.270 align:middle line:84%
So this is very
important if you are

00:16:50.270 --> 00:16:53.240 align:middle line:84%
trying to identify whether
the system has been hardened

00:16:53.240 --> 00:16:56.690 align:middle line:84%
or whether any system hardening
mechanisms are in place, right?

00:16:56.690 --> 00:17:00.620 align:middle line:84%
So we can set the session
to 3 and then hit Run.

00:17:00.620 --> 00:17:09.109 align:middle line:90%


00:17:09.109 --> 00:17:11.569 align:middle line:84%
All right, so we can see
on this particular system,

00:17:11.569 --> 00:17:14.089 align:middle line:84%
it actually has quite a
few security mechanisms

00:17:14.089 --> 00:17:18.109 align:middle line:84%
in place, like ASLR,
SMEP, SMAP, Yama,

00:17:18.109 --> 00:17:21.530 align:middle line:84%
iptables for the firewall,
tcpdump for traffic sniffing,

00:17:21.530 --> 00:17:23.119 align:middle line:90%
as well as Wireshark.

00:17:23.119 --> 00:17:26.010 align:middle line:84%
And all of this is going
to be saved to your notes.

00:17:26.010 --> 00:17:29.660 align:middle line:84%
So you can open up your
notes by typing in notes.

00:17:29.660 --> 00:17:32.780 align:middle line:84%
And that, again, is where
all your important notes will

00:17:32.780 --> 00:17:34.760 align:middle line:84%
be stored in regards
to information

00:17:34.760 --> 00:17:37.400 align:middle line:84%
gathered from post
exploitation modules, right?

00:17:37.400 --> 00:17:41.660 align:middle line:84%
So whenever a module tells you
that the actual information has

00:17:41.660 --> 00:17:44.330 align:middle line:84%
been stored in notes, you can
access that by typing in notes.

00:17:44.330 --> 00:17:47.210 align:middle line:84%
And of course, this is stored
within the Metasploit Framework

00:17:47.210 --> 00:17:48.440 align:middle line:90%
database.

00:17:48.440 --> 00:17:52.520 align:middle line:84%
All right, so that is the actual
protections or enum protections

00:17:52.520 --> 00:17:53.150 align:middle line:90%
module.

00:17:53.150 --> 00:17:55.700 align:middle line:84%
Let's take a look at some
system enumeration, right?

00:17:55.700 --> 00:17:58.460 align:middle line:84%
And in order to do that, we
can search for a module called

00:17:58.460 --> 00:18:01.192 align:middle line:90%
enum_system.

00:18:01.192 --> 00:18:01.900 align:middle line:90%
And there we are.

00:18:01.900 --> 00:18:03.330 align:middle line:90%
That's the actual module there.

00:18:03.330 --> 00:18:06.690 align:middle line:84%
So this performs or gathers
system and user information,

00:18:06.690 --> 00:18:09.100 align:middle line:90%
which can be very useful.

00:18:09.100 --> 00:18:10.913 align:middle line:90%
So again, show options.

00:18:10.913 --> 00:18:13.080 align:middle line:84%
And if you want to learn
more about the module, just

00:18:13.080 --> 00:18:13.920 align:middle line:90%
type in info.

00:18:13.920 --> 00:18:16.650 align:middle line:84%
As you can see, this module
gathers system information.

00:18:16.650 --> 00:18:19.440 align:middle line:84%
We collect installed
packages, installed services,

00:18:19.440 --> 00:18:22.770 align:middle line:84%
mount information, the user
list, the user bash history,

00:18:22.770 --> 00:18:23.530 align:middle line:90%
and cron jobs.

00:18:23.530 --> 00:18:25.380 align:middle line:84%
So this is a very
comprehensive module

00:18:25.380 --> 00:18:28.540 align:middle line:84%
in regards to the information
that it will actually give us.

00:18:28.540 --> 00:18:30.810 align:middle line:90%
So we'll set the session to 3.

00:18:30.810 --> 00:18:34.330 align:middle line:90%
And we'll then hit Run.

00:18:34.330 --> 00:18:35.780 align:middle line:90%
There we are.

00:18:35.780 --> 00:18:38.420 align:middle line:84%
So we'll give that a couple
of seconds to complete.

00:18:38.420 --> 00:18:39.950 align:middle line:84%
All right, so
first and foremost,

00:18:39.950 --> 00:18:42.580 align:middle line:84%
it gives us the distribution
release version as well as

00:18:42.580 --> 00:18:44.510 align:middle line:84%
the host name and
the kernel version.

00:18:44.510 --> 00:18:46.060 align:middle line:84%
And then it tells
us that the module

00:18:46.060 --> 00:18:47.770 align:middle line:84%
is running as the
root user because we

00:18:47.770 --> 00:18:49.000 align:middle line:90%
have root privileges.

00:18:49.000 --> 00:18:51.040 align:middle line:84%
It then says that the
Linux version is stored,

00:18:51.040 --> 00:18:53.470 align:middle line:84%
and it provides you
with that information.

00:18:53.470 --> 00:18:56.980 align:middle line:84%
And it also tells us the user
accounts, installed packages,

00:18:56.980 --> 00:18:59.120 align:middle line:84%
which may be
something interesting.

00:18:59.120 --> 00:19:00.910 align:middle line:90%
So let's open up our loot here.

00:19:00.910 --> 00:19:03.730 align:middle line:84%
And let's try and take a look
at the installed packages

00:19:03.730 --> 00:19:05.990 align:middle line:84%
because we weren't able to
enumerate that previously,

00:19:05.990 --> 00:19:06.490 align:middle line:90%
right?

00:19:06.490 --> 00:19:10.380 align:middle line:84%
So we can copy that,
and we can say cat.

00:19:10.380 --> 00:19:11.160 align:middle line:90%
Display that.

00:19:11.160 --> 00:19:14.400 align:middle line:84%
And you can see this will
display all of the installed

00:19:14.400 --> 00:19:15.750 align:middle line:90%
packages on the Linux system.

00:19:15.750 --> 00:19:19.050 align:middle line:84%
And of course, on Linux, you're
going to have way more packages

00:19:19.050 --> 00:19:21.250 align:middle line:90%
than a typical Windows system.

00:19:21.250 --> 00:19:24.243 align:middle line:84%
So again, if we list out
the actual loot here,

00:19:24.243 --> 00:19:26.910 align:middle line:84%
let's take a look at some of the
other information like the disk

00:19:26.910 --> 00:19:29.350 align:middle line:90%
information here.

00:19:29.350 --> 00:19:30.100 align:middle line:90%
There we go.

00:19:30.100 --> 00:19:31.810 align:middle line:90%
Let's cat that out as well.

00:19:31.810 --> 00:19:33.570 align:middle line:90%
This should be fairly minimal.

00:19:33.570 --> 00:19:36.000 align:middle line:84%
And as you can see here,
it actually lists out

00:19:36.000 --> 00:19:37.200 align:middle line:90%
the disk information.

00:19:37.200 --> 00:19:38.100 align:middle line:90%
And it's sorted.

00:19:38.100 --> 00:19:40.290 align:middle line:84%
You can take a look at
your storage devices

00:19:40.290 --> 00:19:43.630 align:middle line:84%
and the space used and
the space available,

00:19:43.630 --> 00:19:44.880 align:middle line:90%
et cetera, et cetera, right?

00:19:44.880 --> 00:19:46.950 align:middle line:84%
So you can get a
lot of information

00:19:46.950 --> 00:19:49.948 align:middle line:84%
with this particular
post exploitation module.

00:19:49.948 --> 00:19:51.990 align:middle line:84%
All right, so that is how
to enumerate or perform

00:19:51.990 --> 00:19:54.030 align:middle line:90%
system enumeration.

00:19:54.030 --> 00:19:59.290 align:middle line:84%
We can also check whether we are
currently a VM or a container,

00:19:59.290 --> 00:19:59.790 align:middle line:90%
right?

00:19:59.790 --> 00:20:03.570 align:middle line:84%
So in many cases, a Linux
system or a Linux target

00:20:03.570 --> 00:20:06.480 align:middle line:84%
may be a container,
a Docker container,

00:20:06.480 --> 00:20:08.070 align:middle line:90%
or a Virtual Machine.

00:20:08.070 --> 00:20:10.420 align:middle line:84%
So we can check for
both of these things.

00:20:10.420 --> 00:20:13.110 align:middle line:84%
First and foremost,
we can start off

00:20:13.110 --> 00:20:16.350 align:middle line:84%
by checking whether this
is a container by searching

00:20:16.350 --> 00:20:19.828 align:middle line:90%
for the checkcontainer module.

00:20:19.828 --> 00:20:20.370 align:middle line:90%
There we are.

00:20:20.370 --> 00:20:21.830 align:middle line:90%
That's a Linux module there.

00:20:21.830 --> 00:20:24.380 align:middle line:90%


00:20:24.380 --> 00:20:26.890 align:middle line:84%
And if we are in a container,
then we could possibly

00:20:26.890 --> 00:20:29.830 align:middle line:84%
utilize that information
to perform a container

00:20:29.830 --> 00:20:32.650 align:middle line:84%
breakout, which is an
advanced you know exploitation

00:20:32.650 --> 00:20:34.820 align:middle line:90%
technique, but it is viable.

00:20:34.820 --> 00:20:40.260 align:middle line:84%
So if we show the options here,
we can set the session to 3.

00:20:40.260 --> 00:20:41.010 align:middle line:90%
There we go.

00:20:41.010 --> 00:20:43.170 align:middle line:90%
Session is set to 3.

00:20:43.170 --> 00:20:45.540 align:middle line:90%
And we can then hit Run.

00:20:45.540 --> 00:20:48.180 align:middle line:84%
As you can see, this appears
to be a Docker container.

00:20:48.180 --> 00:20:51.700 align:middle line:84%
All right, so that's very, very
important, because as I said,

00:20:51.700 --> 00:20:53.280 align:middle line:84%
there are many
privilege, escalation,

00:20:53.280 --> 00:20:57.120 align:middle line:84%
and container breakout
exploits or techniques

00:20:57.120 --> 00:20:59.280 align:middle line:84%
that you can utilize to
essentially break out

00:20:59.280 --> 00:21:02.550 align:middle line:84%
of the container and gain access
to the host system that is

00:21:02.550 --> 00:21:04.380 align:middle line:90%
hosting the Docker containers.

00:21:04.380 --> 00:21:07.710 align:middle line:84%
So that can be very useful if
you are staging further attacks

00:21:07.710 --> 00:21:08.580 align:middle line:90%
on the system.

00:21:08.580 --> 00:21:12.240 align:middle line:84%
We can then search for the
checkvm module, which we

00:21:12.240 --> 00:21:15.370 align:middle line:90%
utilized in the Windows video.

00:21:15.370 --> 00:21:16.950 align:middle line:90%
So we utilized this one here.

00:21:16.950 --> 00:21:20.340 align:middle line:84%
But now we are using
the Linux module.

00:21:20.340 --> 00:21:21.390 align:middle line:90%
So I'll copy that.

00:21:21.390 --> 00:21:22.890 align:middle line:90%
And we'll say use.

00:21:22.890 --> 00:21:24.510 align:middle line:90%
Paste that in there.

00:21:24.510 --> 00:21:25.920 align:middle line:90%
Show options.

00:21:25.920 --> 00:21:28.680 align:middle line:90%
And we can set the session to 3.

00:21:28.680 --> 00:21:30.210 align:middle line:90%
Hit Run.

00:21:30.210 --> 00:21:31.950 align:middle line:84%
As you can see here,
it looks like that

00:21:31.950 --> 00:21:33.480 align:middle line:90%
failed for some reason.

00:21:33.480 --> 00:21:35.740 align:middle line:84%
And we weren't able
to gather that.

00:21:35.740 --> 00:21:39.220 align:middle line:84%
But we do know that the target
system is a Docker container,

00:21:39.220 --> 00:21:39.720 align:middle line:90%
right?

00:21:39.720 --> 00:21:42.780 align:middle line:84%
So we are fairly
comfortable there

00:21:42.780 --> 00:21:46.680 align:middle line:84%
in understanding what type
of system we're dealing with.

00:21:46.680 --> 00:21:48.150 align:middle line:84%
Right now, let's
take a look at how

00:21:48.150 --> 00:21:50.310 align:middle line:84%
to enumerate the
user's history, right?

00:21:50.310 --> 00:21:53.460 align:middle line:84%
And this can be done by
searching for a module called

00:21:53.460 --> 00:21:55.470 align:middle line:90%
enum_users_history.

00:21:55.470 --> 00:21:59.190 align:middle line:90%


00:21:59.190 --> 00:22:00.120 align:middle line:90%
There we are.

00:22:00.120 --> 00:22:02.160 align:middle line:90%
And that's the module there.

00:22:02.160 --> 00:22:04.980 align:middle line:84%
So this will gather the user
history for all the user

00:22:04.980 --> 00:22:05.980 align:middle line:90%
accounts on the system.

00:22:05.980 --> 00:22:08.290 align:middle line:84%
And in this case, we only
have the root user account.

00:22:08.290 --> 00:22:10.890 align:middle line:84%
So if we show the
options here, we

00:22:10.890 --> 00:22:15.190 align:middle line:84%
can set the session to
session 3 and hit Run.

00:22:15.190 --> 00:22:17.760 align:middle line:84%
And in this case,
as you can see,

00:22:17.760 --> 00:22:19.980 align:middle line:84%
it's going to try and
get the bash history

00:22:19.980 --> 00:22:24.390 align:middle line:84%
file or the history file for all
these service accounts as well

00:22:24.390 --> 00:22:25.540 align:middle line:90%
as the root account.

00:22:25.540 --> 00:22:28.540 align:middle line:84%
So you can see it's going
through all the history files

00:22:28.540 --> 00:22:29.040 align:middle line:90%
here.

00:22:29.040 --> 00:22:31.200 align:middle line:84%
And it, first of all,
gets the history file

00:22:31.200 --> 00:22:32.170 align:middle line:90%
for the root account.

00:22:32.170 --> 00:22:34.740 align:middle line:84%
So the history file
on Linux essentially

00:22:34.740 --> 00:22:37.500 align:middle line:84%
stores a list of command,
or it essentially

00:22:37.500 --> 00:22:39.150 align:middle line:84%
just stores a log
of commands that

00:22:39.150 --> 00:22:40.660 align:middle line:90%
have been typed in by the user.

00:22:40.660 --> 00:22:42.690 align:middle line:90%
So again, it can be very useful.

00:22:42.690 --> 00:22:47.070 align:middle line:84%
And we can again take a look
at all of this by saying loot

00:22:47.070 --> 00:22:49.110 align:middle line:84%
or by typing in
the loot command.

00:22:49.110 --> 00:22:52.020 align:middle line:84%
And we can say bash
history for root there.

00:22:52.020 --> 00:22:53.350 align:middle line:90%
That's the actual file.

00:22:53.350 --> 00:22:57.148 align:middle line:84%
So I'm going to cat the
content of this file.

00:22:57.148 --> 00:22:57.690 align:middle line:90%
There we are.

00:22:57.690 --> 00:23:02.145 align:middle line:84%
So we can see what commands
the root user typed in.

00:23:02.145 --> 00:23:04.080 align:middle line:84%
And as you can see, these
are all the commands

00:23:04.080 --> 00:23:05.110 align:middle line:90%
that we typed in.

00:23:05.110 --> 00:23:07.210 align:middle line:90%
So this module does work.

00:23:07.210 --> 00:23:10.050 align:middle line:84%
Now, if the root user had typed
in any commands previously,

00:23:10.050 --> 00:23:12.120 align:middle line:90%
then we would see them here.

00:23:12.120 --> 00:23:15.120 align:middle line:84%
So sometimes, users may paste
in or type in passwords.

00:23:15.120 --> 00:23:18.090 align:middle line:84%
And you can check the history
file to actually identify

00:23:18.090 --> 00:23:19.580 align:middle line:90%
those passwords in clear text.

00:23:19.580 --> 00:23:21.840 align:middle line:84%
So again, the history
file just gives you

00:23:21.840 --> 00:23:23.700 align:middle line:84%
a rundown of all the
commands that have been

00:23:23.700 --> 00:23:25.830 align:middle line:90%
typed in sequentially, right?

00:23:25.830 --> 00:23:28.290 align:middle line:84%
All right, so that's how to
enumerate the user account

00:23:28.290 --> 00:23:29.250 align:middle line:90%
history.

00:23:29.250 --> 00:23:34.770 align:middle line:84%
And in regards to
post exploitation

00:23:34.770 --> 00:23:36.930 align:middle line:84%
and the various
post exploitation

00:23:36.930 --> 00:23:39.490 align:middle line:84%
modules available for Linux,
that's pretty much it.

00:23:39.490 --> 00:23:43.230 align:middle line:84%
There are a few others that
are used to essentially perform

00:23:43.230 --> 00:23:44.430 align:middle line:90%
credential dumping.

00:23:44.430 --> 00:23:47.880 align:middle line:84%
But we'll be exploring them
in the next set of videos

00:23:47.880 --> 00:23:49.380 align:middle line:90%
once we get there.

00:23:49.380 --> 00:23:53.610 align:middle line:84%
And yeah, that is going to
conclude the practical section

00:23:53.610 --> 00:23:56.850 align:middle line:90%
of this video.

00:23:56.850 --> 00:23:59.180 align:middle line:84%
In the next video,
we will be exploring

00:23:59.180 --> 00:24:03.210 align:middle line:84%
the process of elevating our
privileges on a Linux system.

00:24:03.210 --> 00:24:05.500 align:middle line:90%
So I'll see you there.

00:24:05.500 --> 00:24:06.000 align:middle line:90%