﻿WEBVTT

00:00:27.730 --> 00:00:31.000
Welcome to the Hacker House
Hands On Hacking DNS theory

00:00:31.000 --> 00:00:31.990
module.

00:00:31.990 --> 00:00:34.840
We're now going to talk
about DNS, what DNS is,

00:00:34.840 --> 00:00:36.800
and how it relates
to an attacker.

00:00:36.800 --> 00:00:39.310
So the current
vantage point for you

00:00:39.310 --> 00:00:40.780
as the adversary
is to be thinking

00:00:40.780 --> 00:00:42.430
from the external perspective.

00:00:42.430 --> 00:00:43.630
You are outside a company.

00:00:43.630 --> 00:00:45.130
You're trying to
work your way in.

00:00:45.130 --> 00:00:47.470
You're doing your open
source intelligence.

00:00:47.470 --> 00:00:49.570
Most companies, almost
every company out there,

00:00:49.570 --> 00:00:50.487
is using the internet.

00:00:50.487 --> 00:00:52.870
Will make use of domains or
have a domain name, something

00:00:52.870 --> 00:00:55.550
that you use like
www.company.com or whatever.

00:00:55.550 --> 00:00:58.450
So this is about DNS
and how we can leverage

00:00:58.450 --> 00:01:01.450
DNS to identify information
about our targets

00:01:01.450 --> 00:01:02.970
and take advantage of it.

00:01:08.580 --> 00:01:10.150
So first, what is DNS?

00:01:10.150 --> 00:01:12.730
Well, DNS is the
domain name system.

00:01:12.730 --> 00:01:15.730
It's a service and system
used to translate IP addresses

00:01:15.730 --> 00:01:19.040
into readable human domains
or mnemonics domain names

00:01:19.040 --> 00:01:19.980
that are easy to read.

00:01:19.980 --> 00:01:23.080
Things like example.org
could have the address

00:01:23.080 --> 00:01:25.890
193.184.something.

00:01:25.890 --> 00:01:30.010
And the reverse of that, 93.184,
has the host name example.org,

00:01:30.010 --> 00:01:33.340
the idea of looking up an IP
to its domain reverse DNS.

00:01:33.340 --> 00:01:37.680
And domains-- this company,
example.org, is a zone.

00:01:37.680 --> 00:01:40.300
It's defined as a zone.

00:01:40.300 --> 00:01:42.760
And inside of that zone
is a resource record.

00:01:42.760 --> 00:01:44.980
So try to think of it a
little bit like a database.

00:01:44.980 --> 00:01:46.397
You've got a
database that you can

00:01:46.397 --> 00:01:49.120
query that has different
kinds of records inside of it.

00:01:49.120 --> 00:01:50.590
And these are
described as zones.

00:01:50.590 --> 00:01:52.240
They're actually
these flat files,

00:01:52.240 --> 00:01:56.412
but these records have
different types of purposes.

00:01:56.412 --> 00:01:58.870
Each of these records are stored
in their resource records.

00:01:58.870 --> 00:02:00.412
So it might be
records for looking up

00:02:00.412 --> 00:02:03.310
the IP to the domain,
such as the A record.

00:02:03.310 --> 00:02:07.139
You look up the domain
to the IP, an A record.

00:02:07.139 --> 00:02:09.139
Others could be something
like a service record.

00:02:09.139 --> 00:02:11.140
And each of these
different records,

00:02:11.140 --> 00:02:12.730
they have a different purpose.

00:02:12.730 --> 00:02:17.770
So DNS is commonly, and mostly,
used over TCP and UDP ports 53,

00:02:17.770 --> 00:02:19.870
primarily over UDP ports 53.

00:02:19.870 --> 00:02:22.120
And we'll get into why
it uses both in a moment.

00:02:28.388 --> 00:02:29.930
When we're talking
about DNS, there's

00:02:29.930 --> 00:02:31.850
a lot of different kinds
of software over the years

00:02:31.850 --> 00:02:32.420
that's been written.

00:02:32.420 --> 00:02:34.670
But overwhelmingly, one of
the most widely used pieces

00:02:34.670 --> 00:02:37.610
of DNS software is something
called Berkeley Internet Name

00:02:37.610 --> 00:02:38.925
Domain, or BIND.

00:02:38.925 --> 00:02:41.300
It was originally created at
the University of California

00:02:41.300 --> 00:02:43.050
as a project known as JEEVES.

00:02:43.050 --> 00:02:45.060
And it exists in
various provisions.

00:02:45.060 --> 00:02:47.720
There's been versions
BIND4, BIND8, BIND9.

00:02:47.720 --> 00:02:50.450
The newer version is BIND10,
which is nicknamed as Bundy.

00:02:50.450 --> 00:02:53.000
And BIND has been considered
to be fairly critical internet

00:02:53.000 --> 00:02:53.500
code.

00:02:53.500 --> 00:02:56.030
It's quite critical code,
because it powers this DNS

00:02:56.030 --> 00:02:59.600
system, which we've come to rely
upon for how we access the web

00:02:59.600 --> 00:03:03.160
and how we remember
example.org or company.com.

00:03:03.160 --> 00:03:04.910
So it became quite
critical internet code.

00:03:04.910 --> 00:03:07.280
And because of that,
there was a very big push

00:03:07.280 --> 00:03:09.660
after around 1999
and 2000, when it

00:03:09.660 --> 00:03:11.660
was discovered that people
were actually hacking

00:03:11.660 --> 00:03:13.310
into the root name servers.

00:03:13.310 --> 00:03:15.755
There was a big push
to secure this code.

00:03:15.755 --> 00:03:17.630
A lot of auditing went,
and a lot of the code

00:03:17.630 --> 00:03:20.120
was read and reviewed and
error handling and others

00:03:20.120 --> 00:03:23.780
added to try and reduce the
severity of vulnerabilities

00:03:23.780 --> 00:03:24.530
inside of BIND.

00:03:24.530 --> 00:03:26.940
So it's considered
internet critical code.

00:03:26.940 --> 00:03:28.610
It definitely will
make your eyes

00:03:28.610 --> 00:03:30.455
bleed if you try to
read it, particularly

00:03:30.455 --> 00:03:31.580
some of the older versions.

00:03:31.580 --> 00:03:33.830
It's very, very hard to follow.

00:03:33.830 --> 00:03:35.720
But just like all
software, there's

00:03:35.720 --> 00:03:36.930
been numerous versions of it.

00:03:36.930 --> 00:03:38.430
And it's been found
to contain bugs.

00:03:38.430 --> 00:03:39.110
There have been bugs.

00:03:39.110 --> 00:03:39.920
There have been vulnerabilities.

00:03:39.920 --> 00:03:41.530
There have been mistakes made.

00:03:41.530 --> 00:03:43.110
Alternatively,
there's not just BIND.

00:03:43.110 --> 00:03:44.485
There's other
pieces of software.

00:03:44.485 --> 00:03:47.360
We have DJBDNS,
PowerDNS, MaraDNS.

00:03:47.360 --> 00:03:48.590
All kinds of different--

00:03:48.590 --> 00:03:50.248
DNSmasq, et cetera.

00:03:50.248 --> 00:03:52.040
And these are widely-used
software packages

00:03:52.040 --> 00:03:54.830
that also provide
DNS services or DNS

00:03:54.830 --> 00:03:56.780
servers and clients, et cetera.

00:03:56.780 --> 00:03:58.100
So DNSmasq.

00:03:58.100 --> 00:04:00.440
Berkeley Internet
Name Domain, or BIND.

00:04:07.310 --> 00:04:10.220
When we think about DNS, then
we think about example.org that

