# DNS and How It Gets Abused

> Understand DNS resolution and record types, and how attackers use DNS for phishing, tunneling and command-and-control. Free notes, key concepts, resources and...

Canonical: https://www.internhack.in/roadmaps/tracks/cybersecurity/dns
Last updated: 2026-11-28

Understand DNS resolution and record types, and how attackers use DNS for phishing, tunneling and command-and-control.

Beginner · about 4 hours · difficulty 2/5

Learn first: [How the Internet and TCP/IP Work](https://www.internhack.in/roadmaps/tracks/cybersecurity/internet-basics)

**DNS** turns names like `example.com` into IP addresses. It is also one of the richest data sources in security, because almost every connection starts with a lookup.

### How resolution works

Your device asks a **recursive resolver** (your ISP, 1.1.1.1 or 8.8.8.8). If it has no cached answer, it walks the hierarchy: root servers, then the `.com` TLD servers, then the domain's **authoritative** nameserver. Answers are cached for their **TTL**.

### Record types

- `A` / `AAAA`: IPv4 / IPv6 address
- `CNAME`: alias to another name
- `MX`: mail servers
- `TXT`: free text, used for SPF, DKIM and DMARC email security and domain verification
- `NS`: authoritative nameservers
- `PTR`: reverse lookup from IP to name

Try `dig example.com A`, `dig example.com MX` and `nslookup` on Windows.

### Security angles

- **Recon**: subdomains and DNS records reveal infrastructure. Certificate transparency logs expose more names.
- **Phishing**: look-alike domains and newly registered domains are strong signals.
- **Tunneling and C2**: malware can hide data inside DNS queries; long random subdomains are a tell.
- **Hijacking and takeover**: dangling CNAMEs pointing to deleted cloud resources can let an attacker claim your subdomain.
- **Email security**: SPF, DKIM and DMARC records reduce spoofing.

### Pitfalls

- Forgetting caching when troubleshooting or investigating; old answers linger until the TTL expires.

Good enough: you can resolve a domain's full record set with dig, explain each record, and spot suspicious-looking queries in a DNS log.

## Key concepts

- **Recursive vs authoritative servers**
- **Record types (A, CNAME, MX, TXT, NS)**
- **TTL and caching**
- **dig and nslookup**
- **SPF, DKIM and DMARC**
- **DNS tunneling and C2**
- **Subdomain takeover**

## Mini project

Pick five well-known domains and document their A, MX, NS and TXT records, including whether each has a DMARC policy and what it says.

## Check yourself

A workstation makes thousands of DNS queries to long random subdomains of one unfamiliar domain. What might be happening?

## Free resources

- [Cloudflare: What is DNS?](https://www.cloudflare.com/learning/dns/what-is-dns/) (Cloudflare)
- [How DNS Works (comic)](https://howdns.works/) (DNSimple)
- [DMARC.org overview](https://dmarc.org/) (DMARC.org)

Previous: [Subnetting, Ports and Common Services](https://www.internhack.in/roadmaps/tracks/cybersecurity/subnetting-ports) · Next: [HTTP for Security Work](https://www.internhack.in/roadmaps/tracks/cybersecurity/http)

## More in Networking for Security

- [How the Internet and TCP/IP Work](https://www.internhack.in/roadmaps/tracks/cybersecurity/internet-basics)
- [Subnetting, Ports and Common Services](https://www.internhack.in/roadmaps/tracks/cybersecurity/subnetting-ports)
- [DNS and How It Gets Abused](https://www.internhack.in/roadmaps/tracks/cybersecurity/dns)
- [HTTP for Security Work](https://www.internhack.in/roadmaps/tracks/cybersecurity/http)
- [TLS and Encryption in Transit](https://www.internhack.in/roadmaps/tracks/cybersecurity/tls)
- [Packet Analysis with Wireshark](https://www.internhack.in/roadmaps/tracks/cybersecurity/wireshark)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Cybersecurity Roadmap](https://www.internhack.in/roadmaps/tracks/cybersecurity)
