﻿WEBVTT

00:00:00.000 --> 00:00:05.445
[ELECTRONIC BEEPING AND BUZZING]

00:00:15.345 --> 00:00:20.790
[MUSIC PLAYING]

00:00:28.220 --> 00:00:32.509
Welcome to the Hacker House
Hands-On Hacking DNS Practical

00:00:32.509 --> 00:00:33.110
module.

00:00:33.110 --> 00:00:34.610
We're now going to
walk through some

00:00:34.610 --> 00:00:38.420
of the practical steps that are
necessary for taking advantage

00:00:38.420 --> 00:00:40.190
of vulnerabilities
in DNS servers,

00:00:40.190 --> 00:00:43.778
and we're going to look at how
to target a DNS server as it

00:00:43.778 --> 00:00:44.820
would appear in the wild.

00:00:44.820 --> 00:00:47.120
So what you've got here
is, hopefully, you've

00:00:47.120 --> 00:00:49.970
gone through the Getting Started
guide and Getting Started video

00:00:49.970 --> 00:00:52.070
and you have set up
a host-only network,

00:00:52.070 --> 00:00:55.370
and you have your Kali
Linux, or similar, VM

00:00:55.370 --> 00:00:56.750
with a host-only adapter.

00:00:56.750 --> 00:00:59.247
And I'm now going to click
Play on my Hacker House lab.

00:00:59.247 --> 00:01:00.830
If you review your
lab, just make sure

00:01:00.830 --> 00:01:03.860
that you've got the
correct ISO set.

00:01:03.860 --> 00:01:06.770
Once my lab is booted
up, should be presented

00:01:06.770 --> 00:01:11.922
with an IP address that
can be used to probe

00:01:11.922 --> 00:01:14.130
and see whether that server
is alive and functioning.

00:01:14.130 --> 00:01:17.970
You can see that mine
is on 192.168.56.3.

00:01:17.970 --> 00:01:20.200
Don't worry if
yours is different.

00:01:20.200 --> 00:01:22.950
And what I do is make
sure that we can actually

00:01:22.950 --> 00:01:24.050
ping that address.

00:01:24.050 --> 00:01:27.690
So first things first, when
we're targeting new systems

00:01:27.690 --> 00:01:30.760
and servers we'd obviously
want to do something like Nmap

00:01:30.760 --> 00:01:32.460
to actually query
against a server.

00:01:32.460 --> 00:01:35.005
So I'm going to do a very
basic Nmap port scan.

00:01:35.005 --> 00:01:36.630
It's quite likely we
would have learned

00:01:36.630 --> 00:01:39.000
about the details of
where a DNS server was

00:01:39.000 --> 00:01:40.860
during our open source
intelligence phase,

00:01:40.860 --> 00:01:43.160
because we could
query DNS records,

00:01:43.160 --> 00:01:45.098
we could query DNS
servers and find out

00:01:45.098 --> 00:01:46.140
where our name server is.

00:01:46.140 --> 00:01:48.580
But as an example here,
we've done a quick port scan,

00:01:48.580 --> 00:01:51.700
and what we can see is we can
see that this is a name server.

00:01:51.700 --> 00:01:55.778
It has a single open CCP
port, which is CCP port 53.

00:01:55.778 --> 00:01:57.570
That gives me the
impression of a footprint

00:01:57.570 --> 00:02:00.040
of a very standard name server.

00:02:00.040 --> 00:02:01.738
So that's just a
common footprint

00:02:01.738 --> 00:02:03.280
that you would see
if you were coming

00:02:03.280 --> 00:02:06.150
across something that was
DNS, you'd see this 53 open.

00:02:06.150 --> 00:02:08.610
So that's an Nmap against
the IP address like that.

00:02:08.610 --> 00:02:12.670
Of course, DNS is
typically run over UDP.

00:02:12.670 --> 00:02:14.730
So if you wanted
to scan via UDP,

00:02:14.730 --> 00:02:17.892
you would also
use Nmap minus SU,

00:02:17.892 --> 00:02:19.350
and that will just
limit the number

00:02:19.350 --> 00:02:23.430
of ports it will scan
to see whether or not

00:02:23.430 --> 00:02:24.820
the ports are open there.

00:02:24.820 --> 00:02:27.660
So you can see now when I've
done Nmap minus SU, I've

00:02:27.660 --> 00:02:31.380
told Nmap to do a
UDP scan, provided

00:02:31.380 --> 00:02:35.100
the port numbers of 53 and
123 are common UDP services.

00:02:35.100 --> 00:02:38.790
And we can see, again, it
says open for UDP on 53.

00:02:38.790 --> 00:02:43.170
So that's an example of
a DNS server's footprint.

00:02:43.170 --> 00:02:47.040
So we can see that this server
might be a DNS server, just

00:02:47.040 --> 00:02:49.830
by port scanning it, or we've
learned the location of the DNS

00:02:49.830 --> 00:02:51.298
server by querying it.

00:02:51.298 --> 00:02:52.340
So how would we query it?

00:02:52.340 --> 00:02:52.840
OK.

00:02:52.840 --> 00:02:56.010
Well, let's say I
was to do NS lookup.

00:02:56.010 --> 00:03:02.560
I could do set query type equals
start of authority NSA.gov,

00:03:02.560 --> 00:03:08.310
and I can actually look up and
see what is the authority name

00:03:08.310 --> 00:03:10.230
server for the NSA.gov.

00:03:10.230 --> 00:03:16.200
So let me just do set query type
equals MX, and then do NSA.gov.

00:03:16.200 --> 00:03:19.940
And we can see here we've got
the MX record for NSA.gov.

00:03:19.940 --> 00:03:22.890
If I was to do a set query
type equals start of authority

00:03:22.890 --> 00:03:25.560
for Hacker.House,
we can see here

00:03:25.560 --> 00:03:27.780
that we've got the start
of authority record

00:03:27.780 --> 00:03:28.910
for Hacker House.

00:03:28.910 --> 00:03:30.933
This ns1.live.dns,
for instance, we

00:03:30.933 --> 00:03:32.850
could query that, and
that would be the domain

00:03:32.850 --> 00:03:37.650
server responsible
for DNS for that zone

00:03:37.650 --> 00:03:42.000
file for that Hacker.House
zone, for instance.

00:03:42.000 --> 00:03:46.080
So we can see here we can
query for the DNS service

00:03:46.080 --> 00:03:49.083
just by querying DNS
itself, and we can also look

00:03:49.083 --> 00:03:50.250
at different kinds of tools.

00:03:50.250 --> 00:03:52.950
So if we were to query
a DNS server once we've

00:03:52.950 --> 00:03:55.265
learned the location of
one, and in our example,

00:03:55.265 --> 00:03:56.640
we're going to
ensure that we run

00:03:56.640 --> 00:03:59.245
our attacks against the labs
in our host-only environment,

00:03:59.245 --> 00:04:01.620
because we don't want to send
packets across the internet

00:04:01.620 --> 00:04:04.500
and start trying to hack other
people's DNS servers because we

00:04:04.500 --> 00:04:07.600
don't want to cause any
complications or problems.

00:04:07.600 --> 00:04:15.960
So we're going to do
Dig@192.56.3 and query

00:04:15.960 --> 00:04:18.370
what information we can
get about the server.

00:04:18.370 --> 00:04:22.019
So if I was to do
Dig@any, and then

00:04:22.019 --> 00:04:25.120
I'll do NSA.gov as an example.

00:04:25.120 --> 00:04:28.800
So here we can say I've
done a DNS query using Dig,

00:04:28.800 --> 00:04:30.800
which is a DNS querying tool.

00:04:30.800 --> 00:04:32.820
I've queried this server.

00:04:32.820 --> 00:04:34.380
I've asked it for
the resource record

00:04:34.380 --> 00:04:36.420
of type any, so I'm saying,
give me any resource

00:04:36.420 --> 00:04:39.690
records that you can
for the domain NSA.gov.

00:04:39.690 --> 00:04:42.630
And what we can see here is
that the server has responded,

00:04:42.630 --> 00:04:44.890
it's given us the start
of authority record.

00:04:44.890 --> 00:04:48.480
It says, hey, the NSA
server, NS1.NSA.gov

00:04:48.480 --> 00:04:51.720
is the start of authority, it's
responsible for the zone file

00:04:51.720 --> 00:04:53.640
NS1.NSA.gov.

00:04:53.640 --> 00:04:57.660
These two name servers are
responsible for handling

00:04:57.660 --> 00:05:01.110
requests for resources
in that known zone file.