00:04:10.220 --> 00:04:13.490
example.org is part of
a tree-like hierarchical

00:04:13.490 --> 00:04:17.750
structure, which is how DNS is
constructed so that we can use

00:04:17.750 --> 00:04:20.779
these top-level domains, which
are defined in a tree-like

00:04:20.779 --> 00:04:23.270
structure, for
things like .co.uk.

00:04:23.270 --> 00:04:25.280
And then these zones
are described inside

00:04:25.280 --> 00:04:28.550
of these name servers
that can allow you

00:04:28.550 --> 00:04:31.340
to basically traverse
from the root name servers

00:04:31.340 --> 00:04:33.140
down a tree to try
and find out who

00:04:33.140 --> 00:04:35.620
is responsible for
a particular domain

00:04:35.620 --> 00:04:38.390
to do this reverse
lookup as well.

00:04:38.390 --> 00:04:39.320
Recursive lookup.

00:04:39.320 --> 00:04:42.180
Look back up that tree
to find the next entry.

00:04:42.180 --> 00:04:45.590
So it's a recursive
tree-like structure

00:04:45.590 --> 00:04:47.140
that you can traverse.

00:04:47.140 --> 00:04:49.130
And you can also download
the root zone files.

00:04:49.130 --> 00:04:50.630
If you have a look,
you can actually

00:04:50.630 --> 00:04:53.960
download them from this FTP site
there and see who's responsible

00:04:53.960 --> 00:04:56.768
and which servers and things
are actually available.

00:04:56.768 --> 00:04:59.060
These are the actual zone
files that are running there.

00:04:59.060 --> 00:05:02.120
The root name servers listed
here, 13 of them, I believe.

00:05:02.120 --> 00:05:05.960
So you've got the different
IP addresses and the host

00:05:05.960 --> 00:05:07.190
names of the name servers.

00:05:07.190 --> 00:05:09.697
And you can actually see
whereabouts they are located

00:05:09.697 --> 00:05:11.030
and who is responsible for them.

00:05:11.030 --> 00:05:13.100
And we can see
overwhelmingly, actually,

00:05:13.100 --> 00:05:16.010
that the United States
is pretty much largely

00:05:16.010 --> 00:05:17.690
in control of the internet.

00:05:17.690 --> 00:05:20.840
largely because it has such
a monopoly on these root name

00:05:20.840 --> 00:05:21.560
servers.

00:05:21.560 --> 00:05:23.352
As you can see, they're
owned predominately

00:05:23.352 --> 00:05:24.800
by American based companies.

00:05:24.800 --> 00:05:27.070
So America pretty
much holds the keys

00:05:27.070 --> 00:05:28.320
to the internet at the moment.

00:05:35.280 --> 00:05:37.923
So when it comes to
DNS resource records,

00:05:37.923 --> 00:05:39.590
these are the different
kinds of records

00:05:39.590 --> 00:05:42.693
that can be stored
inside of a zone file.

00:05:42.693 --> 00:05:45.110
So if you think of this like
a zone, like a database file,

00:05:45.110 --> 00:05:46.610
we can actually
query these records.

00:05:46.610 --> 00:05:48.320
It's actually just a flat file.

00:05:48.320 --> 00:05:50.945
But they have different resource
records stored inside of them.

00:05:50.945 --> 00:05:52.945
And these are an example
of some of the records.

00:05:52.945 --> 00:05:55.700
You would have an A record,
which points to an IP version 4

00:05:55.700 --> 00:06:00.050
address, an AAAA record, which
points to an IP version 6

00:06:00.050 --> 00:06:03.760
address, a C name record,
which is just an alias.

00:06:03.760 --> 00:06:06.170
An MX record, which
is the Mail Exchanger

00:06:06.170 --> 00:06:08.960
used for identifying where
email is delivered for a domain,

00:06:08.960 --> 00:06:10.600
and we'll come to
that in a moment.

00:06:10.600 --> 00:06:14.270
A Name Server, which
identifies who is responsible

00:06:14.270 --> 00:06:17.450
for a particular zone or a
Start of Authority record,

00:06:17.450 --> 00:06:19.420
which is who's
responsible for the zone.

00:06:19.420 --> 00:06:21.200
And a Name Server,
which also can respond

00:06:21.200 --> 00:06:23.600
to the records in the zone.

00:06:23.600 --> 00:06:25.670
You'd have things
like a SRV record

00:06:25.670 --> 00:06:27.680
for information on services.

00:06:27.680 --> 00:06:29.180
If you ever launched
a chat program

00:06:29.180 --> 00:06:31.703
like Office Communicator,
and it says,

00:06:31.703 --> 00:06:32.870
what company do you work at?

00:06:32.870 --> 00:06:35.120
And you put
mycompany.com, and then

00:06:35.120 --> 00:06:37.210
it automatically starts
trying to log in,

00:06:37.210 --> 00:06:39.740
it's probably doing that
through service records.

00:06:39.740 --> 00:06:41.120
It's looking up in DNS.

00:06:41.120 --> 00:06:44.900
It's asking DNS, where is the
office communicator service?

00:06:44.900 --> 00:06:46.353
And it's getting that back.

00:06:46.353 --> 00:06:48.020
And obviously, that's
advantageous to us

00:06:48.020 --> 00:06:50.880
as attackers, because we could
ask, where is the communicator

00:06:50.880 --> 00:06:51.380
service?

00:06:51.380 --> 00:06:53.730
And learn details
of where are end

00:06:53.730 --> 00:06:55.200
points we can communicate with?

00:06:55.200 --> 00:06:56.690
So DNS records,
resource records.

00:06:56.690 --> 00:06:59.330
We want to dig through those
and find information in them.

00:06:59.330 --> 00:07:01.693
TXT records are human or
machine readable text.

00:07:01.693 --> 00:07:03.110
And you often find
that these have

00:07:03.110 --> 00:07:05.600
been used to add additional
security features

00:07:05.600 --> 00:07:08.090
and enhancements to
other technologies

00:07:08.090 --> 00:07:09.240
through these TXT records.

00:07:09.240 --> 00:07:10.573
And we'll look at some of those.

00:07:16.830 --> 00:07:19.910
The concept of a DNS Resolver
Cache is important now.

00:07:19.910 --> 00:07:21.535
Because when you've
got your computer--

00:07:21.535 --> 00:07:23.530
and if you think
about it, zone files

00:07:23.530 --> 00:07:26.380
are these little databases
that are returning records.

00:07:26.380 --> 00:07:28.630
If you've got a database
and your local machine,

00:07:28.630 --> 00:07:32.020
it actually contains all your
recently requested DNS records.

00:07:32.020 --> 00:07:34.000
It's called your
DNS Resolver Cache.

00:07:34.000 --> 00:07:36.070
And each of your
workstations or laptops

00:07:36.070 --> 00:07:38.320
will have this DNS
Resolver Cache in there.

00:07:38.320 --> 00:07:40.390
And even sometimes,
the DNS Name Servers

00:07:40.390 --> 00:07:43.660
themselves will contain a Cache
or allow you to look it up.

00:07:43.660 --> 00:07:46.030
Or will be used as
Cache-only name servers.

00:07:46.030 --> 00:07:50.200
And these are often complemented
with things like /etc/hosts

00:07:50.200 --> 00:07:53.728
files, which have static
entries for different domains.

00:07:53.728 --> 00:07:56.020
So the way this works is, if
you look up a website like

00:07:56.020 --> 00:07:58.720
example.org, and the DNS
server comes back and says, oh,

00:07:58.720 --> 00:08:00.250
example.org is--

00:08:00.250 --> 00:08:03.400
A record is here, it'll also
have a time-to-live value.

