WEBVTT

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


00:00:03.409 --> 00:00:07.305 align:middle line:90%
[THEME TUNE PLAYING]

00:00:07.305 --> 00:00:10.230 align:middle line:90%


00:00:10.230 --> 00:00:13.560 align:middle line:84%
Linux Privilege Escalation,
Exploiting A Vulnerable

00:00:13.560 --> 00:00:14.500 align:middle line:90%
Program.

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

00:00:16.379 --> 00:00:19.650 align:middle line:84%
the process of elevating our
privileges on a Linux system

00:00:19.650 --> 00:00:21.870 align:middle line:84%
through the use of the
Metasploit framework.

00:00:21.870 --> 00:00:24.660 align:middle line:84%
And in specific, we
will be taking a look

00:00:24.660 --> 00:00:28.650 align:middle line:84%
at a technique that involves
exploiting a vulnerable program

00:00:28.650 --> 00:00:31.350 align:middle line:84%
installed on the
Linux target in order

00:00:31.350 --> 00:00:33.120 align:middle line:90%
to elevate our privileges.

00:00:33.120 --> 00:00:36.240 align:middle line:84%
Now when we talk about privilege
escalation on both Windows

00:00:36.240 --> 00:00:38.940 align:middle line:84%
and Linux, there are various
privilege escalation techniques

00:00:38.940 --> 00:00:42.370 align:middle line:84%
that can be utilized in order
to elevate your privileges.

00:00:42.370 --> 00:00:45.120 align:middle line:84%
And of course, given the fact
that this is a Metasploit

00:00:45.120 --> 00:00:47.100 align:middle line:84%
course, we are primarily
going to be focusing

00:00:47.100 --> 00:00:50.700 align:middle line:84%
on the techniques that can be
performed using the Metasploit

00:00:50.700 --> 00:00:51.250 align:middle line:90%
framework.

00:00:51.250 --> 00:00:54.540 align:middle line:84%
So in this case, the technique
that we will be exploring

00:00:54.540 --> 00:00:59.280 align:middle line:84%
is the process of exploiting a
vulnerable program on the Linux

00:00:59.280 --> 00:01:01.410 align:middle line:84%
target system that,
again, can provide us

00:01:01.410 --> 00:01:02.980 align:middle line:90%
with elevated privileges.

00:01:02.980 --> 00:01:06.720 align:middle line:84%
Now the privilege escalation
techniques that we can utilize

00:01:06.720 --> 00:01:09.000 align:middle line:84%
will depend on the version
of the Linux kernel

00:01:09.000 --> 00:01:12.090 align:middle line:84%
running on the target system
as well as the distribution

00:01:12.090 --> 00:01:13.000 align:middle line:90%
release version.

00:01:13.000 --> 00:01:15.150 align:middle line:84%
So again, when it
comes down to Linux,

00:01:15.150 --> 00:01:18.600 align:middle line:84%
and in specific, kernel
exploitation, which, again,

00:01:18.600 --> 00:01:21.750 align:middle line:84%
is very common, the most
important piece of information

00:01:21.750 --> 00:01:24.570 align:middle line:84%
is going to be the actual
kernel version as well

00:01:24.570 --> 00:01:26.290 align:middle line:84%
as the distribution
release version.

00:01:26.290 --> 00:01:29.610 align:middle line:84%
So given that that is the
case, the Metasploit framework

00:01:29.610 --> 00:01:33.430 align:middle line:84%
offers very little in regards
to Linux kernel exploit modules.

00:01:33.430 --> 00:01:37.830 align:middle line:84%
However, in some cases, there
may be an exploit module

00:01:37.830 --> 00:01:40.620 align:middle line:84%
that can be utilized to
exploit a vulnerable service

00:01:40.620 --> 00:01:43.080 align:middle line:84%
or program in order to
elevate our privileges.

00:01:43.080 --> 00:01:45.360 align:middle line:84%
So the technique
here really involves

00:01:45.360 --> 00:01:49.584 align:middle line:84%
performing local
privilege escalation

00:01:49.584 --> 00:01:51.840 align:middle line:84%
through the exploitation
of a vulnerable program.

00:01:51.840 --> 00:01:54.900 align:middle line:84%
Now of course, the process
of enumerating or finding out

00:01:54.900 --> 00:01:58.170 align:middle line:84%
what program on the Linux target
is vulnerable to a privilege

00:01:58.170 --> 00:02:01.230 align:middle line:84%
escalation exploit
or vulnerability

