Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Network Intrusion Detection, Third Edition.pdf
Скачиваний:
222
Добавлен:
15.03.2015
Размер:
2.58 Mб
Скачать

dns.verbose.com source port domain (53). That is why the three-way handshake is never completed and the large DNS response is never delivered. To avoid this problem, block traffic to TCP destination port 53 only and allow traffic from TCP source port 53 that has an already

established connection.

Summary of DNS Theory

DNS relies on a complex interweaving of many DNS servers.You must be able to examine traffic to and from your DNS server to understand the nature of the activity. TCPdump is an adequate tool to use; but at times, you have to use other tools to examine the content of the datagrams to see whether problems exist. Typical DNS servers on active networks receive a lot of traffic, and hackers can use the volume of normal activity as a smoke screen for malicious activity.

Using DNS for Reconnaissance

Given the notion that DNS is a global database, it is an excellent source for reconnaissance. DNS information is intended to be freely shared and freely available in the spirit of cooperation. At one time in the evolution of the Internet, this was a relatively innocuous philosophy. In today's climate of hungry pirates, however, it seems quite naive. Here are some

ways in which reconnaissance can be done using DNS.

The nslookup Command

nslookup acts much like a DNS client would, but displays the information so that you can see it. In fact, that is how the authoritative name server host names and IP addresses for the sans.org domain were obtained. This is a very helpful interactive tool that can be used on a UNIX or Windows NT (and beyond) host. Some UNIX operating systems are beginning to replace the nslookup command with the dig (Domain Internet Groper) command.

You can ask many more questions of a DNS server than just the host name. Using nslookup, you can formulate queries and see the kinds of responses you get. There is also a debug setting that enables you to see more of the data in the DNS message that is sent and returned than just the query and response values.

Look at the following output to get an idea of the capabilities of the nslookup tool. You see host.my.com issue the nslookup command. You then enter into the nslookup interactive process and receive notification of the default DNS server, dns.my.com and its associated IP

address (192.168.4.4) used to resolve your queries. The output follows: host.my.com% nslookup

Default Server: dns.my.com Address: 192.168.4.4

> www.sans.org

Server: dns.my.com Address: 192.168.4.4

Name: www.sans.org Address: 12.33.247.6

At the greater than (>) prompt, www.sans.org is entered to find its IP address. Again, you

get confirmation of the DNS server and IP address being used to resolve the query. You see the answer below that of 12.33.247.6.

Name That Name Server

How does someone discover what your DNS server is? Given the number of reconnaissance

attempts targeting DNS servers only, there must be a way to find out. Actually, it is rather

easy to find this out using nslookup:

> set type=ns > sans.org

Server: dns.my.com Address: 192.168.4.4

NON-AUTHORITATIVE ANSWER sans.org nameserver = NS.DELOS.COM sans.org nameserver = server1.sans.org sans.org nameserver = NS.BSDI.COM

AUTHORITATIVE ANSWERS CAN BE FOUND FROM NS.DELOS.COM Internet address = 65.102.83.117 server1.sans.org Internet address = 167.216.198.40 NS.BSDI.COM Internet address = 206.196.44.241

Assuming that you are at a subcommand prompt of the nslookup command, enter the subcommand set type=ns. You have just set the option to return an answer of a name server(s) to subsequent queries issued. Bump up one node on the DNS tree and query for sans.org to see the name servers for this domain. You discover all the name servers for sans.org, both host names and IP addresses. This appears to be a pretty good place to start the reconnaissance effort for a site. After discovering the name servers, one might scan those name servers for potential security deficiencies or to see what kind of Internet services or

daemons are being run on the DNS server.

HINFO: Snooping for Details

HINFO records are yet another record type stored by DNS. These are information records and another potential source for reconnaissance. A DNS server administrator has the option of entering host information, specifically the CPU type and operating system, when creating a new or maintaining an existing DNS record. If trusted intranet hosts use the DNS server, this is a way to maintain an inventory of the hosts without too much risk.

Because this provides too much information to unknown Internet users, many administrators do not enter these parameters. Obviously, if this type of information can be harvested from a

DNS server, a hacker can get some serious intelligence about the site.

> set type=hinfo > host49

Server: dns.my.com Address: 192.68.4.4

host49.my.com CPU = SunSparc

OS = Solaris

my.com nameserver =dns.my.com

 

dns.my.com

Internet address = 192.68.4.4

Set the type to hinfo as a subcommand in nslookup. Information is queried for host49, which is a fictional renaming of a real host. host49.my.com is a Sun SPARC running a version of the Solaris operating system. It is possible that a hacker's efforts might be foiled by outdated data kept in the HINFO records. This is probably one of the few times that less-than diligent

maintenance is a desirable thing.

List Zone Map Information

One of the easiest ways to discover a lot of information about a domain is to try to list all the zone map information. Assume that there is a domain with the lackluster name of fakeplace.com. You can attempt to dump the records associated with the domain using the

following subcommand in the nslookup utility:

> ls –d fakeplace.com

If the site has not disabled the dissemination or transfer of the data, the DNS server lists all records for the domain fakeplace.com. As a bonus to the information collector, this site also

maintains HINFO records.

"SGI" "Irix"

whish

1D

IN HINFO

1D

IN A

1D

IN HINFO

192.168.1.239

susie

"IBM-RS/560F" "unix"

1D

IN A

1D

IN HINFO

172.16.16.13

pixie

"IBM-RS/560F" "unix"

1D

IN A

1D

IN HINFO

172.12.16.14

bandit

"PC" "Win98"

1D

IN A

1D

IN HINFO

192.168.3.107

adder

"IBM-RS/530" "unix"

1D

IN A

1D

IN HINFO

172.16.133.4

hub21

"Cabletron-MMAC3" "SNMP"

1D

IN A

1D

IN HINFO

192.168.26.80

switch3

"Switch" "3COM"

1D

IN A

 

 

192.168.7.130

This information harvesting can occur only if the site allows indiscrimate access to TCP

destination port 53, because TCP is the transport protocol used to deliver this information.

Dig

Another information gathering technique is to query a DNS server for its BIND version

number:

dns.my.com% dig @MYDNS.COM version.bind txt chaos

;<<>> dig 8.1 <<>> @MYDNS.COM version.bind txt chaos

;(1 server found)

;;res options: init recurs defnam dnsrch

;;got answer:

;;->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10

;;flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;;QUERY SECTION:

;;version.bind, type = TXT, class = CHAOS

;;ANSWER SECTION:

VERSION.BIND

0S CHAOS TXT

"4.9.7-REL"

A tool called dig (which stands for Domain Internet Groper) comes with many implementations of BIND. It has many of the same capabilities as nslookup. You have an option to display the version number of BIND running on a DNS server. The format of the command is as follows: dig followed by the at sign (@), followed by the name of the DNS server you want to examine, followed by the option version.bind, followed by the word TXT and the word CHAOS. The word TXT tells DNS that the type of entry you are searching for is a TXT record found in the DNS database. This is just a different record type, much as HINFO records and NS records are different types. Finally, you see the word CHAOS, which is a query class that is mostly obsolete.

This dig command has queried for the version number of MYDNS.com. You see that it is running an older version 4.9.7 of BIND. For someone conducting reconnaissance, this is valuable information. If a hacker can pair a BIND vulnerability with the version discovered, she is better able to target the name server for attack. BIND versions 8.2 and later have an options statement in the configuration file /etc/named.conf that will return a message instead of the version number. You select the contents of the message, perhaps something like "unknown version of BIND." But, if you feel mischievous, your message can return the wrong version of BIND just to confuse the information gatherer.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]