WEBVTT

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


00:00:03.458 --> 00:00:05.434 align:middle line:90%
[ELECTRONIC NOISES]

00:00:05.434 --> 00:00:10.380 align:middle line:90%


00:00:10.380 --> 00:00:12.728 align:middle line:84%
SSH enumeration--
in this video, we're

00:00:12.728 --> 00:00:14.520 align:middle line:84%
going to be taking a
look at how to extract

00:00:14.520 --> 00:00:17.850 align:middle line:84%
as much information as possible
from SSH through the use

00:00:17.850 --> 00:00:19.770 align:middle line:90%
of various auxiliary modules.

00:00:19.770 --> 00:00:22.650 align:middle line:84%
So first and
foremost, what is SSH?

00:00:22.650 --> 00:00:24.780 align:middle line:90%
SSH stands for Secure Shell.

00:00:24.780 --> 00:00:27.150 align:middle line:84%
It is a remote
administration protocol

00:00:27.150 --> 00:00:30.030 align:middle line:84%
that offers encryption and
is the natural successor

00:00:30.030 --> 00:00:31.170 align:middle line:90%
to Telnet.

00:00:31.170 --> 00:00:33.270 align:middle line:84%
It is typically used
for remote access

00:00:33.270 --> 00:00:35.250 align:middle line:90%
to servers and remote systems.

00:00:35.250 --> 00:00:37.650 align:middle line:84%
So an example of
this-- and I'm pretty

00:00:37.650 --> 00:00:39.600 align:middle line:90%
sure you have come across SSH.

00:00:39.600 --> 00:00:41.880 align:middle line:84%
Whenever you want to
connect to a remote server,

00:00:41.880 --> 00:00:44.160 align:middle line:84%
it could be hosted
on a cloud platform,

00:00:44.160 --> 00:00:45.690 align:middle line:90%
or it just could be offsite.

00:00:45.690 --> 00:00:47.850 align:middle line:90%
The protocol of choice is SSH.

00:00:47.850 --> 00:00:51.450 align:middle line:84%
And if you are
dealing or if you want

00:00:51.450 --> 00:00:54.630 align:middle line:84%
to access the target remotely
via a graphical user interface,

00:00:54.630 --> 00:00:58.470 align:middle line:84%
you'd typically use a
protocol like RDP or VNC.

00:00:58.470 --> 00:01:02.370 align:middle line:84%
However, when we're talking
about SSH and its advantages

00:01:02.370 --> 00:01:04.830 align:middle line:84%
over Telnet, one of
the key advantages

00:01:04.830 --> 00:01:09.420 align:middle line:84%
is that it offers encryption
and essentially encrypts

00:01:09.420 --> 00:01:11.370 align:middle line:84%
the communication channel
between the client

00:01:11.370 --> 00:01:12.480 align:middle line:90%
and the server.

00:01:12.480 --> 00:01:16.680 align:middle line:84%
So if I was using Telnet, then
I would typically again initiate

00:01:16.680 --> 00:01:19.470 align:middle line:84%
a connection between
myself and the target,

00:01:19.470 --> 00:01:20.730 align:middle line:90%
provide the credentials.

00:01:20.730 --> 00:01:22.770 align:middle line:84%
However, the
communication channel

00:01:22.770 --> 00:01:25.710 align:middle line:84%
would be unencrypted, which
means that any attacker could

00:01:25.710 --> 00:01:28.320 align:middle line:84%
perform a "man in the middle"
attack and sniff the traffic

00:01:28.320 --> 00:01:31.200 align:middle line:84%
and consequently get
information regarding

00:01:31.200 --> 00:01:32.670 align:middle line:90%
what commands I'm sending over.

00:01:32.670 --> 00:01:34.740 align:middle line:84%
And these commands
could be potentially

00:01:34.740 --> 00:01:36.130 align:middle line:90%
important or useful.

00:01:36.130 --> 00:01:38.310 align:middle line:84%
So this is where
SSH comes into play.

