Skip to content
PHASE 04/16OP TRIANGULATE

Resolution, IP mapping and CDN filtering

Noise
Light active
Reads
subs/all.txtorg/cidrs.txt
Writes
dns/resolved.txtdns/dnsx.jsondns/ips.txtdns/ips-origin.txt

Scope checkActive phase. Check the program policy first. Send traffic only to in-scope assets, at the rate the program allows.

5 min readRecon Atlas

Scanning the wrong IP wastes your time and can break program rules, so answer three questions for every name:

  1. Does it resolve at all?
  2. What does it point at: an A record, a CNAME to a vendor, or nothing?
  3. Is the IP the target’s own server, or a content delivery network (CDN) edge shared with thousands of other sites?

The answers decide what you scan in phase 5 and what you check for takeover in phase 7.

Tool Noise Role
dnsx Light active Resolves lists fast, prints records, filters by response code, outputs JSON
mapcidr Passive Expands CIDRs to IPs, aggregates IPs to CIDRs. Local only
cdncheck Passive Flags IPs belonging to CDN, cloud and web application firewall (WAF) providers from published ranges
tlsx Light active Connects to TLS ports and reads certificate names (the Subject Alternative Name and Common Name fields)
{
"host": "support.example.com",
"cname": ["customer-care.zendesk.com"],
"a": ["192.0.2.45"],
"status_code": "NOERROR"
}

support.example.com is delegated to customer-care.zendesk.com. The record does not mean Zendesk still has a tenant for this name. If the account was closed and the CNAME was left behind, the name points at nothing you can use. The A record is Zendesk’s address, not Example Inc’s.

{
"host": "store.example.com",
"a": ["104.16.123.96", "104.16.124.96"],
"status_code": "NOERROR"
}

Those addresses are a Cloudflare edge. The application is somewhere else. A port scan of 104.16.123.96 scans Cloudflare.

Certificate read straight from an origin IP

Section titled “Certificate read straight from an origin IP”
IP: 203.0.113.45:443
Subject: CN=example.com
Subject Alternative Names:
- example.com
- origin-admin.example.com
- internal-vpn.example.com
Issuer: Let's Encrypt

The host on 203.0.113.45:443 presented a certificate covering those names. It does not mean public DNS sends origin-admin.example.com to that address. The name can exist only on an internal resolver.

tlsx across every address in an owned prefix finds hostnames that never appeared in public DNS. It also opens TCP/443 to every address in that prefix. On a narrow program, mine dns/ips-origin.txt and leave the empty parts of the prefix alone.

dev-assets.example.com resolves to 151.101.65.140. A full port scan finds 80 and 443 answering and everything else silent:

HTTP/1.1 503 Backend unavailable
X-Served-By: cache-iad-kiad7000020-IAD

That address is Fastly. The scan never reached the company.

Reverse DNS on 203.0.113.0/24 prints:

203.0.113.88.in-addr.arpa. IN PTR legacy-payroll.example.com.

Forward resolution of legacy-payroll.example.com is NXDOMAIN. The host is gone. The provider left the PTR in the reverse zone.

Dangling CNAME the vendor will not let you claim

Section titled “Dangling CNAME the vendor will not let you claim”

status.example.com CNAMEs to example-status.freshstatus.io and the target name is NXDOMAIN. Freshstatus will not route a custom domain until a TXT record proves you control it. The dangling name is not a takeover.

