WEBVTT

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


00:00:04.437 --> 00:00:07.395 align:middle line:90%
[MUSIC PLAYING]

00:00:07.395 --> 00:00:09.870 align:middle line:90%


00:00:09.870 --> 00:00:12.060 align:middle line:90%
Targeting vsftpd.

00:00:12.060 --> 00:00:14.160 align:middle line:84%
In this video, we're
going to be taking a look

00:00:14.160 --> 00:00:17.250 align:middle line:84%
at how to exploit the
FTP service that's

00:00:17.250 --> 00:00:18.840 align:middle line:90%
running on the Linux target.

00:00:18.840 --> 00:00:20.610 align:middle line:84%
Now, we've already
covered the process

00:00:20.610 --> 00:00:23.610 align:middle line:84%
of exploiting FTP
on a Windows system,

00:00:23.610 --> 00:00:26.190 align:middle line:84%
and that was fairly
straightforward

00:00:26.190 --> 00:00:27.600 align:middle line:90%
via a brute force attack.

00:00:27.600 --> 00:00:29.520 align:middle line:84%
However, in this
video, we're going

00:00:29.520 --> 00:00:31.440 align:middle line:84%
to be exploring
additional techniques that

00:00:31.440 --> 00:00:34.590 align:middle line:84%
can be used to
exploit an FTP server

00:00:34.590 --> 00:00:38.880 align:middle line:84%
as well as exploring how we
can use our access that we will

00:00:38.880 --> 00:00:42.270 align:middle line:84%
obtain with FTP to
essentially obtain

00:00:42.270 --> 00:00:44.410 align:middle line:84%
a reverse shell on
the target system.

00:00:44.410 --> 00:00:47.262 align:middle line:84%
So we're going to be exploring
quite a few techniques.

00:00:47.262 --> 00:00:49.470 align:middle line:84%
So all you need to do is,
again, just fire up the lab

00:00:49.470 --> 00:00:51.270 align:middle line:84%
environment, or if
you're continuing on

00:00:51.270 --> 00:00:54.100 align:middle line:84%
with your initial session,
that that's perfectly fine.

00:00:54.100 --> 00:00:56.670 align:middle line:84%
So I'll be switching over
to my lab environment now,

00:00:56.670 --> 00:00:59.580 align:middle line:84%
and we can get started
by taking a look at how

00:00:59.580 --> 00:01:01.470 align:middle line:84%
to exploit the
FTP service that's

00:01:01.470 --> 00:01:05.470 align:middle line:90%
running on the target system.

00:01:05.470 --> 00:01:07.760 align:middle line:84%
All right, so I'm back
in the lab environment.

00:01:07.760 --> 00:01:10.090 align:middle line:84%
And I've performed a quick
service version detection

00:01:10.090 --> 00:01:14.350 align:middle line:84%
scan and the default Nmap
script scan on the target system

00:01:14.350 --> 00:01:17.870 align:middle line:84%
on port 21, where we had
the FTP service running.

00:01:17.870 --> 00:01:22.540 align:middle line:84%
And you can see right over,
here it's running vsftpd 2.3.4,

00:01:22.540 --> 00:01:25.720 align:middle line:84%
and it actually ran the
FTP the FTP anon script

00:01:25.720 --> 00:01:27.850 align:middle line:84%
to check for
anonymous FTP logins,

00:01:27.850 --> 00:01:30.010 align:middle line:84%
and indeed we can
see here it looks

00:01:30.010 --> 00:01:32.270 align:middle line:84%
like FTP anonymous
logins are allowed,

00:01:32.270 --> 00:01:34.690 align:middle line:84%
which means we can log
into the FTP server

00:01:34.690 --> 00:01:37.960 align:middle line:84%
without providing a
password, all right?

00:01:37.960 --> 00:01:42.610 align:middle line:84%
And the additional scripts
that have actually been run

00:01:42.610 --> 00:01:46.990 align:middle line:84%
give you information regarding,
so for example, FTP system,

00:01:46.990 --> 00:01:49.630 align:middle line:84%
it was able to actually log
in with anonymous credentials

00:01:49.630 --> 00:01:53.260 align:middle line:84%
and it gives you information
regarding the actual FTP

00:01:53.260 --> 00:01:54.790 align:middle line:90%
service that's running, right?

00:01:54.790 --> 00:01:57.260 align:middle line:84%
So information like
the session timeout,

00:01:57.260 --> 00:02:00.520 align:middle line:84%
so the session timeout is
300 seconds and the control

00:02:00.520 --> 00:02:02.140 align:middle line:90%
connection is in plaintext.

00:02:02.140 --> 00:02:04.720 align:middle line:84%
And data connections
will be in plaintext.

00:02:04.720 --> 00:02:06.820 align:middle line:84%
So let's try and see
whether we can gain access

00:02:06.820 --> 00:02:09.970 align:middle line:84%
to the target
system with vsftpd,

00:02:09.970 --> 00:02:13.900 align:middle line:84%
or rather, with the FTP
client without providing

00:02:13.900 --> 00:02:16.495 align:middle line:84%
any legitimate credentials or
just anonymous credentials.

00:02:16.495 --> 00:02:19.240 align:middle line:84%
So I'll log in with
the FTP client here,

00:02:19.240 --> 00:02:20.170 align:middle line:90%
and we'll hit Enter.

00:02:20.170 --> 00:02:23.900 align:middle line:84%
So we'll say anonymous,
and will it Enter.

00:02:23.900 --> 00:02:26.250 align:middle line:84%
And as you can see,
login successful.

00:02:26.250 --> 00:02:29.820 align:middle line:84%
So let's list out the contents
of the current directory.

00:02:29.820 --> 00:02:31.580 align:middle line:84%
We can see that we
don't have any files

00:02:31.580 --> 00:02:32.630 align:middle line:90%
within this directory.

00:02:32.630 --> 00:02:36.440 align:middle line:84%
Can we navigate to the
root of whatever directory

00:02:36.440 --> 00:02:37.520 align:middle line:90%
we're working in?

00:02:37.520 --> 00:02:41.150 align:middle line:84%
We hit Enter, the directory
successfully changed, ls,

00:02:41.150 --> 00:02:44.240 align:middle line:84%
and we're still working within
the folder that has been

00:02:44.240 --> 00:02:46.430 align:middle line:90%
configured for the FTP server.

00:02:46.430 --> 00:02:49.100 align:middle line:84%
Now this is one of the things
that I wanted to highlight.

00:02:49.100 --> 00:02:52.370 align:middle line:84%
In the previous video,
the FTP server and the web

00:02:52.370 --> 00:02:54.230 align:middle line:84%
server-- or rather, in
the previous section

00:02:54.230 --> 00:02:56.630 align:middle line:84%
when we were covering
Windows exploitation,

00:02:56.630 --> 00:02:59.570 align:middle line:84%
the FTP server was
working in conjunction

00:02:59.570 --> 00:03:04.700 align:middle line:84%
with the web server, in that
the FTP service was essentially

00:03:04.700 --> 00:03:08.600 align:middle line:84%
providing you with access to the
files that are within the web

00:03:08.600 --> 00:03:10.970 align:middle line:84%
server directory
or the folder that

00:03:10.970 --> 00:03:14.060 align:middle line:84%
is used to host the web
application or the multiple web

00:03:14.060 --> 00:03:15.120 align:middle line:90%
applications.

00:03:15.120 --> 00:03:17.300 align:middle line:84%
However, in this case
with anonymous access,