00:01:38.310 --> 00:01:40.650 align:middle line:84%
It essentially encrypts the
channel, the communication

00:01:40.650 --> 00:01:42.820 align:middle line:84%
channel, between the
client and the server.

00:01:42.820 --> 00:01:47.040 align:middle line:84%
And that prevents "man
in the middle" attacks.

00:01:47.040 --> 00:01:50.110 align:middle line:84%
SSH authentication is
performed two ways.

00:01:50.110 --> 00:01:53.970 align:middle line:84%
So you can either utilize a
clear-text password or what

00:01:53.970 --> 00:01:57.210 align:middle line:84%
we've started seeing now is a
SSH key-based authentication,

00:01:57.210 --> 00:01:59.790 align:middle line:84%
where authentication
is handled in the form

00:01:59.790 --> 00:02:02.340 align:middle line:84%
of a public and
private key pair.

00:02:02.340 --> 00:02:05.130 align:middle line:84%
So all of this is very,
very important information

00:02:05.130 --> 00:02:08.550 align:middle line:84%
that's going to be pertinent to
enumeration and exploitation.

00:02:08.550 --> 00:02:13.050 align:middle line:84%
Now, SSH uses port 20
TCP by default. However,

00:02:13.050 --> 00:02:14.550 align:middle line:84%
like any other
service, it can be

00:02:14.550 --> 00:02:17.580 align:middle line:84%
configured to use any
other TCP port that's open.

00:02:17.580 --> 00:02:19.800 align:middle line:84%
So, again, this is
something that we have we've

00:02:19.800 --> 00:02:21.630 align:middle line:90%
started seeing with companies.

00:02:21.630 --> 00:02:24.300 align:middle line:84%
They essentially
changed the TCP port

00:02:24.300 --> 00:02:26.550 align:middle line:84%
to something else,
another port that's

00:02:26.550 --> 00:02:30.210 align:middle line:84%
not really recognizable in
order to, again, trick attackers

00:02:30.210 --> 00:02:33.030 align:middle line:84%
into thinking there isn't
an SSH server that's

00:02:33.030 --> 00:02:34.000 align:middle line:90%
running on the target.

00:02:34.000 --> 00:02:35.910 align:middle line:84%
However, if you perform
a full port scan,

00:02:35.910 --> 00:02:37.800 align:middle line:84%
you should be able
to identify it.

00:02:37.800 --> 00:02:39.900 align:middle line:84%
Now, we can utilize
auxiliary modules

00:02:39.900 --> 00:02:42.630 align:middle line:84%
to enumerate information
like the SSH version

00:02:42.630 --> 00:02:45.480 align:middle line:84%
or, rather, the version of SSH
that's running on the target.

00:02:45.480 --> 00:02:48.180 align:middle line:84%
And this information,
the version information,

00:02:48.180 --> 00:02:51.233 align:middle line:84%
is very important during the
vulnerability scanning section.

00:02:51.233 --> 00:02:52.650 align:middle line:84%
So again, if you're
a bit confused

00:02:52.650 --> 00:02:54.960 align:middle line:84%
as to why we're getting
the version, all of this

00:02:54.960 --> 00:02:56.700 align:middle line:84%
will come into
context when we start

00:02:56.700 --> 00:03:01.020 align:middle line:84%
using the version information
to find inherent exploits

00:03:01.020 --> 00:03:02.220 align:middle line:90%
in these services.

00:03:02.220 --> 00:03:04.170 align:middle line:84%
However, when we're
talking about enumeration,

00:03:04.170 --> 00:03:07.680 align:middle line:84%
we again need to get the
version of SSH that's running.

00:03:07.680 --> 00:03:11.550 align:middle line:84%
And secondly, we can also
perform a brute force attack

00:03:11.550 --> 00:03:14.310 align:middle line:84%
to identify passwords that
can consequently provide

00:03:14.310 --> 00:03:16.330 align:middle line:90%
us remote access to the target.

00:03:16.330 --> 00:03:20.250 align:middle line:84%
So given that SSH is a remote
administration protocol,