Old passive DNS says api-test.example.com pointed at 203.0.113.210. tlsx on that address now returns a certificate for a medical company. The VM was destroyed, the provider reused the address, and the DNS data is stale.

  1. Resolve and record. One pass, JSON output, A and CNAME records together.

    Terminal window
    # Resolve every name, keep A, AAAA and CNAME answers as JSON lines
    dnsx -l subs/all.txt -a -aaaa -cname -resp -json -r ~/wordlists/resolvers-trusted.txt -silent -o dns/dnsx.json
    Terminal window
    # List names that resolved
    jq -r '.host' dns/dnsx.json | sort -u > dns/resolved.txt
    Terminal window
    # List unique IPv4 addresses
    jq -r '.a[]?' dns/dnsx.json | sort -u > dns/ips.txt
    Terminal window
    # List unique IPv6 addresses
    jq -r '.aaaa[]?' dns/dnsx.json | sort -u > dns/ips6.txt

    A host that answers only on AAAA is easy to miss, and an IPv6 address often sits in front of a less guarded service than its IPv4 sibling. Keep dns/ips6.txt, but scan it only if your scanning host and the program both allow IPv6.

  2. Find CNAMEs that point off-site. These feed the takeover checks.

    Terminal window
    # Print host and CNAME target pairs
    jq -r 'select(.cname) | "\(.host) \(.cname | join(","))"' dns/dnsx.json > dns/cnames.txt
  3. Split CDN IPs from origin IPs. A Cloudflare or Akamai IP is the CDN’s server. Port scanning it scans the CDN, wastes time, and can break the program rules.

    Terminal window
    # Show which IPs belong to a CDN, cloud or WAF, with the provider name
    cdncheck -i dns/ips.txt -resp -silent > dns/ips-providers.txt
    Terminal window
    # Keep only IPs that cdncheck does not recognize as CDN or WAF
    cdncheck -i dns/ips.txt -e -silent -o dns/ips-origin.txt

    Cloud providers such as AWS show up as cloud rather than cdn. An EC2 IP serving the target’s app is a real origin. Read dns/ips-providers.txt before you throw cloud IPs away.

    Terminal window
    # Drop RFC 1918, loopback and link-local addresses before scanning
    grep -vE '^(10\.|127\.|169\.254\.|192\.168\.|172\.(1[6-9]|2[0-9]|3[01])\.)' dns/ips-origin.txt | sort -u -o dns/ips-origin.txt

    A private or loopback IP in your resolved set leaks internal addressing. Log it in your notes for later SSRF or pivot work, then strip it from your scan list because you cannot reach it from the internet.

  4. Mine certificates on origin IPs and owned ranges. A server’s certificate often names hosts that DNS enumeration never found.

    Terminal window
    # Read SAN and CN names from TLS on port 443 of every origin IP
    tlsx -l dns/ips-origin.txt -p 443 -san -cn -silent -resp-only | sort -u > dns/tls-names.txt
    Terminal window
    # Expand owned CIDRs to single IPs and mine their certificates too
    mapcidr -cl org/cidrs.txt -silent | tlsx -p 443 -san -cn -silent -resp-only | sort -u >> dns/tls-names.txt
    Terminal window
    # Add certificate names under the target domain to the master list
    grep -E '(^|\.)example\.com$' dns/tls-names.txt | sed 's/^\*\.//' | anew subs/all.txt
  5. Find dead names that are still interesting. NXDOMAIN with a CNAME and SERVFAIL both deserve a look in phase 7.

    Terminal window
    # Names whose lookup returns NXDOMAIN or SERVFAIL
    dnsx -l subs/all.txt -rcode nxdomain,servfail -silent -o dns/dead.txt
  6. Summarize IPs by range. Helpful when you want to see which netblocks the target really uses.

    Terminal window
    # Aggregate origin IPs into the smallest set of CIDRs
    mapcidr -cl dns/ips-origin.txt -aggregate -silent > dns/origin-cidrs.txt

A site behind a CDN sometimes leaks its real IP. Reach the origin directly and a WAF that only sits on the CDN edge does nothing. Three leaks are worth checking on any host that resolves only to CDN addresses.

  1. Old DNS records. The name may have pointed at the origin before the CDN was added. SecurityTrails keeps that history.

    Terminal window
    # Historical A records for the host (needs a SecurityTrails key)
    curl -s -H "APIKEY: $SECURITYTRAILS_KEY" \
    "https://api.securitytrails.com/v1/history/app.example.com/dns/a" | jq -r '.records[].values[].ip' | sort -u
  2. Mail server IPs. Mail rarely goes through the web CDN, so the MX host often sits on the same network as the origin, or on the origin itself.

    Terminal window
    # Resolve the mail servers; their IPs point at the target's real network
    dig +short MX example.com | awk '{print $2}' | dnsx -a -resp-only -silent
  3. Certificate on the raw IP. Scan the owned ranges and read certificates. An origin that serves the site’s certificate on its bare IP gives itself away.

    Terminal window
    # Find owned-range IPs whose certificate names the target domain
    mapcidr -cl org/cidrs.txt -silent | tlsx -san -cn -silent -resp-only | grep -i example.com

When a candidate origin turns up, confirm it serves the target before you trust it: request the site with the real Host header and compare the body.

Terminal window
# Ask the candidate origin for the site directly, bypassing the CDN
curl -sk -H "Host: app.example.com" https://203.0.113.45/ | head

A body that matches the real site, from an IP the CDN does not own, is the origin. Test it the same way you test the main host.

  • dns/ips-origin.txt is the port scan target list for phase 5.
  • dns/resolved.txt is the HTTP probe list for phase 6.
  • dns/cnames.txt and dns/dead.txt feed takeover checks in phase 7.
  • Resolving with untrusted public resolvers in the final pass, which brings back poisoned answers.
  • Port scanning CDN IPs.
  • Dropping cloud IPs along with CDN IPs. Cloud VMs are often the most interesting hosts.
  • Throwing away names that do not resolve. They are takeover candidates.
What to look for
  • CNAMEs to services such as *.herokuapp.com, *.azurewebsites.net, *.s3.amazonaws.com, *.github.io
  • A records in private ranges (10., 172.16. to 172.31., 192.168.) that leak internal addressing
  • Certificate names for hosts you have not seen anywhere else
  • Several names on one origin IP, suggesting virtual hosts worth fuzzing in phase 11
  • Origin IPs for a site that otherwise sits behind a WAF

Next, scan the origin IPs in dns/ips-origin.txt for non-web services in phase 5.

Connections10 backlinks · 3 outgoingFull graph →
Open local graph around this page
Open full graph →
Click a node to open · Drag to reposition · Scroll to zoom

Recon AtlasFor authorized testing only. Your scope is the map edge.