WEBVTT

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


00:00:10.290 --> 00:00:12.072 align:middle line:90%
SMTP Enumeration.

00:00:12.072 --> 00:00:14.280 align:middle line:84%
In this video, we're going
to be taking a look at how

00:00:14.280 --> 00:00:16.800 align:middle line:84%
to enumerate as much
information as possible

00:00:16.800 --> 00:00:20.700 align:middle line:84%
from SMTP through the
use of auxiliary modules.

00:00:20.700 --> 00:00:24.270 align:middle line:84%
So first and foremost,
what is SMTP?

00:00:24.270 --> 00:00:27.990 align:middle line:84%
SMTP stands for the Simple
Mail Transfer Protocol.

00:00:27.990 --> 00:00:29.760 align:middle line:84%
This is a communication
protocol that

00:00:29.760 --> 00:00:31.690 align:middle line:84%
is used for the
transmission of email.

00:00:31.690 --> 00:00:34.260 align:middle line:84%
So for any of you who
have used email before

00:00:34.260 --> 00:00:36.510 align:middle line:84%
and have configured
your own inboxes,

00:00:36.510 --> 00:00:38.970 align:middle line:84%
you will be familiar
with SMTP, right?

00:00:38.970 --> 00:00:42.550 align:middle line:84%
Now SMTP, uses TCP
port 25 by default.

00:00:42.550 --> 00:00:45.660 align:middle line:84%
However, it can also be
configured to run on TCP port

00:00:45.660 --> 00:00:50.940 align:middle line:84%
465 and 587 if an SSL or TLS
certificate has been set up

00:00:50.940 --> 00:00:52.470 align:middle line:90%
for encryption, right?

00:00:52.470 --> 00:00:56.970 align:middle line:84%
Now, we can utilize the various
auxiliary modules available

00:00:56.970 --> 00:00:59.850 align:middle line:84%
or that are afforded to us
by the Metasploit Framework

00:00:59.850 --> 00:01:03.330 align:middle line:84%
to number one, enumerate the
version of SMTP that's running.

00:01:03.330 --> 00:01:06.360 align:middle line:84%
And as I mentioned previously,
the version information

00:01:06.360 --> 00:01:08.760 align:middle line:84%
is going to come in handy
during the vulnerability

00:01:08.760 --> 00:01:10.020 align:middle line:90%
scanning section.

00:01:10.020 --> 00:01:12.310 align:middle line:84%
And we'll be taking a
look at how to, again,

00:01:12.310 --> 00:01:15.240 align:middle line:84%
identify vulnerabilities
for these services,

00:01:15.240 --> 00:01:16.920 align:middle line:84%
or rather inherent
vulnerabilities

00:01:16.920 --> 00:01:18.060 align:middle line:90%
for these services.

00:01:18.060 --> 00:01:20.100 align:middle line:84%
And again, so far
what we've been doing

00:01:20.100 --> 00:01:21.780 align:middle line:90%
is performing enumeration.

00:01:21.780 --> 00:01:24.630 align:middle line:84%
And then exploiting
various misconfigurations

00:01:24.630 --> 00:01:26.940 align:middle line:84%
to either obtain
more information

00:01:26.940 --> 00:01:29.470 align:middle line:84%
or to obtain some
level of access.

00:01:29.470 --> 00:01:31.800 align:middle line:84%
We can also utilize
auxiliary modules

00:01:31.800 --> 00:01:35.400 align:middle line:84%
to perform a brute force
attack on SMTP in order

00:01:35.400 --> 00:01:39.080 align:middle line:84%
to obtain or to find various
user accounts on the target

00:01:39.080 --> 00:01:39.580 align:middle line:90%
system.

00:01:39.580 --> 00:01:41.040 align:middle line:84%
So that's one of
the great things

00:01:41.040 --> 00:01:45.390 align:middle line:84%
with SMTP is that through the
various auxiliary modules,

00:01:45.390 --> 00:01:49.230 align:middle line:84%
we can also identify users
on the target system.