00:08:03.400 --> 00:08:04.840
This time-to-live
value determines

00:08:04.840 --> 00:08:06.430
how long your
computer should keep

00:08:06.430 --> 00:08:07.900
that information in the Cache.

00:08:07.900 --> 00:08:10.960
So instead of every time you
go to example.org's home page,

00:08:10.960 --> 00:08:13.030
you're not looking up
example.org every time.

00:08:13.030 --> 00:08:15.160
You look it up once,
store in your Cache,

00:08:15.160 --> 00:08:17.840
and after a day or so, when
your time-to-live has expired,

00:08:17.840 --> 00:08:19.840
you ask the network again,
where is example.org?

00:08:19.840 --> 00:08:21.370
And it will cache it there.

00:08:21.370 --> 00:08:25.008
So Caching DNS servers are
commonly used in home networks.

00:08:25.008 --> 00:08:26.800
So if you think about
your network at home,

00:08:26.800 --> 00:08:29.560
probably you've been provided
a little box by your ISP.

00:08:29.560 --> 00:08:31.720
Inside of there is
probably a Caching-only,

00:08:31.720 --> 00:08:35.973
non-authoritative domain name
server that will look up--

00:08:35.973 --> 00:08:37.390
it will go and
query the internet,

00:08:37.390 --> 00:08:39.765
store information in its cache,
and then return that back

00:08:39.765 --> 00:08:42.240
to you.

00:08:42.240 --> 00:08:43.900
It's not authoritive
for any domains,

00:08:43.900 --> 00:08:46.300
as in, it doesn't host
any domain zone files.

00:08:46.300 --> 00:08:48.940
You don't query anything from it
other than using it to look up

00:08:48.940 --> 00:08:51.160
information in its cache.

00:08:51.160 --> 00:08:54.070
If you think about that, if I
was to query that little home

00:08:54.070 --> 00:08:58.720
rooter of yours and say,
well, query example.org

00:08:58.720 --> 00:09:02.320
and turn off the recursive
bit so that it doesn't ask

00:09:02.320 --> 00:09:04.740
for the next DNS
entry in the tree,

00:09:04.740 --> 00:09:06.490
it would actually just
get the information

00:09:06.490 --> 00:09:07.507
from the local cache.

00:09:07.507 --> 00:09:10.090
And if it knew about that entry,
it would return it back to me

00:09:10.090 --> 00:09:12.290
and say, example.org is here.

00:09:12.290 --> 00:09:16.300
And that would tell me that this
target has browsed example.org.

00:09:16.300 --> 00:09:18.640
So somebody connected
to your home network

00:09:18.640 --> 00:09:20.590
could actually work
out every website

00:09:20.590 --> 00:09:24.140
you've browsed just by querying
the rooter in your home.

00:09:24.140 --> 00:09:26.032
So this is cache snooping.

00:09:26.032 --> 00:09:27.490
It's a type of
attack that lets you

00:09:27.490 --> 00:09:30.710
learn browsing habits, lets you
learn things about a target.

00:09:30.710 --> 00:09:33.640
What I like to use it for is
learning what kind of software

00:09:33.640 --> 00:09:35.050
maybe a target's using.

00:09:35.050 --> 00:09:37.622
I like to look up update
servers of things like Java,

00:09:37.622 --> 00:09:39.830
lookup update services of
Flash and things like that,

00:09:39.830 --> 00:09:42.100
and see whether or not
my target has been making

00:09:42.100 --> 00:09:44.290
use of these
third-party services

00:09:44.290 --> 00:09:46.360
before I try to
attack their system.

00:09:46.360 --> 00:09:49.540
So cache snooping attacks
and how you can use them.

00:09:49.540 --> 00:09:53.560
As an example here, this is
an example of a DNS query

00:09:53.560 --> 00:09:54.740
as it goes over the wire.

00:09:54.740 --> 00:09:56.323
If you've not seen
the output of this,

00:09:56.323 --> 00:09:57.760
it's from a tool
called Wireshark.

00:09:57.760 --> 00:09:59.590
But this is an example
of a DNS query.

00:09:59.590 --> 00:10:02.500
So we can see here some
IP-related information

00:10:02.500 --> 00:10:06.190
and destination port
related to the DNS query

00:10:06.190 --> 00:10:09.500
from this server to that
server to that destination.

00:10:09.500 --> 00:10:12.340
And we can see that it's
a standard query that

00:10:12.340 --> 00:10:14.350
contains different bits.

00:10:14.350 --> 00:10:16.905
And these flags, you can see,
it's got a recursion bit set.

00:10:16.905 --> 00:10:19.030
And that recursion
bit tells it to walk

00:10:19.030 --> 00:10:21.197
that tree-like structure
for the answer.

00:10:21.197 --> 00:10:22.780
And the question
it's asking is-- here

00:10:22.780 --> 00:10:24.880
you can see the
resource records.

00:10:24.880 --> 00:10:26.140
It's got one question.

00:10:26.140 --> 00:10:30.820
And it's query is, tell me what
the IP address of the NSA.gov

00:10:30.820 --> 00:10:31.870
website is.

00:10:31.870 --> 00:10:34.570
What is the
NationalSecurityAgency.gov's IP

00:10:34.570 --> 00:10:35.070
address?

00:10:35.070 --> 00:10:36.445
And that's what
it's doing there.

00:10:36.445 --> 00:10:38.530
It's just making a request
to try and find out,

00:10:38.530 --> 00:10:40.258
what is that IP
address from a server?

00:10:40.258 --> 00:10:41.800
And what's important
here to remember

00:10:41.800 --> 00:10:44.860
is we've got a source port,
and we have here also there's

00:10:44.860 --> 00:10:48.010
transaction ID and various
of the flags and things.

00:10:48.010 --> 00:10:50.408
And if we were then to look
at the packet response,

00:10:50.408 --> 00:10:52.450
this is the information
that's been returned back

00:10:52.450 --> 00:10:53.510
from the server.

00:10:53.510 --> 00:10:55.750
We can see that a domain
name system has responded.

00:10:55.750 --> 00:10:57.708
It's given the time that
it's taken to respond.

00:10:57.708 --> 00:11:00.550
But also here, we've got
the authority resource

00:11:00.550 --> 00:11:03.940
records, which is that the DNS
server didn't know about it,

00:11:03.940 --> 00:11:08.800
but it knew the query that
you were asking for needed

00:11:08.800 --> 00:11:10.960
the authoritive name server.

00:11:10.960 --> 00:11:12.700
So it didn't know
the answer, but it

00:11:12.700 --> 00:11:14.260
could tell you to
look the answer up

00:11:14.260 --> 00:11:17.230
on this authoritative
name server, NS1.NSA.gov.

00:11:17.230 --> 00:11:19.180
It didn't have a
record for NSA.gov,

00:11:19.180 --> 00:11:21.070
but it had an
authoritative name server.

00:11:21.070 --> 00:11:23.070
So perhaps there's no
record for that one there.

00:11:23.070 --> 00:11:24.778
But just as an example,
it's given that.

00:11:24.778 --> 00:11:25.570
It's returned back.

00:11:25.570 --> 00:11:27.237
It's found something,
and it's given you

00:11:27.237 --> 00:11:29.428
the star of authority,
which is important.

00:11:35.990 --> 00:11:38.900
So what goes in a
DNS hacking tool box?

00:11:38.900 --> 00:11:42.140
What tools do we actually
use for hacking on DNS?

00:11:42.140 --> 00:11:44.173
So we have tools
like dig, nslookup.

00:11:44.173 --> 00:11:45.590
These are two query
tools that you