00:03:17.300 --> 00:03:19.880 align:middle line:84%
it doesn't look like we
can access any directory,

00:03:19.880 --> 00:03:22.020 align:middle line:84%
so you might be thinking
to yourself, well,

00:03:22.020 --> 00:03:22.820 align:middle line:90%
what do we do now?

00:03:22.820 --> 00:03:27.500 align:middle line:84%
We have essentially logged
in, but we can't really

00:03:27.500 --> 00:03:28.940 align:middle line:90%
access any files here.

00:03:28.940 --> 00:03:31.250 align:middle line:84%
And that all comes down
to anonymous access

00:03:31.250 --> 00:03:33.560 align:middle line:84%
and what anonymous
users are allowed to do.

00:03:33.560 --> 00:03:37.610 align:middle line:84%
Now, if we are able to identify
other user credentials for FTP,

00:03:37.610 --> 00:03:40.160 align:middle line:84%
then we could possibly
navigate to other directories

00:03:40.160 --> 00:03:42.410 align:middle line:84%
and do something a
little bit different.

00:03:42.410 --> 00:03:45.350 align:middle line:84%
However, before we do
that, let me just exit.

00:03:45.350 --> 00:03:49.010 align:middle line:84%
Some of you may have
remembered that in the earlier

00:03:49.010 --> 00:03:51.440 align:middle line:84%
sections within this
video, we actually

00:03:51.440 --> 00:03:54.050 align:middle line:84%
were able to identify
a vulnerability

00:03:54.050 --> 00:03:56.720 align:middle line:90%
within vsftpd 2.3.4.

00:03:56.720 --> 00:04:00.800 align:middle line:84%
So if I just perform a quick
searchsploit query here

00:04:00.800 --> 00:04:06.140 align:middle line:84%
on vsftpd, you can see that
we have on version 2.3.4,

00:04:06.140 --> 00:04:08.000 align:middle line:84%
we have backdoor
command execution

00:04:08.000 --> 00:04:10.760 align:middle line:84%
and there is a
Python exploit here,

00:04:10.760 --> 00:04:13.620 align:middle line:84%
as well as a Metasploit
exploit module.

00:04:13.620 --> 00:04:15.170 align:middle line:84%
So let's take a
look at the Python

00:04:15.170 --> 00:04:17.450 align:middle line:84%
exploit here to learn
a little bit more

00:04:17.450 --> 00:04:18.860 align:middle line:90%
about how this exploit works.

00:04:18.860 --> 00:04:21.200 align:middle line:84%
And of course, I'll be
explaining it to you

00:04:21.200 --> 00:04:24.230 align:middle line:84%
if you have never used it or
exploited this service before.

00:04:24.230 --> 00:04:28.370 align:middle line:84%
So I'll just say
searchsploit -m,

00:04:28.370 --> 00:04:37.130 align:middle line:84%
and the actual EDB ID
is 49757, so 49757,

00:04:37.130 --> 00:04:39.240 align:middle line:84%
and that should copy to
our current directory.

00:04:39.240 --> 00:04:41.870 align:middle line:84%
So we can open it up with
Vim or any other text editor

00:04:41.870 --> 00:04:44.060 align:middle line:90%
that you're comfortable with.

00:04:44.060 --> 00:04:44.970 align:middle line:90%
There we go.

00:04:44.970 --> 00:04:46.910 align:middle line:90%
And this is the Python exploit.

00:04:46.910 --> 00:04:48.740 align:middle line:84%
Now, you can see that
it's very simple.

00:04:48.740 --> 00:04:53.570 align:middle line:84%
It's importing a few libraries
here, or packages, if you will.

00:04:53.570 --> 00:04:56.450 align:middle line:84%
And it essentially prints
out a bit of data here.

00:04:56.450 --> 00:04:58.310 align:middle line:90%
We need to actually provide--

00:04:58.310 --> 00:05:00.710 align:middle line:84%
this exploit needs
the target IP address,

00:05:00.710 --> 00:05:04.310 align:middle line:84%
and that can be specified
as a command line argument.

00:05:04.310 --> 00:05:07.550 align:middle line:84%
The portFTP port, I
believe this is-- yeah,

00:05:07.550 --> 00:05:11.720 align:middle line:84%
that's vsftpd 2.3.4
backdoor command execution.

00:05:11.720 --> 00:05:13.050 align:middle line:90%
For some reason, there we are.

00:05:13.050 --> 00:05:14.070 align:middle line:90%
That's portFTP.

00:05:14.070 --> 00:05:18.200 align:middle line:84%
This is where you can modify
the FTP port if the target

00:05:18.200 --> 00:05:21.110 align:middle line:84%
system is running vsftpd
on a different port

00:05:21.110 --> 00:05:23.130 align:middle line:90%
apart from the default one.

00:05:23.130 --> 00:05:25.220 align:middle line:84%
And you can see that
it authenticates

00:05:25.220 --> 00:05:28.940 align:middle line:84%
with very basic
credentials here,

00:05:28.940 --> 00:05:32.240 align:middle line:84%
and it then initiates a
Telnet connection right

00:05:32.240 --> 00:05:35.600 align:middle line:84%
over here to port 6200
running on the target system,

00:05:35.600 --> 00:05:40.910 align:middle line:84%
and then it says success shell
opened, and then says send exit

00:05:40.910 --> 00:05:41.930 align:middle line:90%
to quit shell.

00:05:41.930 --> 00:05:44.600 align:middle line:84%
All right, so we've
understood how it works.

00:05:44.600 --> 00:05:47.030 align:middle line:84%
And I'll explain
what's happening here

00:05:47.030 --> 00:05:50.150 align:middle line:84%
and why this exploit will
fail, even if you use

00:05:50.150 --> 00:05:52.020 align:middle line:90%
the Metasploit exploit module.

00:05:52.020 --> 00:05:55.040 align:middle line:84%
So let me just provide it
with executable permissions.

00:05:55.040 --> 00:06:01.010 align:middle line:84%
So chmod +x 49757, and
we can then say python3,

00:06:01.010 --> 00:06:02.990 align:middle line:84%
because this is a
Python 3 script.

00:06:02.990 --> 00:06:07.880 align:middle line:84%
So 49757, and we paste in
the target IP, hit Enter.

00:06:07.880 --> 00:06:10.650 align:middle line:84%
And as you can see, it's going
to say connection refused.

00:06:10.650 --> 00:06:12.440 align:middle line:84%
Now, why is it same
connection refused?

00:06:12.440 --> 00:06:15.770 align:middle line:84%
Well, it all comes down to
the actual vulnerability

00:06:15.770 --> 00:06:21.740 align:middle line:84%
within vsftpd, more
specifically on vsftpd 2.3.4.

00:06:21.740 --> 00:06:23.990 align:middle line:84%
You might be asking yourself,
well, what do you mean?

00:06:23.990 --> 00:06:27.050 align:middle line:84%
Well, this specific
version of vsftpd

00:06:27.050 --> 00:06:30.320 align:middle line:84%
has a vulnerability within
it, and more specifically

00:06:30.320 --> 00:06:32.070 align:middle line:90%
within 2.3.4.

00:06:32.070 --> 00:06:35.180 align:middle line:84%
So what happened here is
that somehow attackers

00:06:35.180 --> 00:06:39.110 align:middle line:84%
were able to modify the source
code for this specific version

00:06:39.110 --> 00:06:40.490 align:middle line:90%
of vsftpd.

