Current DNS answers hide the past. A subdomain that resolves to a cloud provider today may have pointed at an on-premises server last year, a mail record may have moved providers twice, and a name that looks dead today may have served a full application six months ago. Passive DNS history recovers that timeline from third party databases, without querying the target's own servers. This sub-skill extends recon-passive with the history layer: what changed, when it changed, and what the old answers imply for the current engagement. Only research names you are authorized to test.
Quick Workflow
- Confirm scope and list the names whose history you need, starting from the recon-passive baseline.
- Pull the current DNS answer for each name through a public resolver, as the timeline endpoint.
- Query passive DNS history sources for the same names and save the raw responses with their source and date.
- Build one timeline per name, sorted by first seen and last seen, across A, AAAA, CNAME, MX, NS, and TXT records.
- Flag the interesting transitions - IP moves, provider migrations, record deletions, and new CNAME targets.
- Cross-check old names and old IPs against the current inventory, certificate logs, and takeover candidates.
- Record the timeline and its sources in the engagement notes, with gaps marked as gaps, not as silence.
1. Anchor the timeline with the current answer
History only makes sense against the present. Record the current answer first, through a public resolver, so later comparisons have a fixed endpoint and a date.
mkdir -p dns-history/example.com
cd dns-history/example.com
cat > names.txt <<'EOF'
example.com
www.example.com
mail.example.com
blog.example.com
api.example.com
EOF
# Current answers for the main record types, one file per type
for type in A AAAA CNAME MX NS TXT; do
while read -r n; do
ans=$(dig +short "$n" "$type" @1.1.1.1 | tr '\n' ' ')
[ -n "$ans" ] && echo "$n $type $ans"
done < names.txt > "current-$type.txt"
done
cat current-*.txt
2. Query passive DNS history sources
Passive DNS databases collect DNS answers observed in the wild, from resolvers, sensors, and public feeds. Different sources cover different periods and record types, so query more than one where access allows, and always record which source produced which rows. Access to some databases needs an account or API key; use an engagement-specific account, keep keys out of notes and scripts, and never paste a key into a command that gets saved to the engagement folder.
# Example shape for a passive DNS API query - replace the endpoint and
# key handling with the source your engagement actually uses
# The response is saved raw, so the timeline builder works from evidence
curl -s -H "Authorization: Bearer YOUR_PASSIVE_DNS_API_KEY" \
"https://api.example-passivedns-provider.example/v1/history/example.com" \
-o raw-history-example.com.json
jq -r '.results[]? | "\(.first_seen) \(.last_seen) \(.record_type) \(.record_value)"' \
raw-history-example.com.json 2>/dev/null | sort > history-rows.txt
head -30 history-rows.txt
When a source has no API, its web search or export, certificate log history from crt.sh, and web archive captures of old DNS-adjacent pages can still fill gaps. Certificate issuance dates, in particular, prove a name existed and was served over TLS on a given date, even when the DNS history source has no row for it.
# Certificate history as a cross-check for name existence over time
curl -s "https://crt.sh/?q=%25.example.com&output=json" \
| jq -r '.[] | "\(.not_before) \(.name_value)"' \
| sed 's/^\*\.//' \
| sort -u > cert-history.txt
head -20 cert-history.txt
3. Build one timeline per name
A timeline is a sorted list of answers with first seen and last seen dates. Build it with a script so the sorting and dedup are repeatable, and keep the raw source rows alongside it for audit.
import json
from collections import defaultdict
timelines = defaultdict(list)
try:
for line in open("history-rows.txt"):
parts = line.strip().split()
if len(parts) >= 4:
first, last, rtype, value = parts[0], parts[1], parts[2], " ".join(parts[3:])
timelines[value].append((first, last, rtype))
except FileNotFoundError:
print("history-rows.txt not found - run step 2 first")
for name in sorted(timelines):
print(f"--- {name} ---")
for first, last, rtype in sorted(timelines[name]):
print(f" {first} to {last} {rtype}")
In practice, group by hostname first and by record type second, so a reader sees the A record timeline, then the CNAME timeline, then the MX timeline for one name, instead of a flat list that mixes names. The grouping above is a starting shape; adapt it to the fields your source actually returns, and keep the adaptation in the run notes.
4. Flag transitions that matter
Not every change matters equally. Flag these five transitions explicitly, because each one maps to a follow-up action:
# Transition flags - fill from the timeline, one line per flag
cat > transitions.txt <<'EOF'
# name | transition | old value | new value | date | follow-up
# blog.example.com | CNAME added | - | example-blog.herokuapp.com. | 2025-06-12 | dangling CNAME check
# mail.example.com | MX provider migration | old-mail-provider | new-mail-provider | 2026-01-08 | note provider, check SPF and TXT
# api.example.com | IP move | 203.0.113.10 | 198.51.100.44 | 2026-03-19 | check ASN and provider of new IP
# old.example.com | record deleted | 203.0.113.25 | - | 2025-11-02 | check if DNS record or service was removed
# www.example.com | NS change | ns1.old-provider | ns1.new-provider | 2025-09-30 | check delegation and provider
EOF
cat transitions.txt
An IP move to a new ASN often means a hosting migration, and it is worth checking whether the old IP is still serving anything or has been reassigned to another tenant. A record deletion where the DNS record still exists but the service is gone is a takeover precursor, and it goes to recon-subdomain-dangling-cname. A CNAME added to a platform domain shortly before a service launch often marks staging infrastructure that later became production.
5. Cross-check old answers against the current inventory
Old answers are leads, not findings. For each old IP and old hostname, check whether it appears in the current inventory, in certificate logs, or in indexed data, and whether it still resolves.
# Old IPs from the timeline, checked for current resolution and ownership signal
cut -d' ' -f4- history-rows.txt 2>/dev/null | grep -E '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$' | sort -u > old-ips.txt
while read -r ip; do
ptr=$(dig +short -x "$ip" @1.1.1.1 | head -1)
echo "$ip PTR ${ptr:-none}"
done < old-ips.txt > old-ip-ptrs.txt
cat old-ip-ptrs.txt
# Old hostnames that no longer appear in the current subdomain list
grep -E '^[a-z0-9.-]+\.example\.com$' history-rows.txt 2>/dev/null | sort -u > old-names.txt
comm -23 old-names.txt normalized-subs.txt 2>/dev/null | head -20 || echo "current subdomain list not in this folder, compare against the recon-passive baseline"
An old hostname that still resolves but is absent from the current inventory is a coverage gap, not a historical curiosity. Add it to the inventory, probe it, and score it like any other asset.
Edge cases
- Passive DNS coverage is uneven. A name with no history rows may simply be unobserved, not new. Mark it "no history found in queried sources" and name the sources, rather than calling it newly created.
- First seen dates are observation dates, not creation dates. A name first observed in 2026 may have existed for years before any sensor saw it. Never present a first seen date as a registration or creation date.
- CNAME chains change over time, so a single snapshot can mislead. Read the full chain at each timeline point, not just the first hop.
- Wildcard records pollute history with names that never existed as real hosts. Filter wildcard-derived rows before building timelines, or mark them as wildcard-derived.
- Some history sources aggregate answers and lose exact change dates, giving only a month or a range. Keep the precision the source gives, and do not invent a day-level date from a month-level row.
- GDPR and privacy rules apply to history data that includes personal names in hostnames or TXT records. Keep history files inside the engagement folder and delete them when the engagement closes.
Key references
- MITRE ATT&CK T1590.002 DNS
- MITRE ATT&CK T1593.001 Databases
- crt.sh documentation: https://crt.sh
- OWASP Web Security Testing Guide, Information Gathering: https://owasp.org/www-project-web-security-testing-guide/
- ProjectDiscovery dnsx documentation: https://github.com/projectdiscovery/dnsx
