WEBVTT

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


00:00:03.388 --> 00:00:06.776 align:middle line:90%
[AUDIO LOGO]

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


00:00:10.170 --> 00:00:13.380 align:middle line:84%
Automating Linux
local enumeration.

00:00:13.380 --> 00:00:15.390 align:middle line:84%
In this video, we
will be exploring

00:00:15.390 --> 00:00:19.320 align:middle line:84%
the process of how to automate
local enumeration on Linux

00:00:19.320 --> 00:00:22.560 align:middle line:84%
through a combination of
both Metasploit framework,

00:00:22.560 --> 00:00:24.690 align:middle line:84%
post-exploitation
modules for Linux,

00:00:24.690 --> 00:00:29.100 align:middle line:84%
as well as a Linux
automated enumeration

00:00:29.100 --> 00:00:31.620 align:middle line:84%
script that will
essentially automate

00:00:31.620 --> 00:00:33.330 align:middle line:90%
local enumeration for us.

00:00:33.330 --> 00:00:36.090 align:middle line:84%
The objective here is
to essentially automate

00:00:36.090 --> 00:00:38.880 align:middle line:84%
all of the checks that we
performed within this section,

00:00:38.880 --> 00:00:42.810 align:middle line:84%
and of course we also explored
how to do this with Windows.

00:00:42.810 --> 00:00:44.580 align:middle line:84%
So, again, in this
video, we're primarily

00:00:44.580 --> 00:00:48.720 align:middle line:84%
focused on how to automate
Linux local enumeration,

00:00:48.720 --> 00:00:51.840 align:middle line:84%
and we're going to be doing that
through a couple of Metasploit

00:00:51.840 --> 00:00:55.260 align:middle line:84%
framework exploit or
post-exploitation modules

00:00:55.260 --> 00:00:58.210 align:middle line:84%
as well as a local
enumeration script.

00:00:58.210 --> 00:00:58.710 align:middle line:90%
Right?

00:00:58.710 --> 00:01:02.610 align:middle line:84%
So, why do we need to do
this, or why is automating

00:01:02.610 --> 00:01:04.739 align:middle line:90%
local enumeration so important?

00:01:04.739 --> 00:01:08.430 align:middle line:84%
Well, while local enumeration
techniques or commands

00:01:08.430 --> 00:01:11.700 align:middle line:84%
are important to know
as a penetration tester,

00:01:11.700 --> 00:01:13.820 align:middle line:84%
you will need to
be time-efficient.

00:01:13.820 --> 00:01:16.500 align:middle line:84%
The reason I say that is
when you're performing a pen

00:01:16.500 --> 00:01:22.410 align:middle line:84%
test, the primary variable
that you're going to be looking

00:01:22.410 --> 00:01:24.510 align:middle line:84%
at as you perform
your assessments

00:01:24.510 --> 00:01:27.580 align:middle line:84%
is the actual time frame
that you have been allotted.

00:01:27.580 --> 00:01:28.080 align:middle line:90%
Right?

00:01:28.080 --> 00:01:32.190 align:middle line:84%
And you actually have to ensure
that you are efficient when

00:01:32.190 --> 00:01:35.670 align:middle line:84%
it comes down to performing
whatever stage of a penetration

00:01:35.670 --> 00:01:37.260 align:middle line:90%
test you are performing.

00:01:37.260 --> 00:01:40.320 align:middle line:84%
In the case of the
post-exploitation phase

00:01:40.320 --> 00:01:44.250 align:middle line:84%
of a pen test, you actually
need to be really efficient

00:01:44.250 --> 00:01:46.650 align:middle line:84%
as you're gathering
a lot of information.

00:01:46.650 --> 00:01:48.780 align:middle line:84%
The great thing about
this phase is primarily

00:01:48.780 --> 00:01:51.360 align:middle line:84%
because you're
essentially focused

00:01:51.360 --> 00:01:53.220 align:middle line:90%
on gathering information.

00:01:53.220 --> 00:01:55.500 align:middle line:84%
You can utilize
various automation

00:01:55.500 --> 00:01:58.810 align:middle line:84%
or automated enumeration
scripts to do the work for you.

00:01:58.810 --> 00:02:00.843 align:middle line:84%
Now, this doesn't mean
that you throw away

00:02:00.843 --> 00:02:02.760 align:middle line:84%
all the manual techniques
that you've learned.

00:02:02.760 --> 00:02:04.170 align:middle line:90%
Those are still important.

00:02:04.170 --> 00:02:07.380 align:middle line:84%
However, when you want to be
time-efficient or productive

00:02:07.380 --> 00:02:11.160 align:middle line:84%
for that matter, then you
can utilize these Metasploit

00:02:11.160 --> 00:02:14.520 align:middle line:84%
framework post-exploitation
modules in conjunction

00:02:14.520 --> 00:02:17.320 align:middle line:84%
with some automated
enumeration scripts.

00:02:17.320 --> 00:02:17.820 align:middle line:90%
Right?

00:02:17.820 --> 00:02:21.180 align:middle line:84%
So the way the scripts work
is that they're primarily

00:02:21.180 --> 00:02:24.780 align:middle line:84%
designed to identify privilege
escalation vulnerabilities

00:02:24.780 --> 00:02:29.130 align:middle line:84%
because that's really why you're
performing local enumeration.

00:02:29.130 --> 00:02:32.400 align:middle line:84%
Again, it's not really limited
to privilege escalation,

00:02:32.400 --> 00:02:34.470 align:middle line:84%
but all of this
information really

00:02:34.470 --> 00:02:37.800 align:middle line:84%
becomes important during
the privilege escalation

00:02:37.800 --> 00:02:41.760 align:middle line:90%
phase of post-exploitation.

00:02:41.760 --> 00:02:44.550 align:middle line:84%
In addition to automating
the process of enumerating

00:02:44.550 --> 00:02:47.790 align:middle line:84%
information like system
information, users, and groups,

00:02:47.790 --> 00:02:50.730 align:middle line:84%
et cetera, these automated
enumeration scripts

00:02:50.730 --> 00:02:53.340 align:middle line:84%
will provide you with
additional information regarding

00:02:53.340 --> 00:02:55.860 align:middle line:84%
the target system, like
privilege escalation

00:02:55.860 --> 00:02:59.040 align:middle line:84%
vulnerabilities and, in
addition to that, locally stored

00:02:59.040 --> 00:03:01.270 align:middle line:90%
passwords, et cetera, et cetera.

00:03:01.270 --> 00:03:02.040 align:middle line:90%
Right?

00:03:02.040 --> 00:03:04.950 align:middle line:84%
In this case, we are going to
be utilizing the following Linux

00:03:04.950 --> 00:03:06.750 align:middle line:90%
local enumeration script.

00:03:06.750 --> 00:03:10.380 align:middle line:84%
It is called LinEnum, which,
again, is just an abbreviation

00:03:10.380 --> 00:03:12.810 align:middle line:90%
for "Linux enumeration."

00:03:12.810 --> 00:03:16.470 align:middle line:84%
This is a simple Bash script
that automates common Linux

00:03:16.470 --> 00:03:20.130 align:middle line:84%
local enumeration checks
in order to identifying

00:03:20.130 --> 00:03:22.650 align:middle line:84%
or in addition to identifying
privilege escalation

00:03:22.650 --> 00:03:23.770 align:middle line:90%
vulnerabilities.

00:03:23.770 --> 00:03:25.530 align:middle line:84%
So what it does
is it essentially

00:03:25.530 --> 00:03:27.240 align:middle line:84%
automates everything
that we've done

00:03:27.240 --> 00:03:28.690 align:middle line:90%
so far within this section.

00:03:28.690 --> 00:03:31.620 align:middle line:84%
So it enumerates
user information,

00:03:31.620 --> 00:03:34.140 align:middle line:84%
system information,
group information,

00:03:34.140 --> 00:03:35.520 align:middle line:90%
network information.

00:03:35.520 --> 00:03:39.000 align:middle line:84%
It enumerates services and cron
jobs, and so on and so forth.

00:03:39.000 --> 00:03:42.000 align:middle line:84%
The GitHub repository for
this particular script

00:03:42.000 --> 00:03:46.230 align:middle line:84%
is linked to this slide, and
I'll be showcasing or taking

00:03:46.230 --> 00:03:48.960 align:middle line:84%
you through the process
of how to copy it over

00:03:48.960 --> 00:03:52.080 align:middle line:84%
or how to copy the script
content over to the lab

00:03:52.080 --> 00:03:54.540 align:middle line:84%
environment, as the lab
environment does not