00:06:40.490 --> 00:06:43.580 align:middle line:84%
And as part of that,
they included a backdoor

00:06:43.580 --> 00:06:46.020 align:middle line:84%
within the actual
service itself.

00:06:46.020 --> 00:06:48.050 align:middle line:84%
And that backdoor
would essentially

00:06:48.050 --> 00:06:50.300 align:middle line:90%
open or set up a bind--

00:06:50.300 --> 00:06:54.900 align:middle line:84%
it would essentially set up
a bind listener on port 6200,

00:06:54.900 --> 00:06:55.400 align:middle line:90%
right?

00:06:55.400 --> 00:06:57.500 align:middle line:84%
And as a result, an
attacker could easily

00:06:57.500 --> 00:06:59.690 align:middle line:84%
gain access to the target
system by connecting

00:06:59.690 --> 00:07:02.630 align:middle line:84%
to that bind listener
via netcat or telnet

00:07:02.630 --> 00:07:06.350 align:middle line:84%
or whatever other client
you want to utilize.

00:07:06.350 --> 00:07:08.480 align:middle line:84%
And in this case,
what has happened

00:07:08.480 --> 00:07:11.540 align:middle line:84%
is the administrator
of the Linux system

00:07:11.540 --> 00:07:14.120 align:middle line:84%
has actually gotten
rid of that backdoor.

00:07:14.120 --> 00:07:17.480 align:middle line:84%
So again, if we take a
look at the code again,

00:07:17.480 --> 00:07:22.570 align:middle line:84%
the actual exploit code here,
you can see that at the bottom,

00:07:22.570 --> 00:07:24.300 align:middle line:84%
it actually connects
with telnet.

00:07:24.300 --> 00:07:27.990 align:middle line:84%
So it specifies the target
IP and then port 6200.

00:07:27.990 --> 00:07:31.500 align:middle line:84%
And if we perform
a quick Nmap scan

00:07:31.500 --> 00:07:35.520 align:middle line:84%
on port 6200 on the target, we
should see that it is closed.

00:07:35.520 --> 00:07:38.220 align:middle line:84%
And again, that
highlights here the fact

00:07:38.220 --> 00:07:41.590 align:middle line:84%
that the backdoor was
removed by the administrator.

00:07:41.590 --> 00:07:43.060 align:middle line:90%
So that's a very good thing.

00:07:43.060 --> 00:07:46.080 align:middle line:84%
And of course, I can also
confirm this with you

00:07:46.080 --> 00:07:48.420 align:middle line:84%
that this is not really the
fault of the exploit code

00:07:48.420 --> 00:07:48.930 align:middle line:90%
itself.

00:07:48.930 --> 00:07:51.850 align:middle line:84%
It actually does not
need any modification.

00:07:51.850 --> 00:07:54.930 align:middle line:84%
We can run the same exploit
from within MSF console,

00:07:54.930 --> 00:07:57.220 align:middle line:84%
and you will see that
it will not work.

00:07:57.220 --> 00:08:00.960 align:middle line:84%
So we'll give this a
couple of seconds here,

00:08:00.960 --> 00:08:03.150 align:middle line:84%
and we can search for
the exploit module.

00:08:03.150 --> 00:08:07.020 align:middle line:90%
So we'll say search vsftpd.

00:08:07.020 --> 00:08:08.650 align:middle line:84%
There we are, and
that's the one there.

00:08:08.650 --> 00:08:10.440 align:middle line:84%
So that is backdoor
command execution.

00:08:10.440 --> 00:08:12.630 align:middle line:90%
So I'll say use 0.

00:08:12.630 --> 00:08:15.240 align:middle line:84%
I can then set the
RHOST to the target IP,

00:08:15.240 --> 00:08:16.915 align:middle line:90%
so set RHOST's there.

00:08:16.915 --> 00:08:18.540 align:middle line:84%
We can show the
options whether we need

00:08:18.540 --> 00:08:20.400 align:middle line:90%
to configure anything else.

00:08:20.400 --> 00:08:21.900 align:middle line:84%
Those are the only
options required.

00:08:21.900 --> 00:08:24.660 align:middle line:84%
And if you want to learn more
about this particular exploit

00:08:24.660 --> 00:08:27.472 align:middle line:84%
or this vulnerability, you
can see that it provides you

00:08:27.472 --> 00:08:28.680 align:middle line:90%
with a very good description.

00:08:28.680 --> 00:08:30.570 align:middle line:84%
So you can see this
module exploits

00:08:30.570 --> 00:08:34.740 align:middle line:84%
a malicious back door that was
added to the vsftpd download

00:08:34.740 --> 00:08:35.490 align:middle line:90%
archive.

00:08:35.490 --> 00:08:39.539 align:middle line:84%
This backdoor was introduced
into the vsftpd 2.3.4

00:08:39.539 --> 00:08:44.430 align:middle line:84%
tarball archives between June
the 30th, 2011, and July 1,

00:08:44.430 --> 00:08:48.190 align:middle line:84%
2011, according to the most
recent information available.

00:08:48.190 --> 00:08:51.450 align:middle line:84%
This backdoor was removed
on July the 3rd, 2011.

00:08:51.450 --> 00:08:54.330 align:middle line:84%
So that was the updated
version of vsftpd.

00:08:54.330 --> 00:08:58.320 align:middle line:84%
The point here being is
that that backdoor has been

00:08:58.320 --> 00:08:59.950 align:middle line:90%
disabled by the administrator.

00:08:59.950 --> 00:09:03.340 align:middle line:84%
Now, if it wasn't disabled
and port 6200 was open,

00:09:03.340 --> 00:09:05.190 align:middle line:84%
then we would have
been able to obtain

00:09:05.190 --> 00:09:08.970 align:middle line:84%
a telnet session, or
rather a standard bash

00:09:08.970 --> 00:09:11.310 align:middle line:90%
session on the target system.

00:09:11.310 --> 00:09:13.950 align:middle line:84%
OK, so again, we
can test this out.

00:09:13.950 --> 00:09:16.410 align:middle line:84%
I can say exploit,
hit Enter, and it's

00:09:16.410 --> 00:09:18.690 align:middle line:90%
going to connect to FTP.

00:09:18.690 --> 00:09:21.420 align:middle line:84%
And in this case, you
can see it says user

00:09:21.420 --> 00:09:22.890 align:middle line:90%
please specify the password.

00:09:22.890 --> 00:09:25.690 align:middle line:84%
Exploit completed, but
no session was created.

00:09:25.690 --> 00:09:27.100 align:middle line:90%
So that will fail.

00:09:27.100 --> 00:09:29.850 align:middle line:84%
Now, most of you might have
been excited by that prospect

00:09:29.850 --> 00:09:33.300 align:middle line:84%
and thought you could
exploit it either through

00:09:33.300 --> 00:09:36.600 align:middle line:84%
the Python script or the Python
exploit or the Metasploit

00:09:36.600 --> 00:09:37.890 align:middle line:90%
framework.

00:09:37.890 --> 00:09:40.320 align:middle line:84%
The main lesson here that
I wanted to highlight

00:09:40.320 --> 00:09:43.530 align:middle line:84%
is that in most cases
or in some cases,

00:09:43.530 --> 00:09:46.735 align:middle line:84%
exploits will not work because
they may have been patched,

00:09:46.735 --> 00:09:49.110 align:middle line:84%
and that's something that you
have to actually understand