00:02:01.230 --> 00:02:02.388 align:middle line:90%
can be done manually.

00:02:02.388 --> 00:02:03.930 align:middle line:84%
And in this case,
that's exactly what

00:02:03.930 --> 00:02:05.410 align:middle line:90%
we're going to be exploring.

00:02:05.410 --> 00:02:08.310 align:middle line:84%
So again, all you need
to do is just start up

00:02:08.310 --> 00:02:10.199 align:middle line:84%
your lab environment
and I'll join you in,

00:02:10.199 --> 00:02:13.590 align:middle line:84%
and we can take a look at how
we can elevate our privileges

00:02:13.590 --> 00:02:16.850 align:middle line:90%
on a Linux system.

00:02:16.850 --> 00:02:17.350 align:middle line:90%
All right.

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

00:02:20.030 --> 00:02:24.010 align:middle line:84%
And the first step, of course,
is to identify the target IP

00:02:24.010 --> 00:02:25.010 align:middle line:90%
address.

00:02:25.010 --> 00:02:28.330 align:middle line:84%
So we type in ifconfig and head
over to the interface Ethernet

00:02:28.330 --> 00:02:29.190 align:middle line:90%
1.

00:02:29.190 --> 00:02:32.500 align:middle line:84%
The target IP address is going
to be in the same subnet here.

00:02:32.500 --> 00:02:35.360 align:middle line:84%
Of course, it's going to be
the next IP within the subnet.

00:02:35.360 --> 00:02:38.283 align:middle line:84%
So in your case, this
subnet will be different.

00:02:38.283 --> 00:02:39.700 align:middle line:84%
The only thing
that you need to do

00:02:39.700 --> 00:02:44.290 align:middle line:84%
is just copy this particular IP
and change the value 2 to a 3,

00:02:44.290 --> 00:02:45.350 align:middle line:90%
and that's the target IP.

00:02:45.350 --> 00:02:45.850 align:middle line:90%
Right?

00:02:45.850 --> 00:02:47.710 align:middle line:90%
So we'll copy that.

00:02:47.710 --> 00:02:50.260 align:middle line:84%
I'm then going to start up the
PostgreSQL database service.

00:02:50.260 --> 00:02:53.380 align:middle line:84%
I'm going to say service
PostgreSQL Start and MSF

00:02:53.380 --> 00:02:54.580 align:middle line:90%
console.

00:02:54.580 --> 00:02:58.270 align:middle line:84%
And that will start both at
the PostgreSQL database server

00:02:58.270 --> 00:03:00.830 align:middle line:90%
as well as the MSF console.

00:03:00.830 --> 00:03:01.330 align:middle line:90%
All right.

00:03:01.330 --> 00:03:02.260 align:middle line:90%
So there we are.

00:03:02.260 --> 00:03:04.450 align:middle line:84%
As you can see,
that started both.

00:03:04.450 --> 00:03:07.220 align:middle line:84%
And we can then create a
workspace, and in this case,

00:03:07.220 --> 00:03:10.750 align:middle line:84%
we're just going to
call it a Linux PrivEsc.

00:03:10.750 --> 00:03:12.460 align:middle line:84%
We'll just call
it Linux PrivEsc.

00:03:12.460 --> 00:03:13.130 align:middle line:90%
There we are.

00:03:13.130 --> 00:03:13.940 align:middle line:90%
Fantastic.

00:03:13.940 --> 00:03:16.510 align:middle line:84%
We are then going to set up the
global variable for the RHost

00:03:16.510 --> 00:03:17.170 align:middle line:90%
option.

00:03:17.170 --> 00:03:19.867 align:middle line:84%
And we're going to specify the
target IP as the value here.

00:03:19.867 --> 00:03:21.700 align:middle line:84%
And of course, that
will save us from having

00:03:21.700 --> 00:03:25.600 align:middle line:84%
to type in the target IP address
whenever we load a module.

00:03:25.600 --> 00:03:26.590 align:middle line:90%
So I'll hit Enter.

00:03:26.590 --> 00:03:29.590 align:middle line:84%
And of course, remember
to change the 2 to a 3.

00:03:29.590 --> 00:03:30.220 align:middle line:90%
Fantastic.

00:03:30.220 --> 00:03:30.720 align:middle line:90%
OK.

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

00:03:33.370 --> 00:03:37.300 align:middle line:84%
begin the process of gaining
access to the target system.