00:11:45.590 --> 00:11:47.930
can use for looking up
information in those data

00:11:47.930 --> 00:11:48.430
stores.

00:11:48.430 --> 00:11:50.540
And it's information
in those zone

00:11:50.540 --> 00:11:53.630
files that you can then
query using those two tools.

00:11:53.630 --> 00:11:56.630
Things like dnsrecon,
dsnenum, these

00:11:56.630 --> 00:11:58.970
are different reconnaissance
and enumeration scripts

00:11:58.970 --> 00:12:03.890
that we can use to identify
different vulnerabilities

00:12:03.890 --> 00:12:05.750
and information
in those systems.

00:12:05.750 --> 00:12:08.492
Fierce is a DNS
scanning utility.

00:12:08.492 --> 00:12:09.950
And there are others
there as well.

00:12:09.950 --> 00:12:13.850
Host, dnsspoof,
dsniff, hping3, scapy.

00:12:13.850 --> 00:12:16.310
And again, nmap and metasploit.

00:12:16.310 --> 00:12:18.722
We'll come across these
tools fairly frequently.

00:12:18.722 --> 00:12:20.180
But these are tools
as well that we

00:12:20.180 --> 00:12:22.790
could use for learning
exploits, packet injection,

00:12:22.790 --> 00:12:25.130
or indeed doing some
kind of spoofing attack.

00:12:25.130 --> 00:12:26.900
As an example,
this is how to make

00:12:26.900 --> 00:12:28.070
use of some of those tools.

00:12:28.070 --> 00:12:30.020
So we could use dig.

00:12:30.020 --> 00:12:31.940
Dig is a way-- or nslookup--

00:12:31.940 --> 00:12:33.920
to query a DNS resource record.

00:12:33.920 --> 00:12:36.600
So let's say we wanted to run
a query at a particular name

00:12:36.600 --> 00:12:37.100
server.

00:12:37.100 --> 00:12:40.130
We would use dig @ the
nameserver, the type

00:12:40.130 --> 00:12:42.573
of resource record we
want, and then the domain.

00:12:42.573 --> 00:12:44.740
So if we were interested
in learning which computers

00:12:44.740 --> 00:12:47.780
are responsible for email at
the National Security Agency,

00:12:47.780 --> 00:12:52.370
we would do dig @ the IP address
of the server we're querying.

00:12:52.370 --> 00:12:55.970
Query the MX record
type for the NSA.gov,

00:12:55.970 --> 00:12:59.540
and we would then get a
response for which servers

00:12:59.540 --> 00:13:02.443
are responsible for handling
email at that address.

00:13:02.443 --> 00:13:04.610
As an alternative, you could
do the same query type.

00:13:04.610 --> 00:13:06.530
You could do set
querytype equals ANY,

00:13:06.530 --> 00:13:10.400
and request any resource records
from the server using something

00:13:10.400 --> 00:13:11.350
like nslookup.

00:13:11.350 --> 00:13:13.402
Two tools that do
effectively the same job.

00:13:13.402 --> 00:13:15.110
And it's down to your
preference, really.

00:13:15.110 --> 00:13:16.023
I quite like dig.

00:13:16.023 --> 00:13:17.190
Some people prefer nslookup.

00:13:24.240 --> 00:13:25.690
Information leaks in DNS.

00:13:25.690 --> 00:13:28.560
So when you're using these
tools to query servers,

00:13:28.560 --> 00:13:30.300
you're querying DNS
resource records.

00:13:30.300 --> 00:13:32.220
You're learning
information about a network

00:13:32.220 --> 00:13:35.340
and how it is put together
from these zone files.

00:13:35.340 --> 00:13:38.748
You can also query the software
for different types of version

00:13:38.748 --> 00:13:40.290
and information that
they might hold,

00:13:40.290 --> 00:13:43.140
which can include what software
is running and powering

00:13:43.140 --> 00:13:45.270
the DNS configuration.

00:13:45.270 --> 00:13:47.350
And this is due to
something called CHAOSNET.

00:13:47.350 --> 00:13:49.950
Now CHAOSNET is actually
a legacy network type

00:13:49.950 --> 00:13:51.510
defined in DNS.

00:13:51.510 --> 00:13:54.750
The CHAOS subclass existed
pre-internet protocol,

00:13:54.750 --> 00:13:56.263
pre-modern internet.

00:13:56.263 --> 00:13:57.930
And it's actually a
very legacy protocol

00:13:57.930 --> 00:13:59.530
from the early days
of the internet,

00:13:59.530 --> 00:14:01.260
around the ARPANET era.

00:14:01.260 --> 00:14:04.230
And this CHAOS subnet
class is actually

00:14:04.230 --> 00:14:07.050
now used by software
like BIND to keep

00:14:07.050 --> 00:14:08.190
details of the software.

00:14:08.190 --> 00:14:10.860
It just keeps information inside
of this subnet class that's

00:14:10.860 --> 00:14:11.610
no longer used.

00:14:11.610 --> 00:14:13.140
It's kind of depreciative.

00:14:13.140 --> 00:14:14.760
So you can actually query--

00:14:14.760 --> 00:14:19.170
instead of just querying
DNS for internet addresses,

00:14:19.170 --> 00:14:22.260
you could query it for this
subclass of CHAOS addresses

00:14:22.260 --> 00:14:25.020
and learn information
about the DNS software.

00:14:25.020 --> 00:14:28.830
So you can learn things like the
host name, version information,

00:14:28.830 --> 00:14:30.353
authors, and some of the IDs.

00:14:30.353 --> 00:14:32.520
So you can actually get
information like internal IP

00:14:32.520 --> 00:14:33.930
information and things from it.

00:14:33.930 --> 00:14:37.500
So dig @ IP address,
chaos to determine

00:14:37.500 --> 00:14:40.320
that you're querying the
CHAOS class or the CHAOS net,

00:14:40.320 --> 00:14:43.830
and then the version.bind
and a TXT record

00:14:43.830 --> 00:14:45.793
to return back that
text-based response.

00:14:45.793 --> 00:14:47.460
It would actually
tell you what software

00:14:47.460 --> 00:14:49.200
was powering that DNS system.

00:14:49.200 --> 00:14:51.390
And then you can profile
that for vulnerabilities.

00:14:51.390 --> 00:14:53.385
And we'll do some of
that in the practical.

00:14:53.385 --> 00:14:54.660
Another thing that
we should be aware of

00:14:54.660 --> 00:14:56.260
is this thing called
a zone transfer.

00:14:56.260 --> 00:14:58.380
So if you have a
couple of DNS servers,

00:14:58.380 --> 00:15:02.930
let's say example.org and
mycompany.com, these two

00:15:02.930 --> 00:15:06.330
websites, they have resources.

00:15:06.330 --> 00:15:09.713
And let's say that they
want to transfer one server.

00:15:09.713 --> 00:15:11.130
They've switched
hosting provider,

00:15:11.130 --> 00:15:14.130
and mycompany.com wants to
move to example.org's server,

00:15:14.130 --> 00:15:16.860
because they get a better
service level agreement.

00:15:16.860 --> 00:15:18.690
And the companies again,
are going to swap.

00:15:18.690 --> 00:15:20.537
They're going to transfer
this zone records.

00:15:20.537 --> 00:15:21.870
They're going to copy them over.

00:15:21.870 --> 00:15:24.960
Now because UDP, user
datagram protocol,

00:15:24.960 --> 00:15:32.910
which is usually how DNS works,
is using UDP most commonly--

00:15:32.910 --> 00:15:35.400
because it's not
connection orientated,

00:15:35.400 --> 00:15:37.590
because it's not reliable,
it's not a good way

