WEBVTT

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


00:00:10.520 --> 00:00:14.450 align:middle line:84%
We're going to start looking
at a database-- in this case,

00:00:14.450 --> 00:00:17.760 align:middle line:90%
a SQL or SQL database.

00:00:17.760 --> 00:00:22.280 align:middle line:84%
One of the most common open
versions of the SQL database

00:00:22.280 --> 00:00:24.020 align:middle line:90%
is MySQL.

00:00:24.020 --> 00:00:27.890 align:middle line:84%
It usually runs on Ubuntu
or some version of Linux--

00:00:27.890 --> 00:00:36.440 align:middle line:84%
rather, or Unix, and it allows
many users to store information

00:00:36.440 --> 00:00:38.150 align:middle line:90%
in the database.

00:00:38.150 --> 00:00:43.520 align:middle line:84%
It can be pulled and used in
many different operations,

00:00:43.520 --> 00:00:48.610 align:middle line:84%
and it's very common to find
on an enterprise network.

00:00:48.610 --> 00:00:52.980 align:middle line:84%
It's also very
often misconfigured

00:00:52.980 --> 00:00:54.370 align:middle line:90%
and very vulnerable.

00:00:54.370 --> 00:00:58.020 align:middle line:84%
So we're going to look at
what that would normally

00:00:58.020 --> 00:01:01.680 align:middle line:84%
look like when you're
come across an SQL Server

00:01:01.680 --> 00:01:04.980 align:middle line:84%
and how you would enumerate
or gather information from it.

00:01:04.980 --> 00:01:11.410 align:middle line:90%


00:01:11.410 --> 00:01:15.075 align:middle line:84%
So in our console, we'll
look at our IP address.

00:01:15.075 --> 00:01:23.960 align:middle line:90%


00:01:23.960 --> 00:01:30.470 align:middle line:84%
We'll take that same IP address
and use the .3 of the subnet.

00:01:30.470 --> 00:01:34.070 align:middle line:84%
And we see that we've
got 3306, which usually

00:01:34.070 --> 00:01:38.940 align:middle line:90%
ties to the MySQL service.

00:01:38.940 --> 00:01:43.920 align:middle line:84%
We'll run a service
scan on 3306,

00:01:43.920 --> 00:01:46.870 align:middle line:84%
and it should go
quite a bit quicker.

00:01:46.870 --> 00:01:57.950 align:middle line:84%
But it does confirm it is a
MySQL 5.5.62 running on Ubuntu.

00:01:57.950 --> 00:02:00.690 align:middle line:84%
Now we can try a few
different things.

00:02:00.690 --> 00:02:05.570 align:middle line:84%
The first being we'll
run a MySQL command using

00:02:05.570 --> 00:02:10.789 align:middle line:84%
the -h for the host,
our IP address, and then

00:02:10.789 --> 00:02:12.200 align:middle line:90%
-u for the username.

00:02:12.200 --> 00:02:13.580 align:middle line:90%
And we'll go with root.

00:02:13.580 --> 00:02:15.950 align:middle line:84%
Since it's running
on Ubuntu, root

00:02:15.950 --> 00:02:19.790 align:middle line:90%
tends to be the default admin.

00:02:19.790 --> 00:02:21.320 align:middle line:84%
Let's see if we're
able to log in.

00:02:21.320 --> 00:02:26.370 align:middle line:90%


00:02:26.370 --> 00:02:28.920 align:middle line:84%
And it looks like it
did take correctly

00:02:28.920 --> 00:02:32.580 align:middle line:90%
and we were able to log in.

00:02:32.580 --> 00:02:37.290 align:middle line:84%
With that, we can now look
at the databases with a show

00:02:37.290 --> 00:02:37.970 align:middle line:90%
databases.

00:02:37.970 --> 00:02:57.950 align:middle line:90%


00:02:57.950 --> 00:03:01.980 align:middle line:84%
It requires a
semicolon at the end.

00:03:01.980 --> 00:03:03.690 align:middle line:84%
Otherwise, it just
gives you a new line.