00:09:49.110 --> 00:09:52.430 align:middle line:84%
as a system administrator
or as a penetration tester.

00:09:52.430 --> 00:09:54.930 align:middle line:84%
You have to understand that
from the perspective of a system

00:09:54.930 --> 00:09:58.050 align:middle line:84%
administrator, whenever there's
a vulnerability discovered,

00:09:58.050 --> 00:10:01.140 align:middle line:84%
they have the ability to
update the affected service

00:10:01.140 --> 00:10:04.200 align:middle line:84%
or they can actually
patch it manually.

00:10:04.200 --> 00:10:06.450 align:middle line:84%
And one of the patching
techniques in this case

00:10:06.450 --> 00:10:09.660 align:middle line:84%
is to get rid of that
backdoor, or to block that port

00:10:09.660 --> 00:10:12.040 align:middle line:84%
from being accessed
via a firewall.

00:10:12.040 --> 00:10:14.730 align:middle line:84%
So always be cognizant
of that, and again,

00:10:14.730 --> 00:10:17.280 align:middle line:84%
do not put all your
eggs in one basket.

00:10:17.280 --> 00:10:18.540 align:middle line:90%
All right, so that has failed.

00:10:18.540 --> 00:10:20.140 align:middle line:90%
What can we do next?

00:10:20.140 --> 00:10:21.870 align:middle line:84%
So I'll just get rid
of the exploit code

00:10:21.870 --> 00:10:24.480 align:middle line:84%
here that I copied because
we don't need it anymore.

00:10:24.480 --> 00:10:27.310 align:middle line:84%
Well, the next obvious step
is to perform a brute force

00:10:27.310 --> 00:10:27.810 align:middle line:90%
attack.

00:10:27.810 --> 00:10:29.940 align:middle line:84%
However, I also
want to highlight

00:10:29.940 --> 00:10:32.610 align:middle line:84%
a few additional
techniques here that we

00:10:32.610 --> 00:10:36.030 align:middle line:84%
didn't explore in the
Windows exploitation section.

00:10:36.030 --> 00:10:39.600 align:middle line:84%
In that section, when we
were performing a brute force

00:10:39.600 --> 00:10:42.840 align:middle line:84%
on FTP, we were performing
a brute force for both

00:10:42.840 --> 00:10:44.490 align:middle line:90%
the username and password.

00:10:44.490 --> 00:10:48.570 align:middle line:84%
But if we remember correctly,
the Linux target system

00:10:48.570 --> 00:10:50.370 align:middle line:90%
is running SMPT, right?

00:10:50.370 --> 00:10:51.820 align:middle line:90%
So let's actually verify that.

00:10:51.820 --> 00:10:56.130 align:middle line:84%
So if I say Nmap
and sv port 25, that

00:10:56.130 --> 00:11:00.180 align:middle line:90%
is the default port for SMTP.

00:11:00.180 --> 00:11:02.760 align:middle line:84%
Let me type that in
correctly, so port 25,

00:11:02.760 --> 00:11:05.130 align:middle line:90%
and paste in the target IP.

00:11:05.130 --> 00:11:06.575 align:middle line:84%
You'll see that
it's running SMTP.

00:11:06.575 --> 00:11:08.200 align:middle line:84%
Now you might be
wondering to yourself,

00:11:08.200 --> 00:11:10.140 align:middle line:84%
why are we taking
a look at SMTP?

00:11:10.140 --> 00:11:13.320 align:middle line:84%
Well, SMTP provides us
with a really easy way

00:11:13.320 --> 00:11:16.560 align:middle line:84%
of identifying user
accounts on a target system,

00:11:16.560 --> 00:11:18.690 align:middle line:84%
and in this case, a
Linux target system.

00:11:18.690 --> 00:11:20.670 align:middle line:84%
And what that can
do is it can help

00:11:20.670 --> 00:11:24.180 align:middle line:84%
us narrow down our brute force
attack in terms of obtaining

00:11:24.180 --> 00:11:26.250 align:middle line:84%
legitimate credentials
that can then provide us

00:11:26.250 --> 00:11:30.030 align:middle line:84%
with access to the
target system via FTP

00:11:30.030 --> 00:11:33.960 align:middle line:84%
and consequently provide us with
access through a reverse shell.

00:11:33.960 --> 00:11:37.350 align:middle line:84%
So how can we perform
a brute force on SMTP

00:11:37.350 --> 00:11:42.360 align:middle line:84%
and identify system
accounts really easily?

00:11:42.360 --> 00:11:45.090 align:middle line:84%
Well, in order to do
this, we can open up

00:11:45.090 --> 00:11:48.210 align:middle line:84%
MSF console because there
is a really cool module that

00:11:48.210 --> 00:11:51.140 align:middle line:84%
will essentially
streamline this process.

00:11:51.140 --> 00:11:57.160 align:middle line:84%
And the name of the
module is SMTP--

00:11:57.160 --> 00:11:59.890 align:middle line:90%
I think it's smpt_enum.

00:11:59.890 --> 00:12:01.270 align:middle line:90%
So we can search for it here.

00:12:01.270 --> 00:12:05.170 align:middle line:90%
So search smtp_enum.

00:12:05.170 --> 00:12:07.687 align:middle line:84%
And that's the one
there, so use 0.

00:12:07.687 --> 00:12:09.145 align:middle line:84%
And as you can see
the description,

00:12:09.145 --> 00:12:13.310 align:middle line:84%
it tells you that it's an
SMTP user enumeration utility.

00:12:13.310 --> 00:12:15.580 align:middle line:90%
So I'll show the options here.

00:12:15.580 --> 00:12:17.740 align:middle line:84%
We need to specify
the target IP.

00:12:17.740 --> 00:12:19.610 align:middle line:84%
The target port
is set correctly.

00:12:19.610 --> 00:12:22.090 align:middle line:84%
And the default user
file it's going to use

00:12:22.090 --> 00:12:25.360 align:middle line:84%
is on the user share
Metasploit framework data,

00:12:25.360 --> 00:12:27.160 align:middle line:90%
where it lists Unix users.

00:12:27.160 --> 00:12:31.300 align:middle line:84%
Now, because the target is
running Linux or really Unix,

00:12:31.300 --> 00:12:34.510 align:middle line:84%
for that matter, make sure
that the Unix only option is

00:12:34.510 --> 00:12:36.970 align:middle line:84%
set to true, and we can
use the default word

00:12:36.970 --> 00:12:38.570 align:middle line:90%
list that is recommended here.

00:12:38.570 --> 00:12:43.630 align:middle line:84%
So I'll set the target IP,
RHOSTS, target IP, hit Enter,

00:12:43.630 --> 00:12:45.010 align:middle line:90%
and then I can hit Run.

00:12:45.010 --> 00:12:46.960 align:middle line:84%
Now, this is going to
take a couple of seconds

00:12:46.960 --> 00:12:48.620 align:middle line:84%
to a couple of
minutes to complete.

00:12:48.620 --> 00:12:50.830 align:middle line:84%
So I'm actually just
going to let it run,

00:12:50.830 --> 00:12:54.250 align:middle line:84%
and we should be able to
identify user accounts

00:12:54.250 --> 00:12:55.780 align:middle line:84%
on the system that
we can then use

00:12:55.780 --> 00:12:57.490 align:middle line:84%
to narrow down our
brute force attack

00:12:57.490 --> 00:13:00.890 align:middle line:84%
or to make our brute force
attack more efficient.