00:03:37.300 --> 00:03:40.150 align:middle line:84%
Now in this case, the
documentation for this lab

00:03:40.150 --> 00:03:42.580 align:middle line:84%
already provides you
with the SSH credentials

00:03:42.580 --> 00:03:45.260 align:middle line:84%
as that is going to
be our access vector.

00:03:45.260 --> 00:03:48.310 align:middle line:84%
So again, just to confirm, we
can perform a quick Nmap scan

00:03:48.310 --> 00:03:50.590 align:middle line:90%
using the DB_Nmap command.

00:03:50.590 --> 00:03:52.840 align:middle line:84%
And of course, that will
allow us to perform the Nmap

00:03:52.840 --> 00:03:55.480 align:middle line:84%
scan from within MSF
console and furthermore,

00:03:55.480 --> 00:03:57.670 align:middle line:84%
it will save the
Nmap scan results

00:03:57.670 --> 00:03:59.320 align:middle line:84%
into the Metasploit
framework database

00:03:59.320 --> 00:04:01.090 align:middle line:90%
within our current workspace.

00:04:01.090 --> 00:04:03.400 align:middle line:84%
So we'll perform some
service version detection,

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

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

00:04:07.120 --> 00:04:09.400 align:middle line:90%
And it Enter.

00:04:09.400 --> 00:04:13.330 align:middle line:84%
As you can see, we have port
22 open on the target system

00:04:13.330 --> 00:04:14.690 align:middle line:90%
and that's running SSH.

00:04:14.690 --> 00:04:16.750 align:middle line:84%
So again, as per
the documentation

00:04:16.750 --> 00:04:19.089 align:middle line:84%
provided within
this lab, we already

00:04:19.089 --> 00:04:20.740 align:middle line:90%
have the SSH credentials.

00:04:20.740 --> 00:04:23.290 align:middle line:84%
So we actually do not need
to get into the process

00:04:23.290 --> 00:04:24.850 align:middle line:90%
of performing a brute force.

00:04:24.850 --> 00:04:27.340 align:middle line:84%
So in order to log in
using the credentials,

00:04:27.340 --> 00:04:30.730 align:middle line:84%
we will say Search, and we
will utilize the SSH log

00:04:30.730 --> 00:04:34.210 align:middle line:84%
in module which we have utilized
previously during the SSH

00:04:34.210 --> 00:04:36.038 align:middle line:90%
enumeration section.

00:04:36.038 --> 00:04:36.580 align:middle line:90%
There we are.

00:04:36.580 --> 00:04:39.820 align:middle line:84%
And we're going to use
the first module here.

00:04:39.820 --> 00:04:42.470 align:middle line:84%
And we're going to say
Use, based that in there.

00:04:42.470 --> 00:04:45.070 align:middle line:84%
And if we show the options
here, the only value

00:04:45.070 --> 00:04:47.230 align:middle line:84%
that we need to
specify is going to be

00:04:47.230 --> 00:04:49.160 align:middle line:90%
the password and the username.

00:04:49.160 --> 00:04:52.300 align:middle line:84%
Now as per the credentials
provided within the lab

00:04:52.300 --> 00:04:56.930 align:middle line:84%
documentation, the username that
we can log in with is "Jackie."

00:04:56.930 --> 00:04:57.430 align:middle line:90%
All right.

00:04:57.430 --> 00:05:01.180 align:middle line:84%
And the password is
going to be "password."

00:05:01.180 --> 00:05:01.680 align:middle line:90%
Right?

00:05:01.680 --> 00:05:04.180 align:middle line:84%
So it's a fairly
simple password there.

00:05:04.180 --> 00:05:06.690 align:middle line:84%
And of course, we have
the target IP specified,

00:05:06.690 --> 00:05:10.110 align:middle line:84%
because we set up the global
variable for the RHost option

00:05:10.110 --> 00:05:13.630 align:middle line:84%
as well as the RPort
option, which is set to 22.

00:05:13.630 --> 00:05:15.540 align:middle line:90%
So I'll hit Enter.

00:05:15.540 --> 00:05:17.310 align:middle line:90%
And then I can Exploit.

00:05:17.310 --> 00:05:19.650 align:middle line:84%
And this will authenticate
and provide us

00:05:19.650 --> 00:05:22.210 align:middle line:84%
with a command shell session
on the target system.

00:05:22.210 --> 00:05:24.330 align:middle line:84%
So it says Success
Jackie and password.