00:03:03.690 --> 00:03:10.318 align:middle line:84%
So we have 11 rows in the set,
so those are 11 databases.

00:03:10.318 --> 00:03:20.160 align:middle line:84%
If we wanted to script it,
we could dig into that.

00:03:20.160 --> 00:03:22.500 align:middle line:84%
But now let's look
at some information

00:03:22.500 --> 00:03:23.610 align:middle line:90%
in one of these databases.

00:03:23.610 --> 00:03:29.930 align:middle line:84%
Let's use books, include
that semicolon at the end,

00:03:29.930 --> 00:03:38.690 align:middle line:84%
and now we're looking in the
books table for the database.

00:03:38.690 --> 00:03:41.550 align:middle line:90%
And let's now dig into authors.

00:03:41.550 --> 00:03:58.980 align:middle line:84%
So if we select count from
all things from authors,

00:03:58.980 --> 00:04:01.780 align:middle line:84%
it should give us a
count of all the options.

00:04:01.780 --> 00:04:02.880 align:middle line:90%
So there's 10 in there.

00:04:02.880 --> 00:04:05.010 align:middle line:84%
If you're curious
what that looks like,

00:04:05.010 --> 00:04:07.710 align:middle line:84%
we just wanted to see
everything from the database.

00:04:07.710 --> 00:04:10.800 align:middle line:84%
Select star, for wild
card, from authors.

00:04:10.800 --> 00:04:15.520 align:middle line:90%


00:04:15.520 --> 00:04:18.040 align:middle line:84%
And now inside of the book's
database, there's authors

00:04:18.040 --> 00:04:23.780 align:middle line:84%
and there's all this information
that goes with those authors.

00:04:23.780 --> 00:04:26.870 align:middle line:84%
These are all just different
tables in the database.

00:04:26.870 --> 00:04:30.310 align:middle line:84%
What they're used for
may or may not matter.

00:04:30.310 --> 00:04:32.045 align:middle line:84%
In this case, it
looks like it is.

00:04:32.045 --> 00:04:37.740 align:middle line:90%


00:04:37.740 --> 00:04:40.260 align:middle line:84%
For something nondescript,
there's books.

00:04:40.260 --> 00:04:43.260 align:middle line:90%
There's videos.

00:04:43.260 --> 00:04:43.950 align:middle line:90%
There's a store.

00:04:43.950 --> 00:04:45.150 align:middle line:90%
There's secrets and vendors.

00:04:45.150 --> 00:04:51.650 align:middle line:90%


00:04:51.650 --> 00:04:54.390 align:middle line:84%
But mostly, we're trying
to enumerate this thing.

00:04:54.390 --> 00:04:59.030 align:middle line:84%
So, generally, you
log in with MySQL.

00:04:59.030 --> 00:05:02.990 align:middle line:84%
You use a database, and
then you can select items

00:05:02.990 --> 00:05:04.340 align:middle line:90%
from that database.

00:05:04.340 --> 00:05:09.190 align:middle line:90%


00:05:09.190 --> 00:05:15.110 align:middle line:84%
And if you ever need help,
you just type "help" and you

00:05:15.110 --> 00:05:21.980 align:middle line:84%
get a whole list of what is in
here, what options you have.

00:05:21.980 --> 00:05:28.050 align:middle line:84%
Now, if you're not
familiar with SQL, S-Q-L,

00:05:28.050 --> 00:05:31.800 align:middle line:84%
then it might be more useful
to use some tools that we

00:05:31.800 --> 00:05:34.430 align:middle line:90%
are more comfortable with.

00:05:34.430 --> 00:05:37.310 align:middle line:84%
And leave the syntax up to
those who created the tools.

00:05:37.310 --> 00:05:41.650 align:middle line:90%


00:05:41.650 --> 00:05:43.360 align:middle line:84%
Our good friend
Metasploit-- we're

00:05:43.360 --> 00:05:48.670 align:middle line:84%
going to use an auxiliary
scanner, very common

00:05:48.670 --> 00:05:51.580 align:middle line:90%
with enumeration.

