How to Automate Recon and Detect Subdomain Takeovers with Amass, Subfinder and Nuclei

Subdomain takeovers are a high-severity issue in bug bounty and security assessments. By automating reconnaissance using tools like Amass, Subfinder, and Nuclei, security researchers can systematically uncover abandoned DNS entries pointing to unclaimed services. These tools streamline subdomain enumeration, vulnerability scanning, and takeover detection—making the process scalable across large attack surfaces. This guide shows how a hacker combined automation and intelligence to identify 30+ vulnerable subdomains.

Jul 26, 2025 - 17:22
Updated: 7 days ago
108.2k
How to Automate Recon and Detect Subdomain Takeovers with Amass, Subfinder and Nuclei

Quick answer: To find subdomain takeovers at scale, enumerate a domain's subdomains with Subfinder and Amass, check which are live with httpx, then match dangling services against takeover fingerprints with Nuclei's http/takeovers templates. Schedule it so new exposures are caught early. Run this only on domains you own or an authorised bug-bounty scope. The fix is on the defender's side: remove or reclaim DNS records that point at de-provisioned third-party services.

Key takeaways

  • Chain tools in order: Subfinder and Amass to enumerate, httpx to find live hosts, then Nuclei's http/takeovers templates to match fingerprints.
  • The permanent fix is defensive: delete or reclaim DNS records that still point to de-provisioned services such as GitHub Pages, Heroku or S3.
  • Schedule the pipeline against your own domains so new dangling records are caught early, and run it only on authorised scope.

A subdomain takeover is one of the most preventable high-severity issues, and the same automation that finds it for a bug-bounty report is what a security team should run against itself. This walks through the workflow and, just as importantly, how to close the gap for good.

What is a subdomain takeover?

A subdomain takeover happens when a subdomain, say blog.example.com, still has a DNS record pointing to a third-party service, GitHub Pages, Heroku, an S3 bucket or a help-desk tool, but that service is no longer claimed by the owner. If anyone else can register the dangling resource on that provider, they can serve content from your subdomain. That enables convincing phishing, cookie theft on the parent domain in some setups, and reputational damage, because the address bar genuinely shows your domain.

The root cause is almost always a DNS record that outlived the service it pointed to.

Why automate the check

Large organisations create and retire subdomains constantly, and a dangling record can appear the day after a clean audit. Manual enumeration does not keep up. Automating it lets you continuously enumerate your estate, confirm which hosts are live, match them against known takeover signatures, and get an alert the moment something new appears. Treat it as monitoring, not a one-off scan.

Before you run anything: scope and the law

Run this pipeline only against domains you own or a bug-bounty or engagement scope that explicitly authorises it. Enumerating and probing a third party's subdomains without permission can attract liability under India's Information Technology Act, 2000, regardless of intent. Actually registering someone else's dangling service to "prove" a takeover can cause real harm and goes beyond most bug-bounty rules, so report the dangling record instead of claiming it. Keep a record of your authorisation.

The recon pipeline, step by step

1. Enumerate subdomains (Subfinder + Amass)

Subfinder does fast passive discovery; Amass adds deeper passive and active enumeration. Combine and de-duplicate their output.

subfinder -d example.com -silent -o subfinder.txt
amass enum -passive -d example.com -o amass.txt
sort -u subfinder.txt amass.txt > all_subs.txt

2. Find the live hosts (httpx)

Not every name resolves to a running service. httpx filters to live hosts and records status codes, titles and detected technology, which already hints at which third-party services are in play.

httpx -l all_subs.txt -silent -status-code -title -tech-detect -o live_subs.txt

3. Match takeover fingerprints (Nuclei)

Nuclei's community templates include a maintained set of subdomain-takeover checks. Point them at your live hosts. The current template path is http/takeovers:

nuclei -l live_subs.txt -t http/takeovers/ -o takeover_findings.txt

Treat every hit as a lead to verify by hand, not a confirmed issue. Takeover templates produce false positives as providers change their policies, so confirm the DNS target really is unclaimed before you act or report.

4. Schedule it

Wrap the steps in a script and run it on a schedule against your own estate so new dangling records surface quickly.

#!/usr/bin/env bash
set -euo pipefail
target="example.com"
stamp="$(date +%F)"
subfinder -d "$target" -silent -o subfinder.txt
amass enum -passive -d "$target" -o amass.txt
sort -u subfinder.txt amass.txt > all_subs.txt
httpx -l all_subs.txt -silent > live.txt
nuclei -l live.txt -t http/takeovers/ -o "report_${stamp}.txt"

How to verify and fix a finding

  1. Confirm the dangling target. Resolve the record (CNAME or A) and check the provider says the resource is unclaimed or missing, not merely down.
  2. Fix on the DNS side. If the service is retired, delete the DNS record. If it is still needed, reclaim the resource on the provider so it is owned again.
  3. Close the process gap. Decommissioning a service and removing its DNS record should be a single checklist item, so records never outlive services.
  4. Re-scan. Confirm the finding is gone and keep the monitoring running.

The tools at a glance

ToolRoleMaintainer
SubfinderFast passive subdomain discoveryProjectDiscovery
AmassDeeper passive and active enumerationOWASP
httpxLive-host and technology detectionProjectDiscovery
NucleiTemplate-based fingerprint matchingProjectDiscovery

Where to go next

This pipeline is a slice of reconnaissance and attack-surface management. To use it responsibly, understand how DNS actually resolves and how recon fits into a lawful engagement. If you want to build these skills formally, structured training ties the tools, the scope rules and the reporting together.

Related reading

Frequently Asked Questions

It happens when a subdomain still has a DNS record pointing to a third-party service that is no longer claimed by the owner. If someone else can register that dangling resource on the provider, they can serve content from your subdomain, enabling phishing and reputational damage because the address bar shows your real domain.

Only against domains you own or a bug-bounty or engagement scope that explicitly authorises it. Enumerating or probing a third party's subdomains without permission can attract liability under India's IT Act, 2000. Always keep evidence of your authorisation before you start.

The subdomain-takeover checks live in the community templates under the http/takeovers path. Point Nuclei at your live hosts with -t http/takeovers/. Treat every hit as a lead to verify by hand, since provider policy changes cause false positives.

Subfinder focuses on fast passive subdomain discovery from public sources. Amass, an OWASP project, goes deeper with both passive and active enumeration. Running both and de-duplicating the output gives wider coverage than either alone, which is why they are usually combined.

No. Actually claiming someone else's dangling resource can cause real harm and goes beyond most bug-bounty rules. Report the dangling DNS record and the evidence that the target is unclaimed, and let the owner remediate. Proof of the misconfiguration is enough.

Fix it on the DNS side. If the service is retired, delete the DNS record that points to it. If it is still needed, reclaim the resource on the provider so you own it again. Then make removing DNS records part of your decommissioning checklist so they never outlive services.

Treat it as continuous monitoring rather than a one-off. A dangling record can appear the day after a clean audit, so schedule the pipeline against your own estate and alert on new findings. Always re-scan after decommissioning a service.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.