00:05:01.110 --> 00:05:04.470
MX records-- here we can see
we've got two MX records.

00:05:04.470 --> 00:05:07.110
These are servers that are
responsible for looking up

00:05:07.110 --> 00:05:10.710
email addresses and handling
information related to email.

00:05:10.710 --> 00:05:14.070
So looking at these
different other responses

00:05:14.070 --> 00:05:15.750
down here in the
additional section,

00:05:15.750 --> 00:05:17.580
we can see that a
number of A records

00:05:17.580 --> 00:05:19.950
have also been returned
that correspond back

00:05:19.950 --> 00:05:22.770
to these servers that
we've just identified.

00:05:22.770 --> 00:05:26.250
So we've identified the start
of authority, the name servers,

00:05:26.250 --> 00:05:29.400
and the MX servers just
by querying a DNS server

00:05:29.400 --> 00:05:33.112
and asking it for any records
that we had around the NSA.gov.

00:05:33.112 --> 00:05:34.530
That's an example
of how you could

00:05:34.530 --> 00:05:40.650
use Dig to look up a query
against a particular server.

00:05:40.650 --> 00:05:43.800
As an example here, I'll do
Dig at the IP address again.

00:05:43.800 --> 00:05:45.330
And we can see for
an A record now,

00:05:45.330 --> 00:05:48.300
we're looking up www.NSA.gov.

00:05:48.300 --> 00:05:50.340
We can see here in
the answer section

00:05:50.340 --> 00:05:54.030
we've got some information,
like the CNAME fedora.NSA.gov,

00:05:54.030 --> 00:05:58.320
which then maps back to an A
record, so it's using an alias.

00:05:58.320 --> 00:06:02.130
The alias then maps back
to this IP address here.

00:06:02.130 --> 00:06:06.600
So this is how DNS can be used
to look up information, look up

00:06:06.600 --> 00:06:09.690
resource records, look up
information inside of that zone

00:06:09.690 --> 00:06:11.497
file we discussed.

00:06:11.497 --> 00:06:13.080
So another thing
that we could use DNS

00:06:13.080 --> 00:06:16.620
for is to begin querying
information of that chaos net

00:06:16.620 --> 00:06:18.060
subclass we mentioned.

00:06:18.060 --> 00:06:22.730
So typing chaos
then version.BIND

00:06:22.730 --> 00:06:26.440
and then supplying text
will query the DNS server,

00:06:26.440 --> 00:06:30.940
look up the chaos net subclass,
query the version information,

00:06:30.940 --> 00:06:34.897
and try to return
what information that

00:06:34.897 --> 00:06:35.730
is in a text record.

00:06:35.730 --> 00:06:39.610
And I actually provided the
wrong IP, so it's 192.168.56.3.

00:06:39.610 --> 00:06:42.010
And I've looked at my text
record here for chaos net,

00:06:42.010 --> 00:06:44.050
and you can see that the
response has come back.

00:06:44.050 --> 00:06:46.420
And instead of it giving an
internet address or an IN

00:06:46.420 --> 00:06:50.020
address, it's come back with a
chaos record of a text subclass

00:06:50.020 --> 00:06:52.450
version 9.8.1.

00:06:52.450 --> 00:06:54.420
So you can actually see
what version of BIND

00:06:54.420 --> 00:06:57.070
it is based on the
version number that's

00:06:57.070 --> 00:06:58.703
returned inside of there.

00:06:58.703 --> 00:07:01.120
So when we've got a version
number for a piece of software

00:07:01.120 --> 00:07:02.890
I like to make a note
of it, and I'll say,

00:07:02.890 --> 00:07:09.217
OK, well, I'm doing DNS, so
I'll do DNS server BIND 9.8.1.

00:07:09.217 --> 00:07:11.050
I'll just make notes
of things as I go along

00:07:11.050 --> 00:07:13.150
in a file called Notes,
because maybe that might

00:07:13.150 --> 00:07:14.290
be useful to me later on.

00:07:14.290 --> 00:07:16.270
So we know a version
of the DNS server

00:07:16.270 --> 00:07:17.770
by querying that
chaos net subclass.

00:07:17.770 --> 00:07:20.270
As an example, what other things
you could query from there,

00:07:20.270 --> 00:07:21.970
and these are little
lesser known trick,

00:07:21.970 --> 00:07:26.410
is you can actually
query for hostname.BIND--

00:07:26.410 --> 00:07:29.320
apologies, I appear to have
pasted unwanted characters

00:07:29.320 --> 00:07:33.910
onto the screen, and again--

00:07:38.100 --> 00:07:41.900
chaos hostname.BIND,
and that would actually

00:07:41.900 --> 00:07:44.690
return back to the internal
hostname of the server.

00:07:44.690 --> 00:07:47.630
So we can see here that this
server's called, imaginatively,

00:07:47.630 --> 00:07:49.557
name server 01.

00:07:49.557 --> 00:07:51.140
So you can actually
query back, what's

00:07:51.140 --> 00:07:52.902
the local hostname
of the server?

00:07:52.902 --> 00:07:54.860
And other things you can
actually query as well

00:07:54.860 --> 00:07:57.470
include authors.BIND,
which is the number

00:07:57.470 --> 00:07:59.630
of the people of
the individuals who

00:07:59.630 --> 00:08:02.520
are involved in authoring that
particular piece of software.

00:08:02.520 --> 00:08:04.760
So, in fact, even if somebody
suppresses the version

00:08:04.760 --> 00:08:07.250
information, you could look
up which authors were involved

00:08:07.250 --> 00:08:08.780
in that particular
version of BIND,

00:08:08.780 --> 00:08:10.697
and then try to work out
which version of BIND

00:08:10.697 --> 00:08:12.890
it is based on when these
programmers joined or left

00:08:12.890 --> 00:08:13.640
the project.

00:08:13.640 --> 00:08:16.290
So you can also get other
bits of information there.

00:08:16.290 --> 00:08:19.160
Another thing you can also
do is do ID.BIND, learn

00:08:19.160 --> 00:08:21.320
a little bit of extra
information from there.

00:08:21.320 --> 00:08:22.730
But nothing in this query.

00:08:22.730 --> 00:08:25.730
So don't forget, you can
query chaos net records,

00:08:25.730 --> 00:08:27.650
it's not just
internet addresses.

00:08:27.650 --> 00:08:30.710
You may be able to
query a hidden subnet

00:08:30.710 --> 00:08:34.250
classing or a network
class classification chaos

00:08:34.250 --> 00:08:35.101
net or similar.

00:08:35.101 --> 00:08:36.559
So always have a
look through code,

00:08:36.559 --> 00:08:38.000
see if there's
any extra resource

00:08:38.000 --> 00:08:40.010
records or kinds
of classes that you

00:08:40.010 --> 00:08:44.855
could query that may
contain information leaks.

00:08:44.855 --> 00:08:46.730
Another thing that we
saw on this DNS server,

00:08:46.730 --> 00:08:48.680
if we look back at
its ports scan output,

00:08:48.680 --> 00:08:53.750
we saw that it had
TCP port 53 open.

00:08:53.750 --> 00:08:56.550
And we know that when
we see TCP port 53 open,

00:08:56.550 --> 00:08:59.900
that means that that server
may support zone transfers

00:08:59.900 --> 00:09:02.150
because I can actually make
use of the required ports

00:09:02.150 --> 00:09:05.900
to conduct the transfer
from the DNS server.

00:09:05.900 --> 00:09:07.290
So what I would
do then is to Dig

00:09:07.290 --> 00:09:10.460
at the IP address of
the server, do transfer,

00:09:10.460 --> 00:09:13.300
and then I'll just
query it for NSA.gov.

00:09:13.300 --> 00:09:15.740
And although this
isn't a reality,

00:09:15.740 --> 00:09:18.890
here is an example
of a name server--

00:09:18.890 --> 00:09:21.450
a DNS zone transfer
being done, and it's

00:09:21.450 --> 00:09:25.040
returning back now all of these
systems and inputs, records

00:09:25.040 --> 00:09:25.813
from the NSA.

00:09:25.813 --> 00:09:27.230
We can see, actually,
the resource

00:09:27.230 --> 00:09:30.150
records that were installed
into that zone file

00:09:30.150 --> 00:09:31.852
or were created
into that zone file.

00:09:31.852 --> 00:09:34.310
So we can see, for instance,
the start of authority record,

00:09:34.310 --> 00:09:37.610
and here we can see
additional text records.

00:09:37.610 --> 00:09:39.955
So this is unusual, the
black sparrow password.