00:05:51.580 --> 00:05:53.530 align:middle line:84%
And let's look at
writable directories.

00:05:53.530 --> 00:05:57.780 align:middle line:90%


00:05:57.780 --> 00:06:05.450 align:middle line:84%
So the options--
we'll pick a dir_list,

00:06:05.450 --> 00:06:09.470 align:middle line:84%
and we use this one
right out of Metasploit--

00:06:09.470 --> 00:06:13.640 align:middle line:84%
Metasploit data, word
lists, and directory.

00:06:13.640 --> 00:06:16.550 align:middle line:90%


00:06:16.550 --> 00:06:18.875 align:middle line:84%
And I used tab completion
whenever possible.

00:06:18.875 --> 00:06:21.420 align:middle line:90%


00:06:21.420 --> 00:06:24.780 align:middle line:84%
It prevents typos,
especially if you hit Tab.

00:06:24.780 --> 00:06:28.350 align:middle line:84%
And it goes all the way to the
end, and you know you're good.

00:06:28.350 --> 00:06:34.680 align:middle line:84%
We'll setg rhosts because
we're going to keep using this.

00:06:34.680 --> 00:06:37.290 align:middle line:84%
And setg sets it as
a global variable

00:06:37.290 --> 00:06:41.050 align:middle line:84%
for this whole
Metasploit session.

00:06:41.050 --> 00:06:45.550 align:middle line:84%
Also verbose to
false because it's

00:06:45.550 --> 00:06:48.430 align:middle line:84%
going to tell us a
lot of information,

00:06:48.430 --> 00:06:50.860 align:middle line:84%
and this will just make
life a little easier for us.

00:06:50.860 --> 00:06:52.600 align:middle line:84%
If you're curious
where verbose is,

00:06:52.600 --> 00:07:00.160 align:middle line:84%
since it's not showing up here,
it's in the advanced options.

00:07:00.160 --> 00:07:03.890 align:middle line:90%


00:07:03.890 --> 00:07:08.450 align:middle line:84%
And verbose gives you a
detailed status messages.

00:07:08.450 --> 00:07:13.212 align:middle line:84%
It's going to run a brute force
of all the directories, testing

00:07:13.212 --> 00:07:14.670 align:middle line:84%
things to see if
they're relatable.

00:07:14.670 --> 00:07:18.390 align:middle line:84%
And if we have
verbosity on verbose,

00:07:18.390 --> 00:07:22.380 align:middle line:84%
then we're going to get
flooded with messages.

00:07:22.380 --> 00:07:25.050 align:middle line:84%
Let's set a password
to annul password.

00:07:25.050 --> 00:07:29.175 align:middle line:90%


00:07:29.175 --> 00:07:30.550 align:middle line:84%
Double check that
we have all the

00:07:30.550 --> 00:07:37.095 align:middle line:84%
required items, yes,
yes, yes, and we'll run.

00:07:37.095 --> 00:07:45.210 align:middle line:90%


00:07:45.210 --> 00:07:46.740 align:middle line:90%
It gave us quite a list--

00:07:46.740 --> 00:07:53.760 align:middle line:90%


00:07:53.760 --> 00:07:54.655 align:middle line:90%
went too far.

00:07:54.655 --> 00:08:03.080 align:middle line:90%


00:08:03.080 --> 00:08:06.440 align:middle line:84%
For a lot of your enumeration,
if you are able to output

00:08:06.440 --> 00:08:11.780 align:middle line:84%
to a file, and then look at that
file, that can be quite useful.

00:08:11.780 --> 00:08:14.680 align:middle line:90%


00:08:14.680 --> 00:08:17.370 align:middle line:84%
So it checked some
common places--

00:08:17.370 --> 00:08:21.630 align:middle line:84%
came up with tmp is writable
and root is writable.

00:08:21.630 --> 00:08:27.660 align:middle line:84%
There's some error
codes in here,

00:08:27.660 --> 00:08:32.380 align:middle line:84%
but it looks like temp and
root are the only writable

