DNS Protocol

DNS Protocol

The DNS (Domain Name System) is the backbone of the internet, functioning as the "phone book" of the web by resolving domain names to IP addresses.

Common Ports

  • 53 UDP - Standard DNS queries

  • 53 TCP - Zone transfers and larger responses

DNS Server Types

Server Type

Description

DNS Root Server

Responsible for top-level domains (TLDs). There are 13 such root servers globally, coordinated by ICANN.

Authoritative Nameserver

Hold authority for particular zones and provide binding information for their areas of responsibility.

Non-authoritative Nameserver

Not responsible for particular DNS zones but collect information on DNS zones through recursive or iterative querying.

Caching DNS Server

Cache information from other name servers for a specified period determined by the authoritative name server.

Forwarding Server

Simply forward DNS queries to another DNS server.

Resolver

Perform name resolution locally in the computer or router.

DNS Configuration Examples

named.conf.options:

named.conf.local

Zone File Example (czr.local):

Reverse Zone Example (czr_reverse.local):

DNS Enumeration Tools

Dig Commands

Attacking DNS

Zone Transfer

A DNS zone transfer is a type of DNS transaction used to replicate DNS databases across servers. If misconfigured, this can leak sensitive information.

DNS Poisoning & MITM

DNS spoofing (cache poisoning) alters legitimate DNS records with false information to redirect traffic to malicious sites.

Using Ettercap for local DNS poisoning:

  1. Edit /etc/ettercap/etter.dns:

  2. Activate dns_spoof plugin in Ettercap

Subdomain Enumeration

Before performing subdomain takeovers, enumerate existing subdomains:

Domain Takeover

When a CNAME record points to a service that's no longer active, an attacker can register that service and take control of the subdomain.

Defending Against DNS Attacks

  • Implement DNSSEC to verify DNS records

  • Properly configure DNS servers to only allow zone transfers to authorized servers

  • Regularly audit DNS configurations

  • Use DNS monitoring to detect unusual patterns

  • Keep DNS software updated to patch vulnerabilities

Last updated