00:09:39.955 --> 00:09:41.330
I've seen things
like this, where

00:09:41.330 --> 00:09:45.110
people have used text records to
make human readable notes just

00:09:45.110 --> 00:09:47.690
for their own memory or to
store some information in a zone

00:09:47.690 --> 00:09:48.480
record.

00:09:48.480 --> 00:09:50.450
So finding things
like this, this here,

00:09:50.450 --> 00:09:53.930
this text record is an example
of a Sender Policy Framework,

00:09:53.930 --> 00:09:57.680
which is a machine parsable
record used for determining who

00:09:57.680 --> 00:10:00.910
can and cannot send email
through a mail server.

00:10:00.910 --> 00:10:02.975
You've got all of
these other A records.

00:10:02.975 --> 00:10:04.850
Again, that's an extension
of a text record--

00:10:04.850 --> 00:10:08.660
C name, start of authority,
knock twice to enter,

00:10:08.660 --> 00:10:12.080
and as we can see here,
Snowden.NSA.gov, sigint,

00:10:12.080 --> 00:10:15.060
prison.NSA.gov,
keyscore.NSA.gov, et

00:10:15.060 --> 00:10:18.670
cetera, all of these
different systems that maybe

00:10:18.670 --> 00:10:19.550
in that network.

00:10:19.550 --> 00:10:23.390
So that's an example of a
DNS zone transfer request.

00:10:23.390 --> 00:10:25.620
Remember, it operates
over TCP ports

00:10:25.620 --> 00:10:27.770
53 and the types
of information you

00:10:27.770 --> 00:10:30.740
would see there are IP
addresses, potentially

00:10:30.740 --> 00:10:32.575
internal network configuration.

00:10:32.575 --> 00:10:33.950
A lot of these IP
addresses would

00:10:33.950 --> 00:10:35.900
be internal and not
something that you

00:10:35.900 --> 00:10:39.821
would hope to have
exposed to the internet.

00:10:39.821 --> 00:10:43.110
But, however, if you
couldn't do a zone transfer,

00:10:43.110 --> 00:10:44.360
there are alternatives to you.

00:10:44.360 --> 00:10:47.536
You could actually use
something like Fierce--

00:10:47.536 --> 00:10:49.870
I think Fierce supports it.

00:10:49.870 --> 00:10:52.070
You can actually--

00:10:52.070 --> 00:10:55.500
Fierce-- I'm going to
clear my clipboard as well.

00:11:04.510 --> 00:11:10.030
So Fierce minus minus help.

00:11:14.672 --> 00:11:16.380
So we're going to use
the Fierce command.

00:11:16.380 --> 00:11:18.145
So if you do Fierce
minus minus help,

00:11:18.145 --> 00:11:19.520
you'll actually
get the arguments

00:11:19.520 --> 00:11:21.793
that you can use to
supply to Fierce.

00:11:21.793 --> 00:11:23.210
So Fierce will
take, for instance,

00:11:23.210 --> 00:11:26.150
a DNS server as an example
and it will actually

00:11:26.150 --> 00:11:29.360
try and do a number of
these probes for you.

00:11:29.360 --> 00:11:34.800
So if I was to do Fierce
and then DNS server,

00:11:34.800 --> 00:11:37.160
the IP address of the
server I'm targeting,

00:11:37.160 --> 00:11:40.530
and then I'll do
NSA.gov, and then

00:11:40.530 --> 00:11:43.518
I'll go minus DNS-- sorry--
to give it the NSA.gov,

00:11:43.518 --> 00:11:45.060
and what that'll do
is it'll actually

00:11:45.060 --> 00:11:48.630
query against that DNS
server, try to work out

00:11:48.630 --> 00:11:50.090
what those DNS servers are.

00:11:50.090 --> 00:11:52.750
And interestingly, it will get
them from the web interface

00:11:52.750 --> 00:11:54.960
and then it will
actually try and do

00:11:54.960 --> 00:11:57.630
a zone transfer against
those DNS servers,

00:11:57.630 --> 00:12:00.990
and then it will also
check for wildcard DNSs.

00:12:00.990 --> 00:12:03.330
And then after that, it
will do some brute forcing

00:12:03.330 --> 00:12:05.100
and it will actually
try to look up

00:12:05.100 --> 00:12:08.070
if it can find any IPs
for common hostname.

00:12:08.070 --> 00:12:11.550
So, for instance, x key
score sigint VPN web mail.

00:12:11.550 --> 00:12:13.050
You see it's just
done a brute force

00:12:13.050 --> 00:12:15.353
attack to try and find these.

00:12:15.353 --> 00:12:17.520
Another tool that you could
use is tool called Host.

00:12:17.520 --> 00:12:21.000
Host will take IP addresses
and reverse them back.

00:12:21.000 --> 00:12:23.320
So host.west to the
web address there.

00:12:23.320 --> 00:12:25.740
And then you could, of course,
look up those IP addresses

00:12:25.740 --> 00:12:29.000
in your open source
intelligence and query it.

00:12:29.000 --> 00:12:30.750
In fact, a lot of open
source intelligence

00:12:30.750 --> 00:12:33.780
will also encompass a DNS
review because there'll

00:12:33.780 --> 00:12:36.630
be so many systems linked
together from DNS and mapping

00:12:36.630 --> 00:12:40.040
that this would be part
of that exercise as well.

00:12:40.040 --> 00:12:42.540
But here we've got-- you can
see various bits of information

00:12:42.540 --> 00:12:44.430
from the IPs that we found.

00:12:44.430 --> 00:12:46.400
We were able to do
that zone transfer.

00:12:46.400 --> 00:12:49.890
We did some DNS brute forcing.

00:12:49.890 --> 00:12:52.410
And we're not going
to do one more.

00:12:52.410 --> 00:12:54.600
We'll look at the traffic
amplification attacks

00:12:54.600 --> 00:12:56.940
and some other elements
of the attack as well.

00:12:56.940 --> 00:13:02.080
And I'll just see if we've
got DNS recon, for instance,

00:13:02.080 --> 00:13:04.430
is another tool we could use.

00:13:04.430 --> 00:13:07.060
And DNS recon is a DNS
reconnaissance tool

00:13:07.060 --> 00:13:08.470
that can be used for doing--

00:13:08.470 --> 00:13:12.340
similar to Fierce, we'd
supply it with a domain name

00:13:12.340 --> 00:13:15.730
and then we'd give it a name
server as an IP address,

00:13:15.730 --> 00:13:19.000
and it does very similar
concept where it'll actually

00:13:19.000 --> 00:13:22.720
go and look up the
files, it will look up

00:13:22.720 --> 00:13:24.160
for the name
servers, and it will

00:13:24.160 --> 00:13:29.800
try to do the DNS zone transfer
and obtain as much information

00:13:29.800 --> 00:13:31.610
as it can from a DNS server.

00:13:31.610 --> 00:13:34.480
So that's an example
of DNS recon.

00:13:34.480 --> 00:13:37.880
There's other tools,
such as dnsenum.

00:13:37.880 --> 00:13:43.690
And for some reason, I'm going
to have to exit this terminal

00:13:43.690 --> 00:13:48.830
and restart this terminal--
dnsenum minus minus help.

00:13:48.830 --> 00:13:50.680
There we go.

00:13:50.680 --> 00:13:54.100
dnsenum read subdomains from
this file to brute force.

00:13:54.100 --> 00:13:57.130
So this is a tool for doing
the brute force attacks.

00:13:57.130 --> 00:13:59.933
So we do dnsenum
DNS server, provide

00:13:59.933 --> 00:14:01.600
it the IP address of
the server that you

00:14:01.600 --> 00:14:03.880
want to do your brute
force attacks against.

00:14:03.880 --> 00:14:06.370
We've got 56.3.

00:14:06.370 --> 00:14:08.320
Use this DNS server.

00:14:08.320 --> 00:14:14.350
And then the brute
force switch minus F

00:14:14.350 --> 00:14:17.560
to provide it with a file
of subnames to brute force,

00:14:17.560 --> 00:14:20.070
and that would be list
of files or domain names.

00:14:20.070 --> 00:14:23.080
I'll put echo VPN DNS.text.

00:14:23.080 --> 00:14:26.710
So dnsenum minus minus
DNS server, the IP address

00:14:26.710 --> 00:14:33.280
of the server that you want
to target minus F DNS.text,

00:14:33.280 --> 00:14:34.590
and then the domain name.

00:14:34.590 --> 00:14:37.560
And it would actually then try
and do that kind of DNS zone

00:14:37.560 --> 00:14:39.150
transfer again, do the similar--