00:08:32.380 --> 00:08:33.280 align:middle line:90%
directories.

00:08:33.280 --> 00:08:35.880 align:middle line:90%


00:08:35.880 --> 00:08:41.069 align:middle line:84%
And that's on the
system utilizing SQL.

00:08:41.069 --> 00:08:43.913 align:middle line:90%


00:08:43.913 --> 00:08:45.580 align:middle line:84%
So it's kind of crazy
that we get access

00:08:45.580 --> 00:08:48.040 align:middle line:84%
to things that aren't
necessarily about the database,

00:08:48.040 --> 00:08:49.330 align:middle line:90%
through the database.

00:08:49.330 --> 00:08:55.520 align:middle line:90%


00:08:55.520 --> 00:08:59.200 align:middle line:84%
Another scanner that
we can use is hashdump.

00:08:59.200 --> 00:09:08.085 align:middle line:84%
So use auxiliary/scanner/msql
and hashdump.

00:09:08.085 --> 00:09:13.050 align:middle line:84%
If we run options,
rhost is already

00:09:13.050 --> 00:09:16.190 align:middle line:84%
set because it was set
as a global variable.

00:09:16.190 --> 00:09:22.140 align:middle line:84%
So we changed our module from
this writable dirs to hashdump.

00:09:22.140 --> 00:09:22.920 align:middle line:90%
It kept it.

00:09:22.920 --> 00:09:27.220 align:middle line:90%


00:09:27.220 --> 00:09:31.680 align:middle line:84%
We'll username to be
root since we already

00:09:31.680 --> 00:09:35.250 align:middle line:84%
saw that was vulnerable,
and we'll set the password

00:09:35.250 --> 00:09:37.930 align:middle line:90%
to be a null password.

00:09:37.930 --> 00:09:45.970 align:middle line:84%
And even though in options
it shows that it's empty,

00:09:45.970 --> 00:09:49.360 align:middle line:84%
passing that empty
value actually did

00:09:49.360 --> 00:09:52.058 align:middle line:90%
give it something, ironically.

00:09:52.058 --> 00:09:55.200 align:middle line:90%


00:09:55.200 --> 00:09:56.130 align:middle line:90%
Delete.

00:09:56.130 --> 00:09:56.715 align:middle line:90%
Type exploit.

00:09:56.715 --> 00:09:59.470 align:middle line:90%


00:09:59.470 --> 00:10:04.900 align:middle line:84%
And we get a whole bunch of
hashes for different users.

00:10:04.900 --> 00:10:08.920 align:middle line:84%
Add that to our list
of things enumerated.

00:10:08.920 --> 00:10:10.180 align:middle line:90%
It can be quite useful later.

00:10:10.180 --> 00:10:19.810 align:middle line:90%


00:10:19.810 --> 00:10:23.730 align:middle line:84%
And now leave Metasploit,
and jump back into mysql.

00:10:23.730 --> 00:10:31.870 align:middle line:90%


00:10:31.870 --> 00:10:38.140 align:middle line:84%
So mysql dot h our IP
and the user as root.

00:10:38.140 --> 00:10:42.060 align:middle line:90%


00:10:42.060 --> 00:10:48.330 align:middle line:84%
And what we'll do is select,
and then we'll load file.

00:10:48.330 --> 00:10:54.370 align:middle line:84%
And see if we have access
to files on the system.

00:10:54.370 --> 00:10:56.010 align:middle line:84%
And we did that
enumeration before,

00:10:56.010 --> 00:10:59.475 align:middle line:90%
so we should have some access.

00:10:59.475 --> 00:11:02.480 align:middle line:90%


00:11:02.480 --> 00:11:02.980 align:middle line:90%
And we do.

00:11:02.980 --> 00:11:05.335 align:middle line:90%
We get the full etc shadow file.

00:11:05.335 --> 00:11:16.430 align:middle line:90%


00:11:16.430 --> 00:11:20.250 align:middle line:84%
Not in the prettiest
output, but we

00:11:20.250 --> 00:11:25.270 align:middle line:84%
can see what users and
services are currently