00:13:00.890 --> 00:13:03.920 align:middle line:84%
So I'm just going to wait
for this to complete.

00:13:03.920 --> 00:13:06.950 align:middle line:84%
All right, so the enumeration
process is complete.

00:13:06.950 --> 00:13:10.300 align:middle line:84%
And as you can see, it did
find valid user and service

00:13:10.300 --> 00:13:11.170 align:middle line:90%
accounts.

00:13:11.170 --> 00:13:14.890 align:middle line:84%
So for example, it looks like
we have service accounts called

00:13:14.890 --> 00:13:21.240 align:middle line:84%
backup, daemon, ftp, irc,
lp, mail, so on and so forth,

00:13:21.240 --> 00:13:22.220 align:middle line:90%
dot dot dot, data.

00:13:22.220 --> 00:13:25.310 align:middle line:84%
So we know that this
indeed is correct.

00:13:25.310 --> 00:13:28.000 align:middle line:84%
So again, these are all
valid user accounts,

00:13:28.000 --> 00:13:29.960 align:middle line:84%
more specifically,
service accounts,

00:13:29.960 --> 00:13:32.350 align:middle line:84%
which are very different than
user accounts on the target

00:13:32.350 --> 00:13:33.220 align:middle line:90%
system.

00:13:33.220 --> 00:13:37.170 align:middle line:84%
And we can now utilize this to
narrow down our FTP brute force

00:13:37.170 --> 00:13:37.670 align:middle line:90%
attack.

00:13:37.670 --> 00:13:39.940 align:middle line:84%
So I'll just paste
them in there.

00:13:39.940 --> 00:13:43.240 align:middle line:84%
And the account that I'm
particularly interested in

00:13:43.240 --> 00:13:45.550 align:middle line:84%
is the one called
service, because again,

00:13:45.550 --> 00:13:47.950 align:middle line:84%
there really isn't a
service called service.

00:13:47.950 --> 00:13:51.100 align:middle line:84%
Service accounts are typically
named after the service

00:13:51.100 --> 00:13:52.550 align:middle line:90%
that they are used to manage.

00:13:52.550 --> 00:13:57.520 align:middle line:84%
So for example, we have
backup, bin, FTP, games.

00:13:57.520 --> 00:13:59.970 align:middle line:84%
Those are the typical Linux
accounts that you will see.

00:13:59.970 --> 00:14:03.280 align:middle line:84%
You'll also have postmaster,
Postgres for managing

00:14:03.280 --> 00:14:07.640 align:middle line:84%
the PostgreSQL database
service, MySQL SSHD, et cetera.

00:14:07.640 --> 00:14:09.650 align:middle line:90%
So this one really stands out.

00:14:09.650 --> 00:14:11.410 align:middle line:84%
So we're going to
use service, OK?

00:14:11.410 --> 00:14:13.190 align:middle line:90%
So just keep that in mind.

00:14:13.190 --> 00:14:15.560 align:middle line:84%
Now that we've
identified user accounts,

00:14:15.560 --> 00:14:18.820 align:middle line:84%
we can actually perform
the actual FTP brute force.

00:14:18.820 --> 00:14:21.010 align:middle line:90%
So I'll just exit from there.

00:14:21.010 --> 00:14:23.038 align:middle line:84%
And in order to perform
the FTP brute force,

00:14:23.038 --> 00:14:24.580 align:middle line:84%
you should be familiar
with this now.

00:14:24.580 --> 00:14:27.410 align:middle line:84%
We can just say hydra
and we have the user,

00:14:27.410 --> 00:14:29.110 align:middle line:90%
so the user is service.

00:14:29.110 --> 00:14:32.380 align:middle line:84%
And we can use the
same word list first

00:14:32.380 --> 00:14:37.220 align:middle line:84%
that was actually recommended
to us with the smtp_enum module.

00:14:37.220 --> 00:14:42.160 align:middle line:84%
So that is on the user
share Metasploit framework

00:14:42.160 --> 00:14:46.630 align:middle line:84%
under data, I believe, yeah,
data, and then word lists.

00:14:46.630 --> 00:14:49.870 align:middle line:84%
And that the one that was
recommended was Unix users,

00:14:49.870 --> 00:14:52.540 align:middle line:84%
and we can also try Unix
passwords if this doesn't work.

00:14:52.540 --> 00:14:56.410 align:middle line:84%
So Unix users, paste
in the target IP, which

00:14:56.410 --> 00:15:00.100 align:middle line:84%
I've just I've actually
just pasted in the user

00:15:00.100 --> 00:15:01.090 align:middle line:90%
accounts that I copied.

00:15:01.090 --> 00:15:04.760 align:middle line:84%
So again, I can just get the
target IP really quickly here.

00:15:04.760 --> 00:15:09.700 align:middle line:84%
So ping demo.ine.local, because
I don't have it at hand,

00:15:09.700 --> 00:15:11.470 align:middle line:90%
and that's the target IP there.

00:15:11.470 --> 00:15:16.760 align:middle line:84%
And then I can just say
hydra -l service, and then

00:15:16.760 --> 00:15:18.230 align:middle line:84%
the password list
or the word list

00:15:18.230 --> 00:15:20.600 align:middle line:90%
that contains the passwords.

00:15:20.600 --> 00:15:23.720 align:middle line:84%
Let me just type that in
correctly is user share

00:15:23.720 --> 00:15:27.830 align:middle line:84%
Metasploit framework
under data, word lists,

00:15:27.830 --> 00:15:31.880 align:middle line:84%
and we're using common,
or rather Unix users,

00:15:31.880 --> 00:15:36.410 align:middle line:84%
unix_users.txt, and we paste in
the target IP and the protocol,

00:15:36.410 --> 00:15:38.000 align:middle line:90%
which in this case is FTP.

00:15:38.000 --> 00:15:40.920 align:middle line:84%
We can hit Enter, and that is
going to begin the brute force

00:15:40.920 --> 00:15:41.420 align:middle line:90%
attack.

00:15:41.420 --> 00:15:45.200 align:middle line:84%
And let's see if we
can identify whether we

00:15:45.200 --> 00:15:48.170 align:middle line:84%
can find any legitimate FTP
credentials that we can then

00:15:48.170 --> 00:15:50.090 align:middle line:84%
use to log onto
the target system.

00:15:50.090 --> 00:15:54.170 align:middle line:84%
And of course, this will
probably also give us access

00:15:54.170 --> 00:15:56.480 align:middle line:90%
to the target system via SSH.

00:15:56.480 --> 00:15:59.240 align:middle line:84%
So if we are able to find
credentials for the service

00:15:59.240 --> 00:16:01.220 align:middle line:84%
account, then that
might be a good thing.

00:16:01.220 --> 00:16:01.790 align:middle line:90%
There we are.

00:16:01.790 --> 00:16:06.020 align:middle line:84%
We can see we get the password
for the service account,

00:16:06.020 --> 00:16:07.470 align:middle line:90%
and the password is service.

00:16:07.470 --> 00:16:09.650 align:middle line:84%
So that's fairly
simple to understand.

00:16:09.650 --> 00:16:12.140 align:middle line:84%
And of course, you can go
ahead and perform a brute force

00:16:12.140 --> 00:16:13.860 align:middle line:84%
attack for the
user account here,

00:16:13.860 --> 00:16:15.770 align:middle line:90%
the user account called user.

00:16:15.770 --> 00:16:18.620 align:middle line:84%
And the reason why I'm saying
why you shouldn't perform