00:03:20.250 --> 00:03:22.380 align:middle line:84%
if we are able to
get the credentials

00:03:22.380 --> 00:03:24.420 align:middle line:84%
or get any
credentials, then that

00:03:24.420 --> 00:03:27.510 align:middle line:84%
means we can establish
a direct communication

00:03:27.510 --> 00:03:30.750 align:middle line:84%
channel with the target and
consequently get remote access

00:03:30.750 --> 00:03:31.490 align:middle line:90%
to the target.

00:03:31.490 --> 00:03:33.600 align:middle line:84%
So let's take a look
at how to do this

00:03:33.600 --> 00:03:36.450 align:middle line:90%
within the lab environment.

00:03:36.450 --> 00:03:38.310 align:middle line:84%
I'm currently within
the lab environment.

00:03:38.310 --> 00:03:39.685 align:middle line:84%
The first thing
we're going to do

00:03:39.685 --> 00:03:42.210 align:middle line:84%
is, of course, identify
the target IP, which

00:03:42.210 --> 00:03:45.240 align:middle line:84%
can be done really simply by
typing in ifconfig, taking

00:03:45.240 --> 00:03:47.325 align:middle line:84%
a look at the
interface ethernet 1.

00:03:47.325 --> 00:03:49.560 align:middle line:84%
And of course, if we
get our input address,

00:03:49.560 --> 00:03:52.440 align:middle line:84%
we know that the target is
going to be on the same subnet

00:03:52.440 --> 00:03:54.810 align:middle line:90%
except on the IP address 3.

00:03:54.810 --> 00:03:56.680 align:middle line:90%
So let's copy this.

00:03:56.680 --> 00:04:00.120 align:middle line:84%
And what we'll do now is, again,
just start up the PostgreSQL

00:04:00.120 --> 00:04:00.870 align:middle line:90%
Database Service.

00:04:00.870 --> 00:04:04.160 align:middle line:90%


00:04:04.160 --> 00:04:05.780 align:middle line:90%
That's going to start it up.

00:04:05.780 --> 00:04:08.750 align:middle line:84%
And then we can start up the
Metasploit framework console.

00:04:08.750 --> 00:04:11.540 align:middle line:84%
And, again, just give that
a few seconds to start up.

00:04:11.540 --> 00:04:17.740 align:middle line:90%


00:04:17.740 --> 00:04:19.570 align:middle line:84%
That started up,
so the next step

00:04:19.570 --> 00:04:21.170 align:middle line:90%
would be to create a workspace.

00:04:21.170 --> 00:04:23.260 align:middle line:84%
So I'm going to say
workspace add SSH_Enum.

00:04:23.260 --> 00:04:26.542 align:middle line:90%


00:04:26.542 --> 00:04:28.750 align:middle line:84%
And that's going to be the
current, active workspace.

00:04:28.750 --> 00:04:32.110 align:middle line:84%
The next thing we want to do
is set up our global variables

00:04:32.110 --> 00:04:36.310 align:middle line:84%
for rhosts so that we don't have
to keep typing in the target IP

00:04:36.310 --> 00:04:37.600 align:middle line:90%
whenever we load a module.

00:04:37.600 --> 00:04:41.350 align:middle line:84%
So I'm going to say set
global, or setg, rhosts

00:04:41.350 --> 00:04:43.030 align:middle line:84%
and then paste in
the IP we copied.

00:04:43.030 --> 00:04:46.600 align:middle line:84%
And again, change it from
a 2 to a 3 and hit Enter.

00:04:46.600 --> 00:04:51.130 align:middle line:84%
And, again, we can also do that
for the rhost variable because

00:04:51.130 --> 00:04:54.850 align:middle line:84%
with some modules, the
target IP can either be

00:04:54.850 --> 00:04:57.280 align:middle line:90%
specified as rhosts or rhost.

00:04:57.280 --> 00:04:59.820 align:middle line:90%
So I'm going to say rhost.

00:04:59.820 --> 00:05:02.230 align:middle line:84%
And we paste in the IP
we copied and, of course,