00:01:49.230 --> 00:01:51.450 align:middle line:84%
And this information
can be very useful

00:01:51.450 --> 00:01:54.150 align:middle line:90%
if we SSH open on the target.

00:01:54.150 --> 00:01:55.800 align:middle line:84%
And we can then
use that username

00:01:55.800 --> 00:01:59.720 align:middle line:84%
to perform a brute force on SSH
and then gain access via SSH.

00:01:59.720 --> 00:02:02.640 align:middle line:84%
So again, in terms
of SMTP, it really

00:02:02.640 --> 00:02:04.680 align:middle line:84%
can provide us with
much in regards

00:02:04.680 --> 00:02:07.020 align:middle line:84%
to exploitation
unless we exploit

00:02:07.020 --> 00:02:10.570 align:middle line:84%
the exact version of SMTP
that's running on the target.

00:02:10.570 --> 00:02:12.030 align:middle line:84%
However, we can
use the information

00:02:12.030 --> 00:02:15.450 align:middle line:84%
we gather from SMTP to
stage our other attacks.

00:02:15.450 --> 00:02:18.540 align:middle line:84%
So I will be taking a look
at all of this within the lab

00:02:18.540 --> 00:02:19.210 align:middle line:90%
environment.

00:02:19.210 --> 00:02:22.810 align:middle line:84%
So let's actually
get started now.

00:02:22.810 --> 00:02:25.480 align:middle line:84%
All right, so I am back
in the lab environment.

00:02:25.480 --> 00:02:29.190 align:middle line:84%
And again, starting off, we need
to get the target IP, which we

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

00:02:31.200 --> 00:02:34.020 align:middle line:84%
And the interface we're
interested in is ethernet 1.

00:02:34.020 --> 00:02:37.320 align:middle line:84%
So we'll get our IP
here, and the target IP

00:02:37.320 --> 00:02:38.820 align:middle line:90%
is going to be the same subnet.

00:02:38.820 --> 00:02:41.070 align:middle line:84%
But instead of a 2
it's going to be a 3.

00:02:41.070 --> 00:02:42.690 align:middle line:90%
So I'm just going to copy that.

00:02:42.690 --> 00:02:48.940 align:middle line:84%
And we'll then start up the
PostgreSQL Database Service

00:02:48.940 --> 00:02:50.020 align:middle line:90%
like so.

00:02:50.020 --> 00:02:54.160 align:middle line:90%
And so Service PostgreSQL--

00:02:54.160 --> 00:02:56.998 align:middle line:84%
let me just type
that in correctly.

00:02:56.998 --> 00:02:57.540 align:middle line:90%
There we are.

00:02:57.540 --> 00:02:59.060 align:middle line:84%
That's going to
start it up for us

00:02:59.060 --> 00:03:01.940 align:middle line:84%
so that we can utilize the
Metasploit Framework database.

00:03:01.940 --> 00:03:04.460 align:middle line:84%
Once that is done,
we can essentially

00:03:04.460 --> 00:03:06.410 align:middle line:84%
start up the Metasploit
Framework console

00:03:06.410 --> 00:03:08.450 align:middle line:90%
by typing in MSFConsole.

00:03:08.450 --> 00:03:10.580 align:middle line:84%
Give that a few
seconds to start up.

00:03:10.580 --> 00:03:15.200 align:middle line:90%


00:03:15.200 --> 00:03:18.920 align:middle line:84%
All right, we can now add our
workspace for SMTP enumeration.

00:03:18.920 --> 00:03:23.180 align:middle line:84%
So we're going to say SMTP and
then underscore enum, right?

00:03:23.180 --> 00:03:25.850 align:middle line:84%
And we should have that
as our active interface,

00:03:25.850 --> 00:03:28.730 align:middle line:90%
or rather, our active workspace.

00:03:28.730 --> 00:03:32.160 align:middle line:84%
Now that that is done, we need
to set up our global variables.

00:03:32.160 --> 00:03:34.430 align:middle line:84%
So we're going to set up
the global variable value