00:16:18.620 --> 00:16:20.750 align:middle line:84%
a brute force attack on
the other user accounts,

00:16:20.750 --> 00:16:23.240 align:middle line:84%
specifically the service
accounts, is they

00:16:23.240 --> 00:16:25.850 align:middle line:90%
really don't have any passwords.

00:16:25.850 --> 00:16:28.790 align:middle line:84%
So performing a brute
force attack on them

00:16:28.790 --> 00:16:30.330 align:middle line:90%
will not yield any results.

00:16:30.330 --> 00:16:33.620 align:middle line:84%
So you need to be able to
identify or differentiate user

00:16:33.620 --> 00:16:35.790 align:middle line:90%
accounts from service accounts.

00:16:35.790 --> 00:16:39.170 align:middle line:84%
So now that we have identified
legitimate credentials,

00:16:39.170 --> 00:16:43.160 align:middle line:84%
we can log in to the FTP server
by saying FTP, target IP,

00:16:43.160 --> 00:16:44.990 align:middle line:90%
and the port, which is 21.

00:16:44.990 --> 00:16:49.088 align:middle line:84%
We'll say service and
service for the password.

00:16:49.088 --> 00:16:49.630 align:middle line:90%
There we are.

00:16:49.630 --> 00:16:50.950 align:middle line:90%
Login successful.

00:16:50.950 --> 00:16:52.450 align:middle line:90%
And I'll clear out the terminal.

00:16:52.450 --> 00:16:54.580 align:middle line:84%
And if I print my current
working directory,

00:16:54.580 --> 00:16:55.870 align:middle line:90%
I'm under home service.

00:16:55.870 --> 00:16:57.700 align:middle line:84%
Or as I said, that's
a user account.

00:16:57.700 --> 00:17:01.030 align:middle line:84%
And the reason I'm able to tell
that is because the actual home

00:17:01.030 --> 00:17:04.450 align:middle line:84%
directory for this account is
stored in the home directory,

00:17:04.450 --> 00:17:05.930 align:middle line:90%
so that's a user account.

00:17:05.930 --> 00:17:08.020 align:middle line:84%
So what can we do with
this user account?

00:17:08.020 --> 00:17:09.535 align:middle line:90%
What's within this folder?

00:17:09.535 --> 00:17:11.410 align:middle line:84%
We can see that we don't
have anything there.

00:17:11.410 --> 00:17:14.290 align:middle line:84%
Can we navigate to the
root of the file system?

00:17:14.290 --> 00:17:15.250 align:middle line:90%
Yes, we can.

00:17:15.250 --> 00:17:17.560 align:middle line:84%
So we list all the contents
of the file system.

00:17:17.560 --> 00:17:20.800 align:middle line:84%
You can see we can now navigate
around the entire Linux file

00:17:20.800 --> 00:17:24.099 align:middle line:84%
system make changes, upload
files, download files,

00:17:24.099 --> 00:17:24.910 align:middle line:90%
et cetera.

00:17:24.910 --> 00:17:27.790 align:middle line:84%
Now, what do we do with
this type of access, right?

00:17:27.790 --> 00:17:30.910 align:middle line:84%
As an attacker, we can look
for data, exfiltrate data.

00:17:30.910 --> 00:17:33.700 align:middle line:84%
This is as good as having
access on the target system,

00:17:33.700 --> 00:17:37.060 align:middle line:84%
with a few exceptions, in that
we cannot execute commands that

00:17:37.060 --> 00:17:38.900 align:middle line:84%
you typically would
be able to execute.

00:17:38.900 --> 00:17:41.750 align:middle line:84%
If you had a reverse
shell on the system.

00:17:41.750 --> 00:17:45.580 align:middle line:84%
So if we remember
correctly, the target system

00:17:45.580 --> 00:17:48.690 align:middle line:90%
is running a web server, right?

00:17:48.690 --> 00:17:51.150 align:middle line:84%
And it's running the
web server on port 80.

00:17:51.150 --> 00:17:53.400 align:middle line:84%
So let's see if we can
actually access the web server.

00:17:53.400 --> 00:17:53.942 align:middle line:90%
There we are.

00:17:53.942 --> 00:17:56.820 align:middle line:84%
You can see that we have
multiple web applications.

00:17:56.820 --> 00:18:00.270 align:middle line:84%
And the one that's really
interesting to me is WebDAV.

00:18:00.270 --> 00:18:01.380 align:middle line:90%
Right now, WebDAV--

00:18:01.380 --> 00:18:04.470 align:middle line:84%
I've already
explained what WebDAV

00:18:04.470 --> 00:18:06.870 align:middle line:84%
is used for in regards
to storing of files

00:18:06.870 --> 00:18:08.730 align:middle line:90%
and the sharing of documents.

00:18:08.730 --> 00:18:12.690 align:middle line:84%
But what this means is that
this folder will essentially--

00:18:12.690 --> 00:18:14.220 align:middle line:84%
we can essentially
use this folder

00:18:14.220 --> 00:18:16.530 align:middle line:84%
to upload any files that
we would like to upload.

00:18:16.530 --> 00:18:18.960 align:middle line:84%
Now, if we wanted to
gain a reverse shell,

00:18:18.960 --> 00:18:22.950 align:middle line:84%
we can actually upload a PHP
reverse shell to this directory

00:18:22.950 --> 00:18:26.430 align:middle line:84%
and then execute it or
launch it with the browser

00:18:26.430 --> 00:18:29.190 align:middle line:84%
and we should receive a
reverse shell if we set up

00:18:29.190 --> 00:18:30.270 align:middle line:90%
the netcat listener.

00:18:30.270 --> 00:18:33.720 align:middle line:84%
So how do we obtain
a reverse shell?

00:18:33.720 --> 00:18:36.060 align:middle line:84%
Well, the easiest
way we can obtain one

00:18:36.060 --> 00:18:38.430 align:middle line:84%
is either to generate
one with MSF venom,

00:18:38.430 --> 00:18:42.600 align:middle line:84%
or alternatively, take advantage
of your Kali Linux system.

00:18:42.600 --> 00:18:48.570 align:middle line:84%
And if you take a look at the
directory under user share

00:18:48.570 --> 00:18:51.960 align:middle line:84%
and web shells, that
directory contains a list

00:18:51.960 --> 00:18:54.690 align:middle line:84%
of shells that have
again been developed

00:18:54.690 --> 00:18:57.120 align:middle line:84%
in different languages
based on your own use case.

00:18:57.120 --> 00:19:00.420 align:middle line:84%
And in this case, we're
looking for PHP web shells.

00:19:00.420 --> 00:19:02.580 align:middle line:84%
Now again, you might
be asking yourself

00:19:02.580 --> 00:19:05.190 align:middle line:84%
if you're not familiar with
Apache and Linux and the LAMP

00:19:05.190 --> 00:19:08.400 align:middle line:84%
stack in general, why
we're uploading PHP.

00:19:08.400 --> 00:19:10.900 align:middle line:84%
Well, if you remember
in the previous section,

00:19:10.900 --> 00:19:14.130 align:middle line:84%
where we were covering
Windows exploitation,

00:19:14.130 --> 00:19:17.250 align:middle line:84%
the web server technology
was Microsoft IIS,

00:19:17.250 --> 00:19:20.880 align:middle line:84%
which meant that the only
files that could be executed