00:05:02.230 --> 00:05:03.240 align:middle line:90%
change it to a 3.

00:05:03.240 --> 00:05:04.800 align:middle line:90%
And there we go.

00:05:04.800 --> 00:05:07.890 align:middle line:84%
So let's get started
with SSH enumeration.

00:05:07.890 --> 00:05:11.010 align:middle line:84%
So we can search for SSH
modules by saying search.

00:05:11.010 --> 00:05:13.020 align:middle line:84%
And then we can limit
it to auxiliary modules

00:05:13.020 --> 00:05:15.570 align:middle line:84%
because we don't want
any exploit modules

00:05:15.570 --> 00:05:17.020 align:middle line:90%
or post-exploitation modules.

00:05:17.020 --> 00:05:18.570 align:middle line:90%
So we'll say type auxiliary.

00:05:18.570 --> 00:05:21.300 align:middle line:84%
And then the name is, of
course, going to be SSH.

00:05:21.300 --> 00:05:22.200 align:middle line:90%
We hit Enter.

00:05:22.200 --> 00:05:25.750 align:middle line:84%
And as you can see, we
have quite a few modules.

00:05:25.750 --> 00:05:30.905 align:middle line:84%
The one that we're interested in
first is the SSH version here.

00:05:30.905 --> 00:05:32.530 align:middle line:84%
That's the module,
we're interested in.

00:05:32.530 --> 00:05:36.150 align:middle line:84%
So let's use that to identify
the version of SSH that's

00:05:36.150 --> 00:05:37.330 align:middle line:90%
running on the target.

00:05:37.330 --> 00:05:39.090 align:middle line:90%
So we've loaded the module.

00:05:39.090 --> 00:05:41.310 align:middle line:90%
I'll now say show options.

00:05:41.310 --> 00:05:43.650 align:middle line:84%
And as you can see, the
target IP has been set.

00:05:43.650 --> 00:05:46.350 align:middle line:84%
The target port is set
to port 22, which we know

00:05:46.350 --> 00:05:48.390 align:middle line:90%
is the default port for SSH.

00:05:48.390 --> 00:05:50.880 align:middle line:84%
We can change the threads,
but that's not required.

00:05:50.880 --> 00:05:54.210 align:middle line:84%
And we can also set up
the timeout option here

00:05:54.210 --> 00:05:56.770 align:middle line:84%
for the timeout
for the SSH probe.

00:05:56.770 --> 00:05:59.170 align:middle line:84%
But in this case, we'll
leave it as the default.

00:05:59.170 --> 00:06:00.880 align:middle line:90%
So we'll hit run.

00:06:00.880 --> 00:06:04.170 align:middle line:84%
And as you can see, we're able
to detect the version of SSH.

00:06:04.170 --> 00:06:06.030 align:middle line:84%
As you can see,
it's running SSH--

00:06:06.030 --> 00:06:09.150 align:middle line:90%
or rather, OpenSSH 7.9p1.

00:06:09.150 --> 00:06:11.610 align:middle line:84%
And we also get the
operating system banner,

00:06:11.610 --> 00:06:13.770 align:middle line:84%
so we know that
it's running Ubuntu.

00:06:13.770 --> 00:06:16.890 align:middle line:84%
If we take a look at some of
the other information displayed

00:06:16.890 --> 00:06:18.990 align:middle line:84%
here, it doesn't give
us the exact version.

00:06:18.990 --> 00:06:20.020 align:middle line:90%
Well, it actually does.

00:06:20.020 --> 00:06:21.750 align:middle line:90%
So we get the version of Ubuntu.

00:06:21.750 --> 00:06:24.630 align:middle line:84%
So operating system
version is 19.04.

00:06:24.630 --> 00:06:28.200 align:middle line:84%
So we know that the target
is running Ubuntu 19.04.

00:06:28.200 --> 00:06:31.800 align:middle line:84%
Now, as I said, this information
will really become pertinent

00:06:31.800 --> 00:06:35.370 align:middle line:84%
when we move on to exploitation
and vulnerability scanning.