00:11:25.270 --> 00:11:26.815 align:middle line:90%
existing on the system.

00:11:26.815 --> 00:11:35.880 align:middle line:90%


00:11:35.880 --> 00:11:39.000 align:middle line:84%
We could use that to pull
other files as well, especially

00:11:39.000 --> 00:11:40.050 align:middle line:90%
if we have root access.

00:11:40.050 --> 00:11:43.860 align:middle line:90%


00:11:43.860 --> 00:11:45.840 align:middle line:84%
But currently we're just
enumerating and seeing

00:11:45.840 --> 00:11:49.410 align:middle line:84%
what we do have the
ability to find.

00:11:49.410 --> 00:11:51.330 align:middle line:84%
We'll return to our
good friend nmap.

00:11:51.330 --> 00:11:55.530 align:middle line:90%


00:11:55.530 --> 00:11:57.105 align:middle line:84%
In this case,
we'll run a script.

00:11:57.105 --> 00:12:01.820 align:middle line:90%


00:12:01.820 --> 00:12:08.300 align:middle line:84%
It will be the mysql
empty password--

00:12:08.300 --> 00:12:12.900 align:middle line:84%
just see if there are any
other accounts that can log in

00:12:12.900 --> 00:12:14.730 align:middle line:90%
with an empty password.

00:12:14.730 --> 00:12:17.490 align:middle line:90%
And it remains to be just root.

00:12:17.490 --> 00:12:19.110 align:middle line:90%
If we had run this first--

00:12:19.110 --> 00:12:23.278 align:middle line:84%
once we saw that we had
mysql ran the empty password,

00:12:23.278 --> 00:12:24.570 align:middle line:90%
we would have gotten that root.

00:12:24.570 --> 00:12:26.237 align:middle line:84%
We would have gotten
the empty password,

00:12:26.237 --> 00:12:29.580 align:middle line:84%
and that's how we were able to
do all the other scans we've

00:12:29.580 --> 00:12:30.210 align:middle line:90%
done so far.

00:12:30.210 --> 00:12:32.970 align:middle line:90%


00:12:32.970 --> 00:12:37.770 align:middle line:84%
We want more information
on the database.

00:12:37.770 --> 00:12:42.945 align:middle line:84%
We can run the
msql info command.

00:12:42.945 --> 00:12:49.610 align:middle line:90%


00:12:49.610 --> 00:12:51.760 align:middle line:84%
And this, again, gets
is our version number.

00:12:51.760 --> 00:12:57.850 align:middle line:84%
We can see that we've got
this interactive client, which

00:12:57.850 --> 00:13:01.330 align:middle line:84%
is going to allow us
access to the system

00:13:01.330 --> 00:13:04.468 align:middle line:84%
through mysql,
which is never good.

00:13:04.468 --> 00:13:06.010 align:middle line:84%
That's something
that they would want

00:13:06.010 --> 00:13:08.140 align:middle line:84%
to fix in the configuration,
but they left for us.

00:13:08.140 --> 00:13:12.850 align:middle line:90%


00:13:12.850 --> 00:13:16.180 align:middle line:84%
Another thing we can
look at is users.

00:13:16.180 --> 00:13:19.300 align:middle line:84%
And for this, we need
to pass some arguments.

00:13:19.300 --> 00:13:29.010 align:middle line:90%


00:13:29.010 --> 00:13:30.450 align:middle line:90%
We will pass it--

00:13:30.450 --> 00:13:39.215 align:middle line:84%
a user of root and
the password of null.

00:13:39.215 --> 00:13:45.970 align:middle line:90%


00:13:45.970 --> 00:13:48.190 align:middle line:90%
I see we do have root--

00:13:48.190 --> 00:13:53.890 align:middle line:84%
also got udadmin,
sysadmin, ultra.

00:13:53.890 --> 00:13:57.430 align:middle line:84%
And there is a guest
account on there.

00:13:57.430 --> 00:14:00.560 align:middle line:90%


00:14:00.560 --> 00:14:02.780 align:middle line:84%
And we want to add all
of these to our list--