00:14:39.150 --> 00:14:42.420
automate that process for
you, undo that brute forcing,

00:14:42.420 --> 00:14:44.490
try and guess those
common mnemonics

00:14:44.490 --> 00:14:46.630
that might be being
used on the network.

00:14:46.630 --> 00:14:52.260
So those are examples of
common DNS query tools.

00:14:52.260 --> 00:14:56.790
We've used DNS now to
do host enumeration

00:14:56.790 --> 00:15:00.660
attacks, query information,
query common resource records.

00:15:00.660 --> 00:15:04.050
Now what we want to do is see if
we can misuse that DNS server.

00:15:04.050 --> 00:15:07.080
So when we can use a DNS
server to actually make

00:15:07.080 --> 00:15:10.812
queries and use it to look
up external resources,

00:15:10.812 --> 00:15:12.270
one of the other
things we would do

00:15:12.270 --> 00:15:13.937
is then try and probe
it, see if there's

00:15:13.937 --> 00:15:15.810
any common misconfigurations
or weaknesses

00:15:15.810 --> 00:15:17.190
that we could maybe use.

00:15:17.190 --> 00:15:20.232
And a way we might do that is
by using a tool like Metasploit.

00:15:20.232 --> 00:15:21.690
We're going to use
Metasploit quite

00:15:21.690 --> 00:15:23.430
a lot throughout
this course, so this

00:15:23.430 --> 00:15:24.597
is the first time we use it.

00:15:24.597 --> 00:15:28.470
But if you simply type
MSF console in Kali,

00:15:28.470 --> 00:15:31.170
it will effectively load
up the Metasploit console,

00:15:31.170 --> 00:15:33.060
which will give you
a unified framework

00:15:33.060 --> 00:15:35.220
interface for interacting
with various kinds

00:15:35.220 --> 00:15:36.210
of exploit scripts.

00:15:36.210 --> 00:15:40.220
Very similar to how the
recon ng framework worked

00:15:40.220 --> 00:15:42.145
from the previous module.

00:15:42.145 --> 00:15:43.770
So as you can see
here, it's booted up.

00:15:43.770 --> 00:15:46.062
And if your prompt doesn't
look like mine, don't worry.

00:15:46.062 --> 00:15:48.960
There's various msf
console rc set options

00:15:48.960 --> 00:15:50.490
that are specified
here that allow

00:15:50.490 --> 00:15:52.650
me to keep track of
things, like timestamps,

00:15:52.650 --> 00:15:55.890
and turns on logging and
various other options

00:15:55.890 --> 00:15:56.910
when I start Metasploit.

00:15:56.910 --> 00:15:59.445
The reason I do that is
I like to be accountable

00:15:59.445 --> 00:16:00.570
when I'm targeting systems.

00:16:00.570 --> 00:16:03.900
So I keep a very detailed,
itemized recording

00:16:03.900 --> 00:16:06.510
of most of my actions when I'm
targeting any kind of system

00:16:06.510 --> 00:16:08.580
or network, so it
allows me to distinguish

00:16:08.580 --> 00:16:10.770
between my activity
and benign activity

00:16:10.770 --> 00:16:12.240
and those of a
legitimate attacker.

00:16:12.240 --> 00:16:15.210
If anybody was to query what
I was doing Tuesday at 10

00:16:15.210 --> 00:16:16.760
past 3:00, I'd be
able to say, oh,

00:16:16.760 --> 00:16:18.810
I was running these commands
against this server.

00:16:18.810 --> 00:16:21.270
So it's a way of me giving
accountability for my actions

00:16:21.270 --> 00:16:22.328
on a network as well.

00:16:22.328 --> 00:16:24.120
So I just turn on all
these various options

00:16:24.120 --> 00:16:25.710
every time I run it.

00:16:25.710 --> 00:16:27.210
So again, when
you're in Metasploit,

00:16:27.210 --> 00:16:29.220
you've got all the
various common commands

00:16:29.220 --> 00:16:31.710
that we saw earlier,
this help output, which

00:16:31.710 --> 00:16:33.990
will give you an
example of how to use

00:16:33.990 --> 00:16:35.700
some of those various commands.

00:16:35.700 --> 00:16:37.440
And once you've got
the things like help

00:16:37.440 --> 00:16:39.240
and various other
options in there,

00:16:39.240 --> 00:16:41.460
you could do show
modules, list through all

00:16:41.460 --> 00:16:43.360
the various modules--

00:16:43.360 --> 00:16:45.780
or show exploits,
sorry, to list out

00:16:45.780 --> 00:16:47.520
various exploits
or various things

00:16:47.520 --> 00:16:50.320
that you might want to
use within Metasploit.

00:16:50.320 --> 00:16:53.280
So simply typing show exploits
would list all of the exploits

00:16:53.280 --> 00:16:55.470
that it might know about,
and obviously there's

00:16:55.470 --> 00:16:57.090
going to be quite a lot there.

00:16:57.090 --> 00:16:59.940
Another thing I
would do is not just

00:16:59.940 --> 00:17:04.079
using the Metasploit
framework, we

00:17:04.079 --> 00:17:07.230
could also download
from our stuff directory

00:17:07.230 --> 00:17:10.235
from stuff a tool
called nse discover.py.

00:17:10.235 --> 00:17:19.040
This nsc discover.py is on
static.Hacker.House/stuff.

00:17:19.040 --> 00:17:21.770
nsc discover.py is
a little utility

00:17:21.770 --> 00:17:23.690
for working with Nmap scripts.

00:17:23.690 --> 00:17:25.970
So Nmap contains a nice
little scripting engine.

00:17:25.970 --> 00:17:27.500
So as you're doing
your port scans

00:17:27.500 --> 00:17:28.880
and you're using
enumeration, you

00:17:28.880 --> 00:17:31.130
can actually use Nmap
as a scriptable engine

00:17:31.130 --> 00:17:33.500
to conduct some kind of
fingerprinting and probing

00:17:33.500 --> 00:17:34.760
and similar for you.

00:17:34.760 --> 00:17:38.023
And if you were to simply just
run Python nsc discover.py,

00:17:38.023 --> 00:17:39.440
you'd actually
find that-- or just

00:17:39.440 --> 00:17:42.862
list all of the Nmap discovery
scripts that it can use,

00:17:42.862 --> 00:17:44.570
allow you to browse
through those scripts

00:17:44.570 --> 00:17:47.870
and select ones which are
relevant to your target

00:17:47.870 --> 00:17:48.470
platform.

00:17:48.470 --> 00:17:50.930
So for an example, you
could scroll down and look

00:17:50.930 --> 00:17:53.990
for things like
DNS, and here you

00:17:53.990 --> 00:17:56.780
can see there are various
scripts that it supports

00:17:56.780 --> 00:18:01.580
running, including cache
snoop, check zone, DNS fuzz,

00:18:01.580 --> 00:18:04.520
DNS recursion, various
service enumeration.

00:18:04.520 --> 00:18:07.610
There's various DNS probes
that we could run along

00:18:07.610 --> 00:18:12.500
with Nmap to see what kind of
information we might get back.

00:18:12.500 --> 00:18:15.380
One of those we
could see is, perhaps

00:18:15.380 --> 00:18:18.020
we're doing things like
traffic amplification

00:18:18.020 --> 00:18:20.600
or similar kinds of probing.

00:18:20.600 --> 00:18:25.430
So you can see there recursion,
service discovery, DNS updates,

00:18:25.430 --> 00:18:26.330
and brute force.

00:18:26.330 --> 00:18:28.247
So for instance, you
could use this one to try

00:18:28.247 --> 00:18:31.190
and brute force DNS.

00:18:31.190 --> 00:18:32.810
So you do that by
simply supplying

00:18:32.810 --> 00:18:34.100
the name of the script.

00:18:34.100 --> 00:18:36.200
In fact, if you wanted
to run every DNS script

00:18:36.200 --> 00:18:39.620
against the target, you could
simply do with DNS star,

00:18:39.620 --> 00:18:42.140
and then tell it to
actually run the DNS

00:18:42.140 --> 00:18:45.920
probes against that server
once it's come back.

00:18:45.920 --> 00:18:47.420
So that's an example
of just running

00:18:47.420 --> 00:18:48.870
Nmap with one of the scripts.

00:18:48.870 --> 00:18:51.710
And I've told it to run
all matching DNS scripts

00:18:51.710 --> 00:18:52.850
against that DNS server.

00:18:52.850 --> 00:18:54.975
I wouldn't really recommend
you do that in the wild