00:15:37.590 --> 00:15:40.320
to transfer something
like a full zone

00:15:40.320 --> 00:15:41.700
file between two servers.

00:15:41.700 --> 00:15:45.150
So DNS would then
use TCP port 53

00:15:45.150 --> 00:15:47.910
to allow the two servers to
communicate that information.

00:15:47.910 --> 00:15:50.310
So it was in a connection
orientated protocol,

00:15:50.310 --> 00:15:53.940
thus making it more
stable and more secure.

00:15:53.940 --> 00:15:56.640
Sorry, not more secure.

00:15:56.640 --> 00:15:57.430
More reliable.

00:15:57.430 --> 00:16:00.390
Less likely to be error
prone and cause corruption.

00:16:00.390 --> 00:16:03.150
So it makes use of
the transfer record

00:16:03.150 --> 00:16:05.653
to request all of the
records for a zone.

00:16:05.653 --> 00:16:08.070
So if it just tries to request
this resource record called

00:16:08.070 --> 00:16:11.010
transfer, or AXFR, it
will try to request

00:16:11.010 --> 00:16:12.910
all of the records for a zone.

00:16:12.910 --> 00:16:14.550
And obviously, if
that's permitted,

00:16:14.550 --> 00:16:16.830
it can expose internal
network configuration,

00:16:16.830 --> 00:16:18.270
sensitive information,
and you can

00:16:18.270 --> 00:16:21.210
use those two tools we discussed
to get that information

00:16:21.210 --> 00:16:23.520
from the server.

00:16:23.520 --> 00:16:26.130
And one thing I
also wanted to cover

00:16:26.130 --> 00:16:28.848
that I didn't mention before--
when we looked at that DNS

00:16:28.848 --> 00:16:30.390
query, an important
thing to remember

00:16:30.390 --> 00:16:33.690
is that destination port
from that client query

00:16:33.690 --> 00:16:38.190
and that transaction ID are the
same from the original query.

00:16:38.190 --> 00:16:40.440
I just want you to keep that
in the back of your mind,

00:16:40.440 --> 00:16:42.065
that the source port
on the transaction

00:16:42.065 --> 00:16:44.670
ID for the query
and the response

00:16:44.670 --> 00:16:46.830
have to be identical
for it to be valid.

00:16:46.830 --> 00:16:48.150
Because that's UDP.

00:16:48.150 --> 00:16:49.230
It's not using TCP.

00:16:49.230 --> 00:16:52.590
So those two numbers are how
it distinguishes the query.

00:16:52.590 --> 00:16:55.945
So looking back at this
zone transfer request,

00:16:55.945 --> 00:16:57.570
another thing you
might be able to do--

00:16:57.570 --> 00:17:02.440
if you can't see TCP
port 53 on a DNS server--

00:17:02.440 --> 00:17:06.300
and there's no point checking
a DNS server for zone transfers

00:17:06.300 --> 00:17:09.180
if it doesn't have TCP
port 53, because it

00:17:09.180 --> 00:17:11.710
won't be able to do the transfer
even if it was supported.

00:17:11.710 --> 00:17:13.168
And so what you
want to do is, make

00:17:13.168 --> 00:17:16.170
sure that it supports TCP port
53 before trying that attack.

00:17:22.643 --> 00:17:24.310
And then what you
would do with that is,

00:17:24.310 --> 00:17:26.500
you could host
enumeration attacks.

00:17:26.500 --> 00:17:29.228
If you're not able to just
transfer the whole zone file,

00:17:29.228 --> 00:17:30.895
which would be amazing,
and sometimes it

00:17:30.895 --> 00:17:32.890
does happen, so
worth checking for.

00:17:32.890 --> 00:17:35.530
In fact, there's been leaks of
North Korea's entire top level

00:17:35.530 --> 00:17:38.680
domains due to misconfigurations
of their DNS servers,

00:17:38.680 --> 00:17:41.230
which were obtained by doing
these kinds of queries.

00:17:41.230 --> 00:17:43.840
So host enumeration
attacks is another attack

00:17:43.840 --> 00:17:46.810
that you can use that allows
you to use predictable naming

00:17:46.810 --> 00:17:47.410
conventions.

00:17:47.410 --> 00:17:50.890
And that is, we as people, we
like easy things to remember.

00:17:50.890 --> 00:17:56.440
We like words like firewall
and web server and www and VPN.

00:17:56.440 --> 00:17:58.990
So we do things like
firewall.target.com

00:17:58.990 --> 00:18:03.820
or VPN.company.com
or www.company.com.

00:18:03.820 --> 00:18:06.010
And because we pick
these common names

00:18:06.010 --> 00:18:08.230
for hosts and from
network engineers

00:18:08.230 --> 00:18:09.760
and common engineering
backgrounds,

00:18:09.760 --> 00:18:11.050
we can actually
try to brute force

00:18:11.050 --> 00:18:13.050
and just guess what these
are using probe tools.

00:18:13.050 --> 00:18:14.560
So we do some
enumeration attacks

00:18:14.560 --> 00:18:18.130
just by guessing
what the DNS might

00:18:18.130 --> 00:18:19.810
be for a particular
system and target.

00:18:25.957 --> 00:18:27.540
Another thing that
you can do with DNS

00:18:27.540 --> 00:18:29.248
and is particularly
popular and prevalent

00:18:29.248 --> 00:18:32.520
with hacktivist
groups and others,

00:18:32.520 --> 00:18:35.190
is to use traffic amplification.

00:18:35.190 --> 00:18:37.620
So it's important now to
understand how this works.

00:18:37.620 --> 00:18:40.230
If you are an attacker,
and you're using UDP,

00:18:40.230 --> 00:18:43.343
and you spoof a UDP packet
to a DNS server that's

00:18:43.343 --> 00:18:44.760
on the internet
that allows anyone

00:18:44.760 --> 00:18:47.070
to query it to make it
look up other requests,

00:18:47.070 --> 00:18:50.460
and it can do recursive lookups,
and it can query elsewhere,

00:18:50.460 --> 00:18:52.660
it's an open DNS resolver.

00:18:52.660 --> 00:18:55.900
And if you send a spoof
packet to that DNS resolver

00:18:55.900 --> 00:18:58.830
and spoof the IP
address, that DNS server

00:18:58.830 --> 00:19:01.080
will then respond
to the IP address

00:19:01.080 --> 00:19:03.090
that it thinks has sent
the UDP query, which

00:19:03.090 --> 00:19:04.200
is of course, not you.

00:19:04.200 --> 00:19:06.450
And that would be your
target, your destination.

00:19:06.450 --> 00:19:09.360
And what would happen is, they
send a small amount of traffic

00:19:09.360 --> 00:19:10.460
to the DNS server.

00:19:10.460 --> 00:19:12.990
And because the response that
will come back from the DNS

00:19:12.990 --> 00:19:15.115
server-- they get it to
come back with a big amount

00:19:15.115 --> 00:19:15.900
of data--

00:19:15.900 --> 00:19:18.690
will cause the response
to go to the victim.

00:19:18.690 --> 00:19:20.140
It will cause an amplification.

00:19:20.140 --> 00:19:24.430
And then what they do is, they
basically find as many servers

00:19:24.430 --> 00:19:26.640
as they can that
allow this behavior.

00:19:26.640 --> 00:19:28.830
And then they send as
much traffic at them

00:19:28.830 --> 00:19:32.520
as they can to cause the systems
to overwhelm the intended

00:19:32.520 --> 00:19:33.820
victims.

00:19:33.820 --> 00:19:35.880
And this is known as
a DNS amplification

