> For the complete documentation index, see [llms.txt](https://ceh-practical.cavementech.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ceh-practical.cavementech.com/module-4.-enumeration/5.-dns-enumeration.md).

# 5. DNS Enumeration

## 1. DNS Enumeration using zone transfer

### dig

find the nameserver of a domain

```
dig ns zonetransfer.me
```

<figure><img src="/files/9ub1Fx8AJ1Oh9WDcEISN" alt=""><figcaption></figcaption></figure>

Now try the zone transfer for the domain from its primary and secondary name servers

```
dig axfr zonetransfer.me @nsztm2.digi.ninja
```

<figure><img src="/files/Qch81cv4tkgecn5D0Hk1" alt=""><figcaption></figcaption></figure>

### nslookup

Fire up the tool on windows

```
nslookup
set querytype=soa
```

<figure><img src="/files/xOiBum2GGEtpx9qkdFXO" alt=""><figcaption></figcaption></figure>

Now execute the zone transfer

```
ls -d nsztm2.digi.ninja
```

## <mark style="color:red;">2. Zone transfer using DNSSEC transfer</mark>

{% embed url="<https://github.com/darkoperator/dnsrecon>" %}

```
./dnsrecon.py -d zonetransfer.me -z
```

{% hint style="info" %}
-d target domain

-z DNSSEC Zone walk
{% endhint %}

<figure><img src="/files/lroEbKwYXjD5cFAtL9ip" alt=""><figcaption></figcaption></figure>

**Other tools**

{% embed url="<https://github.com/davebarr/dnswalk>" %}

## <mark style="color:red;">3. DNS Enumeration using Nmap</mark>

```
nmap --script=broadcast-dns-service-discovery zonetransfer.me
```

<figure><img src="/files/hL5s0w16dV8yjRvjpXHW" alt=""><figcaption></figcaption></figure>

DNS brute forcing

```
nmap -T5 -p 53 --script dns-brute zonetransfer.me
```

<figure><img src="/files/c53HSy5UYchahgqnEDvd" alt=""><figcaption></figcaption></figure>

common service records

```
nmap --script dns-srv-enum --script-args "dns-srv-enum.domain='zonetransfer.me'"
```

{% embed url="<https://www.youtube.com/watch?v=PvDS1ZBFPwk&list=PL-Fa25Pu8l6wrp7rSDuZYRe1pbtmpEGa-&index=4&pp=gAQBiAQB>" %}

{% embed url="<https://youtu.be/sBq73tI9BKM>" %}

{% embed url="<https://www.udemy.com/course/ethical-hacker-practical/?referralCode=289CF01CF51246BCAD6C>" %}