00:06:35.370 --> 00:06:37.710 align:middle line:84%
Right now, again, it's
not really pertinent.

00:06:37.710 --> 00:06:42.600 align:middle line:84%
So for example, if we search
for an exploit for OpenSSH,

00:06:42.600 --> 00:06:45.220 align:middle line:84%
you can see that they're
far and few in between.

00:06:45.220 --> 00:06:47.250 align:middle line:84%
And, again, that will
all come into context

00:06:47.250 --> 00:06:49.380 align:middle line:84%
when we're performing
vulnerability scanning.

00:06:49.380 --> 00:06:52.230 align:middle line:84%
So really, there isn't
much we can do now

00:06:52.230 --> 00:06:54.270 align:middle line:84%
in regards to as search
enumeration apart

00:06:54.270 --> 00:06:56.580 align:middle line:84%
from performing a
brute force in order

00:06:56.580 --> 00:06:59.310 align:middle line:84%
to obtain credentials
that we can

00:06:59.310 --> 00:07:01.240 align:middle line:90%
use to authenticate via SSH.

00:07:01.240 --> 00:07:04.440 align:middle line:84%
So in order to do that, what
we can do is say search.

00:07:04.440 --> 00:07:07.570 align:middle line:84%
And, again, we can use our
previous search filter.

00:07:07.570 --> 00:07:09.360 align:middle line:90%
So let's just go back.

00:07:09.360 --> 00:07:11.970 align:middle line:84%
And we are looking
for ssh_login.

00:07:11.970 --> 00:07:14.700 align:middle line:84%
Now, if the target
has been configured

00:07:14.700 --> 00:07:18.450 align:middle line:84%
to use password authentication,
then we use this module.

00:07:18.450 --> 00:07:20.160 align:middle line:84%
If the target has
been configured

00:07:20.160 --> 00:07:23.640 align:middle line:84%
to use a public or a
key-pair authentication,

00:07:23.640 --> 00:07:25.800 align:middle line:84%
then we would use this
particular module.

00:07:25.800 --> 00:07:29.400 align:middle line:84%
But in this case, the
target has been configured

00:07:29.400 --> 00:07:31.170 align:middle line:84%
to use password
authentication, so we'll

00:07:31.170 --> 00:07:33.750 align:middle line:90%
use the ssh_login module.

00:07:33.750 --> 00:07:43.050 align:middle line:84%
So what we'll do is we will say
use, hit Enter, show options.

00:07:43.050 --> 00:07:45.727 align:middle line:84%
And as you can see,
there's a few options

00:07:45.727 --> 00:07:46.810 align:middle line:90%
that we need to configure.

00:07:46.810 --> 00:07:49.300 align:middle line:90%
So let me just expand that here.

00:07:49.300 --> 00:07:50.970 align:middle line:84%
The first option
that we can configure

00:07:50.970 --> 00:07:52.013 align:middle line:90%
is the brute force speed.

00:07:52.013 --> 00:07:53.430 align:middle line:84%
It's currently set
to the highest.

00:07:53.430 --> 00:07:56.490 align:middle line:84%
Now, depending on the type of
target you're dealing with,

00:07:56.490 --> 00:08:00.480 align:middle line:84%
you may want to reduce
this to prevent you

00:08:00.480 --> 00:08:04.320 align:middle line:84%
from actually tripping any
alarms because SSH logs are

00:08:04.320 --> 00:08:08.250 align:middle line:84%
usually logged or are usually
sent to a syslog server

00:08:08.250 --> 00:08:11.940 align:middle line:84%
if the target server that you're
targeting has been configured

00:08:11.940 --> 00:08:15.240 align:middle line:84%
or rather has some security
apparatus behind it.

00:08:15.240 --> 00:08:17.370 align:middle line:84%
Now, the other option
that we can specify

00:08:17.370 --> 00:08:19.410 align:middle line:84%
is the target IP
and the target port.

00:08:19.410 --> 00:08:21.840 align:middle line:84%
But in this case, because
we don't know the username