00:14:02.780 --> 00:14:09.740 align:middle line:90%


00:14:09.740 --> 00:14:14.980 align:middle line:84%
another great command if you
didn't want to try logging in

00:14:14.980 --> 00:14:22.170 align:middle line:84%
or weren't sure if you
could log in the databases

00:14:22.170 --> 00:14:24.945 align:middle line:84%
with that same root
and null password.

00:14:24.945 --> 00:14:32.280 align:middle line:90%


00:14:32.280 --> 00:14:39.732 align:middle line:84%
And we get those same databases
that we found at the beginning.

00:14:39.732 --> 00:14:44.360 align:middle line:90%


00:14:44.360 --> 00:14:51.620 align:middle line:84%
For more access, we can also
look at mysql variables.

00:14:51.620 --> 00:14:54.890 align:middle line:90%


00:14:54.890 --> 00:15:00.610 align:middle line:84%
Since it's a database, knowing
how to interact with it

00:15:00.610 --> 00:15:01.510 align:middle line:90%
can be quite useful.

00:15:01.510 --> 00:15:07.120 align:middle line:90%


00:15:07.120 --> 00:15:10.570 align:middle line:84%
What's most useful is
the data directory.

00:15:10.570 --> 00:15:14.380 align:middle line:90%


00:15:14.380 --> 00:15:15.630 align:middle line:90%
Where is all this been stored?

00:15:15.630 --> 00:15:18.980 align:middle line:90%


00:15:18.980 --> 00:15:20.870 align:middle line:84%
Where are all the
variables being stored?

00:15:20.870 --> 00:15:23.850 align:middle line:90%


00:15:23.850 --> 00:15:25.082 align:middle line:90%
[INAUDIBLE]

00:15:25.082 --> 00:15:37.490 align:middle line:90%


00:15:37.490 --> 00:15:47.108 align:middle line:84%
This datadir, data
directory, a var/lib/mysql,

00:15:47.108 --> 00:15:48.275 align:middle line:90%
that has its potential uses.

00:15:48.275 --> 00:15:55.800 align:middle line:90%


00:15:55.800 --> 00:16:04.310 align:middle line:84%
After variables, let's
run the mysql audit

00:16:04.310 --> 00:16:16.460 align:middle line:84%
again with an null password, but
also with an audit file name.

00:16:16.460 --> 00:16:24.635 align:middle line:84%
So instead of mysql user, we
want mysql audit dot user.

00:16:24.635 --> 00:16:40.130 align:middle line:90%


00:16:40.130 --> 00:16:44.120 align:middle line:84%
A lot of these
scripts, you have to go

00:16:44.120 --> 00:16:47.300 align:middle line:84%
into the script on
your file to see

00:16:47.300 --> 00:17:05.359 align:middle line:84%
what they want for
arguments, which initially

00:17:05.359 --> 00:17:07.099 align:middle line:90%
can be a lot of work.

00:17:07.099 --> 00:17:12.730 align:middle line:84%
But as you get a
lot of this down

00:17:12.730 --> 00:17:15.400 align:middle line:84%
and you create
your own tool list,

00:17:15.400 --> 00:17:17.900 align:middle line:84%
you'll just put all these
commands into a file.

00:17:17.900 --> 00:17:22.510 align:middle line:84%
And when you come across
MySQL, or "Mis-QL," database,

00:17:22.510 --> 00:17:24.369 align:middle line:84%
you can just grab the
commands you want.

00:17:24.369 --> 00:17:27.819 align:middle line:84%
Pop them in, and you already
have mostly built out for you.

00:17:27.819 --> 00:17:30.530 align:middle line:84%
You can just change the
things that you find.

00:17:30.530 --> 00:17:32.080 align:middle line:84%
For example, maybe,
it's not root.

00:17:32.080 --> 00:17:33.170 align:middle line:90%
Maybe, it's another user.

00:17:33.170 --> 00:17:37.480 align:middle line:84%
So you run that initial nmap
scan for any empty passwords,