00:05:24.330 --> 00:05:27.160 align:middle line:84%
And then it opens up a
command shell session there.

00:05:27.160 --> 00:05:29.400 align:middle line:84%
So if I say Sessions,
you can see that we

00:05:29.400 --> 00:05:30.730 align:middle line:90%
have a command shell session.

00:05:30.730 --> 00:05:34.290 align:middle line:84%
And if we say Sessions
1, and you can see that

00:05:34.290 --> 00:05:36.480 align:middle line:84%
gives us access to
the Linux terminal

00:05:36.480 --> 00:05:39.700 align:middle line:84%
or to the Linux system
via a command shell.

00:05:39.700 --> 00:05:43.590 align:middle line:84%
So if I say PWD, you can see
we are within the Jackie home

00:05:43.590 --> 00:05:44.290 align:middle line:90%
directory.

00:05:44.290 --> 00:05:46.920 align:middle line:84%
So I'll open up a
bash session here.

00:05:46.920 --> 00:05:49.980 align:middle line:84%
And I'll use bin/bash
I. Fantastic.

00:05:49.980 --> 00:05:52.830 align:middle line:84%
As you can see, we are currently
logged in as the user Jackie.

00:05:52.830 --> 00:05:56.010 align:middle line:84%
So again, we can perform
some basic enumeration

00:05:56.010 --> 00:05:59.865 align:middle line:84%
like who am I. We can see
that we are indeed Jackie.

00:05:59.865 --> 00:06:05.750 align:middle line:84%
If we say cat etc issue,
that's the distribution release

00:06:05.750 --> 00:06:06.270 align:middle line:90%
version.

00:06:06.270 --> 00:06:09.650 align:middle line:90%
So it's Ubuntu 18.04.3 LTS.

00:06:09.650 --> 00:06:15.900 align:middle line:84%
We can say Uname R, and
we get the kernel version.

00:06:15.900 --> 00:06:16.400 align:middle line:90%
Right?

00:06:16.400 --> 00:06:18.860 align:middle line:84%
However in this case,
what we want to do

00:06:18.860 --> 00:06:22.400 align:middle line:84%
is we want to essentially
establish a Meterpreter session

00:06:22.400 --> 00:06:25.730 align:middle line:84%
or to upgrade our command shell
session into a Meterpreter

00:06:25.730 --> 00:06:27.750 align:middle line:84%
session, which is
fairly simple to do.

00:06:27.750 --> 00:06:29.900 align:middle line:84%
So I'll put this
in the background.

00:06:29.900 --> 00:06:32.390 align:middle line:84%
And we will then utilize
the Sessions command

00:06:32.390 --> 00:06:35.570 align:middle line:84%
and say we want to
upgrade session 1.

00:06:35.570 --> 00:06:38.120 align:middle line:84%
So I'm going to say
Sessions, Upgrade 1.

00:06:38.120 --> 00:06:38.888 align:middle line:90%
Hit Enter.

00:06:38.888 --> 00:06:40.430 align:middle line:84%
Don't worry if it
gives you the error

00:06:40.430 --> 00:06:42.680 align:middle line:84%
here telling you that
this session may not

00:06:42.680 --> 00:06:44.790 align:middle line:90%
be compatible with this module.

00:06:44.790 --> 00:06:47.517 align:middle line:84%
So it's going to say
Upgrading Session 1.

00:06:47.517 --> 00:06:49.725 align:middle line:84%
We'll just give that a couple
of seconds to complete.

00:06:49.725 --> 00:06:54.040 align:middle line:90%


00:06:54.040 --> 00:06:54.540 align:middle line:90%
All right.

00:06:54.540 --> 00:06:56.760 align:middle line:84%
So it starts up the
exploit multi handler

00:06:56.760 --> 00:07:01.120 align:middle line:84%
and starts the reverse
DCP handler on port 4433.

00:07:01.120 --> 00:07:01.620 align:middle line:90%
All right.

00:07:01.620 --> 00:07:04.200 align:middle line:84%
And don't worry if it gives
you this error right over here.

00:07:04.200 --> 00:07:07.500 align:middle line:84%
If we say Sessions, you can
see that we have a Meterpreter

00:07:07.500 --> 00:07:09.070 align:middle line:90%
session and that is session 2.

00:07:09.070 --> 00:07:09.570 align:middle line:90%
Right?