00:08:21.840 --> 00:08:24.930 align:middle line:84%
and password we will
need to specify a user

00:08:24.930 --> 00:08:26.530 align:middle line:90%
file and a password file.

00:08:26.530 --> 00:08:27.880 align:middle line:90%
So we'll start by doing that.

00:08:27.880 --> 00:08:29.620 align:middle line:90%
So we'll set the user file.

00:08:29.620 --> 00:08:33.299 align:middle line:84%
And in this case, again, we'll
use the default Metasploit

00:08:33.299 --> 00:08:35.350 align:middle line:90%
Framework wordlist.

00:08:35.350 --> 00:08:38.520 align:middle line:84%
So we'll say
/usr/share/metasploit-framework

00:08:38.520 --> 00:08:40.980 align:middle line:90%
under data and on the wordlists.

00:08:40.980 --> 00:08:43.620 align:middle line:84%
Let's try and use
common_users because we

00:08:43.620 --> 00:08:47.820 align:middle line:84%
have really no idea of what
users could be on the system.

00:08:47.820 --> 00:08:51.740 align:middle line:84%
And for the password
file, we will, again,

00:08:51.740 --> 00:08:57.090 align:middle line:84%
use the same Metasploit
framework wordlists.

00:08:57.090 --> 00:08:59.940 align:middle line:84%
So we'll say /metasploit
frameworks/wordlists.

00:08:59.940 --> 00:09:02.940 align:middle line:90%


00:09:02.940 --> 00:09:07.380 align:middle line:84%
And that's under data, sorry,
so /data/wordlists/common.

00:09:07.380 --> 00:09:09.690 align:middle line:84%
And yeah, let's try
common_passwords

00:09:09.690 --> 00:09:10.890 align:middle line:90%
instead of UNIX passwords.

00:09:10.890 --> 00:09:14.640 align:middle line:84%
But we can alternate if we
aren't able to find one.

00:09:14.640 --> 00:09:19.260 align:middle line:84%
The next thing we want to do
is we can say stop on success

00:09:19.260 --> 00:09:21.270 align:middle line:84%
or we can change the
option here to stop when

00:09:21.270 --> 00:09:23.070 align:middle line:90%
we've got a successful match.

00:09:23.070 --> 00:09:26.550 align:middle line:84%
And we can also enable
the verbose option

00:09:26.550 --> 00:09:28.080 align:middle line:90%
to show all the attempts.

00:09:28.080 --> 00:09:30.850 align:middle line:84%
But in this case, I think that's
perfectly fine the way it is.

00:09:30.850 --> 00:09:31.890 align:middle line:90%
So we'll hit run.

00:09:31.890 --> 00:09:35.202 align:middle line:84%
And depending on the
wordlists we've selected,

00:09:35.202 --> 00:09:36.660 align:middle line:84%
this is going to
take a few seconds

00:09:36.660 --> 00:09:38.860 align:middle line:84%
to a few minutes or
possibly even hours.

00:09:38.860 --> 00:09:41.610 align:middle line:84%
So I'm just going
to let this run.

00:09:41.610 --> 00:09:45.700 align:middle line:84%
So the module is completed, and
we get the credentials here.

00:09:45.700 --> 00:09:48.270 align:middle line:84%
So we can see we get
the username sysadmin

00:09:48.270 --> 00:09:49.860 align:middle line:90%
and the password hailey.

00:09:49.860 --> 00:09:52.890 align:middle line:84%
So we've been able to find
some legitimate credentials.

00:09:52.890 --> 00:09:54.780 align:middle line:84%
And this module
will automatically

00:09:54.780 --> 00:09:56.910 align:middle line:84%
open up a command
shell session here

00:09:56.910 --> 00:09:59.160 align:middle line:90%
on the target system via SSH.

00:09:59.160 --> 00:10:01.810 align:middle line:84%
So, again, if we type
in ls, in this case

00:10:01.810 --> 00:10:04.652 align:middle line:84%
we can see that it doesn't
actually print out any results.