00:18:54.975 --> 00:18:57.680
because you'd be running a
lot of unnecessary queries,

00:18:57.680 --> 00:19:00.450
but that's just an example
of how you would do that.

00:19:00.450 --> 00:19:03.260
So going back to here, we can
now see our Metasploit module,

00:19:03.260 --> 00:19:07.870
and we're going to do a
search now for DNS_amp.

00:19:07.870 --> 00:19:11.500
And this DNS_amp, you can see
it says it's a DNS amplification

00:19:11.500 --> 00:19:12.250
scanner.

00:19:12.250 --> 00:19:14.320
And what we can do is use
this auxiliary module,

00:19:14.320 --> 00:19:17.350
it's an extra module, not
part of the exploit framework,

00:19:17.350 --> 00:19:19.690
that's designed to
do a specific task.

00:19:19.690 --> 00:19:22.060
So if we were to type
use in the module name,

00:19:22.060 --> 00:19:23.650
you can see the
prompt has now changed

00:19:23.650 --> 00:19:25.660
to show us that we've
selected that module,

00:19:25.660 --> 00:19:28.810
and we can now do various
things, including show info.

00:19:28.810 --> 00:19:31.900
And show info will give us
various bits of information.

00:19:31.900 --> 00:19:33.880
We can see it'll
give us the name--

00:19:33.880 --> 00:19:36.610
very similar to the way that
we saw in the previous recon ng

00:19:36.610 --> 00:19:38.980
framework, it's given us
the name of the module,

00:19:38.980 --> 00:19:41.680
it's given us a ranking,
which we'll explain later,

00:19:41.680 --> 00:19:43.850
and then it's given us
various other options,

00:19:43.850 --> 00:19:47.390
the different options that
need to be set for this module

00:19:47.390 --> 00:19:47.890
to work.

00:19:47.890 --> 00:19:51.010
So the required is the ones that
have to be set for this module

00:19:51.010 --> 00:19:51.980
to function.

00:19:51.980 --> 00:19:54.250
So we can see here, you've
got things like filter

00:19:54.250 --> 00:19:55.400
is not required.

00:19:55.400 --> 00:19:57.490
And if you were to
just type show options,

00:19:57.490 --> 00:19:59.818
it will actually just
show you the options

00:19:59.818 --> 00:20:01.110
that are needed for the module.

00:20:01.110 --> 00:20:04.720
So we can see here any required
options that are specified

00:20:04.720 --> 00:20:07.330
and the one that's missing
is the r host option,

00:20:07.330 --> 00:20:09.490
so we can actually
provide r host

00:20:09.490 --> 00:20:12.700
and see whether that would then
satisfy all of the arguments

00:20:12.700 --> 00:20:13.250
necessary.

00:20:13.250 --> 00:20:16.330
And you see that, indeed, all
of the arguments that say yes

00:20:16.330 --> 00:20:17.470
are specified.

00:20:17.470 --> 00:20:19.540
And if you were to look
at the description,

00:20:19.540 --> 00:20:23.080
you can see here it says
it will do recursive name

00:20:23.080 --> 00:20:25.780
lookups, which can be
used in an amplification

00:20:25.780 --> 00:20:27.550
attack against a third party.

00:20:27.550 --> 00:20:30.730
And I will set the
domain name to NSA.gov

00:20:30.730 --> 00:20:32.890
to ensure that we get
the correct query back,

00:20:32.890 --> 00:20:35.380
as this query
response on its own

00:20:35.380 --> 00:20:37.780
may not work on our
lab environment.

00:20:37.780 --> 00:20:39.880
So if I now send that
exploit to the server

00:20:39.880 --> 00:20:42.700
by simply typing
exploit or run, you

00:20:42.700 --> 00:20:44.710
can see that it
sends DNS probes,

00:20:44.710 --> 00:20:47.440
and then it's actually
responded back to the probe

00:20:47.440 --> 00:20:50.710
and worked out how much
amplification has come back

00:20:50.710 --> 00:20:52.100
from that DNS server.

00:20:52.100 --> 00:20:54.910
So this particular DNS server
is also a good candidate for us

00:20:54.910 --> 00:20:58.390
to use in a DNS Smurf attack.

00:20:58.390 --> 00:21:01.210
So we could actually
try to use a DNS attack

00:21:01.210 --> 00:21:03.150
against that particular server.

00:21:03.150 --> 00:21:05.690
And the way that
we could do that

00:21:05.690 --> 00:21:07.610
is actually to
download another tool.

00:21:07.610 --> 00:21:10.400
If we were to go to
our stuff directory--

00:21:10.400 --> 00:21:16.150
go to stuff.Hacker.House/stuff--
oh, static, sorry,

00:21:16.150 --> 00:21:22.460
.Hacker.House/stuff, you'll see
that there's various modules

00:21:22.460 --> 00:21:23.460
in here that we can use.

00:21:23.460 --> 00:21:25.002
And one of the tools
I'm going to use

00:21:25.002 --> 00:21:27.240
is DNS doctor dos,
a tool by a friend

00:21:27.240 --> 00:21:29.280
of mine called Nop Tricks.

00:21:29.280 --> 00:21:34.553
And this tool allows
you to use DNS servers.

00:21:34.553 --> 00:21:35.970
You provide them
in a list format,

00:21:35.970 --> 00:21:38.310
and it actually allows you
to use them for a traffic

00:21:38.310 --> 00:21:39.297
amplification attack.

00:21:39.297 --> 00:21:41.130
So if you have a look
through the code here,

00:21:41.130 --> 00:21:44.390
you can see that it's DNS
reflection dos, a denial

00:21:44.390 --> 00:21:48.860
assertive technique that you can
use to use these name servers

00:21:48.860 --> 00:21:50.610
and actually do this
traffic amplification

00:21:50.610 --> 00:21:53.400
attack against a DNS server.

00:21:53.400 --> 00:21:58.260
So you need to compile that code
by doing GCC DNS doctor dos,

00:21:58.260 --> 00:22:02.483
and I'll output
to DNS doctor dos.

00:22:02.483 --> 00:22:03.900
And then if you
were to simply run

00:22:03.900 --> 00:22:07.560
DNS doctor dos
with a minus H, you

00:22:07.560 --> 00:22:10.620
can see that there are
various options that it needs.

00:22:10.620 --> 00:22:13.740
And one of those options is it
takes a list of a name server.

00:22:13.740 --> 00:22:16.410
So you've got a DNS
server and you've

00:22:16.410 --> 00:22:18.630
got an IP address that
you want to send the spoof

00:22:18.630 --> 00:22:22.000
responses from and the requests
that it should be looking up

00:22:22.000 --> 00:22:23.250
to send those attacks through.

00:22:23.250 --> 00:22:25.380
So what I would
do is I'll do echo

00:22:25.380 --> 00:22:29.070
and I will add my IP
address of my DNS server

00:22:29.070 --> 00:22:32.700
into a file called
name server.lst.

00:22:32.700 --> 00:22:35.940
And these names server.lst
files would then contain--

00:22:38.570 --> 00:22:41.330
[INAUDIBLE] server minus one--
and these names server.lst

00:22:41.330 --> 00:22:45.340
files would then be used to feed
into Doctor DNS Dos, like this.

00:22:45.340 --> 00:22:48.500
So I'll do DNS Doctor
Dos minus F name server

00:22:48.500 --> 00:22:50.480
list minus source IP address.

00:22:50.480 --> 00:22:53.310
Well, I want it to DDoS
an IP on the network.

00:22:53.310 --> 00:22:55.220
So I will get it to DDoS me--

00:22:55.220 --> 00:22:59.000
I'll get to DDoS
myself as an example,

00:22:59.000 --> 00:23:01.830
so I'll use my IP
address of 104.

00:23:01.830 --> 00:23:04.670
And you see now that
if I do minus L 10

00:23:04.670 --> 00:23:07.590
just to loop over it and see
how many loops it will do,

00:23:07.590 --> 00:23:10.970
and this will actually
then spoof a DNS query,

00:23:10.970 --> 00:23:13.230
look up the DNS name I provide.

00:23:13.230 --> 00:23:15.890
So I'm going to put
NSA.gov.fullstop,

00:23:15.890 --> 00:23:18.140
and then I'll do
minus L and tell it

00:23:18.140 --> 00:23:21.747
to do a million DNS requests.

00:23:21.747 --> 00:23:23.330
And actually, if you
were to then look

00:23:23.330 --> 00:23:26.000
at this in a tool
like wireshark,

00:23:26.000 --> 00:23:27.860
we would actually
see that this is now