00:19:35.880 --> 00:19:38.070
attack, or a traffic
amplification attack.

00:19:38.070 --> 00:19:40.700
Commonly used by
hactivist groups

00:19:40.700 --> 00:19:43.350
and political
orientated attackers

00:19:43.350 --> 00:19:45.630
or people who are
seeking to cause

00:19:45.630 --> 00:19:47.850
hacktivist-related activity.

00:19:47.850 --> 00:19:51.300
Because it's very effective
at bringing systems offline.

00:19:51.300 --> 00:19:53.250
Traffic amplification attacks.

00:19:53.250 --> 00:19:55.200
Widely used to perform
DDoS attacks, otherwise

00:19:55.200 --> 00:19:57.230
known as a DNS Smurf attack.

00:19:57.230 --> 00:20:00.180
Not the lovable blue characters,
but yes, named after them.

00:20:00.180 --> 00:20:02.790
So the DNS Smurf attack.

00:20:02.790 --> 00:20:05.190
Nmap and metasploit
contain various scripts

00:20:05.190 --> 00:20:06.760
that allow you to
test amplification

00:20:06.760 --> 00:20:09.130
and test for this kind of
behavior and try to leverage

00:20:09.130 --> 00:20:09.630
it.

00:20:09.630 --> 00:20:10.350
And you can see
there, you've got

00:20:10.350 --> 00:20:12.240
domain name system at 26 bytes.

00:20:12.240 --> 00:20:14.640
And then getting a
response back of 251

00:20:14.640 --> 00:20:16.182
bytes using one of these probes.

00:20:16.182 --> 00:20:17.640
And then in
metasploit, we actually

00:20:17.640 --> 00:20:20.610
see that you've got four times
the traffic amplification.

00:20:20.610 --> 00:20:23.730
So you can effectively use this
to boost a weak internet signal

00:20:23.730 --> 00:20:26.460
and overpower somebody
else and knock them

00:20:26.460 --> 00:20:28.100
off their online
video game, et cetera.

00:20:34.940 --> 00:20:38.240
DNS spoofing, which is what we
briefly were touching on there,

00:20:38.240 --> 00:20:40.510
is an attacker who can
observe DNS requests.

00:20:40.510 --> 00:20:44.480
So if I see your computer
sending a UDP DNS request,

00:20:44.480 --> 00:20:47.900
then I could actually just
reply with a forged response.

00:20:47.900 --> 00:20:50.540
Because as long as I've got
the transaction ID, and as

00:20:50.540 --> 00:20:52.220
long as I've got that
source port, which

00:20:52.220 --> 00:20:54.380
I can get if I see the
packet, and then it's

00:20:54.380 --> 00:20:56.750
just a simple case
of who replies first.

00:20:56.750 --> 00:20:59.030
Because I could then just
send a spoof packet back.

00:20:59.030 --> 00:21:01.460
And if mine is responded
to by the computer first,

00:21:01.460 --> 00:21:04.040
then I would be the one
stored in the Cache.

00:21:04.040 --> 00:21:05.630
And you can also try
to do that blind.

00:21:05.630 --> 00:21:07.130
You could actually
just try to guess

00:21:07.130 --> 00:21:11.538
what those two numbers were by
just sending a blind responses

00:21:11.538 --> 00:21:12.080
all the time.

00:21:12.080 --> 00:21:12.980
Are they looking up Google?

00:21:12.980 --> 00:21:14.022
And trying to flood them.

00:21:14.022 --> 00:21:15.470
But because you
would have to get

00:21:15.470 --> 00:21:19.250
two numbers right at exactly
the same time as the lookup,

00:21:19.250 --> 00:21:21.920
it would be quite difficult
to just blind brute force

00:21:21.920 --> 00:21:26.140
those magic numbers and
spoof a DNS response.

00:21:26.140 --> 00:21:28.597
It's because UDP is not
connection orientated,

00:21:28.597 --> 00:21:30.680
because it's not using a
full three-way handshake,

00:21:30.680 --> 00:21:32.330
because it's just a datagram.

00:21:32.330 --> 00:21:33.170
It's a broadcast.

00:21:33.170 --> 00:21:37.370
It's not a connection
orientated protocol.

00:21:37.370 --> 00:21:40.310
It doesn't have any
of that nicety to it.

00:21:40.310 --> 00:21:44.540
So the attacker only needs
to know the DNS request, UDP

00:21:44.540 --> 00:21:47.150
source port, and
the transaction ID

00:21:47.150 --> 00:21:48.927
to basically spoof a response.

00:21:48.927 --> 00:21:50.510
So with those two
bits of information,

00:21:50.510 --> 00:21:51.560
you can spoof a response.

00:21:51.560 --> 00:21:54.230
It's implemented by a
tool called dnsspoof

00:21:54.230 --> 00:21:56.300
by a very talented
hacker called Dug Song.

00:21:56.300 --> 00:21:59.932
And you can actually go and
download his toolkit, dnsspoof.

00:21:59.932 --> 00:22:01.640
And actually, you can
use that on a line.

00:22:01.640 --> 00:22:05.030
Just run it, and it will
do this action for you.

00:22:05.030 --> 00:22:07.430
It will also respond
and make everyone

00:22:07.430 --> 00:22:08.740
think you are Google.com.

00:22:14.968 --> 00:22:17.260
Another attack you could do
is something called a Cache

00:22:17.260 --> 00:22:18.400
Poisoning attack.

00:22:18.400 --> 00:22:21.960
The reverse of a
Cache snooping attack

00:22:21.960 --> 00:22:25.000
is actually trying to
poison the DNS Cache that

00:22:25.000 --> 00:22:29.660
could cause the clients of
that DNS server to be impacted.

00:22:29.660 --> 00:22:32.110
And if you ever
recall in 2008, there

00:22:32.110 --> 00:22:34.645
was a big news story around
the internet being broken.

00:22:34.645 --> 00:22:36.520
And this was because of
a security researcher

00:22:36.520 --> 00:22:41.740
called Dan Kaminsky, who
found CVE-2008-1447, which

00:22:41.740 --> 00:22:44.290
is the so-called
bailiwick attack, which

00:22:44.290 --> 00:22:46.000
is a Cache Poisoning attack.

00:22:46.000 --> 00:22:48.370
And the way that this
works was, the attacker

00:22:48.370 --> 00:22:53.230
would send many DNS
requests to a server

00:22:53.230 --> 00:22:55.930
to cause it to do
lookups on a domain.

00:22:55.930 --> 00:23:00.385
I would query DNS server to
make it look up 1.victim.com.

00:23:00.385 --> 00:23:02.890
The DNS server would
go to try and find out,

00:23:02.890 --> 00:23:04.660
what is the answer
to 1.victim.com?

00:23:04.660 --> 00:23:06.910
And in the response,
it would get the answer

00:23:06.910 --> 00:23:09.400
for victim.com's
start of authority.

00:23:09.400 --> 00:23:12.160
And I can force it to look it
up again by doing 2.victim,com,

00:23:12.160 --> 00:23:14.760
3.victim.com, et cetera.

00:23:14.760 --> 00:23:16.510
And what you would
then do is actually try

00:23:16.510 --> 00:23:17.455
to flood the server.

00:23:17.455 --> 00:23:20.605
And because the
internet's got faster,

00:23:20.605 --> 00:23:23.230
because we could connect faster,
we could send more information

00:23:23.230 --> 00:23:25.930
quickly, these two
numbers were considered

00:23:25.930 --> 00:23:27.880
sufficient and
difficult to guess.

00:23:27.880 --> 00:23:31.600
But because you could use
this 1.victim.2, 2.victim.2,