00:03:54.540 --> 00:03:57.930 align:middle line:90%
have an internet connection.

00:03:57.930 --> 00:04:00.570 align:middle line:84%
In this video, we're going to
be utilizing a different lab

00:04:00.570 --> 00:04:03.840 align:middle line:84%
environment to demonstrate
the process of how to automate

00:04:03.840 --> 00:04:05.260 align:middle line:90%
Linux local enumeration.

00:04:05.260 --> 00:04:07.530 align:middle line:84%
So we're not using the
same lab environment

00:04:07.530 --> 00:04:10.800 align:middle line:84%
that we've used in the previous
videos within this section.

00:04:10.800 --> 00:04:13.570 align:middle line:84%
The lab environment is attached
to this particular video,

00:04:13.570 --> 00:04:15.800 align:middle line:84%
so all you need to do
is just start it up.

00:04:15.800 --> 00:04:17.550 align:middle line:84%
We're going to start
off by gaining access

00:04:17.550 --> 00:04:18.899 align:middle line:90%
to the target system.

00:04:18.899 --> 00:04:20.490 align:middle line:84%
After we've gained
access to it, we

00:04:20.490 --> 00:04:23.100 align:middle line:84%
can then walk through a
few Metasploit framework

00:04:23.100 --> 00:04:25.140 align:middle line:84%
post-exploitation
modules, and then

00:04:25.140 --> 00:04:28.680 align:middle line:84%
take a look at how to utilize
the LinEnum script to automate

00:04:28.680 --> 00:04:30.220 align:middle line:90%
Linux local enumeration.

00:04:30.220 --> 00:04:34.830 align:middle line:84%
So I'll see you within
the lab environment.

00:04:34.830 --> 00:04:37.290 align:middle line:84%
All right, so I'm back
within the lab environment.

00:04:37.290 --> 00:04:38.970 align:middle line:84%
In this lab
environment, you will

00:04:38.970 --> 00:04:40.830 align:middle line:84%
be provided with
a graphical user

00:04:40.830 --> 00:04:45.360 align:middle line:84%
interface in terms of accessing
your Kali Linux system.

00:04:45.360 --> 00:04:47.680 align:middle line:84%
You'll not be provided
with the target IP address,

00:04:47.680 --> 00:04:49.230 align:middle line:84%
but that can easily
be identified

00:04:49.230 --> 00:04:53.080 align:middle line:84%
by opening up a terminal,
and let me just zoom in here.

00:04:53.080 --> 00:04:55.770 align:middle line:84%
And you can type in
ifconfig and take a look

00:04:55.770 --> 00:04:58.620 align:middle line:84%
at the interface ethernet
1, and of course we are

00:04:58.620 --> 00:05:00.810 align:middle line:90%
looking at the inet value here.

00:05:00.810 --> 00:05:02.820 align:middle line:84%
In your case, this is
going to be different

00:05:02.820 --> 00:05:04.440 align:middle line:90%
based on your region.

00:05:04.440 --> 00:05:07.470 align:middle line:84%
The only thing you need to
know is that the Kali Linux IP

00:05:07.470 --> 00:05:10.690 align:middle line:84%
address is the second
IP within this subnet

00:05:10.690 --> 00:05:15.000 align:middle line:84%
and the target IP address is
the third IP within this subnet.

00:05:15.000 --> 00:05:16.500 align:middle line:84%
As I said, in your
case, the subnet

00:05:16.500 --> 00:05:17.770 align:middle line:90%
is going to be different.

00:05:17.770 --> 00:05:18.970 align:middle line:90%
It really doesn't matter.

00:05:18.970 --> 00:05:21.480 align:middle line:84%
All you need to do is
just copy this value,

00:05:21.480 --> 00:05:25.090 align:middle line:84%
change the 2 to a 3, and
that's the target IP address.

00:05:25.090 --> 00:05:26.310 align:middle line:90%
All right.

00:05:26.310 --> 00:05:28.020 align:middle line:84%
The next step will
of course involve

00:05:28.020 --> 00:05:30.930 align:middle line:84%
performing an Nmap scan
on the target system

00:05:30.930 --> 00:05:33.300 align:middle line:84%
in order to identify a
vulnerable service that

00:05:33.300 --> 00:05:36.360 align:middle line:84%
is running that we can
then exploit to gain access

00:05:36.360 --> 00:05:37.840 align:middle line:90%
to the target system.

00:05:37.840 --> 00:05:41.310 align:middle line:84%
So I'll just type in Nmap, and
we'll perform a quick service

00:05:41.310 --> 00:05:42.750 align:middle line:90%
version detection scan.

00:05:42.750 --> 00:05:46.110 align:middle line:84%
I'll paste in the IPI copy,
then I'll change the 2 to 3,

00:05:46.110 --> 00:05:47.893 align:middle line:90%
and we can hit Enter.

00:05:47.893 --> 00:05:50.310 align:middle line:84%
We'll give this a couple of
seconds to a couple of minutes

00:05:50.310 --> 00:05:52.230 align:middle line:84%
to complete, and
that should tell us

00:05:52.230 --> 00:05:54.820 align:middle line:84%
what services are running
on the target system.

00:05:54.820 --> 00:05:57.130 align:middle line:84%
As you can see, the
Nmap scan is complete,

00:05:57.130 --> 00:06:00.600 align:middle line:84%
and it looks like we have a
web server running on port 80,

00:06:00.600 --> 00:06:04.920 align:middle line:84%
and the web server is
Apache HTTPD 2.4.6,

00:06:04.920 --> 00:06:07.500 align:middle line:84%
and of course we know that
it's running on a Linux target

00:06:07.500 --> 00:06:08.230 align:middle line:90%
system.

00:06:08.230 --> 00:06:10.740 align:middle line:84%
So we can actually just
copy the target IP there

00:06:10.740 --> 00:06:13.890 align:middle line:84%
that we specified
during the Nmap scan,

00:06:13.890 --> 00:06:15.900 align:middle line:84%
and we can open this
up in the browser.

00:06:15.900 --> 00:06:21.180 align:middle line:84%
And let's see what is being
hosted on this specific web

00:06:21.180 --> 00:06:22.080 align:middle line:90%
server.

00:06:22.080 --> 00:06:24.060 align:middle line:84%
So we open up the
target IP address.

00:06:24.060 --> 00:06:26.970 align:middle line:84%
You can see that we have an
under construction landing

00:06:26.970 --> 00:06:30.510 align:middle line:84%
page, and it looks like the
website is displaying a timer,

00:06:30.510 --> 00:06:33.880 align:middle line:84%
telling us that the website
will be online in 0 days,

00:06:33.880 --> 00:06:37.650 align:middle line:84%
23 hours, et cetera, which is
very interesting because this

00:06:37.650 --> 00:06:39.510 align:middle line:84%
doesn't look like
it's being rendered

00:06:39.510 --> 00:06:44.880 align:middle line:84%
or it doesn't look like it's
statically-generated text.

00:06:44.880 --> 00:06:47.550 align:middle line:84%
We can view the
page source to get--

00:06:47.550 --> 00:06:49.650 align:middle line:84%
we can actually just
highlight the page here

00:06:49.650 --> 00:06:53.520 align:middle line:84%
and view selection source
and/or rather the page source.

00:06:53.520 --> 00:06:57.300 align:middle line:84%
And if we take a look at
the content of the web page,

00:06:57.300 --> 00:07:00.630 align:middle line:84%
you can see that under
the JavaScript section

00:07:00.630 --> 00:07:05.370 align:middle line:84%
it looks like it is essentially
executing a particular CGI

00:07:05.370 --> 00:07:06.930 align:middle line:90%
script.

00:07:06.930 --> 00:07:10.860 align:middle line:84%
In this case, the target system
or the instance of Apache

00:07:10.860 --> 00:07:12.690 align:middle line:84%
that's running on
the target system

00:07:12.690 --> 00:07:15.450 align:middle line:84%
is vulnerable to the
shellshock vulnerability.

00:07:15.450 --> 00:07:18.210 align:middle line:84%
Now, I've already covered
the shellshock vulnerability

00:07:18.210 --> 00:07:20.628 align:middle line:84%
in depth in the system and
host-based attacks course.

00:07:20.628 --> 00:07:22.170 align:middle line:84%
So if you want to
learn more about it

00:07:22.170 --> 00:07:25.920 align:middle line:84%
and how it can be exploited
both manually and automatically

00:07:25.920 --> 00:07:28.200 align:middle line:84%
with Metasploit,
you can actually