00:07:09.570 --> 00:07:12.730 align:middle line:84%
So you can say
Sessions 2, and again,

00:07:12.730 --> 00:07:16.330 align:middle line:84%
SysInfo, Get User ID,
et cetera, et cetera.

00:07:16.330 --> 00:07:16.830 align:middle line:90%
Right?

00:07:16.830 --> 00:07:18.450 align:middle line:84%
And in this case,
it says No User

00:07:18.450 --> 00:07:20.530 align:middle line:84%
but it provides us
with the user ID.

00:07:20.530 --> 00:07:23.610 align:middle line:84%
And in this case, we know
that the user is Jackie.

00:07:23.610 --> 00:07:25.770 align:middle line:84%
And of course, if we say
Shell, and then open up

00:07:25.770 --> 00:07:28.770 align:middle line:84%
a bash session here, we
can enumerate the users

00:07:28.770 --> 00:07:33.460 align:middle line:84%
on the system by saying
cat etc password.

00:07:33.460 --> 00:07:36.070 align:middle line:84%
As we can see, we only
have two user accounts.

00:07:36.070 --> 00:07:37.930 align:middle line:84%
One of them is Jackie,
and the other one

00:07:37.930 --> 00:07:39.290 align:middle line:90%
is the root user account.

00:07:39.290 --> 00:07:41.860 align:middle line:84%
So the rest of them are
all service accounts,

00:07:41.860 --> 00:07:43.660 align:middle line:84%
and we want to
elevate our privileges

00:07:43.660 --> 00:07:45.620 align:middle line:90%
to that of the root user.

00:07:45.620 --> 00:07:46.120 align:middle line:90%
OK.

00:07:46.120 --> 00:07:48.580 align:middle line:84%
So what we can do now
in order to identify

00:07:48.580 --> 00:07:50.830 align:middle line:84%
the vulnerable
program or service,

00:07:50.830 --> 00:07:53.170 align:middle line:84%
we can essentially
list out the processes

00:07:53.170 --> 00:07:56.750 align:middle line:84%
running on the system
using the command ps aux.

00:07:56.750 --> 00:07:58.970 align:middle line:84%
And if we take a look
at the process tree,

00:07:58.970 --> 00:08:01.570 align:middle line:84%
we can see that
the user root here

00:08:01.570 --> 00:08:05.410 align:middle line:84%
has initiated a program
binary or script

00:08:05.410 --> 00:08:09.010 align:middle line:84%
and has executed it with bash,
and the name of the binary

00:08:09.010 --> 00:08:11.590 align:middle line:84%
or script is called
Check Down, and it's

00:08:11.590 --> 00:08:13.420 align:middle line:84%
stored within the
binary directory

00:08:13.420 --> 00:08:15.190 align:middle line:90%
here or the binaries directory.

00:08:15.190 --> 00:08:17.170 align:middle line:84%
So we can actually
check out what

00:08:17.170 --> 00:08:20.230 align:middle line:84%
this file does by cutting
the contents of the file.

00:08:20.230 --> 00:08:23.320 align:middle line:84%
And of course, it could be a
binary or it could be a script.

00:08:23.320 --> 00:08:25.670 align:middle line:84%
And in this case, it looks
like it is a Bash script.

00:08:25.670 --> 00:08:26.170 align:middle line:90%
Right?

00:08:26.170 --> 00:08:29.500 align:middle line:84%
So within the bash script, we
can see some logic or some code

00:08:29.500 --> 00:08:30.080 align:middle line:90%
here.

00:08:30.080 --> 00:08:35.799 align:middle line:84%
So this is a while loop,
whereby the binary CHK

00:08:35.799 --> 00:08:40.010 align:middle line:84%
rootkit is executed every
60 seconds or every minute.

00:08:40.010 --> 00:08:40.510 align:middle line:90%
Right?

00:08:40.510 --> 00:08:42.789 align:middle line:84%
So this particular
check down script

00:08:42.789 --> 00:08:46.490 align:middle line:84%
is used to run CHK
rootkit every 60 seconds.

00:08:46.490 --> 00:08:46.990 align:middle line:90%
OK?

00:08:46.990 --> 00:08:48.640 align:middle line:90%
So what is CHK rootkit?

00:08:48.640 --> 00:08:51.310 align:middle line:84%
Well CHK rootkit
is a Linux utility

00:08:51.310 --> 00:08:54.130 align:middle line:84%
that is used to scan a
Linux system for rootkit.