00:23:27.860 --> 00:23:29.240
doing a traffic amplification.

00:23:29.240 --> 00:23:34.190
It's sending lots of packets to
the DNS server, which is then

00:23:34.190 --> 00:23:36.590
amplifying back the
responses and sending back

00:23:36.590 --> 00:23:37.700
much more traffic.

00:23:37.700 --> 00:23:40.790
So it is, in effect, conducting
a denial of service attack

00:23:40.790 --> 00:23:41.510
against myself.

00:23:41.510 --> 00:23:45.710
So if I was to then run start
and actually observe traffic

00:23:45.710 --> 00:23:48.380
on the network and do capture--
make sure that I capture

00:23:48.380 --> 00:23:50.570
on the right interface--

00:23:50.570 --> 00:23:56.110
capture options and I'll
put on interface ETH1,

00:23:56.110 --> 00:23:58.240
you can actually see
all of these DNS queries

00:23:58.240 --> 00:24:00.360
that are being sent
to the DNS server,

00:24:00.360 --> 00:24:03.760
flooding my connection
with amplified traffic.

00:24:03.760 --> 00:24:06.730
So this is what attackers would
do, is they would find as many

00:24:06.730 --> 00:24:08.860
of these systems as
they can allow them

00:24:08.860 --> 00:24:10.540
to use traffic amplification.

00:24:10.540 --> 00:24:12.917
So that's why if you are
responsible for a DNS server

00:24:12.917 --> 00:24:14.500
or if you're responsible
DNS security,

00:24:14.500 --> 00:24:18.640
you need to ensure that you
can't have your server misused

00:24:18.640 --> 00:24:20.980
as part of these traffic
amplification attacks.

00:24:20.980 --> 00:24:23.980
Because this is
actually what happens,

00:24:23.980 --> 00:24:27.580
some hacktivists might use these
name servers to overload a web

00:24:27.580 --> 00:24:30.700
server with DNS requests,
but the requests

00:24:30.700 --> 00:24:33.562
will appear to come
from your DNS server.

00:24:33.562 --> 00:24:35.020
So therefore, you
would then end up

00:24:35.020 --> 00:24:38.230
on blacklists or with abuse
complaints and various others.

00:24:38.230 --> 00:24:40.935
So this is an example of how you
could actually use DNS Doctor

00:24:40.935 --> 00:24:42.310
Dos, and obviously,
it would hack

00:24:42.310 --> 00:24:44.620
a bunch of different
computers, use this tool

00:24:44.620 --> 00:24:46.270
with a big list of
DNS servers so they

00:24:46.270 --> 00:24:48.750
send lots of packets,
overwhelming, say,

00:24:48.750 --> 00:24:53.800
number 10 or Westminster because
they're upset over animal

00:24:53.800 --> 00:24:55.060
rights or something like that.

00:24:55.060 --> 00:24:59.710
So just as an example there of
how you could use a DNS Smurf

00:24:59.710 --> 00:25:02.680
attack, and Nmap
and Metasploit both

00:25:02.680 --> 00:25:05.720
contain scripts that help
you with probing for that.

00:25:05.720 --> 00:25:07.570
Another thing that
you might want to use

00:25:07.570 --> 00:25:10.900
are looking for the
bailiwick attack,

00:25:10.900 --> 00:25:14.260
if you were to do
for the bailiwick

00:25:14.260 --> 00:25:24.910
or bailiwick So
in Metasploit, you

00:25:24.910 --> 00:25:27.970
could find some modules
to actually exploit

00:25:27.970 --> 00:25:31.090
the domain start of authority
exploit that we mentioned

00:25:31.090 --> 00:25:34.660
before, you could actually
trying to use this module

00:25:34.660 --> 00:25:37.650
if you wanted to find
a vulnerable DNS server

00:25:37.650 --> 00:25:42.340
and try to actually use this
module to do that injection

00:25:42.340 --> 00:25:45.190
and poison the cache of
a server and cause it

00:25:45.190 --> 00:25:47.275
to-- anyone who
looked up Example.com

00:25:47.275 --> 00:25:51.640
or a similar website like
that would subsequently

00:25:51.640 --> 00:25:53.530
get a different response.

00:25:53.530 --> 00:25:57.670
So what I'll do is I'll
do set domain NSA.gov set

00:25:57.670 --> 00:26:03.250
interface set new DNS the
hostname of the replacement DNS

00:26:03.250 --> 00:26:08.380
server, 192.168.56.104,
set reconnaissance.

00:26:08.380 --> 00:26:12.790
The DNS server to query
will be the actual DNS

00:26:12.790 --> 00:26:14.080
server I want to query itself.

00:26:14.080 --> 00:26:18.048
And then the target server to
see whether or not that's done.

00:26:18.048 --> 00:26:20.590
And then that should be it, it
should set up all the options.

00:26:20.590 --> 00:26:22.558
Once it's set and you
then try to do that,

00:26:22.558 --> 00:26:24.100
the following options
is source port,

00:26:24.100 --> 00:26:27.650
and I'll set source port to 0.

00:26:27.650 --> 00:26:29.640
And what it would try
to do is then actually

00:26:29.640 --> 00:26:32.840
try to do that bailiwick attack
by querying against that DNS

00:26:32.840 --> 00:26:33.340
server.

00:26:33.340 --> 00:26:35.550
And it'll fail in this
example, but it would then

00:26:35.550 --> 00:26:40.530
try to do that 1.NSA.gov,
2.NSA.gov, 3.NSA.gov,

00:26:40.530 --> 00:26:42.600
and try to spoof
back the responses

00:26:42.600 --> 00:26:45.580
so that it would poison the
cache on that DNS server,

00:26:45.580 --> 00:26:47.260
giving you back
some information.

00:26:47.260 --> 00:26:49.530
Likewise, if I
wanted to simply look

00:26:49.530 --> 00:26:52.470
at the cache of a
DNS server, we could

00:26:52.470 --> 00:26:56.230
look in things like
Dig or NS lookup.

00:26:56.230 --> 00:26:59.940
And what I'll do is I'll
do set recursive equals 0,

00:26:59.940 --> 00:27:02.430
so that we disable
the recursive bit.

00:27:02.430 --> 00:27:06.060
And then I'll set the server
to be the remote server.

00:27:06.060 --> 00:27:08.670
Then if I was to simply
look up Google.com,

00:27:08.670 --> 00:27:11.670
we can see that this server
doesn't have Google.com in its

00:27:11.670 --> 00:27:15.300
cache, so we know that
Google.com has not been used--

00:27:15.300 --> 00:27:17.070
nobody who is using
that DNS server

00:27:17.070 --> 00:27:20.280
is using Google.com,
which is very unlikely.

00:27:20.280 --> 00:27:23.280
However, we can see that if
we were to look up NSA.gov,

00:27:23.280 --> 00:27:25.320
we also don't get
an answer for there.

00:27:25.320 --> 00:27:28.160
So there's actually nothing
in this DNS server's cache,

00:27:28.160 --> 00:27:30.090
but because it's not
doing recursive lookups,

00:27:30.090 --> 00:27:33.000
that's how it should be looking,
just in the local server cache.

00:27:33.000 --> 00:27:34.950
So remember, DNS
cache snooping is

00:27:34.950 --> 00:27:38.010
disabling the recursive
lookup, measuring the time

00:27:38.010 --> 00:27:40.260
or the responses coming
back from a server

00:27:40.260 --> 00:27:43.590
to see what information
is contained in it.

00:27:43.590 --> 00:27:46.830
So likewise, another attack
that you might want to do

00:27:46.830 --> 00:27:49.140
is perhaps maybe
leverage some exploits.

00:27:49.140 --> 00:27:51.690
And we know from our
notes file, we actually

00:27:51.690 --> 00:27:56.388
have a version of DNS BIND
that's in use on this server,

00:27:56.388 --> 00:27:57.930
so we can actually
begin profiling it

00:27:57.930 --> 00:27:59.115
for vulnerabilities.

00:27:59.115 --> 00:28:01.740
So what I would do to profile it
for vulnerabilities is I would

00:28:01.740 --> 00:28:08.820
go to SecurityFocus.com/bid, and
this is a database known as bug

00:28:08.820 --> 00:28:09.570
track.

00:28:09.570 --> 00:28:12.240
It's provided by the
Security Focus website.

00:28:12.240 --> 00:28:13.840
And you can actually
select a vendor.

00:28:13.840 --> 00:28:17.970
So let's say I selected ISC,
which is the Internet Software

00:28:17.970 --> 00:28:18.720
Consortium.