00:07:28.200 --> 00:07:30.090 align:middle line:90%
take a look at that course.

00:07:30.090 --> 00:07:33.520 align:middle line:84%
For now, the way it works
is really very simple.

00:07:33.520 --> 00:07:37.140 align:middle line:84%
We can see that we've identified
the CGI script being executed,

00:07:37.140 --> 00:07:39.360 align:middle line:84%
and the shellshock
vulnerability essentially

00:07:39.360 --> 00:07:42.990 align:middle line:84%
allows us to inject
specific system commands

00:07:42.990 --> 00:07:47.970 align:middle line:84%
into the HTTP headers that will
then essentially get executed.

00:07:47.970 --> 00:07:48.990 align:middle line:90%
Right?

00:07:48.990 --> 00:07:51.340 align:middle line:84%
So if we try and
access the CGI script--

00:07:51.340 --> 00:07:53.490 align:middle line:84%
so I'll just go back
here, and we can then

00:07:53.490 --> 00:07:55.260 align:middle line:90%
access the CGI script.

00:07:55.260 --> 00:07:57.780 align:middle line:84%
You can see that
this particular CGI

00:07:57.780 --> 00:08:00.120 align:middle line:90%
script is called "gettime.cgi."

00:08:00.120 --> 00:08:04.050 align:middle line:84%
So it looks like it's
essentially displaying a timer,

00:08:04.050 --> 00:08:07.170 align:middle line:84%
and the command specified
within the CGI script

00:08:07.170 --> 00:08:09.180 align:middle line:84%
are being executed
by the system.

00:08:09.180 --> 00:08:10.350 align:middle line:90%
Right?

00:08:10.350 --> 00:08:12.210 align:middle line:84%
Now, there is a
Metasploit framework

00:08:12.210 --> 00:08:15.550 align:middle line:84%
exploit module that can be used
to exploit this vulnerability,

00:08:15.550 --> 00:08:19.020 align:middle line:84%
so I'll just fire up
msfconsole, and I'll just

00:08:19.020 --> 00:08:21.300 align:middle line:84%
copy the target IP
there as we'll need it,

00:08:21.300 --> 00:08:23.670 align:middle line:90%
and I'll just hit Enter.

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

00:08:27.220 --> 00:08:28.950 align:middle line:90%
All right, there we go.

00:08:28.950 --> 00:08:32.370 align:middle line:84%
I'll just search for the
actual shellshock vulnerability

00:08:32.370 --> 00:08:33.070 align:middle line:90%
or exploit.

00:08:33.070 --> 00:08:37.200 align:middle line:84%
So I'll say search
shell shock, and we

00:08:37.200 --> 00:08:40.240 align:middle line:84%
are looking for the exploit
module right over here.

00:08:40.240 --> 00:08:47.490 align:middle line:84%
So exploit multi HTTP Apache
mod CGI bash environment exec

00:08:47.490 --> 00:08:49.260 align:middle line:84%
Again, we'll just
copy this, or we can

00:08:49.260 --> 00:08:51.460 align:middle line:90%
specify the actual exploit ID.

00:08:51.460 --> 00:08:55.500 align:middle line:84%
So we can say use 5,
and I'll hit Enter.

00:08:55.500 --> 00:08:59.740 align:middle line:84%
And if I show the options for
this particular exploit module,

00:08:59.740 --> 00:09:02.700 align:middle line:84%
you can see that the options
we need to specify firstly

00:09:02.700 --> 00:09:06.400 align:middle line:84%
is the target IP address,
which I will actually set it.

00:09:06.400 --> 00:09:11.070 align:middle line:84%
So I'll say set RHOSTS and
paste in the target IP address.

00:09:11.070 --> 00:09:14.340 align:middle line:84%
Make sure that you set the
correct target IP address based

00:09:14.340 --> 00:09:16.720 align:middle line:90%
on your own lab environment.

00:09:16.720 --> 00:09:19.000 align:middle line:84%
We then need to set
up the target URI.

00:09:19.000 --> 00:09:21.840 align:middle line:84%
So this is the path
to the CGI script

00:09:21.840 --> 00:09:23.320 align:middle line:90%
that we will be targeting.

00:09:23.320 --> 00:09:25.980 align:middle line:84%
So we're going to
set the target.

00:09:25.980 --> 00:09:32.230 align:middle line:84%
We're going to say set target
URI to get time dot CGI.

00:09:32.230 --> 00:09:32.730 align:middle line:90%
Right?

00:09:32.730 --> 00:09:34.530 align:middle line:84%
Because that's the
CGI script that we

00:09:34.530 --> 00:09:36.330 align:middle line:90%
are going to be utilizing.

00:09:36.330 --> 00:09:38.610 align:middle line:84%
We can hit Exploit, and
this should provide us

00:09:38.610 --> 00:09:40.810 align:middle line:90%
with a Meterpreter session.

00:09:40.810 --> 00:09:41.490 align:middle line:90%
There we are.

00:09:41.490 --> 00:09:44.740 align:middle line:84%
After a couple of seconds, we
obtain an Meterpreter session.

00:09:44.740 --> 00:09:47.040 align:middle line:84%
So I'll give this a couple
of seconds to start up,

00:09:47.040 --> 00:09:49.260 align:middle line:90%
and there we go.

00:09:49.260 --> 00:09:51.960 align:middle line:84%
Again, I've already covered the
individual Meterpreter commands

00:09:51.960 --> 00:09:53.910 align:middle line:84%
that you can perform
when performing

00:09:53.910 --> 00:09:55.750 align:middle line:90%
local enumeration on Linux.

00:09:55.750 --> 00:09:59.310 align:middle line:84%
So let's start off by exploring
a few post-exploitation modules

00:09:59.310 --> 00:10:02.820 align:middle line:84%
for Linux that can
be used to automate

00:10:02.820 --> 00:10:06.060 align:middle line:84%
the enumeration of various
types of information

00:10:06.060 --> 00:10:07.630 align:middle line:90%
from a Linux target system.

00:10:07.630 --> 00:10:09.450 align:middle line:84%
So I can put this
in the background

00:10:09.450 --> 00:10:12.270 align:middle line:84%
by typing in "background,"
or I can use the keyboard

00:10:12.270 --> 00:10:16.060 align:middle line:84%
combination or key combination
Control and Z. There we are,

00:10:16.060 --> 00:10:18.180 align:middle line:84%
and I'll just put this
in the background.

00:10:18.180 --> 00:10:20.370 align:middle line:84%
If I type in "sessions,"
you can see that it's still

00:10:20.370 --> 00:10:21.453 align:middle line:90%
running in the background.

00:10:21.453 --> 00:10:25.500 align:middle line:84%
The first module is one
called enum configs, so

00:10:25.500 --> 00:10:29.100 align:middle line:90%
search "enum configs."

00:10:29.100 --> 00:10:32.670 align:middle line:84%
I'll hit Enter, and you can
see this will essentially

00:10:32.670 --> 00:10:36.510 align:middle line:84%
gather configurations or, for
lack of a better description,

00:10:36.510 --> 00:10:38.560 align:middle line:90%
Linux gather configurations.

00:10:38.560 --> 00:10:42.160 align:middle line:84%
So we can say use 0, as
that is the model ID.

00:10:42.160 --> 00:10:44.160 align:middle line:84%
And if we show the
options, because this

00:10:44.160 --> 00:10:46.260 align:middle line:84%
is a post-exploitation
module, we only

00:10:46.260 --> 00:10:48.180 align:middle line:90%
need to set our session.

00:10:48.180 --> 00:10:50.320 align:middle line:84%
In in this case, we have
a Meterpreter session.

00:10:50.320 --> 00:10:52.020 align:middle line:84%
So I'll say set
session, and I'll

00:10:52.020 --> 00:10:54.640 align:middle line:84%
set the ID of the
Meterpreter session.

00:10:54.640 --> 00:10:57.940 align:middle line:84%
So I'll say set session
1, and I can hit Run,

00:10:57.940 --> 00:11:01.320 align:middle line:84%
and you'll see the information
that this will enumerate.

00:11:01.320 --> 00:11:04.150 align:middle line:84%
This module enumerates
all configuration files.

00:11:04.150 --> 00:11:07.650 align:middle line:84%
Now, you can see that in some
cases it'll actually fail,

00:11:07.650 --> 00:11:10.380 align:middle line:84%
but the information that
we're looking for specifically

00:11:10.380 --> 00:11:13.350 align:middle line:84%
here is going to be the host
name, which in this case