00:08:54.130 --> 00:08:55.990 align:middle line:90%
So it's an anti rootkit system.

00:08:55.990 --> 00:08:59.290 align:middle line:84%
Now CHK rootkit in
this particular case

00:08:59.290 --> 00:09:02.140 align:middle line:84%
is vulnerable to a local
privilege escalation

00:09:02.140 --> 00:09:04.990 align:middle line:84%
vulnerability, but
it only affects

00:09:04.990 --> 00:09:08.530 align:middle line:90%
versions older than 0.5.0.

00:09:08.530 --> 00:09:12.070 align:middle line:84%
So we can check out the
version of CHK rootkit

00:09:12.070 --> 00:09:16.720 align:middle line:84%
by saying CHK rootkit,
and if we say Help,

00:09:16.720 --> 00:09:19.540 align:middle line:84%
we can see that we can
enumerate the version by using

00:09:19.540 --> 00:09:21.890 align:middle line:90%
the hyphen uppercase V option.

00:09:21.890 --> 00:09:28.080 align:middle line:84%
So I'm going to say CHK rootkit
hyphen V. And as you can see,

00:09:28.080 --> 00:09:31.170 align:middle line:84%
the version of CHK
rootkit is 0.4.9,

00:09:31.170 --> 00:09:34.770 align:middle line:84%
which means we can exploit
this particular binary in order

00:09:34.770 --> 00:09:36.520 align:middle line:90%
to elevate our privileges.

00:09:36.520 --> 00:09:39.030 align:middle line:84%
Now in order to do this, what
we're going to need to do

00:09:39.030 --> 00:09:40.960 align:middle line:84%
is, of course, put
this in the background.

00:09:40.960 --> 00:09:42.720 align:middle line:84%
So I'm going to
terminate this channel

00:09:42.720 --> 00:09:45.510 align:middle line:84%
and I'll put the Meterpreter
session in the background.

00:09:45.510 --> 00:09:49.460 align:middle line:84%
And we can search for the CHK
rootkit exploit module here.

00:09:49.460 --> 00:09:52.800 align:middle line:84%
So I'm going to say
search CHK rootkit.

00:09:52.800 --> 00:09:54.780 align:middle line:84%
And this is the
exploit module here.

00:09:54.780 --> 00:09:57.690 align:middle line:84%
As you can see, this is
CHK rootkit local privilege

00:09:57.690 --> 00:09:58.590 align:middle line:90%
escalation.

00:09:58.590 --> 00:10:01.960 align:middle line:84%
And in terms of usability, we
need to configure it manually.

00:10:01.960 --> 00:10:02.460 align:middle line:90%
All right.

00:10:02.460 --> 00:10:04.770 align:middle line:84%
So it's fairly
simple to configure.

00:10:04.770 --> 00:10:06.520 align:middle line:90%
And we can say Use.

00:10:06.520 --> 00:10:07.950 align:middle line:90%
Paste that in there.

00:10:07.950 --> 00:10:10.890 align:middle line:84%
If we show the Options, you
can see we have the ability

00:10:10.890 --> 00:10:13.470 align:middle line:84%
to specify the session,
and we can also

00:10:13.470 --> 00:10:15.090 align:middle line:84%
configure the
payload option, which

00:10:15.090 --> 00:10:17.160 align:middle line:84%
in this case, the
payload that's being used

00:10:17.160 --> 00:10:20.730 align:middle line:84%
is a simple command
shell payload for Unix.

00:10:20.730 --> 00:10:24.810 align:middle line:84%
If we type in Info, we can see
that it tells us CHK rootkit

00:10:24.810 --> 00:10:30.960 align:middle line:84%
before 0.5.0 or 0.50 will run
any executable file named temp

00:10:30.960 --> 00:10:33.820 align:middle line:84%
update as root allowing a
trivial privilege escalation.

00:10:33.820 --> 00:10:34.320 align:middle line:90%
Right?

00:10:34.320 --> 00:10:38.970 align:middle line:84%
So what we can do is we can
specify the actual path to CHK

00:10:38.970 --> 00:10:42.840 align:middle line:84%
rootkit, first and foremost, and
we can also specify the session

00:10:42.840 --> 00:10:44.400 align:middle line:90%
to run this module on.

00:10:44.400 --> 00:10:47.250 align:middle line:84%
Now when we perform the
enumeration of CHK rootkit,

00:10:47.250 --> 00:10:49.020 align:middle line:84%
we see that CHK
rootkit is stored