00:10:04.652 --> 00:10:06.610 align:middle line:84%
And that's because the
module is still running.

00:10:06.610 --> 00:10:10.710 align:middle line:84%
If we terminate it, just
take note of the credentials.

00:10:10.710 --> 00:10:13.260 align:middle line:84%
However, if we check our
sessions because this module

00:10:13.260 --> 00:10:15.490 align:middle line:90%
sets up a session for us--

00:10:15.490 --> 00:10:17.520 align:middle line:84%
let me just type that
in correctly, sessions.

00:10:17.520 --> 00:10:20.400 align:middle line:84%
You can see that we
have the session 1 here,

00:10:20.400 --> 00:10:22.830 align:middle line:90%
and that is via SSH.

00:10:22.830 --> 00:10:25.740 align:middle line:84%
And it's using the credentials
we were able to identify.

00:10:25.740 --> 00:10:30.840 align:middle line:84%
So we can switch to that
session by typing in sessions 1.

00:10:30.840 --> 00:10:32.520 align:middle line:84%
And we hit Enter,
and we currently

00:10:32.520 --> 00:10:35.640 align:middle line:84%
have access to the
target system primarily

00:10:35.640 --> 00:10:37.590 align:middle line:84%
because we were
able to gather or we

00:10:37.590 --> 00:10:40.420 align:middle line:84%
were able to get the credentials
from the brute force.

00:10:40.420 --> 00:10:42.810 align:middle line:84%
And as you can see, the
target operating system

00:10:42.810 --> 00:10:45.270 align:middle line:90%
is indeed Ubuntu 19.04.

00:10:45.270 --> 00:10:48.430 align:middle line:84%
So we type in ls, we
don't get anything there.

00:10:48.430 --> 00:10:52.030 align:middle line:84%
So let's actually try and
spawn a bash session here.

00:10:52.030 --> 00:10:53.970 align:middle line:84%
So I'm going to
say /bin/bash -i,

00:10:53.970 --> 00:10:55.900 align:middle line:84%
and that gives us
a bash session.

00:10:55.900 --> 00:10:58.090 align:middle line:84%
So if we list out the files
within this directory,

00:10:58.090 --> 00:11:01.540 align:middle line:84%
there currently aren't
any particular files.

00:11:01.540 --> 00:11:04.770 align:middle line:84%
So, again, we can always
check our permissions here.

00:11:04.770 --> 00:11:06.090 align:middle line:90%
So we can say whoami.

00:11:06.090 --> 00:11:07.830 align:middle line:90%
As you can see, we are sysadmin.

00:11:07.830 --> 00:11:11.700 align:middle line:84%
So we've essentially been able
to gain access to the target

00:11:11.700 --> 00:11:14.550 align:middle line:90%
system via SSH brute forcing.

00:11:14.550 --> 00:11:17.430 align:middle line:84%
So, again, I know that this
is part of exploitation.

00:11:17.430 --> 00:11:19.020 align:middle line:84%
But I just wanted
to show you, again,

00:11:19.020 --> 00:11:20.910 align:middle line:90%
how powerful these tools are.

00:11:20.910 --> 00:11:23.550 align:middle line:84%
So what I'm going to do
is I'm just going to exit,

00:11:23.550 --> 00:11:28.208 align:middle line:84%
and I'm going to just terminate
this particular session.

00:11:28.208 --> 00:11:28.750 align:middle line:90%
There we are.

00:11:28.750 --> 00:11:29.560 align:middle line:90%
That's terminated.

00:11:29.560 --> 00:11:30.977 align:middle line:84%
So if we list out
our sessions, we

00:11:30.977 --> 00:11:32.700 align:middle line:84%
shouldn't have any
active sessions.

00:11:32.700 --> 00:11:35.790 align:middle line:84%
I want to show you one other
useful module that, again,

00:11:35.790 --> 00:11:37.480 align:middle line:90%
can be very, very useful.

00:11:37.480 --> 00:11:40.290 align:middle line:90%
And that is the SSH--