00:11:13.350 --> 00:11:14.820 align:middle line:90%
is victim 1.

00:11:14.820 --> 00:11:19.380 align:middle line:84%
It looks like it's running
Ubuntu 14.04.6 LTS,

00:11:19.380 --> 00:11:24.240 align:middle line:84%
and the Linux kernel is
5.4.094, and of course it

00:11:24.240 --> 00:11:25.930 align:middle line:90%
is a 64-bit kernel.

00:11:25.930 --> 00:11:26.430 align:middle line:90%
Right?

00:11:26.430 --> 00:11:28.920 align:middle line:84%
So it'll try and
access some frequently

00:11:28.920 --> 00:11:33.030 align:middle line:84%
utilized configuration
files for various packages

00:11:33.030 --> 00:11:38.340 align:middle line:84%
or pieces of software
like Apache, Nginx,

00:11:38.340 --> 00:11:39.600 align:middle line:90%
so on and so forth.

00:11:39.600 --> 00:11:41.640 align:middle line:84%
It looks like it was
able to enumerate

00:11:41.640 --> 00:11:45.750 align:middle line:84%
the list of shells installed
on this Linux target system.

00:11:45.750 --> 00:11:51.990 align:middle line:84%
It also obtained the sepermit
configuration file, the RPC

00:11:51.990 --> 00:11:55.740 align:middle line:84%
configuration file, LDAP
system control configuration

00:11:55.740 --> 00:11:56.970 align:middle line:90%
file, et cetera.

00:11:56.970 --> 00:11:59.850 align:middle line:84%
It also provides you with a path
to where this information can

00:11:59.850 --> 00:12:01.590 align:middle line:90%
be accessed locally.

00:12:01.590 --> 00:12:03.600 align:middle line:84%
For example, I
can copy the path.

00:12:03.600 --> 00:12:06.480 align:middle line:84%
If I wanted to get an
idea of what shells

00:12:06.480 --> 00:12:08.650 align:middle line:84%
are available on the
Linux target system,

00:12:08.650 --> 00:12:13.830 align:middle line:84%
I can just copy the path where
this particular information has

00:12:13.830 --> 00:12:16.740 align:middle line:84%
been stored locally, which
is under the root user's home

00:12:16.740 --> 00:12:19.890 align:middle line:84%
directory under MS4
under loot, et cetera.

00:12:19.890 --> 00:12:23.310 align:middle line:84%
So I can then say cut
and paste in that there.

00:12:23.310 --> 00:12:26.580 align:middle line:84%
I hit Enter, and you can see
that the information that we're

00:12:26.580 --> 00:12:29.610 align:middle line:84%
looking for or that is
pertinent to the shells that

00:12:29.610 --> 00:12:32.320 align:middle line:84%
are available on the target
system are the following.

00:12:32.320 --> 00:12:37.230 align:middle line:84%
So the command that was executed
was at etc Shells or the file

00:12:37.230 --> 00:12:39.550 align:middle line:84%
that was accessed
was called shells,

00:12:39.550 --> 00:12:41.080 align:middle line:84%
and we can see
that on the target

00:12:41.080 --> 00:12:44.310 align:middle line:84%
we have the Bourne shell We
also have bash dash and rbash,

00:12:44.310 --> 00:12:45.940 align:middle line:90%
and you get the idea.

00:12:45.940 --> 00:12:46.440 align:middle line:90%
All right?

00:12:46.440 --> 00:12:49.350 align:middle line:84%
The next module that we're
going to be exploring

00:12:49.350 --> 00:12:52.790 align:middle line:84%
is the enum network module,
which, as the name suggests,

00:12:52.790 --> 00:12:54.610 align:middle line:90%
enumerates network information.

00:12:54.610 --> 00:13:02.090 align:middle line:84%
So I'll say search enum_network,
and I'll say use 0.

00:13:02.090 --> 00:13:04.640 align:middle line:84%
And if we show the
options, again, we

00:13:04.640 --> 00:13:11.052 align:middle line:84%
can set the session to session
1, and we can then type in run.

00:13:11.052 --> 00:13:13.510 align:middle line:84%
This is going to gather all
network information, so, again,

00:13:13.510 --> 00:13:15.610 align:middle line:84%
it gives you your standard
system information

00:13:15.610 --> 00:13:19.450 align:middle line:84%
here like the version of
Ubuntu, the distribution name,

00:13:19.450 --> 00:13:22.450 align:middle line:84%
distribution release version,
as well as the kernel version

00:13:22.450 --> 00:13:24.430 align:middle line:90%
and architecture.

00:13:24.430 --> 00:13:27.070 align:middle line:84%
You can see that the network
configuration is stored here.

00:13:27.070 --> 00:13:30.730 align:middle line:84%
It also got the routing
table, the DNS configuration,

00:13:30.730 --> 00:13:35.830 align:middle line:84%
the host file, as well as the
listening ports and the if-up

00:13:35.830 --> 00:13:38.680 align:middle line:84%
and if-down commands,
which are essentially used

00:13:38.680 --> 00:13:40.900 align:middle line:90%
to enumerate the interfaces.

00:13:40.900 --> 00:13:42.790 align:middle line:84%
Again, as I said, all
of this information

00:13:42.790 --> 00:13:45.370 align:middle line:84%
can be accessed by
again just cutting out

00:13:45.370 --> 00:13:49.220 align:middle line:84%
the content of the file where
this information was saved.

00:13:49.220 --> 00:13:52.420 align:middle line:84%
So, again, I can just
say cat, and in this case

00:13:52.420 --> 00:13:55.240 align:middle line:84%
we're essentially identifying
the network configuration

00:13:55.240 --> 00:13:56.530 align:middle line:90%
that was identified.

00:13:56.530 --> 00:13:59.980 align:middle line:84%
In this case, it looks like it
enumerated the interfaces, so

00:13:59.980 --> 00:14:04.390 align:middle line:84%
ethernet 0, IP VTI 0,
and the loopback address

00:14:04.390 --> 00:14:06.740 align:middle line:90%
or the loopback interface.

00:14:06.740 --> 00:14:09.100 align:middle line:84%
Let's take a look at
the listening ports.

00:14:09.100 --> 00:14:12.190 align:middle line:84%
If we wanted to identify
that information,

00:14:12.190 --> 00:14:13.670 align:middle line:90%
we can do that as well.

00:14:13.670 --> 00:14:17.560 align:middle line:84%
So I'll say cut and paste in
the path to the file there.

00:14:17.560 --> 00:14:20.770 align:middle line:84%
You can see that we only have
a couple of services, or really

00:14:20.770 --> 00:14:23.230 align:middle line:84%
just one service
that is running.

00:14:23.230 --> 00:14:27.490 align:middle line:84%
In this case, it is the web
server running on port 80.

00:14:27.490 --> 00:14:30.280 align:middle line:84%
Again, the reason why these
post-exploitation modules

00:14:30.280 --> 00:14:32.050 align:middle line:84%
are so useful is
because it actually

00:14:32.050 --> 00:14:34.120 align:middle line:84%
stores all of this
information for you

00:14:34.120 --> 00:14:35.980 align:middle line:84%
so that you can
always go back to it

00:14:35.980 --> 00:14:39.280 align:middle line:84%
and get that information
if you need it.

00:14:39.280 --> 00:14:41.710 align:middle line:84%
You can see that it was
unable to get the firewall

00:14:41.710 --> 00:14:43.160 align:middle line:90%
configuration.

00:14:43.160 --> 00:14:46.190 align:middle line:84%
And let's take a look
at just one more here.

00:14:46.190 --> 00:14:48.440 align:middle line:84%
Let's take a look at
the routing information,

00:14:48.440 --> 00:14:52.060 align:middle line:84%
so let's see if I
can find that there.

00:14:52.060 --> 00:14:56.580 align:middle line:84%
So the routing table that
we all just copied the path

00:14:56.580 --> 00:15:00.390 align:middle line:84%
to that file, and then I can
say cut and paste the other path

00:15:00.390 --> 00:15:03.610 align:middle line:84%
there, hit Enter, and
that is the routing table.

00:15:03.610 --> 00:15:07.050 align:middle line:84%
So that gives you the default
gateway, et cetera, et cetera.

00:15:07.050 --> 00:15:09.840 align:middle line:84%
All right, so we can also
take a look at another module

00:15:09.840 --> 00:15:11.320 align:middle line:90%
called enum system.

00:15:11.320 --> 00:15:14.430 align:middle line:84%
So I'll just say
search enum system,