00:03:34.430 --> 00:03:37.190 align:middle line:84%
for RHOSTS, primarily
because we don't

00:03:37.190 --> 00:03:39.320 align:middle line:84%
want to waste time
always setting

00:03:39.320 --> 00:03:41.090 align:middle line:90%
the target IP for each module.

00:03:41.090 --> 00:03:43.550 align:middle line:84%
Setting up the global
variable for RHOSTS

00:03:43.550 --> 00:03:46.010 align:middle line:84%
will again, load
up the target IP

00:03:46.010 --> 00:03:47.940 align:middle line:90%
with whichever module we use.

00:03:47.940 --> 00:03:51.170 align:middle line:84%
So again, paste that in
and change the 2 into a 3.

00:03:51.170 --> 00:03:52.425 align:middle line:90%
And that is set up.

00:03:52.425 --> 00:03:53.300 align:middle line:90%
All right, excellent.

00:03:53.300 --> 00:03:56.390 align:middle line:84%
So we can begin performing
SMTP enumeration.

00:03:56.390 --> 00:03:59.240 align:middle line:84%
So we can search for the
various Metasploit Framework

00:03:59.240 --> 00:04:02.990 align:middle line:84%
auxiliary modules that
are pertinent to SMTP.

00:04:02.990 --> 00:04:06.710 align:middle line:84%
So again, we can essentially use
a search filter like Auxiliary

00:04:06.710 --> 00:04:09.500 align:middle line:84%
to limit our results to
only auxiliary modules.

00:04:09.500 --> 00:04:12.510 align:middle line:84%
And then the name,
we will specify SMTP.

00:04:12.510 --> 00:04:13.010 align:middle line:90%
All right?

00:04:13.010 --> 00:04:15.568 align:middle line:84%
So we get quite a few
auxiliary modules.

00:04:15.568 --> 00:04:17.360 align:middle line:84%
And the first one we
want to take a look at

00:04:17.360 --> 00:04:20.660 align:middle line:84%
is the SMTP Version module,
which will essentially

00:04:20.660 --> 00:04:24.440 align:middle line:84%
just tell us what version of
SMTP is running on the target.

00:04:24.440 --> 00:04:29.147 align:middle line:84%
Now again, as I said,
SMTP may be configured

00:04:29.147 --> 00:04:30.230 align:middle line:90%
to run on different ports.

00:04:30.230 --> 00:04:32.900 align:middle line:84%
So I would recommend
performing a port scan in order

00:04:32.900 --> 00:04:35.670 align:middle line:84%
to identify what port
SMTP is running on.

00:04:35.670 --> 00:04:38.750 align:middle line:84%
But in this case, we do know
through the lab environment

00:04:38.750 --> 00:04:40.640 align:middle line:90%
that it is running on port 25.

00:04:40.640 --> 00:04:44.500 align:middle line:84%
So we can then just
load the module here.

00:04:44.500 --> 00:04:49.653 align:middle line:84%
And if we show the options
for this particular module,

00:04:49.653 --> 00:04:51.570 align:middle line:84%
you can see that the
RHOST value has been set.

00:04:51.570 --> 00:04:54.120 align:middle line:84%
The RPORT has been
set to 25, which

00:04:54.120 --> 00:04:55.500 align:middle line:90%
is the default, as I said.

00:04:55.500 --> 00:04:57.430 align:middle line:84%
And you can then modify
the threads value,

00:04:57.430 --> 00:04:59.430 align:middle line:84%
which in this case, we
don't because we are only

00:04:59.430 --> 00:05:01.360 align:middle line:90%
targeting one target system.

00:05:01.360 --> 00:05:02.790 align:middle line:90%
So we'll just hit Run.

00:05:02.790 --> 00:05:05.460 align:middle line:84%
And as you can see, it tells
us immediately the version

00:05:05.460 --> 00:05:08.190 align:middle line:84%
of SMTP that's running,
which is Postfix.

00:05:08.190 --> 00:05:11.910 align:middle line:84%
And it also gives us the email
address, or rather the domain