00:10:49.020 --> 00:10:50.700 align:middle line:90%
under the binary directory.

00:10:50.700 --> 00:10:52.620 align:middle line:90%
So Binary CHK Rootkit.

00:10:52.620 --> 00:10:56.610 align:middle line:84%
So in order to execute
this, what we can do

00:10:56.610 --> 00:11:00.650 align:middle line:84%
is say or set the
CHK rootkit option.

00:11:00.650 --> 00:11:01.150 align:middle line:90%
Here we are.

00:11:01.150 --> 00:11:04.480 align:middle line:84%
And we'll just set
this to User or just

00:11:04.480 --> 00:11:05.930 align:middle line:90%
under Binary CHK Rootkit.

00:11:05.930 --> 00:11:06.430 align:middle line:90%
Right?

00:11:06.430 --> 00:11:09.430 align:middle line:84%
Because Linux will be
able to specify that

00:11:09.430 --> 00:11:12.470 align:middle line:84%
or to identify the actual
value of the binary.

00:11:12.470 --> 00:11:18.008 align:middle line:84%
So what we'll do is we will
set that to Bin CHK rootkit.

00:11:18.008 --> 00:11:18.550 align:middle line:90%
There we are.

00:11:18.550 --> 00:11:20.740 align:middle line:84%
And we'll set the
session to session 2,

00:11:20.740 --> 00:11:24.880 align:middle line:84%
because we want to run this
via the Meterpreter session.

00:11:24.880 --> 00:11:27.010 align:middle line:84%
We then need to set
the LHost option

00:11:27.010 --> 00:11:28.670 align:middle line:90%
to the value of Ethernet 1.

00:11:28.670 --> 00:11:30.370 align:middle line:84%
So I'm going to
type in ifconfig,

00:11:30.370 --> 00:11:33.290 align:middle line:84%
and we'll just copy the
ethernet 1 IP address here.

00:11:33.290 --> 00:11:35.470 align:middle line:90%
So I'm going to say Set LHost.

00:11:35.470 --> 00:11:37.250 align:middle line:90%
And there we are.

00:11:37.250 --> 00:11:39.550 align:middle line:90%
And we can leave LPort as is.

00:11:39.550 --> 00:11:42.430 align:middle line:84%
It probably-- If we
say Show Options,

00:11:42.430 --> 00:11:45.250 align:middle line:84%
we can see that it doesn't
display the actual LPort

00:11:45.250 --> 00:11:46.070 align:middle line:90%
options.

00:11:46.070 --> 00:11:48.530 align:middle line:84%
However, if we
say Sessions here,

00:11:48.530 --> 00:11:53.590 align:middle line:84%
we can see that the ports being
used are port 4433 and 38717.

00:11:53.590 --> 00:11:55.880 align:middle line:84%
So again, in this
case, that is fine.

00:11:55.880 --> 00:11:57.700 align:middle line:90%
We can just hit Exploit.

00:11:57.700 --> 00:11:59.500 align:middle line:90%
And we'll hit Enter.

00:11:59.500 --> 00:12:02.860 align:middle line:84%
And it's going to say Started
the reverse TCP double handler.

00:12:02.860 --> 00:12:06.040 align:middle line:84%
It's then going to
tell you that routing

00:12:06.040 --> 00:12:07.270 align:middle line:90%
will depend on the crontab.

00:12:07.270 --> 00:12:11.380 align:middle line:84%
So it'll actually create a Cron
job to execute the temp update

00:12:11.380 --> 00:12:13.450 align:middle line:84%
file that has been created,
and of course, it's

00:12:13.450 --> 00:12:17.170 align:middle line:84%
then going to wait for CHK
rootkit to run via Cron.

00:12:17.170 --> 00:12:19.570 align:middle line:84%
So again, I'm just going
to give this a few seconds.

00:12:19.570 --> 00:12:24.550 align:middle line:84%
And in this case, it looks like
it's utilizing the LHost IP

00:12:24.550 --> 00:12:26.350 align:middle line:84%
and it's said the
interface being set

00:12:26.350 --> 00:12:29.560 align:middle line:90%
there is actually Ethernet 0.

00:12:29.560 --> 00:12:31.640 align:middle line:84%
So let's actually
change this up here.

00:12:31.640 --> 00:12:34.360 align:middle line:84%
So if we show the
options now, we