00:15:14.430 --> 00:15:17.280 align:middle line:84%
and that will essentially
gather the system and user

00:15:17.280 --> 00:15:18.040 align:middle line:90%
information.

00:15:18.040 --> 00:15:20.160 align:middle line:84%
So this is another
very useful module.

00:15:20.160 --> 00:15:23.670 align:middle line:84%
So I'll say use 0 and
set the session to 1,

00:15:23.670 --> 00:15:26.010 align:middle line:90%
and I'll just type in run.

00:15:26.010 --> 00:15:29.340 align:middle line:84%
It'll essentially start
gathering all that information.

00:15:29.340 --> 00:15:33.550 align:middle line:84%
As you can see, it's got
quite a lot of information.

00:15:33.550 --> 00:15:35.550 align:middle line:84%
Firstly, it'll give you
your system information,

00:15:35.550 --> 00:15:39.060 align:middle line:84%
and then the Linux version is
stored under the following file

00:15:39.060 --> 00:15:41.040 align:middle line:90%
or under the following path.

00:15:41.040 --> 00:15:44.070 align:middle line:84%
User accounts, installed
packages, running services,

00:15:44.070 --> 00:15:48.060 align:middle line:84%
cron jobs, disk information,
log files, set user ID,

00:15:48.060 --> 00:15:51.450 align:middle line:84%
and set GID binaries,
so on and so forth.

00:15:51.450 --> 00:15:55.800 align:middle line:84%
For example, if I wanted to
know what installed packages are

00:15:55.800 --> 00:15:59.100 align:middle line:84%
on the target system, I can
just copy the path to the output

00:15:59.100 --> 00:16:02.400 align:middle line:84%
file, then cut the content
of that file, hit Enter,

00:16:02.400 --> 00:16:04.170 align:middle line:84%
and these are all
the packages that are

00:16:04.170 --> 00:16:05.740 align:middle line:90%
installed on the target system.

00:16:05.740 --> 00:16:08.070 align:middle line:84%
So these
post-exploitation modules

00:16:08.070 --> 00:16:12.030 align:middle line:84%
are very, very helpful
in essentially automating

00:16:12.030 --> 00:16:14.880 align:middle line:84%
the process of enumerating
the information that we've

00:16:14.880 --> 00:16:20.020 align:middle line:84%
been able to enumerate manually
throughout this section.

00:16:20.020 --> 00:16:22.740 align:middle line:84%
We can also utilize
another module--

00:16:22.740 --> 00:16:25.770 align:middle line:84%
and I'll just search for it
here-- called a check VM.

00:16:25.770 --> 00:16:28.440 align:middle line:84%
And we also checked
the Windows equivalent

00:16:28.440 --> 00:16:33.030 align:middle line:84%
of this particular module
and essentially tells you

00:16:33.030 --> 00:16:36.160 align:middle line:84%
whether the target system
is a virtual machine.

00:16:36.160 --> 00:16:38.130 align:middle line:84%
So we're looking for
this module here.

00:16:38.130 --> 00:16:41.610 align:middle line:84%
Because the target
system is running Linux,

00:16:41.610 --> 00:16:44.670 align:middle line:84%
we need to use the other
platform-specific module

00:16:44.670 --> 00:16:48.798 align:middle line:84%
because there's one for Solaris
and one for Windows as well.

00:16:48.798 --> 00:16:50.340 align:middle line:84%
As you can see, this
will essentially

00:16:50.340 --> 00:16:53.130 align:middle line:84%
gather the virtual environment,
or it'll essentially

00:16:53.130 --> 00:16:55.140 align:middle line:84%
tell you whether the
target system is indeed

00:16:55.140 --> 00:16:56.410 align:middle line:90%
a virtual machine.

00:16:56.410 --> 00:17:00.510 align:middle line:84%
So I'll say use 0,
set the session to 1,

00:17:00.510 --> 00:17:02.460 align:middle line:90%
and I'll type in run.

00:17:02.460 --> 00:17:06.060 align:middle line:84%
You can see that the target
system appears to be a QEMU KVM

00:17:06.060 --> 00:17:07.900 align:middle line:90%
virtual machine.

00:17:07.900 --> 00:17:10.410 align:middle line:84%
There's a few other
post-exploitation modules

00:17:10.410 --> 00:17:13.950 align:middle line:84%
that you can utilize
to gather information,

00:17:13.950 --> 00:17:17.220 align:middle line:84%
but these are more specific
to identifying privilege

00:17:17.220 --> 00:17:18.785 align:middle line:90%
escalation vulnerabilities.

00:17:18.785 --> 00:17:20.160 align:middle line:84%
And that's something
that we will

00:17:20.160 --> 00:17:22.589 align:middle line:84%
be exploring when we get
to the privilege escalation

00:17:22.589 --> 00:17:24.119 align:middle line:90%
section of this course.

00:17:24.119 --> 00:17:26.130 align:middle line:84%
With that being said,
we can now take a look

00:17:26.130 --> 00:17:27.940 align:middle line:90%
at the LinEnum script.

00:17:27.940 --> 00:17:30.090 align:middle line:84%
So if I just list
out my sessions here,

00:17:30.090 --> 00:17:32.670 align:middle line:84%
I'll just interact
with session 1 here,

00:17:32.670 --> 00:17:37.020 align:middle line:84%
and my current working directory
is under opt/apache/htdocs.

00:17:37.020 --> 00:17:40.170 align:middle line:84%
So I'll navigate to
the temp directory.

00:17:40.170 --> 00:17:42.840 align:middle line:84%
Just like Windows, whenever
you're transferring scripts,

00:17:42.840 --> 00:17:45.240 align:middle line:84%
exploit files, binaries,
always make sure

00:17:45.240 --> 00:17:47.580 align:middle line:84%
that you transfer them
to the temp directory.

00:17:47.580 --> 00:17:49.860 align:middle line:84%
The reason we're doing
this is primarily

00:17:49.860 --> 00:17:53.730 align:middle line:84%
because you never want to upload
or transfer your exploit files

00:17:53.730 --> 00:17:57.180 align:middle line:84%
or scripts to directories or
folders that are frequently

00:17:57.180 --> 00:17:59.880 align:middle line:84%
accessed by users on the
system, because if they

00:17:59.880 --> 00:18:03.190 align:middle line:84%
discover a file, then that is
an indicator of compromise.

00:18:03.190 --> 00:18:06.330 align:middle line:84%
So always make sure to
store your files and scripts

00:18:06.330 --> 00:18:09.060 align:middle line:84%
in a location that is not
frequently accessed by end

00:18:09.060 --> 00:18:11.920 align:middle line:90%
users on the target system.

00:18:11.920 --> 00:18:14.020 align:middle line:84%
So I'll navigate to
the temp directory,

00:18:14.020 --> 00:18:17.190 align:middle line:84%
and you can see it already
has a few files within it,

00:18:17.190 --> 00:18:20.500 align:middle line:84%
but these are not really
pertinent to what we're doing.

00:18:20.500 --> 00:18:24.120 align:middle line:84%
What we now need to do is head
over to the LinEnum GitHub

00:18:24.120 --> 00:18:25.595 align:middle line:90%
repository.

00:18:25.595 --> 00:18:27.970 align:middle line:84%
This lab environment doesn't
have access to the internet,

00:18:27.970 --> 00:18:30.960 align:middle line:84%
so I'll just switch over to
my main system in my browser,

00:18:30.960 --> 00:18:33.240 align:middle line:84%
and I'll show you how
to copy over the script

00:18:33.240 --> 00:18:37.490 align:middle line:84%
and how you can transfer it
over to your lab environment.

00:18:37.490 --> 00:18:37.990 align:middle line:90%
All right.

00:18:37.990 --> 00:18:40.090 align:middle line:84%
So I'm currently
within my browser here,

00:18:40.090 --> 00:18:42.760 align:middle line:84%
and I'm on the LinEnum
GitHub repository,

00:18:42.760 --> 00:18:45.700 align:middle line:90%
which I linked on the slides.

00:18:45.700 --> 00:18:50.110 align:middle line:84%
You can easily access it by
just searching for LinEnum.

00:18:50.110 --> 00:18:52.540 align:middle line:84%
Again, this GitHub
repository essentially just

00:18:52.540 --> 00:18:55.870 align:middle line:84%
contains the Bash script
here, and the script

00:18:55.870 --> 00:18:58.270 align:middle line:90%
is called LinEnum.sh.

00:18:58.270 --> 00:19:02.380 align:middle line:84%
So the actual readme file
on the GitHub repository