00:05:11.910 --> 00:05:15.240 align:middle line:84%
for this particular
SMTP server, right?

00:05:15.240 --> 00:05:17.880 align:middle line:84%
Which again, can
be extremely useful

00:05:17.880 --> 00:05:19.750 align:middle line:90%
as we move on to exploitation.

00:05:19.750 --> 00:05:21.600 align:middle line:84%
However, in this
case, we've already

00:05:21.600 --> 00:05:25.260 align:middle line:84%
been able to enumerate or
to get the version of SMTP

00:05:25.260 --> 00:05:28.260 align:middle line:84%
so we can again, perform a
search for the other SMTP

00:05:28.260 --> 00:05:28.950 align:middle line:90%
modules.

00:05:28.950 --> 00:05:31.590 align:middle line:84%
So I'll just use the
previous search filter.

00:05:31.590 --> 00:05:34.230 align:middle line:84%
And the next module that
we want to take a look at

00:05:34.230 --> 00:05:37.050 align:middle line:84%
is the SMTP enum
module, which again,

00:05:37.050 --> 00:05:38.880 align:middle line:90%
performs user enumeration.

00:05:38.880 --> 00:05:43.965 align:middle line:84%
So we'll copy that module and
we'll paste that in there.

00:05:43.965 --> 00:05:46.590 align:middle line:84%
And again, if you want to learn
more about a particular module,

00:05:46.590 --> 00:05:47.793 align:middle line:90%
just type in Info.

00:05:47.793 --> 00:05:49.710 align:middle line:84%
And as you can see, it
gives you a description

00:05:49.710 --> 00:05:51.930 align:middle line:84%
of what's going on or
what this module is doing.

00:05:51.930 --> 00:05:55.890 align:middle line:84%
So it says the SMTP service
has two internal commands that

00:05:55.890 --> 00:05:57.750 align:middle line:90%
allow the enumeration of users.

00:05:57.750 --> 00:06:00.030 align:middle line:84%
So we can use Verify,
which will confirm

00:06:00.030 --> 00:06:02.950 align:middle line:84%
the names of valid
users, and EXPN,

00:06:02.950 --> 00:06:05.940 align:middle line:84%
which reveals the actual
addresses of user aliases

00:06:05.940 --> 00:06:08.700 align:middle line:84%
and lists of email
or mailing lists.

00:06:08.700 --> 00:06:11.010 align:middle line:84%
Through the implementation
of these SMTP

00:06:11.010 --> 00:06:13.540 align:middle line:84%
commands can reveal a
list of valid users,

00:06:13.540 --> 00:06:16.560 align:middle line:84%
so we can use this to
enumerate user accounts, right?

00:06:16.560 --> 00:06:20.550 align:middle line:84%
So we have the target
IP set, the target port

00:06:20.550 --> 00:06:21.730 align:middle line:90%
is set correctly.

00:06:21.730 --> 00:06:25.120 align:middle line:84%
And again, we can also modify
the Unix Only option here.

00:06:25.120 --> 00:06:27.300 align:middle line:84%
So this will skip
Microsoft branded servers

00:06:27.300 --> 00:06:29.070 align:middle line:90%
when testing Unix users.

00:06:29.070 --> 00:06:32.220 align:middle line:84%
And because we know we are
dealing with a Linux target,

00:06:32.220 --> 00:06:36.360 align:middle line:84%
the user file that we specify
for the brute force is going

00:06:36.360 --> 00:06:40.860 align:middle line:84%
to be the default unix_users.txt
word list that's found under

00:06:40.860 --> 00:06:44.160 align:middle line:84%
User Share Metasploit Framework
Data Word Lists, and then,

00:06:44.160 --> 00:06:45.240 align:middle line:90%
of course, Unix users.

00:06:45.240 --> 00:06:48.180 align:middle line:90%
And we've used this before.

00:06:48.180 --> 00:06:50.902 align:middle line:84%
So we need to do now
is just type in Run.