00:19:20.880 --> 00:19:23.280 align:middle line:84%
or the only file extensions
that could be executed

00:19:23.280 --> 00:19:26.010 align:middle line:90%
were ASP or ASPX.

00:19:26.010 --> 00:19:29.130 align:middle line:84%
Now, in the context
of Apache and Linux,

00:19:29.130 --> 00:19:30.750 align:middle line:90%
that is going to be PHP, right?

00:19:30.750 --> 00:19:32.520 align:middle line:90%
So we need a PHP reverse shell.

00:19:32.520 --> 00:19:36.600 align:middle line:84%
So within this directory,
we have a PHP backdoor.

00:19:36.600 --> 00:19:40.620 align:middle line:84%
We also have a QSD PHP backdoor
and a simple back door.

00:19:40.620 --> 00:19:43.590 align:middle line:84%
What we are looking for
is the PHP reverse shell

00:19:43.590 --> 00:19:46.500 align:middle line:84%
that will actually provide us
with a proper reverse shell.

00:19:46.500 --> 00:19:49.770 align:middle line:84%
And all we need to do is
just copy this PHP reverse

00:19:49.770 --> 00:19:51.750 align:middle line:84%
shell to our current
working directory,

00:19:51.750 --> 00:19:56.550 align:middle line:84%
modify it, and specify our
Kali Linux IP address, as well

00:19:56.550 --> 00:19:59.970 align:middle line:84%
as the port that we want to
be listening on or the port

00:19:59.970 --> 00:20:02.340 align:middle line:84%
that the actual target
will connect to,

00:20:02.340 --> 00:20:04.620 align:middle line:84%
and we should receive
a PHP reverse shell.

00:20:04.620 --> 00:20:10.530 align:middle line:84%
So what I'll do here is I'll
say copy user share and web

00:20:10.530 --> 00:20:16.250 align:middle line:84%
shells PHP, and we're going
to copy over the PHP reverse

00:20:16.250 --> 00:20:19.320 align:middle line:84%
shell to our current
working directory.

00:20:19.320 --> 00:20:22.737 align:middle line:84%
So if we list all the actual
contents of this directory,

00:20:22.737 --> 00:20:24.320 align:middle line:84%
you can see we have
PHP reverse shell.

00:20:24.320 --> 00:20:29.000 align:middle line:84%
I'm just going to rename it
to shell.php, there we are,

00:20:29.000 --> 00:20:31.250 align:middle line:84%
so that it's easier
to essentially upload

00:20:31.250 --> 00:20:32.480 align:middle line:90%
and identify.

00:20:32.480 --> 00:20:34.380 align:middle line:84%
I'm then going to
open it up with Vim.

00:20:34.380 --> 00:20:36.840 align:middle line:84%
You can use any other
text editor you want.

00:20:36.840 --> 00:20:41.605 align:middle line:84%
And again, this is a very simple
PHP reverse shell to modify.

00:20:41.605 --> 00:20:42.980 align:middle line:84%
The only thing
you need to change

00:20:42.980 --> 00:20:45.560 align:middle line:84%
is this value here,
or this variable.

00:20:45.560 --> 00:20:47.840 align:middle line:84%
This is going to be
your Kali Linux IP,

00:20:47.840 --> 00:20:49.370 align:middle line:90%
so we need to identify that.

00:20:49.370 --> 00:20:51.510 align:middle line:84%
In your case, your IP is
going to be different,

00:20:51.510 --> 00:20:53.670 align:middle line:90%
so please do take note of that.

00:20:53.670 --> 00:20:57.590 align:middle line:84%
So I'll say ifconfig, and my
IP address is on ethernet 1,

00:20:57.590 --> 00:20:59.810 align:middle line:84%
so I'll copy that
there and I'll just--

00:20:59.810 --> 00:21:02.990 align:middle line:84%
we can actually leave that
open for the Netcat listener.

00:21:02.990 --> 00:21:05.930 align:middle line:84%
So we'll all go right
over here, and you

00:21:05.930 --> 00:21:08.370 align:middle line:84%
can see it actually
tells you to change this.

00:21:08.370 --> 00:21:13.100 align:middle line:84%
So I'll get rid of that IP there
and paste in my Kali Linux IP,

00:21:13.100 --> 00:21:15.170 align:middle line:90%
and for the port, that is 1234.

00:21:15.170 --> 00:21:18.547 align:middle line:84%
So this information,
again, is very important

00:21:18.547 --> 00:21:19.880 align:middle line:90%
because this is a reverse shell.

00:21:19.880 --> 00:21:21.650 align:middle line:84%
And if you remember,
if you actually

00:21:21.650 --> 00:21:25.430 align:middle line:84%
recall how reverse shells
work, reverse shells

00:21:25.430 --> 00:21:27.620 align:middle line:84%
essentially entail
or involve the target

00:21:27.620 --> 00:21:29.900 align:middle line:84%
connecting back to
the attacker system.

00:21:29.900 --> 00:21:35.720 align:middle line:84%
And in order to connect back
to the attacker's listener,

00:21:35.720 --> 00:21:40.153 align:middle line:84%
the actual attacker system
requires the target IP,

00:21:40.153 --> 00:21:42.320 align:middle line:84%
or rather the attacker's
IP address, which I've just

00:21:42.320 --> 00:21:44.283 align:middle line:84%
specified here,
and then the port

00:21:44.283 --> 00:21:46.200 align:middle line:84%
that we're currently
going to be listening on,

00:21:46.200 --> 00:21:47.960 align:middle line:90%
which in this case is 1234.

00:21:47.960 --> 00:21:49.970 align:middle line:90%
So we can write and quit.

00:21:49.970 --> 00:21:52.200 align:middle line:84%
And we can set up the
Netcat listener here.

00:21:52.200 --> 00:21:57.290 align:middle line:84%
So I'll say netcat nvlp 1234,
and we'll have that ready.

00:21:57.290 --> 00:22:00.110 align:middle line:84%
We can now log in
with FTP again.

00:22:00.110 --> 00:22:04.610 align:middle line:84%
So there we are, and we log
in with the service account,

00:22:04.610 --> 00:22:06.560 align:middle line:90%
and the password is service.

00:22:06.560 --> 00:22:09.600 align:middle line:84%
And we'll navigate to the
root of the file system.

00:22:09.600 --> 00:22:13.100 align:middle line:84%
Now, the default directory where
Apache stores all of its data

00:22:13.100 --> 00:22:17.410 align:middle line:84%
is under var www, so
we'll navigate to var www.

00:22:17.410 --> 00:22:19.580 align:middle line:84%
And as you can see
within this directory,

00:22:19.580 --> 00:22:22.820 align:middle line:84%
we have a phpMyAdmin,
mutillidae, dvwa,

00:22:22.820 --> 00:22:24.150 align:middle line:90%
and the dav directory.

00:22:24.150 --> 00:22:26.330 align:middle line:84%
So I'll show you
why we are going

00:22:26.330 --> 00:22:27.650 align:middle line:90%
to be using the dav directory.

00:22:27.650 --> 00:22:30.000 align:middle line:84%
If I say put or
upload, in this case,

00:22:30.000 --> 00:22:34.850 align:middle line:84%
I'm uploading put shell.php,
you can see right over here it's

00:22:34.850 --> 00:22:36.590 align:middle line:84%
going to say could
not create file.

00:22:36.590 --> 00:22:39.560 align:middle line:84%
And that's because we don't
have the necessary permissions

