# 53 - Pentesting DNS

## DNS Zone Transfer Online

We can use the following website to do DNS Zone Transfer

{% embed url="<https://hackertarget.com/zone-transfer/>" %}

We can get a lot of interesting information doing Zone Transfer below we can see that i did a zone transfer **zonetransfer.me**

<figure><img src="https://3420091786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1ZUO45eHY8aMCLJ7OiN%2Fuploads%2FEmgMjpGDerYQlpCo9BfQ%2Fimage.png?alt=media&#x26;token=0f4e6f7c-54d4-43d5-8396-ce5a1d543fc6" alt=""><figcaption></figcaption></figure>

## Zone Transfer using NSLookup

We can use nslookup as well to do zone transfer Manually

```javascript
nslookup -type=NS zonetransfer.me // Nameservers

nslookup -type=any -query=AXFR zonetransfer.me nsztm1.digi.ninja //any and axfr 

```

Sometimes you might not get anything using zone transfer so you need to check that wether the IP address is actually the DNS for Domain or not, by using Below command

```python
nslookup -type=ns inlanefreight.htb 10.129.121.23
```

<figure><img src="https://3420091786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1ZUO45eHY8aMCLJ7OiN%2Fuploads%2FWctdfdGANE3s789HsOEP%2Fimage.png?alt=media&#x26;token=19aae232-0b4a-4449-96fa-87f283445bfb" alt=""><figcaption></figcaption></figure>

## Zone Transfer using DIG

```python
dig <Domain Name>
dig <Domain Name> @<IP Address>

#Example
dig inlanefreight.htb
dig axfr inlanefreight.htb @10.129.121.23
```

<figure><img src="https://3420091786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1ZUO45eHY8aMCLJ7OiN%2Fuploads%2FrJAyL5xxcMO0ejvFFrNz%2Fimage.png?alt=media&#x26;token=a788982c-2f9e-4e81-bddc-ac83d16746b6" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3420091786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1ZUO45eHY8aMCLJ7OiN%2Fuploads%2FWZks2tYVqkzYfuYyWb7n%2Fimage.png?alt=media&#x26;token=757f9c40-e8f7-4834-8d6a-85015dabf82c" alt=""><figcaption></figcaption></figure>

## DNScan

We can use dnscan to find out some more valuable information like subdomains, DNScan comes with its own wordlists which we can use

1. -d -------> Domain
2. -w ------> wordlist

<figure><img src="https://3420091786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1ZUO45eHY8aMCLJ7OiN%2Fuploads%2FrHImuwth4FNGzFLTQvYa%2Fimage.png?alt=media&#x26;token=d84d88bd-fc91-4fc9-ab47-d38d9bb8095b" alt=""><figcaption></figcaption></figure>