00:19:02.380 --> 00:19:06.130 align:middle line:84%
provides you with documentation
regarding how to utilize it.

00:19:06.130 --> 00:19:09.970 align:middle line:84%
Now, as I said, in addition to
automating local enumeration

00:19:09.970 --> 00:19:14.080 align:middle line:84%
on Linux, it also can be used
to check for specific privilege

00:19:14.080 --> 00:19:15.490 align:middle line:90%
escalation vulnerabilities.

00:19:15.490 --> 00:19:18.100 align:middle line:84%
But as I said, that's something
that we'll be exploring

00:19:18.100 --> 00:19:20.830 align:middle line:90%
when we get to that section.

00:19:20.830 --> 00:19:23.210 align:middle line:84%
In terms of the actual
usage of the tool,

00:19:23.210 --> 00:19:24.370 align:middle line:90%
it really is very simple.

00:19:24.370 --> 00:19:27.850 align:middle line:84%
For now, we can disregard
the additional options that

00:19:27.850 --> 00:19:30.850 align:middle line:84%
are specified here,
and we can just

00:19:30.850 --> 00:19:32.750 align:middle line:90%
run the LinEnum script now.

00:19:32.750 --> 00:19:36.760 align:middle line:84%
So, how do we transfer this Bash
script to the lab environment?

00:19:36.760 --> 00:19:39.650 align:middle line:84%
Well, we just click on
the LinEnum script there,

00:19:39.650 --> 00:19:42.100 align:middle line:84%
and you just want
to click on Raw,

00:19:42.100 --> 00:19:46.150 align:middle line:84%
and you then want to highlight
essentially all the content

00:19:46.150 --> 00:19:47.840 align:middle line:90%
here of the Bash script.

00:19:47.840 --> 00:19:50.930 align:middle line:84%
So I'll just highlight
it all and copy it,

00:19:50.930 --> 00:19:53.440 align:middle line:84%
and now we can switch back
over to the lab environment,

00:19:53.440 --> 00:19:56.590 align:middle line:84%
and I'll show you
how to paste it in.

00:19:56.590 --> 00:19:58.960 align:middle line:84%
All right, so I'm back
within the lab environment.

00:19:58.960 --> 00:20:01.840 align:middle line:84%
To paste in the content
of your clipboard, what

00:20:01.840 --> 00:20:04.450 align:middle line:84%
you want to do on
your keyboard is press

00:20:04.450 --> 00:20:06.140 align:middle line:90%
the following keys in order.

00:20:06.140 --> 00:20:08.500 align:middle line:84%
So Control, Shift,
and Alt, and that'll

00:20:08.500 --> 00:20:13.870 align:middle line:84%
bring up the actual
clipboard option for you

00:20:13.870 --> 00:20:15.790 align:middle line:90%
for the lab environment.

00:20:15.790 --> 00:20:20.920 align:middle line:84%
Within the clipboard, just paste
in the actual script content

00:20:20.920 --> 00:20:22.810 align:middle line:90%
that you copied just like so.

00:20:22.810 --> 00:20:25.120 align:middle line:84%
Once that is copied, you
can then exit from this

00:20:25.120 --> 00:20:28.660 align:middle line:84%
by again utilizing the Control,
Shift, and Alt keyboard

00:20:28.660 --> 00:20:29.290 align:middle line:90%
combination.

00:20:29.290 --> 00:20:32.350 align:middle line:84%
So it's now within the
lab environment clipboard.

00:20:32.350 --> 00:20:34.460 align:middle line:84%
We're going to create
the LinEnum script,

00:20:34.460 --> 00:20:36.700 align:middle line:84%
so I'll just open up
the text editor here,

00:20:36.700 --> 00:20:39.160 align:middle line:90%
and we can then paste in.

00:20:39.160 --> 00:20:42.970 align:middle line:84%
Just right click and say
paste or Control and V,

00:20:42.970 --> 00:20:46.780 align:middle line:84%
and the actual content that
you copied from your browser

00:20:46.780 --> 00:20:48.370 align:middle line:90%
will be pasted here.

00:20:48.370 --> 00:20:50.860 align:middle line:84%
This is a Bash script,
so we will save it,

00:20:50.860 --> 00:20:54.940 align:middle line:84%
and I'll save it within the
desktop folder here of the root

00:20:54.940 --> 00:20:55.630 align:middle line:90%
user.

00:20:55.630 --> 00:21:00.040 align:middle line:84%
And we will just call it
LinEnum, so LinEnum.sh,

00:21:00.040 --> 00:21:01.830 align:middle line:90%
and it's saved.

00:21:01.830 --> 00:21:02.330 align:middle line:90%
All Right.

00:21:02.330 --> 00:21:04.910 align:middle line:84%
So now that is done, we
can actually close that up,

00:21:04.910 --> 00:21:07.400 align:middle line:84%
and we can utilize the
inbuilt Meterpreter

00:21:07.400 --> 00:21:11.940 align:middle line:84%
command to upload that script
into the temp directory.

00:21:11.940 --> 00:21:17.570 align:middle line:84%
So I'll say upload, and I'll
specify the actual path where

00:21:17.570 --> 00:21:19.220 align:middle line:90%
I saved the LinEnum script.

00:21:19.220 --> 00:21:24.110 align:middle line:84%
In this case, it was on the
root desktop and LinEnu.sh.

00:21:24.110 --> 00:21:27.080 align:middle line:84%
That'll upload it, so I can
now open up a shell session

00:21:27.080 --> 00:21:28.650 align:middle line:90%
or a command shell session.

00:21:28.650 --> 00:21:30.710 align:middle line:84%
So I'll just type in
shell, and it's now

00:21:30.710 --> 00:21:34.290 align:middle line:84%
going to provide us with a Bash
session right out of the box.

00:21:34.290 --> 00:21:37.890 align:middle line:84%
So we can say bin/bash
i, and then we are.

00:21:37.890 --> 00:21:41.800 align:middle line:84%
So we can see that right out
of the box this user is not

00:21:41.800 --> 00:21:43.780 align:middle line:84%
a privileged user because
we have gained access

00:21:43.780 --> 00:21:47.320 align:middle line:84%
to the target system as
the daemon service account.

00:21:47.320 --> 00:21:49.690 align:middle line:84%
And the hostname of
the system is victim 1.

00:21:49.690 --> 00:21:51.337 align:middle line:90%
So if I say ID--

00:21:51.337 --> 00:21:53.170 align:middle line:84%
let me just type that
in correctly-- you can

00:21:53.170 --> 00:21:54.340 align:middle line:90%
see that is displayed there.

00:21:54.340 --> 00:21:57.430 align:middle line:84%
I can also say who am I.
I'm only the daemon user,

00:21:57.430 --> 00:22:04.730 align:middle line:84%
and if I say cat etc password,
that'll show you all the user

00:22:04.730 --> 00:22:06.800 align:middle line:90%
counts on the system.

00:22:06.800 --> 00:22:08.870 align:middle line:84%
The reason I said we
currently have access

00:22:08.870 --> 00:22:11.420 align:middle line:84%
to the target system
via a service account

00:22:11.420 --> 00:22:12.440 align:middle line:90%
is right over here.

00:22:12.440 --> 00:22:16.130 align:middle line:84%
You can see that no
default shell is specified

00:22:16.130 --> 00:22:18.350 align:middle line:90%
for legitimate authentication.

00:22:18.350 --> 00:22:19.850 align:middle line:84%
In the case of this
system, we would

00:22:19.850 --> 00:22:22.100 align:middle line:84%
need to elevate our
privileges, but, as I said,

00:22:22.100 --> 00:22:24.420 align:middle line:84%
that's not what we're
interested in right now.

00:22:24.420 --> 00:22:27.450 align:middle line:84%
So if I list out the contents
of the temp directory,

00:22:27.450 --> 00:22:29.810 align:middle line:84%
you can see we have the
LinEnum script here.

00:22:29.810 --> 00:22:31.910 align:middle line:84%
Before we execute it,
we need to provide it

00:22:31.910 --> 00:22:35.915 align:middle line:84%
with executable permissions,
so I'll say chmod plus x

00:22:35.915 --> 00:22:37.950 align:middle line:84%
and then specify the
name of the script.

00:22:37.950 --> 00:22:40.430 align:middle line:90%
So LinEnum.sh.

00:22:40.430 --> 00:22:42.810 align:middle line:84%
I can then execute
it as follows.

00:22:42.810 --> 00:22:46.670 align:middle line:84%
So LinEnum.sh, and
I'll hit Enter.