00:22:39.560 --> 00:22:42.800 align:middle line:84%
to upload files with our current
access or the credentials

00:22:42.800 --> 00:22:44.090 align:middle line:90%
that we currently got.

00:22:44.090 --> 00:22:46.460 align:middle line:84%
So the only folder that
we can make changes

00:22:46.460 --> 00:22:49.100 align:middle line:84%
to that can be
used to execute PHP

00:22:49.100 --> 00:22:51.110 align:middle line:90%
is the dav directory, right?

00:22:51.110 --> 00:22:55.670 align:middle line:84%
So I'll say put
shell.php, hit Enter,

00:22:55.670 --> 00:22:57.930 align:middle line:84%
and you can see
transfer is complete.

00:22:57.930 --> 00:22:59.690 align:middle line:84%
So if we go back
into the browser

00:22:59.690 --> 00:23:02.030 align:middle line:84%
and we refresh the
dav directory here,

00:23:02.030 --> 00:23:03.860 align:middle line:90%
you can see we have shell.php.

00:23:03.860 --> 00:23:08.480 align:middle line:84%
Now, I want you to actually pay
close attention to the listener

00:23:08.480 --> 00:23:09.360 align:middle line:90%
here.

00:23:09.360 --> 00:23:11.570 align:middle line:84%
So I'm just going to
clear that out there,

00:23:11.570 --> 00:23:15.050 align:middle line:84%
and I'll set up a new listener
here so that it's much clearer

00:23:15.050 --> 00:23:15.990 align:middle line:90%
for you.

00:23:15.990 --> 00:23:18.170 align:middle line:84%
So once I click
on shell.php, it's

00:23:18.170 --> 00:23:21.890 align:middle line:84%
going to be executed right
over here on the server side,

00:23:21.890 --> 00:23:25.340 align:middle line:84%
and it will connect to our
Kali Linux IP on the listener

00:23:25.340 --> 00:23:27.540 align:middle line:84%
or on the port that we are
currently listening on.

00:23:27.540 --> 00:23:29.720 align:middle line:84%
So I'll click on it,
and immediately you

00:23:29.720 --> 00:23:31.850 align:middle line:84%
can see right over here
we get a connection

00:23:31.850 --> 00:23:35.390 align:middle line:84%
and we are provided with
a bone PowerShell session

00:23:35.390 --> 00:23:39.020 align:middle line:84%
and the current user that
we have access to is data.

00:23:39.020 --> 00:23:41.210 align:middle line:84%
That is a service
account that is

00:23:41.210 --> 00:23:43.220 align:middle line:90%
used to manage Apache, right?

00:23:43.220 --> 00:23:48.370 align:middle line:84%
So we can obtain a bash
session by saying bin bash -i

00:23:48.370 --> 00:23:49.062 align:middle line:90%
and hit Enter.

00:23:49.062 --> 00:23:50.020 align:middle line:90%
And there we are, bash.

00:23:50.020 --> 00:23:53.170 align:middle line:84%
And we currently have access as
an unprivileged service account

00:23:53.170 --> 00:23:56.020 align:middle line:84%
user, but nonetheless we
have still obtained access

00:23:56.020 --> 00:23:57.590 align:middle line:90%
to the target system.

00:23:57.590 --> 00:23:59.690 align:middle line:84%
And this is really,
really exciting.

00:23:59.690 --> 00:24:03.110 align:middle line:84%
So you can now navigate
around the file system.

00:24:03.110 --> 00:24:05.320 align:middle line:84%
So can we access
the root directory?

00:24:05.320 --> 00:24:07.411 align:middle line:90%
It looks like we can.

00:24:07.411 --> 00:24:15.140 align:middle line:90%
And can we access var www?

00:24:15.140 --> 00:24:15.760 align:middle line:90%
There we are.

00:24:15.760 --> 00:24:16.690 align:middle line:90%
Yes, we can.

00:24:16.690 --> 00:24:18.730 align:middle line:84%
And given our
current permissions,

00:24:18.730 --> 00:24:21.130 align:middle line:84%
we can now upload
files to any directory

00:24:21.130 --> 00:24:27.010 align:middle line:84%
that we want as opposed to when
we had access via the service

00:24:27.010 --> 00:24:28.840 align:middle line:90%
account via FTP.

00:24:28.840 --> 00:24:33.340 align:middle line:84%
So that is how to obtain
a reverse shell via FTP,

00:24:33.340 --> 00:24:36.820 align:middle line:90%
more specifically on Linux.

00:24:36.820 --> 00:24:40.480 align:middle line:84%
And in the previous, in the
Windows exploitation section,

00:24:40.480 --> 00:24:44.110 align:middle line:84%
we weren't able to obtain
a reverse shell because ASP

00:24:44.110 --> 00:24:47.650 align:middle line:84%
files were not being executed
or ASP reverse shells were not

00:24:47.650 --> 00:24:51.200 align:middle line:84%
being executed, so we had to
find another way around that.

00:24:51.200 --> 00:24:54.400 align:middle line:84%
And in this case, we've been
able to get an initial foothold

00:24:54.400 --> 00:24:55.430 align:middle line:90%
on the target system.

00:24:55.430 --> 00:24:57.460 align:middle line:90%
So this is very, very good.

00:24:57.460 --> 00:24:59.410 align:middle line:84%
All right, so that
is going to conclude

00:24:59.410 --> 00:25:03.950 align:middle line:84%
the practical demonstration
side of this video.

00:25:03.950 --> 00:25:06.123 align:middle line:84%
All right, so that
was very, very cool.

00:25:06.123 --> 00:25:07.540 align:middle line:84%
We were able to
take a look at how

00:25:07.540 --> 00:25:10.900 align:middle line:84%
to utilize multiple techniques
and leverage multiple

00:25:10.900 --> 00:25:16.060 align:middle line:84%
services like SMTP to enumerate
as much information as possible

00:25:16.060 --> 00:25:17.500 align:middle line:90%
from the target system.

00:25:17.500 --> 00:25:21.790 align:middle line:84%
And in this case you
were able to actually see

00:25:21.790 --> 00:25:25.000 align:middle line:84%
how to utilize information
from other services

00:25:25.000 --> 00:25:28.780 align:middle line:84%
to stage an attack for a
specific service like FTP.

00:25:28.780 --> 00:25:31.540 align:middle line:84%
And of course, we've
also explored the concept

00:25:31.540 --> 00:25:35.680 align:middle line:84%
of not having exploits work
or having vulnerabilities

00:25:35.680 --> 00:25:38.150 align:middle line:84%
being patched and how
to work around that.

00:25:38.150 --> 00:25:40.600 align:middle line:84%
So you should never
give up in regards

00:25:40.600 --> 00:25:44.920 align:middle line:84%
to identifying
vulnerabilities and always

00:25:44.920 --> 00:25:47.620 align:middle line:84%
be open minded when it
comes down to also targeting

00:25:47.620 --> 00:25:49.900 align:middle line:84%
other services that
can provide you

00:25:49.900 --> 00:25:52.090 align:middle line:84%
with useful information
that can help

00:25:52.090 --> 00:25:56.000 align:middle line:84%
you attack a specific service,
like FTP, for example.

00:25:56.000 --> 00:25:58.330 align:middle line:84%
So that's going to
be it for this video,

00:25:58.330 --> 00:26:01.920 align:middle line:84%
and I'll be seeing
you in the next video.

00:26:01.920 --> 00:26:03.000 align:middle line:90%