Raw recon output is not a target list. Subfinder, certificate logs, ASN scans, and indexed databases each return overlapping names with different formats, different ages, and different errors. Correlation is the work of turning those piles into one list where every asset appears once, every field has a source, every conflict is resolved with a stated rule, and the order reflects risk rather than the order a tool happened to print. This skill covers that work, and it pairs with recon-attack-surface-management, which owns the register that correlation feeds.
Quick Workflow
- Gather every recon output file into one dated folder and record which tool and run produced each file.
- Normalize every file to the same fields - asset, IPs, ports, service hints, first seen, source.
- Deduplicate by canonical asset name, merging sources instead of picking one winner.
- Resolve conflicts with fixed rules - freshest DNS wins for IPs, live probes win over indexed data for liveness.
- Enrich each asset with liveness, technology, and exposure signals from a single probe pass.
- Score and sort into tiers, with the scoring reason recorded per asset.
- Write the ranked queue plus a provenance file, and hand both to active testing.
- Keep the raw files untouched, so any ranked entry can be traced back to its original tool output.
1. Gather and inventory the inputs
Before merging anything, list what you have. A correlation run that silently drops a source file produces a confident, wrong list.
mkdir -p corr/example.com
cd corr/example.com
ls -lh *.txt *.json *.jsonl 2>/dev/null
cat > sources.txt <<'EOF'
subfinder-example.com.txt - subfinder passive run, 2026-10-27
crt-subs.txt - crt.sh JSON parsed with jq, 2026-10-27
resolved.txt - dnsx resolution pass, 2026-10-27
probed.txt - httpx probe pass, 2026-10-27
shodan-hits.txt - Shodan indexed search, date noted in file header
EOF
cat sources.txt
2. Normalize names and IPs to one canonical form
Normalization rules, applied identically every run: lowercase hostnames,
strip trailing dots, strip wildcard prefixes for grouping but keep a flag
that the name came from a wildcard certificate, split comma-separated IPs,
and drop empty lines and comment lines. A name that appears as
WWW.example.com. in one file and www.example.com in another is one
asset, not two.
# Normalize subdomain lists from any tool into one clean file
cat subfinder-example.com.txt crt-subs.txt 2>/dev/null \
| tr 'A-Z' 'a-z' \
| sed -e 's/\.$//' -e 's/^\*\.//' \
| grep -E '^[a-z0-9.-]+\.example\.com$' \
| sort -u > normalized-subs.txt
wc -l normalized-subs.txt
head -20 normalized-subs.txt
The grep pattern pins the scope domain, so provider names swept in from shared certificates do not enter the correlated list. Change the pattern per engagement, and record the pattern in the run notes.
3. Merge sources with provenance, not by overwriting
Merging means keeping the source list per asset. When two sources disagree later, provenance tells you which one to re-check, and when a source is found to be stale, you can find every asset that depended only on it.
import json
from collections import defaultdict
assets = defaultdict(lambda: {"sources": set(), "ips": set()})
def add_file(path, source):
try:
lines = open(path)
except FileNotFoundError:
print(f"missing input, skipped - {path}")
return
for line in lines:
name = line.strip().lower().rstrip(".").removeprefix("*.")
if name:
assets[name]["sources"].add(source)
add_file("subfinder-example.com.txt", "subfinder")
add_file("crt-subs.txt", "crt.sh")
add_file("normalized-subs.txt", "normalized-merge")
merged = []
for name in sorted(assets):
merged.append({
"asset": name,
"sources": sorted(assets[name]["sources"]),
"source_count": len(assets[name]["sources"]),
})
with open("merged.jsonl", "w") as fh:
for row in merged:
fh.write(json.dumps(row) + "\n")
print(f"merged assets: {len(merged)}")
print(f"assets seen by 2 or more sources: {sum(1 for r in merged if r['source_count'] >= 2)}")
Assets seen by two or more independent sources are usually real. Assets seen by only one source are not automatically false, they are lower confidence until a live resolution confirms them. That distinction belongs in the output, not in a silent filter.
4. Resolve conflicts with stated rules
Write the conflict rules down before you need them, and apply them the same way every run:
# Rule 1 - freshest DNS wins for IPs: re-resolve, do not trust old maps
dnsx -l normalized-subs.txt -silent -a -resp -o fresh-resolved.txt -t 50
# Rule 2 - live probe wins over indexed data for liveness
httpx -l normalized-subs.txt -silent -status-code -title -o fresh-probed.txt -threads 50
# Rule 3 - a name that fails fresh resolution is marked dead, not deleted
comm -23 normalized-subs.txt <(cut -d' ' -f1 fresh-resolved.txt | sort -u) > dead-names.txt
wc -l fresh-resolved.txt fresh-probed.txt dead-names.txt
echo "Dead names are kept in dead-names.txt with the run date, for the next diff."
Other conflicts to decide in advance: a certificate name versus a DNS name (DNS wins for liveness, certificate wins for history), an indexed open port versus a fresh closed port (fresh wins, indexed kept as history), and two different owners for one IP range (ASN data wins over reverse DNS guesses). When no rule covers a conflict, mark it "unresolved" and let a human decide, rather than letting a script pick silently.
5. Score and tier the queue
Score from observed signals, and keep the formula simple enough to explain in a report. One workable formula: start at 0, add points for a live web service, more for a login or admin signal, more for a staging or dev name, more for freshness (first seen in the last 30 days), and more for a dangling or expired-certificate signal. Then tier by total, not by raw points alone.
import json
def score(asset, probe_line, first_seen_recent, dangling):
s = 0
reasons = []
if probe_line:
s += 10
reasons.append("live web service")
low = (probe_line or "").lower()
if any(k in low for k in ("login", "admin", "sso")):
s += 20
reasons.append("login or admin signal")
if any(k in asset for k in ("staging", "stage", "dev", "test", "internal")):
s += 15
reasons.append("staging or dev naming")
if first_seen_recent:
s += 10
reasons.append("first seen in last 30 days")
if dangling:
s += 25
reasons.append("dangling record signal")
tier = "high" if s >= 30 else ("medium" if s >= 10 else "low")
return tier, s, reasons
for row in [json.loads(line) for line in open("merged.jsonl")]:
tier, pts, reasons = score(row["asset"], "", False, False)
print(f"{tier} {pts} {row['asset']} - {'; '.join(reasons) if reasons else 'no live signal yet'}")
In a real run, feed the probe line, first seen date, and dangling flag from the merged record instead of the placeholders above. The point is the recorded reason: a tier without a reason cannot be reviewed, challenged, or re-scored when new evidence arrives.
6. Write the ranked queue and the provenance file
The handover is two files, not one. The queue is the ordered work list for active testing. The provenance file maps every queue entry back to its sources, its fresh resolution, and its score reasons.
# Ranked queue format - tier, asset, score, reasons, sources
# high 40 api-staging.example.com - login signal; staging naming - subfinder, crt.sh
# medium 15 blog.example.com - live web service - subfinder
# low 0 old.example.com - no live signal yet - crt.sh only, dead-names.txt
jq -r '"\(.asset) sources=\(.sources | join(","))"' merged.jsonl | head -20
echo "Queue plus merged.jsonl plus fresh-resolved.txt plus fresh-probed.txt is the complete handover."
Edge cases
- A tool returns the same asset under different cases or with a trailing dot, and naive dedup doubles it. Normalization before dedup prevents this, dedup before normalization does not.
- Wildcard certificates and wildcard DNS inflate the list with names that were never real hosts. Flag wildcard-derived names and require a live resolution before they reach the high tier.
- Indexed data (Shodan, Censys) can be weeks old, so an asset that looks live in the index and dead in fresh DNS is dead, with the index kept as history, not as a contradiction to argue about.
- Two organizations can share a cloud IP or a CDN edge, so IP-based merging alone merges unrelated assets. Merge on hostname first, and use IP only as an attribute, never as the merge key.
- A source file that failed halfway through looks like a complete file. Check line counts and tool exit notes before merging, and mark any partial source as partial in sources.txt.
- Scoring punishes new assets if freshness is missing from the data. When first seen is unknown, score freshness as unknown, not as old, and note the gap instead of quietly ranking the asset low.
Key references
- MITRE ATT&CK T1590 Gather Victim Network Information
- MITRE ATT&CK T1593 Search Open Technical Databases
- MITRE ATT&CK T1596 Search Open Websites/Domains
- ProjectDiscovery subfinder documentation: https://github.com/projectdiscovery/subfinder
- ProjectDiscovery dnsx documentation: https://github.com/projectdiscovery/dnsx
- ProjectDiscovery httpx documentation: https://github.com/projectdiscovery/httpx
- crt.sh documentation: https://crt.sh