00:23:31.600 --> 00:23:36.190
3.victim.com, until you got
those two numbers correct,

00:23:36.190 --> 00:23:39.400
that would then cause the server
to cache an incorrect start

00:23:39.400 --> 00:23:40.580
of authority.

00:23:40.580 --> 00:23:44.470
It would make your DNS server
responsible for victim.com's

00:23:44.470 --> 00:23:47.620
DNS requests whenever anyone
looked it up in future.

00:23:47.620 --> 00:23:50.530
So you could actually try
and do this Cache Poisoning

00:23:50.530 --> 00:23:53.210
and actually poison
the DNS server's cache

00:23:53.210 --> 00:23:55.300
so that anyone looking
up that DNS server

00:23:55.300 --> 00:23:59.020
would then get redirected
back to yourself.

00:23:59.020 --> 00:24:01.960
So a DNS Cache Snooping
attack is the opposite

00:24:01.960 --> 00:24:04.440
of this, where you
are using a timing

00:24:04.440 --> 00:24:05.690
measurement on the same cache.

00:24:05.690 --> 00:24:07.398
Instead of poisoning
the cache by putting

00:24:07.398 --> 00:24:10.900
a bad entry in there, you
would use a timing attack.

00:24:10.900 --> 00:24:13.813
Or you would request
non-recursive information

00:24:13.813 --> 00:24:15.730
so you don't get it to
woke up the next entry.

00:24:15.730 --> 00:24:18.160
Just look up the Cache and
see whether information

00:24:18.160 --> 00:24:19.780
exists in that Cache.

00:24:19.780 --> 00:24:20.950
A Cache Snooping attack.

00:24:20.950 --> 00:24:22.900
And again, we would
for things like updates

00:24:22.900 --> 00:24:26.500
or update.adobe.com or
update.java.com or something

00:24:26.500 --> 00:24:27.340
like that.

00:24:27.340 --> 00:24:29.990
Try and find out what
software they might use.

00:24:29.990 --> 00:24:32.110
So again, DNS Cache Poisoning.

00:24:32.110 --> 00:24:34.150
Massively, server
Cache Poisoning attacks

00:24:34.150 --> 00:24:37.390
improved by CVE-2008-1447.

00:24:37.390 --> 00:24:39.910
And a big story, as the
internet was broken.

00:24:46.380 --> 00:24:49.860
Here's a brief history of
various useful DNS exploits.

00:24:49.860 --> 00:24:52.585
You can see around
1999 to 2001, there

00:24:52.585 --> 00:24:53.960
were a couple of
vulnerabilities,

00:24:53.960 --> 00:24:56.020
which were kind of
awesome and a lot of fun.

00:24:56.020 --> 00:24:58.570
And it was found out
that these exploits

00:24:58.570 --> 00:25:01.420
were being used to compromise
the root name servers.

00:25:01.420 --> 00:25:03.190
And it was quite an
alarm for everybody,

00:25:03.190 --> 00:25:08.290
as unknown computer hackers were
able to redirect microsoft.com

00:25:08.290 --> 00:25:09.850
to any website they wanted.

00:25:09.850 --> 00:25:12.858
People were
understandably concerned

00:25:12.858 --> 00:25:14.650
that the name servers
had been compromised.

00:25:14.650 --> 00:25:16.913
So there was a big push
then on security of them.

00:25:16.913 --> 00:25:18.580
And that's why we
have this gap, really,

00:25:18.580 --> 00:25:20.520
from around the 2000 periods.

00:25:20.520 --> 00:25:23.110
There was less interesting
bugs, because a lot of things

00:25:23.110 --> 00:25:25.349
was fixed silently,
behind closed doors.

00:25:25.349 --> 00:25:26.766
There was a lot
of big push, a lot

00:25:26.766 --> 00:25:28.690
of big government,
a lot of big bucks

00:25:28.690 --> 00:25:31.220
spent trying to secure
these bits of software.

00:25:31.220 --> 00:25:34.510
And again, you have know
the DNS Cache Poisoning bug

00:25:34.510 --> 00:25:37.210
or bailiwick attacked,
or bailiwicked attack,

00:25:37.210 --> 00:25:40.210
that can be used to
poison the DNS Cache,

00:25:40.210 --> 00:25:41.770
improving your spoofing.

00:25:41.770 --> 00:25:44.783
And you've got there also some
denial of service attacks.

00:25:44.783 --> 00:25:47.200
There was a big vulnerability,
a glibc vulnerability, that

00:25:47.200 --> 00:25:48.940
impacted a lot of DNS lookups.

00:25:48.940 --> 00:25:50.890
And then again, more
later vulnerabilities.

00:25:50.890 --> 00:25:52.440
A lot of denial of
service attacks.

00:25:52.440 --> 00:25:54.190
And in fact, DNS is
one of the few things

00:25:54.190 --> 00:25:56.650
that I would actually ever
consider denial of service

00:25:56.650 --> 00:26:00.052
to be very relevant on, because
if you can crash a DNS server,

00:26:00.052 --> 00:26:02.510
you're taking out the internet,
effectively, for a company.

00:26:02.510 --> 00:26:05.440
So if their domain name
server crashes and no longer

00:26:05.440 --> 00:26:07.390
functions, email won't work.

00:26:07.390 --> 00:26:09.250
Web browsing won't work.

00:26:09.250 --> 00:26:12.520
It will drive productivity
down, and it will cause harm

00:26:12.520 --> 00:26:14.380
to the organization,
and indeed, probably

00:26:14.380 --> 00:26:16.030
financial implications as well.

00:26:16.030 --> 00:26:18.888
So you need to understand the
denial of service attacks.

00:26:18.888 --> 00:26:21.430
Very important to find out if
a server is vulnerable to them.

00:26:21.430 --> 00:26:23.230
Not necessarily to exploit it.

00:26:23.230 --> 00:26:25.960
Just because when
they are at risk,

00:26:25.960 --> 00:26:28.660
they can have quite
a detrimental effect.

00:26:28.660 --> 00:26:30.700
As an example, if
you were to exploit

00:26:30.700 --> 00:26:32.980
one of those vulnerabilities,
you would see here,

00:26:32.980 --> 00:26:36.280
there is an example of a
stack trace or an error.

00:26:36.280 --> 00:26:37.780
You can see, there's
some assertion.

00:26:37.780 --> 00:26:39.530
If you were a system
administrator looking

00:26:39.530 --> 00:26:41.418
as someone hacked
my DNS server, you

00:26:41.418 --> 00:26:43.210
might see things like
this in the error log

00:26:43.210 --> 00:26:45.200
when exploits and things
are run against it.

00:26:45.200 --> 00:26:47.200
So this is just an example
of what kind of thing

00:26:47.200 --> 00:26:49.510
you might want to look for
if you're reviewing such log

00:26:49.510 --> 00:26:50.650
files.

00:26:50.650 --> 00:26:53.520
While there's been not too many
code execution vulnerabilities,

00:26:53.520 --> 00:26:55.270
there have been a
number of them recently.

00:26:55.270 --> 00:26:58.140
There's been one
or two in dnsmasq.

00:26:58.140 --> 00:27:01.210
And there has been some increase
in recent vulnerabilities

00:27:01.210 --> 00:27:01.780
in that.

00:27:01.780 --> 00:27:04.840
However, historically, we
haven't had too many good code

00:27:04.840 --> 00:27:08.230
execution bugs in name server
technology for some time.

00:27:15.080 --> 00:27:17.330
So DNS-SEC.

00:27:17.330 --> 00:27:19.670
Once everybody realized
that DNS was broken,

00:27:19.670 --> 00:27:22.280
engineers got together, much
smarter engineers than I,