00:17:37.480 --> 00:17:43.135 align:middle line:84%
and then you can use that to do
the rest of your enumeration.

00:17:43.135 --> 00:17:44.510 align:middle line:84%
So all the rest
of these scripts,

00:17:44.510 --> 00:17:46.550 align:middle line:84%
you would just change
that little part.

00:17:46.550 --> 00:17:58.700 align:middle line:90%


00:17:58.700 --> 00:18:02.130 align:middle line:84%
The nselib is where a
lot of this is kept.

00:18:02.130 --> 00:18:27.970 align:middle line:90%


00:18:27.970 --> 00:18:30.760 align:middle line:84%
This one is quite
a script, so double

00:18:30.760 --> 00:18:37.170 align:middle line:84%
check that I wrote it
right, mysql audit.

00:18:37.170 --> 00:18:56.925 align:middle line:84%
No tab completion here, there
it is and my variable name.

00:18:56.925 --> 00:18:59.860 align:middle line:90%


00:18:59.860 --> 00:19:04.550 align:middle line:84%
And I feel bad showing you this,
but it's normal to have typos

00:19:04.550 --> 00:19:06.770 align:middle line:84%
and to mess things up
every once in a while.

00:19:06.770 --> 00:19:14.730 align:middle line:90%


00:19:14.730 --> 00:19:16.425 align:middle line:84%
And we go through
this whole audit.

00:19:16.425 --> 00:19:25.720 align:middle line:90%


00:19:25.720 --> 00:19:26.518 align:middle line:90%
Something's passed.

00:19:26.518 --> 00:19:27.310 align:middle line:90%
Something's failed.

00:19:27.310 --> 00:19:30.477 align:middle line:90%


00:19:30.477 --> 00:19:32.310 align:middle line:84%
As a developer, this
would be a useful thing

00:19:32.310 --> 00:19:39.510 align:middle line:84%
to run on your own system to
see what shows up, if you've

00:19:39.510 --> 00:19:40.920 align:middle line:90%
configured things correctly.

00:19:40.920 --> 00:19:44.250 align:middle line:90%


00:19:44.250 --> 00:19:47.130 align:middle line:84%
And it does not grant
privileges to non-admin users,

00:19:47.130 --> 00:19:50.170 align:middle line:90%
so it passed the audit.

00:19:50.170 --> 00:20:00.180 align:middle line:84%
So it would have to be an
admin user to get privileges.

00:20:00.180 --> 00:20:06.380 align:middle line:90%


00:20:06.380 --> 00:20:08.560 align:middle line:90%
I'll reuse this variables.

00:20:08.560 --> 00:20:11.310 align:middle line:90%


00:20:11.310 --> 00:20:12.870 align:middle line:90%
That's here from earlier.

00:20:12.870 --> 00:20:17.310 align:middle line:84%
Replace variables
with dump-hashes.

00:20:17.310 --> 00:20:19.455 align:middle line:84%
We used the Metasploit
dump-hashes earlier.

00:20:19.455 --> 00:20:28.830 align:middle line:90%


00:20:28.830 --> 00:20:30.570 align:middle line:90%
Change by variables again.

00:20:30.570 --> 00:20:32.010 align:middle line:90%
Username is root.

00:20:32.010 --> 00:20:37.270 align:middle line:90%


00:20:37.270 --> 00:20:39.180 align:middle line:90%
And password is empty.

00:20:39.180 --> 00:20:45.040 align:middle line:90%


00:20:45.040 --> 00:20:47.250 align:middle line:84%
Then we get the hashes
for all of those.

00:20:47.250 --> 00:20:50.280 align:middle line:90%


00:20:50.280 --> 00:20:53.745 align:middle line:84%
We can also use
nmap to run a query.

00:20:53.745 --> 00:20:56.990 align:middle line:90%


00:20:56.990 --> 00:20:59.990 align:middle line:84%
When we logged into the
database earlier, what we did

00:20:59.990 --> 00:21:01.100 align:middle line:90%
is we ran a query.

00:21:01.100 --> 00:21:04.130 align:middle line:90%