00:06:50.902 --> 00:06:52.860 align:middle line:84%
And again, it's going to
begin the brute force.

00:06:52.860 --> 00:06:55.020 align:middle line:84%
So give this a few
seconds to a few minutes.

00:06:55.020 --> 00:06:57.500 align:middle line:90%
It's going to take a while.

00:06:57.500 --> 00:06:59.780 align:middle line:84%
All right, so the
enumeration is complete.

00:06:59.780 --> 00:07:01.050 align:middle line:90%
That took a few minutes.

00:07:01.050 --> 00:07:03.890 align:middle line:84%
And as you can see, it's able
to enumerate the various uses

00:07:03.890 --> 00:07:04.980 align:middle line:90%
on the system.

00:07:04.980 --> 00:07:08.090 align:middle line:84%
So we have an admin, account,
administrator, backup, bin,

00:07:08.090 --> 00:07:10.790 align:middle line:84%
daemon, as well as a few
other interesting ones

00:07:10.790 --> 00:07:14.450 align:middle line:84%
like the www-data user account,
which again, may provide us

00:07:14.450 --> 00:07:18.230 align:middle line:84%
with an idea of what this
server is set up to do.

00:07:18.230 --> 00:07:20.300 align:middle line:84%
And again, all of
this information

00:07:20.300 --> 00:07:22.940 align:middle line:84%
can be very useful in
staging other attacks.

00:07:22.940 --> 00:07:26.150 align:middle line:84%
So for example, if we had
SSH running on this server,

00:07:26.150 --> 00:07:27.740 align:middle line:84%
then we could use
these usernames

00:07:27.740 --> 00:07:29.120 align:middle line:90%
to perform a brute force.

00:07:29.120 --> 00:07:32.480 align:middle line:84%
And of course, having a username
narrows down your brute force

00:07:32.480 --> 00:07:34.080 align:middle line:84%
attack and makes
it more efficient.

00:07:34.080 --> 00:07:37.320 align:middle line:84%
So all of this information
is extremely important.

00:07:37.320 --> 00:07:41.720 align:middle line:84%
Now, that's as far as we can
enumerate in terms of SMTP.

00:07:41.720 --> 00:07:43.460 align:middle line:84%
During the exploitation
section, we'll

00:07:43.460 --> 00:07:46.460 align:middle line:84%
be taking a look at how to
exploit a vulnerable SMTP

00:07:46.460 --> 00:07:47.490 align:middle line:90%
server.

00:07:47.490 --> 00:07:50.600 align:middle line:84%
But for now, this should be
it in regards to enumeration.

00:07:50.600 --> 00:07:54.920 align:middle line:84%
So that concludes the
lab demonstration.

00:07:54.920 --> 00:07:58.210 align:middle line:84%
All right, so that is
essentially SMTP enumeration

00:07:58.210 --> 00:08:00.520 align:middle line:84%
through the use of the
Metasploit Framework

00:08:00.520 --> 00:08:01.780 align:middle line:90%
auxiliary modules.

00:08:01.780 --> 00:08:04.510 align:middle line:84%
And that also concludes
the information gathering

00:08:04.510 --> 00:08:06.940 align:middle line:84%
and enumeration
section of this course.

00:08:06.940 --> 00:08:09.970 align:middle line:84%
In the next section, which
covers vulnerability scanning,

00:08:09.970 --> 00:08:12.850 align:middle line:84%
we'll be taking a look at how
to use all of this version

00:08:12.850 --> 00:08:15.700 align:middle line:84%
information, or rather the
service version information

00:08:15.700 --> 00:08:19.787 align:middle line:84%
to identify exploits that we can
use to exploit these services.

00:08:19.787 --> 00:08:21.370 align:middle line:84%
And we'll also be
taking a look at how

00:08:21.370 --> 00:08:24.200 align:middle line:84%
to perform web application
vulnerability scanning.

00:08:24.200 --> 00:08:26.500 align:middle line:90%
So I'll see you there.

00:08:26.500 --> 00:08:27.000 align:middle line:90%