00:22:46.670 --> 00:22:49.620 align:middle line:84%
So this is going to begin the
actual enumeration process.

00:22:49.620 --> 00:22:53.330 align:middle line:84%
So give it a couple of seconds
to a couple of minutes.

00:22:53.330 --> 00:22:53.830 align:middle line:90%
All right.

00:22:53.830 --> 00:22:56.290 align:middle line:84%
So once it's done, it should
just take a couple of seconds.

00:22:56.290 --> 00:22:58.600 align:middle line:84%
At the bottom, it should
say "scan complete,"

00:22:58.600 --> 00:23:01.480 align:middle line:84%
and it's obtained quite
a lot of information that

00:23:01.480 --> 00:23:03.860 align:middle line:90%
is very useful to us or for us.

00:23:03.860 --> 00:23:08.440 align:middle line:84%
So let's scroll to the
top of the output here,

00:23:08.440 --> 00:23:11.170 align:middle line:84%
and you'll actually see
the breadth of information

00:23:11.170 --> 00:23:13.120 align:middle line:84%
that this tool will
enumerate for you.

00:23:13.120 --> 00:23:13.980 align:middle line:90%
So there we are.

00:23:13.980 --> 00:23:14.890 align:middle line:90%
So it starts off.

00:23:14.890 --> 00:23:17.230 align:middle line:84%
I'll give you a description
as to what this tool is.

00:23:17.230 --> 00:23:19.690 align:middle line:84%
So it's the local Linux
enumeration and privilege

00:23:19.690 --> 00:23:21.580 align:middle line:90%
escalation script.

00:23:21.580 --> 00:23:24.337 align:middle line:84%
It will then, of
course, show you

00:23:24.337 --> 00:23:26.170 align:middle line:84%
whether you've enabled
thorough tests, which

00:23:26.170 --> 00:23:29.230 align:middle line:84%
I said we will be exploring
during the privilege escalation

00:23:29.230 --> 00:23:30.040 align:middle line:90%
section.

00:23:30.040 --> 00:23:33.460 align:middle line:84%
It'll then tell you when
the actual scan was started.

00:23:33.460 --> 00:23:37.480 align:middle line:84%
It'll then start displaying
the actual system information,

00:23:37.480 --> 00:23:40.390 align:middle line:84%
starting off with the
kernel information,

00:23:40.390 --> 00:23:43.540 align:middle line:84%
then the actual additional
information regarding

00:23:43.540 --> 00:23:47.050 align:middle line:84%
the kernel, and then the
specific release information.

00:23:47.050 --> 00:23:50.410 align:middle line:84%
This will contain the actual
distribution and name as well

00:23:50.410 --> 00:23:53.770 align:middle line:84%
as the release version
and additional information

00:23:53.770 --> 00:23:57.040 align:middle line:84%
regarding the Linux
distribution that is

00:23:57.040 --> 00:23:58.690 align:middle line:90%
running on the target system.

00:23:58.690 --> 00:24:01.075 align:middle line:84%
It also enumerates
the host name.

00:24:01.075 --> 00:24:04.120 align:middle line:84%
It then enumerates the
current user and group.

00:24:04.120 --> 00:24:05.650 align:middle line:84%
Again, as we were
able to find, we

00:24:05.650 --> 00:24:09.040 align:middle line:84%
are currently the service
account daemon, and then users

00:24:09.040 --> 00:24:11.080 align:middle line:84%
that have previously
logged on to the system.

00:24:11.080 --> 00:24:13.330 align:middle line:84%
You can see that there are
none, and of course this

00:24:13.330 --> 00:24:16.270 align:middle line:84%
is pertinent to
legitimate authentication,

00:24:16.270 --> 00:24:17.830 align:middle line:90%
not through an exploit.

00:24:17.830 --> 00:24:20.230 align:middle line:90%
Who else is logged on?

00:24:20.230 --> 00:24:22.130 align:middle line:84%
No information is
displayed there.

00:24:22.130 --> 00:24:24.880 align:middle line:84%
It'll then display
the group memberships,

00:24:24.880 --> 00:24:26.890 align:middle line:84%
as you can see here,
and you can now

00:24:26.890 --> 00:24:30.190 align:middle line:84%
start to understand how powerful
these scripts are because it

00:24:30.190 --> 00:24:32.020 align:middle line:84%
is essentially
automated everything

00:24:32.020 --> 00:24:34.960 align:middle line:84%
that we have done manually
throughout the entirety

00:24:34.960 --> 00:24:35.750 align:middle line:90%
of this section.

00:24:35.750 --> 00:24:36.250 align:middle line:90%
Right?

00:24:36.250 --> 00:24:39.970 align:middle line:84%
So it's enumerated system
information, the users,

00:24:39.970 --> 00:24:41.390 align:middle line:90%
and groups.

00:24:41.390 --> 00:24:45.220 align:middle line:84%
It's also identified users
that are currently logged on,

00:24:45.220 --> 00:24:47.530 align:middle line:84%
users that have
previously logged on,

00:24:47.530 --> 00:24:49.930 align:middle line:84%
et cetera, and then
of course it'll also

00:24:49.930 --> 00:24:53.650 align:middle line:84%
display the contents
of the etc/passwd file.

00:24:53.650 --> 00:24:55.620 align:middle line:84%
Then it'll tell you
your superuser account,

00:24:55.620 --> 00:24:57.850 align:middle line:84%
so that's obviously going
to be the root user.

00:24:57.850 --> 00:25:00.280 align:middle line:84%
It can also display
other user accounts that

00:25:00.280 --> 00:25:03.280 align:middle line:84%
are part of the root
or pseudo group,

00:25:03.280 --> 00:25:05.530 align:middle line:84%
and then of course it'll
display permissions

00:25:05.530 --> 00:25:08.320 align:middle line:84%
on home directories
that are lax.

00:25:08.320 --> 00:25:11.200 align:middle line:84%
This is primarily a privilege
escalation vulnerability

00:25:11.200 --> 00:25:12.490 align:middle line:90%
or check.

00:25:12.490 --> 00:25:16.520 align:middle line:84%
It'll then enumerate or display
the environment variables,

00:25:16.520 --> 00:25:18.700 align:middle line:84%
so you can see this is
for the daemon user.

00:25:18.700 --> 00:25:21.640 align:middle line:84%
It'll then essentially display
the environment variables

00:25:21.640 --> 00:25:25.570 align:middle line:90%
for the daemon user.

00:25:25.570 --> 00:25:28.090 align:middle line:84%
Then, of course, you have
the path information here

00:25:28.090 --> 00:25:31.480 align:middle line:84%
to display all of
these paths here.

00:25:31.480 --> 00:25:33.370 align:middle line:84%
Available shells,
we were able to get

00:25:33.370 --> 00:25:35.690 align:middle line:84%
that information,
and then of course

00:25:35.690 --> 00:25:37.340 align:middle line:84%
the password and
storage information.

00:25:37.340 --> 00:25:39.820 align:middle line:84%
So the maximum days,
so this is essentially

00:25:39.820 --> 00:25:43.480 align:middle line:84%
this will tie into the password
policy of the company that

00:25:43.480 --> 00:25:48.610 align:middle line:84%
owns this particular target
system and the actual duration

00:25:48.610 --> 00:25:52.720 align:middle line:84%
they want to specify based
on when users should change

00:25:52.720 --> 00:25:54.220 align:middle line:90%
their passwords, et cetera.

00:25:54.220 --> 00:25:56.320 align:middle line:84%
Then under jobs
and tasks, you can

00:25:56.320 --> 00:25:59.170 align:middle line:84%
see that it will enumerate
a list of cron jobs

00:25:59.170 --> 00:26:01.060 align:middle line:90%
that are currently running.

00:26:01.060 --> 00:26:03.600 align:middle line:84%
Right at the bottom, you can
see the crontab contents,

00:26:03.600 --> 00:26:05.350 align:middle line:84%
and in this case you
can see that we don't

00:26:05.350 --> 00:26:07.090 align:middle line:90%
have any cron jobs running.

00:26:07.090 --> 00:26:09.940 align:middle line:84%
It then enumerates the
networking information, which

00:26:09.940 --> 00:26:14.320 align:middle line:84%
we already know how to perform,
the ARP history, name servers,

00:26:14.320 --> 00:26:18.940 align:middle line:84%
the default route, the
actual TCP connections,

00:26:18.940 --> 00:26:22.210 align:middle line:84%
UDP connections or
services, and then it'll