00:21:04.130 --> 00:21:07.370 align:middle line:84%
So this query is going
to be what we actually

00:21:07.370 --> 00:21:08.600 align:middle line:90%
want to ask it.

00:21:08.600 --> 00:21:13.170 align:middle line:90%


00:21:13.170 --> 00:21:15.705 align:middle line:90%
We'll replace that.

00:21:15.705 --> 00:21:18.730 align:middle line:90%


00:21:18.730 --> 00:21:26.310 align:middle line:84%
So we'll do that select count
of all the things, all the rows,

00:21:26.310 --> 00:21:36.810 align:middle line:84%
really, from books.authors with
a semicolon and a single quote.

00:21:36.810 --> 00:21:40.680 align:middle line:84%
Now we use the username of
root and password of empty.

00:21:40.680 --> 00:21:44.880 align:middle line:90%


00:21:44.880 --> 00:21:51.180 align:middle line:84%
And we see that there are 10
items, 10 rows in the database.

00:21:51.180 --> 00:21:53.980 align:middle line:84%
That's some basic
enumeration from MySQL.

00:21:53.980 --> 00:21:56.970 align:middle line:90%


00:21:56.970 --> 00:21:59.850 align:middle line:90%
It was a bit-- it was a lot.

00:21:59.850 --> 00:22:02.640 align:middle line:84%
Knowing these commands, having
them written down somewhere,

00:22:02.640 --> 00:22:04.290 align:middle line:84%
can be quite helpful
because later when

00:22:04.290 --> 00:22:06.000 align:middle line:84%
you come across
something, then you'll

00:22:06.000 --> 00:22:09.600 align:middle line:84%
want to use your toolset,
your cheat sheet.

00:22:09.600 --> 00:22:11.430 align:middle line:84%
Creating your own
cheat sheet is helpful

00:22:11.430 --> 00:22:13.500 align:middle line:84%
because it's what you're
comfortable running.

00:22:13.500 --> 00:22:14.980 align:middle line:90%
It's what you get used to.

00:22:14.980 --> 00:22:18.990 align:middle line:84%
And if something changes,
then you can adapt to that.

00:22:18.990 --> 00:22:22.470 align:middle line:84%
Knowing what tools are out
there, gives you the option.

00:22:22.470 --> 00:22:25.510 align:middle line:84%
If your tools aren't working,
you can try something else.

00:22:25.510 --> 00:22:28.590 align:middle line:84%
But when we're pen
testing, when you're

00:22:28.590 --> 00:22:32.910 align:middle line:84%
auditing your own system, or
thinking like the attacker,

00:22:32.910 --> 00:22:35.040 align:middle line:84%
if they're trying
to find ways in,

00:22:35.040 --> 00:22:38.990 align:middle line:84%
they're trying to
enumerate your system,

00:22:38.990 --> 00:22:42.350 align:middle line:84%
this is how you
would go about it.

00:22:42.350 --> 00:22:45.290 align:middle line:84%
MySQL or just SQL
databases in general

00:22:45.290 --> 00:22:47.450 align:middle line:84%
have the potential of
being very vulnerable

00:22:47.450 --> 00:22:50.600 align:middle line:84%
and allowing a lot of
access to a machine

00:22:50.600 --> 00:22:53.540 align:middle line:90%
without you knowing it.

00:22:53.540 --> 00:22:58.370 align:middle line:84%
By default, they just have
a lot that's vulnerable.

00:22:58.370 --> 00:23:01.940 align:middle line:84%
So if you have these databases,
you want to lock them down.

00:23:01.940 --> 00:23:03.670 align:middle line:84%
And if you come
across them, then you

00:23:03.670 --> 00:23:05.900 align:middle line:84%
want to find out how
vulnerable they are.

00:23:05.900 --> 00:23:09.220 align:middle line:84%
And if you-- as a pen
tester or as the auditor,

00:23:09.220 --> 00:23:12.558 align:middle line:84%
if there's anything that
can be locked down on that.

00:23:12.558 --> 00:23:13.058 align:middle line:90%