00:12:34.360 --> 00:12:38.360 align:middle line:84%
can see that LHost has been set
to the IP address of Ethernet

00:12:38.360 --> 00:12:38.860 align:middle line:90%
0.

00:12:38.860 --> 00:12:43.030 align:middle line:84%
So if we say ifconfig, we can
set that to the IP address

00:12:43.030 --> 00:12:43.750 align:middle line:90%
on Ethernet 1.

00:12:43.750 --> 00:12:48.100 align:middle line:84%
So I'm going to say Set
LHost to the IP there.

00:12:48.100 --> 00:12:50.390 align:middle line:90%
And we can then Exploit.

00:12:50.390 --> 00:12:50.890 align:middle line:90%
All right.

00:12:50.890 --> 00:12:53.590 align:middle line:84%
So it's going to wait for
CHK rootkit to run via Cron.

00:12:53.590 --> 00:12:55.540 align:middle line:84%
We're going to give
that a few seconds.

00:12:55.540 --> 00:12:59.050 align:middle line:84%
Now we may have to change the
actual path to CHK rootkit

00:12:59.050 --> 00:13:00.290 align:middle line:90%
if this doesn't work.

00:13:00.290 --> 00:13:02.630 align:middle line:84%
So we may have to specify
the absolute path.

00:13:02.630 --> 00:13:04.480 align:middle line:84%
But we're just going
to wait for CHK rootkit

00:13:04.480 --> 00:13:08.050 align:middle line:84%
to run via Cron as it's going
to be executed via the Cron job.

00:13:08.050 --> 00:13:09.920 align:middle line:84%
So we'll give this
a few seconds.

00:13:09.920 --> 00:13:11.980 align:middle line:84%
Again, if it doesn't
start up in a few seconds,

00:13:11.980 --> 00:13:17.480 align:middle line:84%
we may need to change the
actual path to CHK rootkit.

00:13:17.480 --> 00:13:17.980 align:middle line:90%
All right.

00:13:17.980 --> 00:13:21.880 align:middle line:84%
So after a few seconds, we can
see that it actually accepts

00:13:21.880 --> 00:13:24.850 align:middle line:84%
the first client connection,
the second client connection,

00:13:24.850 --> 00:13:27.220 align:middle line:84%
and then writes to
socket A and socket B,

00:13:27.220 --> 00:13:29.870 align:middle line:84%
and we get a command
shell session open.

00:13:29.870 --> 00:13:34.580 align:middle line:84%
So if we say bin/bash I,
you can see that we now

00:13:34.580 --> 00:13:36.650 align:middle line:84%
have root access and
have successfully been

00:13:36.650 --> 00:13:38.060 align:middle line:90%
able to elevate our privileges.

00:13:38.060 --> 00:13:40.820 align:middle line:84%
So if I say Who am I,
you can see we are root

00:13:40.820 --> 00:13:42.440 align:middle line:90%
and we now have root privileges.

00:13:42.440 --> 00:13:46.280 align:middle line:84%
So that is how to elevate your
privileges on a Linux system

00:13:46.280 --> 00:13:51.200 align:middle line:84%
through or via exploiting a
vulnerable program or binary

00:13:51.200 --> 00:13:53.060 align:middle line:90%
that's on the Linux system.

00:13:53.060 --> 00:13:56.390 align:middle line:84%
And of course, this is also
applicable to a kernel exploit.

00:13:56.390 --> 00:13:59.630 align:middle line:84%
However, kernel exploits in
the case of the Metasploit

00:13:59.630 --> 00:14:01.500 align:middle line:84%
framework will need
to be done manually

00:14:01.500 --> 00:14:04.160 align:middle line:84%
and will involve the
process of downloading

00:14:04.160 --> 00:14:06.750 align:middle line:90%
exploit code remotely.

00:14:06.750 --> 00:14:09.800 align:middle line:84%
So that is going to conclude
the practical demonstration

00:14:09.800 --> 00:14:12.350 align:middle line:90%
side of this video.

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

00:14:14.200 --> 00:14:17.440 align:middle line:84%
the process of dumping
hashes on a Linux system

00:14:17.440 --> 00:14:19.970 align:middle line:84%
through the use of
the hash dump module.

00:14:19.970 --> 00:14:20.470 align:middle line:90%
All right.

00:14:20.470 --> 00:14:23.550 align:middle line:84%
So I'll see you
in the next video.

00:14:23.550 --> 00:14:24.131 align:middle line:90%