00:28:21.740 --> 00:28:24.510
And then you could do title
and then you could select BIND.

00:28:27.615 --> 00:28:29.490
And then, of course,
you could try and select

00:28:29.490 --> 00:28:31.740
the version of BIND
that was in use,

00:28:31.740 --> 00:28:35.250
and for this we've got 9.8, so
we could actually select 9.8.

00:28:35.250 --> 00:28:38.490
So we can actually see
then known vulnerabilities

00:28:38.490 --> 00:28:41.220
listed with CV numbers
that might apply

00:28:41.220 --> 00:28:43.440
to that particular
version of BIND

00:28:43.440 --> 00:28:46.140
that we could then click
on and look up and see

00:28:46.140 --> 00:28:48.390
is there any information in
there that's of use to us.

00:28:48.390 --> 00:28:51.060
So if I was to simply click on
this one, recursive queries,

00:28:51.060 --> 00:28:53.538
we could see discussion,
find some more information,

00:28:53.538 --> 00:28:55.830
and whether or not there's
an exploit available for it.

00:28:55.830 --> 00:28:57.875
And this one says there's
an exploit in the wild,

00:28:57.875 --> 00:29:00.000
and it looks like it has
a remote denial of service

00:29:00.000 --> 00:29:01.110
condition.

00:29:01.110 --> 00:29:03.750
And then there's
various references,

00:29:03.750 --> 00:29:07.450
which include advisories
and other things.

00:29:07.450 --> 00:29:10.750
You could also
look at exploit.db,

00:29:10.750 --> 00:29:13.630
and simply do a search for
exploit.db or other websites,

00:29:13.630 --> 00:29:15.030
like Packet Storm.

00:29:15.030 --> 00:29:17.830
And if you were to
simply go to exploits,

00:29:17.830 --> 00:29:21.250
you could actually do a
search in the exploit page--

00:29:21.250 --> 00:29:22.940
unless I am blind--

00:29:22.940 --> 00:29:27.970
and you can actually do a
search in here for the search.

00:29:27.970 --> 00:29:31.240
Search the exploit
database here.

00:29:31.240 --> 00:29:34.620
And then you could do something
like ISC BIND, for instance.

00:29:34.620 --> 00:29:37.200
I am not a robot.

00:29:37.200 --> 00:29:39.390
Street signs.

00:29:39.390 --> 00:29:41.595
Not true, I may be a robot.

00:29:41.595 --> 00:29:43.720
And then we can see here
clicking all the vehicles.

00:29:43.720 --> 00:29:45.803
And once we've got rid of
these annoying captures,

00:29:45.803 --> 00:29:48.540
it would actually search
through that web page.

00:29:48.540 --> 00:29:51.020
And I'll do a search
there for ISC BIND,

00:29:51.020 --> 00:29:54.660
and we can see we could actually
look for any kind of exploits.

00:29:54.660 --> 00:29:58.660
We know 9.8.1, so
we'd look for, OK, 9--

00:29:58.660 --> 00:30:00.180
is there anything here?

00:30:00.180 --> 00:30:01.140
Is this one?

00:30:01.140 --> 00:30:04.470
We'd actually have a look and
say, OK, well, this one here,

00:30:04.470 --> 00:30:07.080
and then we could read through
what that vulnerability does.

00:30:07.080 --> 00:30:08.705
Maybe there'd be some
information there

00:30:08.705 --> 00:30:11.880
as to which version it
targets and similar.

00:30:11.880 --> 00:30:16.200
So that's an example of
one vulnerability, which

00:30:16.200 --> 00:30:18.160
says it impacts version 9.

00:30:18.160 --> 00:30:20.160
So we can have a look for
other vulnerabilities.

00:30:20.160 --> 00:30:21.870
And again, we would
look for exploits

00:30:21.870 --> 00:30:23.820
now for any of these
known vulnerabilities.

00:30:23.820 --> 00:30:27.000
Another place I would
check is the home page.

00:30:27.000 --> 00:30:29.280
I would actually go to the
home page of the project

00:30:29.280 --> 00:30:30.905
and have a look
through the change log,

00:30:30.905 --> 00:30:33.060
have a look through,
look for the bug report,

00:30:33.060 --> 00:30:38.250
look for the security page,
look at the previous advisories

00:30:38.250 --> 00:30:39.180
and try to find out--

00:30:39.180 --> 00:30:42.060
this is basically what's known
as vulnerability analysis.

00:30:42.060 --> 00:30:44.930
You know a piece of software's
name, you know the version.

00:30:44.930 --> 00:30:47.730
You want to go and find all
the known problems in there

00:30:47.730 --> 00:30:50.610
before you start looking
for unknowns or 0 days--

00:30:50.610 --> 00:30:51.240
zero days.

00:30:51.240 --> 00:30:53.280
You want to look for the
known vulnerabilities.

00:30:53.280 --> 00:30:55.440
Once you know what these
known vulnerabilities are,

00:30:55.440 --> 00:30:56.970
has somebody written an exploit?

00:30:56.970 --> 00:31:00.210
Can you just use their exploit
instead of writing your own?

00:31:00.210 --> 00:31:03.920
So in this example here,
we know it's BIND 9.8.1,

00:31:03.920 --> 00:31:06.090
and we saw a number
of issues in there.

00:31:06.090 --> 00:31:07.927
And instead of
going to exploit.db

00:31:07.927 --> 00:31:09.510
and doing that
[INAUDIBLE] every time,

00:31:09.510 --> 00:31:11.453
you can actually just
do search spoilt,

00:31:11.453 --> 00:31:13.870
and then you could actually
just type on the command line.

00:31:13.870 --> 00:31:16.203
It will actually just search
through all those exploits,

00:31:16.203 --> 00:31:18.930
as they're all locally
stored on Kali as well.

00:31:18.930 --> 00:31:22.050
They're actually in
/user share exploit db.

00:31:25.210 --> 00:31:27.880
And then in there,
you'll find platforms

00:31:27.880 --> 00:31:29.890
and you'll find all of
these different exploits

00:31:29.890 --> 00:31:34.780
are stored there based
on the multiple dos

00:31:34.780 --> 00:31:39.460
37721, the file name that we saw
from the command search sploit.

00:31:39.460 --> 00:31:41.950
So here, we can see actually
that same file we just looked

00:31:41.950 --> 00:31:47.380
out on the web
page in a .C file.

00:31:47.380 --> 00:31:50.110
So that's maybe one
place we could do.

00:31:50.110 --> 00:31:52.900
Equally, Metasploit
is a framework

00:31:52.900 --> 00:31:56.290
which unifies a lot of those
exploits into one place.

00:31:56.290 --> 00:31:58.600
So you could also just
do a search through there

00:31:58.600 --> 00:32:01.330
and see if you
could find anything

00:32:01.330 --> 00:32:03.740
for ISC BIND or similar.

00:32:03.740 --> 00:32:05.440
And in fact, if you
just search BIND,

00:32:05.440 --> 00:32:07.232
you'll find that you'll
get a lot of things

00:32:07.232 --> 00:32:09.400
back because it's
referring to BIND payloads.

00:32:09.400 --> 00:32:11.770
But if I was to
go back to exploit

00:32:11.770 --> 00:32:18.760
or whatever, do maybe search
for a known vulnerability,

00:32:18.760 --> 00:32:20.350
you can see search
tiki, you can see

00:32:20.350 --> 00:32:23.380
there's an auxiliary denial
of service, tiki query

00:32:23.380 --> 00:32:24.550
denial of service.

00:32:24.550 --> 00:32:27.850
And again, you could use
that module in Metasploit.

00:32:27.850 --> 00:32:31.120
Simply type use, use
the Metasploit module,

00:32:31.120 --> 00:32:32.652
show options.

00:32:32.652 --> 00:32:34.360
And we can see here
these various options

00:32:34.360 --> 00:32:37.150
that are required to be set.

00:32:37.150 --> 00:32:39.560
So we'll set the r host
option, which is the target

00:32:39.560 --> 00:32:41.400
address that we want to target.

00:32:41.400 --> 00:32:42.830
And once we've
got the option set

00:32:42.830 --> 00:32:44.205
and we've checked
that everything

00:32:44.205 --> 00:32:48.562
that says it's required is set,
we can actually simply type run

00:32:48.562 --> 00:32:50.520
and it will run that
attack against the server.

00:32:50.520 --> 00:32:53.300
And if we were to now try
to use that DNS server

00:32:53.300 --> 00:32:55.640
to query that DNS
server, we would actually

00:32:55.640 --> 00:32:58.610
find that it will no longer
respond to our queries