00:11:40.290 --> 00:11:42.120 align:middle line:90%
let's see, ssh_login.

00:11:42.120 --> 00:11:44.010 align:middle line:84%
Or let's just search
for-- let's just

00:11:44.010 --> 00:11:47.940 align:middle line:84%
utilize the previous search
filter that we had utilized.

00:11:47.940 --> 00:11:49.530 align:middle line:90%
And I'll actually show you this.

00:11:49.530 --> 00:11:53.070 align:middle line:84%
And that is the
ssh_enumusers module, which

00:11:53.070 --> 00:11:54.810 align:middle line:90%
allows you to enumerate users.

00:11:54.810 --> 00:11:58.380 align:middle line:84%
So this can be very useful if
your initial brute force isn't

00:11:58.380 --> 00:11:59.250 align:middle line:90%
successful.

00:11:59.250 --> 00:12:02.580 align:middle line:84%
You can use this module
to essentially find

00:12:02.580 --> 00:12:04.770 align:middle line:84%
usernames and narrow
down your brute force.

00:12:04.770 --> 00:12:10.360 align:middle line:84%
So we'll use this module, and
I'll show you the options here.

00:12:10.360 --> 00:12:13.090 align:middle line:84%
And as you can see, we can
provide the target IP, target

00:12:13.090 --> 00:12:13.590 align:middle line:90%
port.

00:12:13.590 --> 00:12:16.330 align:middle line:84%
And then we can
specify a user file.

00:12:16.330 --> 00:12:19.030 align:middle line:84%
So, again, if we
set the user file--

00:12:19.030 --> 00:12:21.420 align:middle line:84%
and let's just use our
previous command here--

00:12:21.420 --> 00:12:26.370 align:middle line:84%
to the common_users.txt
file and we hit run,

00:12:26.370 --> 00:12:28.480 align:middle line:90%
this should enumerate users.

00:12:28.480 --> 00:12:31.920 align:middle line:84%
And as you can see, we get
more than one user that

00:12:31.920 --> 00:12:33.130 align:middle line:90%
is currently on the system.

00:12:33.130 --> 00:12:36.510 align:middle line:84%
So we get the sysadmin user
whose credentials we found.

00:12:36.510 --> 00:12:40.590 align:middle line:84%
We also get other users like
rooty, demo, auditor, anon,

00:12:40.590 --> 00:12:42.390 align:middle line:90%
administrator and diag.

00:12:42.390 --> 00:12:44.710 align:middle line:84%
So this can be
very, very useful.

00:12:44.710 --> 00:12:46.350 align:middle line:84%
So if we had done
this before, we

00:12:46.350 --> 00:12:49.380 align:middle line:84%
would have targeted or
used ssh_login module

00:12:49.380 --> 00:12:53.160 align:middle line:84%
and specified the username of
sysadmin and then a password

00:12:53.160 --> 00:12:54.390 align:middle line:90%
list.

00:12:54.390 --> 00:12:55.980 align:middle line:84%
And of course, our
brute force would

00:12:55.980 --> 00:12:59.400 align:middle line:84%
have been much faster
because we're only

00:12:59.400 --> 00:13:01.800 align:middle line:84%
performing a brute force
with one user as opposed

00:13:01.800 --> 00:13:03.220 align:middle line:90%
to multiple users.

00:13:03.220 --> 00:13:06.480 align:middle line:84%
So that is how to perform
a search enumeration

00:13:06.480 --> 00:13:09.420 align:middle line:84%
through the use of the various
auxiliary modules afforded

00:13:09.420 --> 00:13:11.430 align:middle line:84%
to you by the
Metasploit framework.

00:13:11.430 --> 00:13:15.510 align:middle line:84%
So that concludes the
practical demonstration.

00:13:15.510 --> 00:13:18.060 align:middle line:84%
In the next video, we're going
to be taking a look at how

00:13:18.060 --> 00:13:20.700 align:middle line:90%
to perform SMTP enumeration.

00:13:20.700 --> 00:13:23.150 align:middle line:90%
So I'll see you there.