Skip to content
Tutorials Center
My learning

Topics

Lesson 7 of 31 ยท Information Gathering Concepts

DNS, WHOIS and Certificate Intelligence

Learn what DNS records, WHOIS data and certificate transparency logs reveal about an organization, how dig output reads, and how to spot risky records in a zone file.

Every organization that has a website also has a public paper trail. The Domain Name System (DNS) says which names exist and where they point. WHOIS and RDAP say who registered a domain. Certificate transparency logs list every TLS certificate that a public certificate authority has issued. None of this needs special access, and that is the point: attackers read it, and so should you. In this lesson you learn what each source contains, how the output of dig and whois is laid out, and how a defender turns the same data into a list of things to fix.

Everything here is passive or uses ordinary public lookups. If you have not read it yet, start with Reconnaissance: Passive vs Active, which explains where lookups like these sit on the spectrum. Only query names that you own or are authorized to assess (Law, Ethics and Authorization).

What the real tools do and what the stand-in does

On Kali, dig, host and whois come with the standard install. The site cannot run them (there is no network from your browser sandbox to arbitrary DNS servers), so the commands below are read-only. The runnable examples are stand-ins: they parse a made-up zone file for the fictional domain example.test and apply simple rules. The parsing logic is real; the data is invented.

Three public sources

DNS Names, addresses, mail servers, text records.
WHOIS / RDAP Registrar, dates, name servers.
Certificate logs Every public certificate ever issued.

Each answers a different question about the same organization.

1 / 2

DNS record types you must recognize

A DNS zone is a list of resource records. Each record has a name, a time to live (TTL, in seconds), a class (almost always IN), a type and a value.

Type Meaning Why it matters for security
A / AAAA Name to IPv4 / IPv6 address Shows where services live
CNAME Alias to another name Dangling aliases enable subdomain takeover
MX Mail servers, with priority Reveals the mail provider
TXT Free text SPF, DKIM, DMARC and domain-verification tokens
NS Authoritative name servers Shows who controls the zone
SOA Start of authority: serial, refresh timers Zone administration details
PTR Address to name (reverse DNS) Reveals naming conventions
SRV Service location Exposes internal-style services

A subdomain takeover happens when a CNAME points at a cloud service (a storage bucket, a hosting page) that was deleted. The alias still exists, so anyone who claims that name at the provider controls content under your domain. Defenders find these by listing every CNAME and checking that its target still answers.

Reading dig output

Here is what a lookup with dig looks like. This block is read-only; the addresses use documentation ranges that are reserved for examples.

Terminal
dig +noall +answer example.test ANY
TEXT
example.test.        300  IN  A      192.0.2.10
example.test.        300  IN  MX     10 mail.example.test.
example.test.        300  IN  TXT    "v=spf1 mx -all"

Read each line left to right: the fully qualified name (note the trailing dot), the TTL, the class, the type, and the data. Many public resolvers now answer ANY queries minimally, so ask for one type at a time (dig example.test MX). To see the whole path from the root, dig +trace example.test follows delegations step by step.

A zone transfer (AXFR) copies an entire zone from a name server. Servers should only allow it to their own secondary servers. If a server answers an AXFR request from anyone, it leaks every host name in the zone. Testing that against your own servers is a standard defensive check.

WHOIS and RDAP

whois example.com queries a registry or registrar and prints the registration record. Typical fields are the registrar, creation and expiry dates, status flags (such as clientTransferProhibited) and name servers. Since privacy regulations came into force, personal contact details are usually redacted. RDAP is the modern, JSON-based successor and returns the same kind of data in a structured form.

What defenders look for: a domain close to expiry (expired domains get re-registered by others), a missing transfer lock, and name servers that no longer belong to the organization.

Certificate transparency

Public certificate authorities must publish every certificate they issue to append-only logs. Search sites built on those logs let anyone ask "which certificates exist for *.example.com?" The answer often lists subdomains that appear nowhere else, such as staging, vpn or old-portal. Two points follow:

  • A certificate for a name proves the name was in use at some time, not that it still resolves.
  • Wildcard certificates (*.example.com) hide individual names, which is one reason some teams prefer them.

Because the logs are public, you cannot keep a hostname secret by not linking to it. Treat every name that ever got a certificate as part of your attack surface.

Stand-in: parse a zone file and flag risky records

The first TryIt parses a small zone file for the fictional example.test into records. It then flags common problems: a missing SPF record, a CNAME that points to a service we know was decommissioned, and a name that suggests an internal system.

Python Parse a sample zone file

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The second TryIt adds the rules. A real assessment would check each CNAME target with a live lookup; here a hard-coded set of "decommissioned" provider names plays that role.

Python Flag risky records

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice what the stand-in cannot do: it cannot tell whether staging is really exposed or merely listed. That needs a follow-up check, which is the difference between a lead and a finding.

Defensive checklist

  • Keep an inventory of every DNS name and who owns it; delete records when a service is retired.
  • Publish SPF, DKIM and DMARC for every domain that sends or should never send mail.
  • Restrict zone transfers to known secondary servers and enable registrar locks.
  • Monitor certificate transparency for certificates you did not request. Unexpected issuance can signal a compromised account or a look-alike domain.
  • Set calendar reminders well ahead of domain and certificate expiry.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which record type is the usual cause of a subdomain takeover?

    A CNAME alias keeps pointing at a provider name even after the resource behind it is deleted. Someone else can claim that resource and serve content under your name.
  2. 2. Why is certificate transparency useful to a defender?

    The logs are public and append-only, so you can search for all certificates issued for your domains and spot names or issuers you did not expect.
  3. 3. A server answers an AXFR request from any client on the internet. What is the problem?

    A zone transfer copies the whole zone. It should be limited to secondary name servers that you trust.
  4. 4. In the line www 300 IN CNAME example.test., what is 300?

    The second field of a resource record is its TTL: how long resolvers may cache the answer.

Summary

  • DNS, WHOIS/RDAP and certificate transparency logs are public sources that describe an organization's online footprint.
  • Know the common record types: A, AAAA, CNAME, MX, TXT, NS, SOA, PTR, SRV.
  • Dangling CNAME records, open zone transfers, missing SPF/DMARC and forgotten test hosts are the typical findings.
  • dig and whois are read-only lookups here; the Python examples are stand-ins on invented data.
  • A flagged name is a lead; confirm it with a follow-up check before calling it a finding.

Next: TCP/IP Essentials for Security