00:32:58.610 --> 00:33:00.560
because, in fact, the
DNS service has crashed

00:33:00.560 --> 00:33:04.040
because this tiki attack is a
denial of service attack, which

00:33:04.040 --> 00:33:05.830
is used to cause
the server to crash.

00:33:05.830 --> 00:33:08.330
And I wouldn't ever like to do
that against a client network

00:33:08.330 --> 00:33:09.590
without their permission.

00:33:09.590 --> 00:33:12.290
Certainly taking out DNS
would be a big deal for them.

00:33:12.290 --> 00:33:16.760
But if you identify
vulnerable DNS servers

00:33:16.760 --> 00:33:19.310
and you can crash DNS, then
this is the implication

00:33:19.310 --> 00:33:20.480
that it can have.

00:33:20.480 --> 00:33:21.605
So this is how you do that.

00:33:21.605 --> 00:33:23.355
So that's looking up
a known vulnerability

00:33:23.355 --> 00:33:24.200
and exploiting it.

00:33:24.200 --> 00:33:26.300
Likewise, we could
have also used

00:33:26.300 --> 00:33:29.240
the exploit that was
from exploit.db instead

00:33:29.240 --> 00:33:31.520
of using Metasploit, and
we could have just compiled

00:33:31.520 --> 00:33:34.730
that using minus
O tiki, and then

00:33:34.730 --> 00:33:38.030
we would have a file
for doing t kill.

00:33:38.030 --> 00:33:41.210
We could actually try to Dos
a DNS server just by simply

00:33:41.210 --> 00:33:43.940
giving it the IP address.

00:33:43.940 --> 00:33:45.890
But this host isn't
actually replying now.

00:33:45.890 --> 00:33:48.650
So if I go back to this DNS
server, what I'm going to do

00:33:48.650 --> 00:33:50.043
is I'm going to reset it.

00:33:50.043 --> 00:33:51.710
If you want to just
get your DNS servers

00:33:51.710 --> 00:33:54.680
or your devices back
to a default state,

00:33:54.680 --> 00:33:56.900
you can simply reset
them and it should

00:33:56.900 --> 00:34:00.450
bring it back alive for you.

00:34:00.450 --> 00:34:02.700
So now I'm going to demonstrate
just one more attack,

00:34:02.700 --> 00:34:06.240
only this time I'm going to
do it with a fuzzing utility

00:34:06.240 --> 00:34:07.890
as well running
in the background.

00:34:07.890 --> 00:34:10.770
And I'm going to use the Nmap
script instead of Metasploit,

00:34:10.770 --> 00:34:12.389
but there's a
fuzzer in Metasploit

00:34:12.389 --> 00:34:14.880
as well, if you were to
do search DNS fuzzer.

00:34:14.880 --> 00:34:17.250
You could also use
a fuzzer from here.

00:34:17.250 --> 00:34:20.650
They both use effectively
the same kind of logic.

00:34:20.650 --> 00:34:24.750
But if you were to do minus
Nmap SU script equals DNS hyphen

00:34:24.750 --> 00:34:27.179
fuzz, you can then give
it some scripts arguments.

00:34:27.179 --> 00:34:29.460
And you'd get these by
reading through that script

00:34:29.460 --> 00:34:32.280
that we identify
with nse discover,

00:34:32.280 --> 00:34:35.429
and then supply it with
the target IP address range

00:34:35.429 --> 00:34:39.449
here that we want to actually
launch the attack on.

00:34:39.449 --> 00:34:42.699
What you'll see is if we were to
actually look at this through--

00:34:42.699 --> 00:34:47.310
I'll add in the argument
minus p 53 and 123

00:34:47.310 --> 00:34:48.909
so that it's only
running the scripts.

00:34:48.909 --> 00:34:51.201
And if we were to actually
just caption now on the wire

00:34:51.201 --> 00:34:54.750
and restart that, we'd
actually see that what's

00:34:54.750 --> 00:34:59.580
happening on the DNS query is
it sending lots of malformed DNS

00:34:59.580 --> 00:35:02.700
queries to the server, looking
up different kinds of resource

00:35:02.700 --> 00:35:04.560
records, trying to
fuzz that server

00:35:04.560 --> 00:35:07.560
to respond in a way
that isn't expected,

00:35:07.560 --> 00:35:09.840
and it effectively tries to
cause the server to crash.

00:35:09.840 --> 00:35:13.800
So even if it doesn't have
a known vulnerability,

00:35:13.800 --> 00:35:16.020
running fuzzing attacks
against a DNS server

00:35:16.020 --> 00:35:18.930
can often cause it to
become unresponsive

00:35:18.930 --> 00:35:22.110
and that can have the same
impact of disabling internet

00:35:22.110 --> 00:35:24.060
connectivity to an organization.

00:35:24.060 --> 00:35:28.710
So that's an example of how you
would run a DNS fuzzing script.

00:35:28.710 --> 00:35:30.960
And finally, with that running
in the background, what

00:35:30.960 --> 00:35:32.970
I'm going to do is I'm actually
going to crash the server

00:35:32.970 --> 00:35:35.590
and simulate an actual attack,
as though the fuzz had actually

00:35:35.590 --> 00:35:35.850
worked.

00:35:35.850 --> 00:35:37.350
So we'll now run
that other exploit,

00:35:37.350 --> 00:35:39.840
the tiki exploit that we
know is a vulnerability that

00:35:39.840 --> 00:35:42.420
impacts on 9.81.

00:35:42.420 --> 00:35:46.030
We knew that because it said
9 in the version number.

00:35:46.030 --> 00:35:48.480
And if we were to go back
to our Metasploit output

00:35:48.480 --> 00:35:53.102
here, in our show info argument,
which we didn't actually run,

00:35:53.102 --> 00:35:55.560
you would have seen that it
told you which versions of BIND

00:35:55.560 --> 00:35:56.440
it supports as well.

00:35:56.440 --> 00:35:59.040
So this tiki attack is
a known vulnerability

00:35:59.040 --> 00:36:01.390
that impacts 9.8.1.

00:36:01.390 --> 00:36:02.960
And I'll just run
this attack now.

00:36:02.960 --> 00:36:04.650
You see it's queried
the version number,

00:36:04.650 --> 00:36:07.108
it sent a denial of service
attack, and it's then come back

00:36:07.108 --> 00:36:09.420
and says it's
probably succeeded.

00:36:09.420 --> 00:36:11.550
But if we were to also
look at our Nmap output,

00:36:11.550 --> 00:36:14.070
you can see that this
DNS fuzz packet now

00:36:14.070 --> 00:36:16.110
believes that it might
have crashed the server

00:36:16.110 --> 00:36:19.590
and it's then spat out the
offending packet's details,

00:36:19.590 --> 00:36:22.410
so you can actually replay
that attack back at the server

00:36:22.410 --> 00:36:24.180
and see whether you
can crash it again.

00:36:24.180 --> 00:36:27.090
So that's a way of
fuzzing DNS services,

00:36:27.090 --> 00:36:28.530
causing denial of
service attacks.

00:36:28.530 --> 00:36:31.350
And again, the implications
of crashing a DNS server

00:36:31.350 --> 00:36:35.190
result in internet downtime,
very critical bits of code.

00:36:35.190 --> 00:36:36.820
So that's something to avoid.

00:36:36.820 --> 00:36:38.280
And we have a lot
of code execution

00:36:38.280 --> 00:36:40.320
and a couple things like
that in a later module.

00:36:40.320 --> 00:36:43.140
If you ever did want to go on
and just debug and experiment

00:36:43.140 --> 00:36:45.390
with this module, you'll see
the username and password

00:36:45.390 --> 00:36:46.440
have been left on the terminal.

00:36:46.440 --> 00:36:49.110
It's the only module we give you
the username and password for.

00:36:49.110 --> 00:36:52.340
You are expected to hack your
way to root on everything else.

00:36:52.340 --> 00:36:54.990
So that's how DNS
and DNS modules, how

00:36:54.990 --> 00:36:56.370
you can query and enumerate.

00:36:56.370 --> 00:36:58.800
What you're looking for
is network endpoints,

00:36:58.800 --> 00:37:01.620
looking for IP addresses,
looking for information,

00:37:01.620 --> 00:37:03.840
look for software
type, software version

00:37:03.840 --> 00:37:06.690
so you can profile and
find vulnerabilities.

00:37:06.690 --> 00:37:09.540
So that concludes the
Hands-On Hacking DNS module,

00:37:09.540 --> 00:37:13.430
and I look forward to seeing
you all in the next module.