00:27:22.280 --> 00:27:24.380
and they decided
we will harden DNS.

00:27:24.380 --> 00:27:27.050
They decided to create
something called DNS-SEC, which

00:27:27.050 --> 00:27:29.810
provides authentication
and not encryption,

00:27:29.810 --> 00:27:32.690
which is most commonly
construed, of the DNS protocol.

00:27:32.690 --> 00:27:35.690
And that what that does is it
uses public key infrastructure,

00:27:35.690 --> 00:27:37.880
adds a new resource
record for supporting

00:27:37.880 --> 00:27:40.040
public key infrastructure,
and then these records

00:27:40.040 --> 00:27:41.300
are signed with public keys.

00:27:41.300 --> 00:27:43.580
And it's implemented
in these RFCs.

00:27:43.580 --> 00:27:46.970
RFC-2535, and then
these various--

00:27:46.970 --> 00:27:50.030
4033, 4034, and 4035,
which describe it

00:27:50.030 --> 00:27:51.530
in much more detail.

00:27:51.530 --> 00:27:53.660
As an example, it adds
two new resource records,

00:27:53.660 --> 00:27:57.620
the DNS key record
and the RRSIG record.

00:27:57.620 --> 00:27:59.870
And these two
records, of course,

00:27:59.870 --> 00:28:01.820
when they were added
to DNS servers,

00:28:01.820 --> 00:28:04.460
it was found that some of
them implemented them badly

00:28:04.460 --> 00:28:07.400
and there were vulnerabilities
looking up these new resource

00:28:07.400 --> 00:28:07.962
records.

00:28:07.962 --> 00:28:09.920
So every time somebody
introduces new features,

00:28:09.920 --> 00:28:11.798
they could also
introduce new bugs.

00:28:11.798 --> 00:28:13.340
So it's worth looking
at new features

00:28:13.340 --> 00:28:15.710
as they're put into browsers,
if that's your bug hunting

00:28:15.710 --> 00:28:16.690
adventure.

00:28:16.690 --> 00:28:18.100
And so yes.

00:28:18.100 --> 00:28:22.000
RRSIG and DNS key resource
records added to DNS.

00:28:22.000 --> 00:28:25.102
RFC-3833 is actually a
really interesting RFC.

00:28:25.102 --> 00:28:26.810
And if you don't want
to read through all

00:28:26.810 --> 00:28:28.340
the RFCs in the world,
I don't blame you.

00:28:28.340 --> 00:28:29.507
Some of them are quite dull.

00:28:29.507 --> 00:28:32.090
But if you do want to read
one in particular I found

00:28:32.090 --> 00:28:34.790
interesting, have a
read through RFC-3833,

00:28:34.790 --> 00:28:37.970
because it documents
all known DNS attacks

00:28:37.970 --> 00:28:41.180
and preventative steps
that DNS-SEC was intending

00:28:41.180 --> 00:28:42.830
to step and implement.

00:28:42.830 --> 00:28:45.150
So when they implemented
DNS-SEC, they

00:28:45.150 --> 00:28:47.210
got some smart engineers
together and they said,

00:28:47.210 --> 00:28:49.220
what are all the
problems in DNS?

00:28:49.220 --> 00:28:51.900
And they said, RFC-3833.

00:28:51.900 --> 00:28:55.550
So RFC-3833 will document all
of the known problems in DNS.

00:28:55.550 --> 00:28:57.140
And it's worth having
a read through.

00:28:57.140 --> 00:28:58.990
So worth having a
look through that one.

00:29:06.080 --> 00:29:09.080
So Fuzzing DNS and DNS-SEC.

00:29:09.080 --> 00:29:12.200
Fuzzing is a method for
finding new vulnerabilities.

00:29:12.200 --> 00:29:14.960
So again, when
DNS-SEC was pushed out

00:29:14.960 --> 00:29:17.780
and people started to
implement this in software,

00:29:17.780 --> 00:29:19.700
a lot of people fuzzed
those new resource

00:29:19.700 --> 00:29:22.290
records and in fact, found
a number of vulnerabilities.

00:29:22.290 --> 00:29:24.813
So fuzzing is a way of
creating a pseudo-random input

00:29:24.813 --> 00:29:27.230
to something, a pseudo-random
input to a character system.

00:29:27.230 --> 00:29:30.680
And do this kind of DNS
queries and try and malform

00:29:30.680 --> 00:29:33.500
those queries to result in
things like denial of service

00:29:33.500 --> 00:29:35.010
conditions and possibly more.

00:29:35.010 --> 00:29:38.270
And most DNS implementations
today have been heavily fuzzed.

00:29:38.270 --> 00:29:40.880
So I only tend to use this
on custom DNS services.

00:29:40.880 --> 00:29:43.760
Or if I'm querying an
organization and their DNS

00:29:43.760 --> 00:29:48.410
servers, and I find that those
DNS servers have my first DNS

00:29:48.410 --> 00:29:52.880
software, then I might use
fuzzing to probe that system

00:29:52.880 --> 00:29:55.275
and see if it's got any
unknown vulnerabilities.

00:29:55.275 --> 00:29:56.900
And you could do that
with nmap, or you

00:29:56.900 --> 00:29:59.330
could do that with
metasploit to actually run

00:29:59.330 --> 00:30:01.820
these kind of probes and
fuzzing against these services.

00:30:01.820 --> 00:30:03.320
And then I would
not recommend doing

00:30:03.320 --> 00:30:05.790
it live against the
client's DNS implementation

00:30:05.790 --> 00:30:07.040
without their prior knowledge.

00:30:07.040 --> 00:30:08.240
Because if they
do crash and there

00:30:08.240 --> 00:30:10.340
is some vulnerability
found, it could, of course,

00:30:10.340 --> 00:30:13.310
take down their capability
to use the internet, which

00:30:13.310 --> 00:30:14.450
would upset them.

00:30:14.450 --> 00:30:16.700
But using these kinds of
fuzzes, vulnerabilities

00:30:16.700 --> 00:30:18.200
were found in
various DNS software.

00:30:18.200 --> 00:30:20.720
So it's always important, if
you see an unusual DNS software

00:30:20.720 --> 00:30:23.150
package, it may be worth
running these against them

00:30:23.150 --> 00:30:25.490
to see if it handles different
kinds of resource queries

00:30:25.490 --> 00:30:26.132
correctly.

00:30:26.132 --> 00:30:27.590
So that brings us
to the conclusion

00:30:27.590 --> 00:30:29.540
of the theory for this module.

00:30:29.540 --> 00:30:32.510
I'm now going to walk through
the practical demonstration

00:30:32.510 --> 00:30:34.352
of the Hands On
Hacking DNS server.

00:30:34.352 --> 00:30:36.560
And you're going to need a
couple of files from this.

00:30:36.560 --> 00:30:38.750
You're going to need to make
sure you've got your resource

00:30:38.750 --> 00:30:41.030
guides and your reference books
to be able to download tools

00:30:41.030 --> 00:30:41.480
from.

00:30:41.480 --> 00:30:43.855
And you're also going to need
to download our name server

00:30:43.855 --> 00:30:48.110
ISO to be able to complete
the practical elements

00:30:48.110 --> 00:30:50.100
of this module.

00:30:50.100 --> 00:30:52.095
So you're going to need
hh-nameserver's ISO,

00:30:52.095 --> 00:30:53.720
and you're going to
need to have access

00:30:53.720 --> 00:30:56.090
to your references
and reference guides.

00:30:56.090 --> 00:30:58.700
So that concludes the
theory module for DNS,

00:30:58.700 --> 00:31:01.540
and thank you for listening.