00:26:22.210 --> 00:26:24.700 align:middle line:84%
also display the list
of running services.

00:26:24.700 --> 00:26:26.650 align:middle line:84%
And this is sorted
based on the user,

00:26:26.650 --> 00:26:31.310 align:middle line:84%
process ID, CPU and memory
consumption, and then of course

00:26:31.310 --> 00:26:33.610 align:middle line:84%
the command that
is being executed.

00:26:33.610 --> 00:26:36.610 align:middle line:84%
It'll then essentially
display the process binaries

00:26:36.610 --> 00:26:38.360 align:middle line:90%
and associated permissions.

00:26:38.360 --> 00:26:43.090 align:middle line:84%
So all of the binaries that
are currently being executed

00:26:43.090 --> 00:26:45.700 align:middle line:84%
will essentially
display the path

00:26:45.700 --> 00:26:48.850 align:middle line:84%
to these binaries or scripts
and their permissions in regards

00:26:48.850 --> 00:26:51.010 align:middle line:90%
to who can modify them.

00:26:51.010 --> 00:26:52.720 align:middle line:84%
And then, of course,
this is where

00:26:52.720 --> 00:26:57.310 align:middle line:84%
it starts displaying the init
system binary permissions.

00:26:57.310 --> 00:26:59.920 align:middle line:84%
That's not really
important at this stage

00:26:59.920 --> 00:27:03.430 align:middle line:84%
in terms of understanding
what that is checking.

00:27:03.430 --> 00:27:06.790 align:middle line:84%
It'll also check for based
on the init system that is

00:27:06.790 --> 00:27:08.470 align:middle line:90%
installed on the Linux target.

00:27:08.470 --> 00:27:11.230 align:middle line:84%
It'll then check for the
configuration file permissions

00:27:11.230 --> 00:27:12.640 align:middle line:90%
of that init system.

00:27:12.640 --> 00:27:17.150 align:middle line:84%
In this case, the init system is
systemd, and then at the bottom

00:27:17.150 --> 00:27:18.740 align:middle line:84%
it'll display the
version of sudo

00:27:18.740 --> 00:27:22.280 align:middle line:84%
that is installed on the
target, a few interesting files

00:27:22.280 --> 00:27:26.930 align:middle line:84%
like netcat and the GNU
C compiler That will also

00:27:26.930 --> 00:27:27.810 align:middle line:90%
be displayed here.

00:27:27.810 --> 00:27:29.420 align:middle line:84%
The list of installed
compilers-- this

00:27:29.420 --> 00:27:32.930 align:middle line:84%
is very important when you want
to compile C code on the target

00:27:32.930 --> 00:27:34.340 align:middle line:90%
system.

00:27:34.340 --> 00:27:38.180 align:middle line:84%
Files that you can read, write,
or make changes to-- that's

00:27:38.180 --> 00:27:39.500 align:middle line:90%
also displayed here.

00:27:39.500 --> 00:27:42.170 align:middle line:84%
SUID binaries-- that's
something that's

00:27:42.170 --> 00:27:44.510 align:middle line:84%
very important during
privilege escalation,

00:27:44.510 --> 00:27:49.450 align:middle line:84%
as well as set group
ID binaries as well.

00:27:49.450 --> 00:27:52.000 align:middle line:84%
Then it's going to search for
all configuration files which

00:27:52.000 --> 00:27:55.450 align:middle line:84%
we were able to enumerate
with the Metasploit

00:27:55.450 --> 00:27:57.190 align:middle line:90%
post-exploitation module.

00:27:57.190 --> 00:27:59.110 align:middle line:84%
It'll also check for
any interesting mail

00:27:59.110 --> 00:28:00.940 align:middle line:90%
that's stored under var/mail.

00:28:00.940 --> 00:28:04.390 align:middle line:84%
And then of course the final
check which is very important

00:28:04.390 --> 00:28:07.030 align:middle line:84%
is that it tells us that
we're running inside a Docker

00:28:07.030 --> 00:28:07.940 align:middle line:90%
container.

00:28:07.940 --> 00:28:11.380 align:middle line:84%
So this will actually give
you a good idea of what

00:28:11.380 --> 00:28:12.530 align:middle line:90%
you've just compromised.

00:28:12.530 --> 00:28:17.020 align:middle line:84%
So when we ran the check VM
post-exploitation module,

00:28:17.020 --> 00:28:19.210 align:middle line:84%
this is the Metasploit
post-exploitation module.

00:28:19.210 --> 00:28:22.370 align:middle line:84%
It told us that we are
indeed a virtual machine,

00:28:22.370 --> 00:28:26.620 align:middle line:84%
but it really didn't specify
what type of virtualization

00:28:26.620 --> 00:28:30.430 align:middle line:84%
is actually set up
and is essentially

00:28:30.430 --> 00:28:32.150 align:middle line:90%
handling this virtual machine.

00:28:32.150 --> 00:28:34.930 align:middle line:84%
In this case, it's able to
confirm that we are indeed

00:28:34.930 --> 00:28:37.300 align:middle line:84%
a Docker container
or the target system

00:28:37.300 --> 00:28:38.870 align:middle line:90%
is indeed a Docker container.

00:28:38.870 --> 00:28:42.160 align:middle line:84%
So the LinEnum script
is extremely useful,

00:28:42.160 --> 00:28:46.450 align:middle line:84%
and the output is
very succinct, and it

00:28:46.450 --> 00:28:48.890 align:middle line:90%
keeps everything nicely sorted.

00:28:48.890 --> 00:28:51.070 align:middle line:84%
So, again, you can copy
all of this information

00:28:51.070 --> 00:28:54.070 align:middle line:84%
based on the information
that interests you.

00:28:54.070 --> 00:28:56.530 align:middle line:84%
Again, it's sorted out
really, really well

00:28:56.530 --> 00:28:59.260 align:middle line:84%
in a very human-readable
format, which

00:28:59.260 --> 00:29:02.320 align:middle line:84%
is why I personally prefer
utilizing this script

00:29:02.320 --> 00:29:04.180 align:middle line:90%
to perform local enumeration.

00:29:04.180 --> 00:29:06.760 align:middle line:84%
When it comes down to
identifying privilege

00:29:06.760 --> 00:29:08.530 align:middle line:84%
escalation
vulnerabilities, there

00:29:08.530 --> 00:29:12.260 align:middle line:84%
are a few other scripts that
are extremely important as well.

00:29:12.260 --> 00:29:15.430 align:middle line:84%
So that is going to conclude
the practical demonstration

00:29:15.430 --> 00:29:17.730 align:middle line:90%
side of this video.

00:29:17.730 --> 00:29:21.320 align:middle line:84%
All right, so that concludes the
Linux local enumeration section

00:29:21.320 --> 00:29:22.410 align:middle line:90%
of this course.

00:29:22.410 --> 00:29:25.700 align:middle line:84%
By the end of this section,
you should have the ability

00:29:25.700 --> 00:29:29.510 align:middle line:84%
to perform local enumeration
on a Linux target system

00:29:29.510 --> 00:29:32.120 align:middle line:84%
both manually and
automatically through the use

00:29:32.120 --> 00:29:35.450 align:middle line:84%
of various automation
scripts, as we just

00:29:35.450 --> 00:29:36.950 align:middle line:90%
explored in this video.

00:29:36.950 --> 00:29:38.450 align:middle line:84%
In the next video,
we're going to be

00:29:38.450 --> 00:29:41.870 align:middle line:84%
moving on to the next section,
which will essentially

00:29:41.870 --> 00:29:44.750 align:middle line:84%
cover the process of
how to transfer files

00:29:44.750 --> 00:29:47.990 align:middle line:84%
onto target systems that
you have compromised.

00:29:47.990 --> 00:29:50.390 align:middle line:84%
In the event you have
compromised the system

00:29:50.390 --> 00:29:52.790 align:middle line:84%
and you have not obtained
a Meterpreter session,

00:29:52.790 --> 00:29:55.310 align:middle line:84%
you have just obtained a
standard conventional session.

00:29:55.310 --> 00:29:57.630 align:middle line:84%
How do you upload a
file to a target system,

00:29:57.630 --> 00:29:58.530 align:middle line:90%
so on and so forth.

00:29:58.530 --> 00:30:01.160 align:middle line:84%
So that's what we are
going to be focusing on

00:30:01.160 --> 00:30:02.550 align:middle line:90%
in the next section.

00:30:02.550 --> 00:30:04.990 align:middle line:90%
So I'll see you there.

00:30:04.990 --> 00:30:06.000 align:middle line:90%