Last updated

Subdomain Takeover Detection

The Subdomain Takeover module is a layered scanner that finds dangling DNS records whose third-party target can still be claimed by an attacker (expired Heroku apps, decommissioned S3 buckets, dead GitHub Pages, orphaned NS delegations, etc.). It stacks three independent detection engines, deduplicates their output, scores each finding against a confidence model, and emits Vulnerability nodes with source="takeover_scan".

It runs as GROUP 6 Phase A (parallel with Nuclei and the GraphQL scanner). Disabled by default. Enable in the project settings under the Subdomain Takeover tab.


Why a layered scanner

No single tool catches every takeover class. The module combines three engines with different strengths so coverage compounds:

EngineStrengthLicenseIsolation
SubjackFast DNS-first CNAME walker with built-in service fingerprints. High precision on classic provider takeoversApache-2.0Native Go binary baked into the recon image
Nuclei (takeover templates)Fingerprint-based HTTP detection against alive URLs. Catches providers that Subjack misses and confirms CNAME matches via the response bodyMITReuses projectdiscovery/nuclei:latest via Docker-in-Docker
BadDNSDeep multi-module DNS audit (CNAME, NS, MX, TXT, SPF, DMARC, wildcard, NSEC-walk, zone-transfer, HTML references). Finds takeover vectors that pure CNAME scanners ignoreAGPL-3.0Runs inside a separate redamon-baddns:latest image. RedAmon code never imports baddns. Opt-in

Findings from all three engines are merged on (hostname, provider, method), so a subdomain confirmed by two engines produces one finding with both tools listed under sources and a confidence bonus.


Pipeline position

GROUP 5  - Resource enumeration (Katana, Hakrawler, jsluice, FFuf, GAU, Kiterunner, Arjun)
GROUP 5b - JS Reconnaissance
GROUP 6 Phase A  - Nuclei  ||  GraphQL Security  ||  Subdomain Takeover     <- parallel fan-out
GROUP 6 Phase B  - MITRE enrichment (consumes Nuclei CVEs)

Phase A tools are launched via ThreadPoolExecutor. Every scanner is handed one deep copy of the shared combined_result, taken before the first one starts, and its _isolated wrapper copies it again, so no scanner reads the dict while finished answers are merged into it. The module pulls its inputs from GROUP 1 (DNS subdomains) and GROUP 4 (httpx alive URLs), so it needs the DNS + HTTP probe stages to have already completed.

It runs even when httpx found no live URL and the other active scans are skipped: Subjack and BadDNS read names and CNAMEs, not URLs, so a group of dangling names, the case the module exists for, is still checked. The Nuclei takeover layer then has no URL to probe.


Target collection

The module assembles two target sets from combined_result:

SetSource in recon_dataConsumed by
Subdomainsdns.subdomains keys + the flat subdomains list + the project apex domainSubjack, BadDNS
Alive URLshttp_probe.by_url entries with status_code < 500, plus http_probe.by_host[*].live_urlsNuclei takeover templates
urlscan takeover hostsurlscan.takeover_hosts: names whose deleted-service page urlscan recorded and this scan's verdict kept (below)Subjack, BadDNS

Dead hosts are Subjack and BadDNS territory (CNAME/NS walks do not need a live HTTP response). Alive URLs get the HTTP-fingerprint treatment via Nuclei.

Deleted-service pages seen on urlscan

A name the DNS list never had can still point to a deleted service: urlscan's history shows it. With URLScan → Takeover Pages on (default), the titles, Server headers and statuses urlscan already returned are checked against the provider error pages of the problem-page catalog (recon/helpers/page_signals.py, family T): Surge, Ghost, Uberflip, Pingdom, Anima, Read the Docs, Canny, Helpjuice, HatenaBlog, S3 and GitHub Pages, Heroku, Wix, Framer, plus Netlify, Azure App Service, Shopify, Fastly, Pantheon and Zendesk, which now only leave the name dangling (a DNS verification record blocks a claim). No search and no request are added.

History alone proves nothing (a CNAME to the provider is the normal state of a healthy site, and a brief "No such app" during a deploy is not a takeover), so a short step after the HTTP probe decides, per host:

This scan showsKept asSeverity
httpx gets the same error page nowthe row's outcomelikely high, possible medium, dangling low
no live page, and the CNAME target does not exist (NXDOMAIN)possible (likely for a likely row)medium / high
the CNAME points to the provider and the page is normalnothing (healthy now)—
no CNAME to that provider (an A record, another CDN)nothing—
never probed, and the CNAME target resolvesnothing (unverified)—

The CNAME comes from the DNS map; a host only urlscan knows costs one CNAME query and one target lookup, through the circuit breaker (dns:takeover-verdict). A kept host is written as Vulnerability {source: 'urlscan_leak', type: 'takeover_page_seen'} with provider, outcome, cname and verdict_basis, and joins this module's subdomain list when it is on, filtered by the group scope (never in an EXACT group) and the RoE. The live counterpart is the Security Checks' Takeover Error Pages check (type: 'takeover_error_page'), which flags the same pages on the hosts httpx probed. The Red Zone takeover tab lists all three, with a "Found by" column: takeover scan, urlscan history, live check.


Subjack layer (DNS-first, primary)

Subjack (haccer/subjack, Apache-2.0) is a Go tool that walks CNAME/NS/MX records, checks the resulting hostname against a compiled-in fingerprint database, and reports vulnerable subdomains. The binary is built in Stage 1d of the recon Dockerfile and installed at /usr/local/bin/subjack.

Command shape:

subjack -w <targets.txt> -t <threads> -timeout <sec> -o <results.json> \
        [-ssl] [-a] [-ns] [-ar] [-mail] [-r <resolvers>]

Flags:

FlagSettingPurpose
-w(auto)Newline-separated targets file
-tSUBJACK_THREADSConcurrent worker count
-timeoutSUBJACK_TIMEOUTPer-request timeout (seconds)
-o(auto)JSON output path
-sslSUBJACK_SSLForce HTTPS on probes. Improves accuracy against HTTPS-only SaaS providers
-aSUBJACK_ALLTest every subdomain, not just ones with an obvious CNAME. Slower but more thorough
-nsSUBJACK_CHECK_NSDetect expired nameserver delegations and dangling cloud DNS zones
-arSUBJACK_CHECK_ARFlag stale A records pointing to dead cloud IPs (probabilistic, manual verification required)
-mailSUBJACK_CHECK_MAILAudit SPF includes and MX records for references to dead infrastructure

Subjack has no -c flag; fingerprints are compiled into the binary. A vulnerable row in subjack_results.json is normalized into the canonical finding shape with source_tool="subjack".

Run bound: SUBJACK_RUN_TIMEOUT (default 900 s) hard-caps the whole subjack invocation so a pathological target set cannot stall the pipeline. On a timeout the rows Subjack already wrote are kept as findings, and since it never says which names it reached, every subdomain counts as not checked (see When a layer fails).


Nuclei takeover templates (fingerprint-based)

The module reuses the existing Nuclei Docker image but forces -t http/takeovers/ -t dns/ so only ~60 takeover-focused templates fire instead of the full 9,000+ community set. Targets are the alive URLs collected above.

Key differences vs. the main Nuclei vuln scan:

BehaviourMain NucleiTakeover Nuclei
TemplatesCommunity + customhttp/takeovers/ + dns/ only
NUCLEI_EXCLUDE_TAGSInherited from projectNot inherited (filters out takeover tags by accident)
Interactsh (OOB)OptionalDisabled (takeover templates do not need OOB)
Severity filterProject defaultTAKEOVER_SEVERITY (default critical,high,medium)
Rate limitNUCLEI_RATE_LIMITTAKEOVER_RATE_LIMIT
Run timeoutNUCLEI_RUN_TIMEOUTNUCLEI_TAKEOVER_RUN_TIMEOUT (default 1800 s)

Only findings whose tags or template-id include takeover, dangling, or detect-dangling-cname are kept; other categories (CVE, misconfig) are discarded by the normalizer. dns-saas-service-detection, tagged dns,service,discovery, is never kept. HTTP templates map to method="cname", DNS templates map to method="dns". The first extracted_results entry becomes cname_target.


BadDNS layer (AGPL-3.0 isolated sidecar)

BadDNS is an AGPL-3.0 Python toolkit that goes well beyond CNAME walks: it audits NS, MX, SPF, DMARC, wildcard, NSEC zone-walking, zone transfers, and HTML references. Because of the AGPL-3.0 license, RedAmon never imports baddns at the Python level. Instead a dedicated Docker image (redamon-baddns:latest) ships upstream baddns unmodified, and the recon container spawns it via Docker-in-Docker. The process + filesystem boundary is the license-safe integration pattern (see THIRD-PARTY-LICENSES.md).

Build the sidecar once:

docker compose --profile tools build baddns-scanner

The image is not pulled automatically. If it is missing on the host, the BadDNS layer is skipped with a warning instead of aborting the run, and its subdomains count as not checked (see When a layer fails).

Container invocation:

docker run --rm --name baddns-<run id>-<8 hex> \
    -v <work_dir_host>:/work:ro \
    redamon-baddns:latest \
    /work/baddns_targets.txt \
    <modules_csv> \
    <nameservers_csv>

The entrypoint is a batch wrapper that invokes baddns -s -m <modules> -- <target> once per line, with a per-target timeout (BADDNS_PER_TARGET_TIMEOUT, default 90 s) so one hanging target cannot stall the batch. Findings arrive as NDJSON on stdout, one JSON object per line from Finding.to_json().

BadDNS modules

BadDNS ships 11 modules; 10 are CLI-addressable (MTA-STS is excluded because the baddns 2.1.0 validate_modules regex rejects the hyphen). RedAmon exposes all 10 in the UI.

Moduletakeover_methodPurpose
cnamecnameDangling CNAME records + takeover potential
nsnsDangling NS records (expired nameservers, cloud DNS delegations)
mxmxDangling MX records + base-domain availability
txttxtTXT record takeover opportunities
spfspfSPF include/redirect chain pointing to dangling domains
dmarctxtMissing or misconfigured DMARC
wildcarddnsWildcard DNS enabling broad takeovers
nsecdnsSubdomain enumeration via NSEC-walking (slow)
referencescnameHTML links pointing to hijackable domains
zonetransferdnsAXFR zone-transfer attempts (slow)

Wildcard DNS and the names checked here. BadDNS's wildcard module audits the wildcard record itself. The names Subjack, Nuclei and BadDNS check come from recon, where RedAmon's wildcard control has already dropped every name that answers only through its zone's wildcard (see Running Reconnaissance > GROUP 1), so a takeover candidate under a wildcard zone is a name with a record of its own.

Default enabled subset: cname, ns, mx, txt, spf. nsec and zonetransfer are opt-in because they can be slow on large targets. Unknown module strings are silently filtered at command-build time to prevent argparse-level baddns failures.

Nameservers: BADDNS_NAMESERVERS is an optional comma-separated resolver list passed to baddns via -n. Empty = system resolvers.

When a layer fails

A layer that times out, raises or cannot start (no Docker, no binary, no BadDNS image), or a Nuclei or BadDNS run that exits non-zero, is not a clean run with no findings. The hosts it did not check keep their earlier takeover findings at the end-of-run prune, and the report's Coverage Limitations names the layer and the reason. Subjack and BadDNS failures cover every subdomain they were given, a Nuclei failure the hosts of its live URLs, and a BadDNS per-target timeout only that name. A BadDNS run stopped by BADDNS_RUN_TIMEOUT keeps the findings it printed: BadDNS checks the names in order and prints a name's findings once it is done with it, so only the names from the last one with a printed finding onwards count as not checked (all of them when it printed nothing). The other layers' results still count, and a layer switched off by configuration prunes as usual.


Provider fingerprinting

Each normalized finding is tagged with a canonical takeover_provider slug (e.g. github-pages, heroku, aws-s3). The provider is part of the finding's id (see Dedupe key), and it is taken from the first of these that names one:

  1. The tool's own signal. Subjack's service field ("GitHub" -> github-pages); a Nuclei template-id substring (heroku-takeover -> heroku); BadDNS's signature or indicator, else the CNAME it reported, else its module name (ns -> ns).
  2. The CNAME, from the DNS map (foo.herokuapp.com -> heroku).
  3. A certificate SAN on a provider's own edge domain (*.herokuapp.com, *.s3.amazonaws.com) in the host's 443 certificate. This works with no CNAME at all.

Steps 2 and 3 replace only a placeholder: an empty value, unknown, none, or the name of what a generic Nuclei DNS template detects rather than a service (dangling-cname, from detect-dangling-cname). A finding none of the three names keeps its placeholder; unknown scores -10.

A certificate's issuer never names the provider. The issuer says who signed the certificate, not which edge serves the host: Google Trust Services also signs Cloudflare's certificates, and Amazon (ACM) and Cloudflare sign their customers' own names. The finding records what the certificate names as cert_provider (the SAN's edge, else the issuer, an Amazon issuer as aws, never aws-s3), but an issuer neither sets takeover_provider nor contradicts it.

A disagreement costs 25 points. A tool's provider that the CNAME names as another known provider is a provider_mismatch, and one that a SAN on another provider's edge domain names is a cert_provider_mismatch. A provider and its own sub-slugs agree (azure with azure-app-service, aws with aws-s3); aws-s3 and aws-cloudfront do not. A CNAME or SAN the provider table does not know proves nothing.

Auto-exploitable providers (single-step claim, no verification challenge) receive a +20 confidence bonus:

github-pages, heroku, aws-s3, shopify, fastly, ghost,
unbounce, readthedocs, surge, webflow, tumblr, statuspage

The full fingerprint table (~40 signals + ~30 CNAME patterns) lives in recon/helpers/takeover_helpers.py::PROVIDER_FROM_SIGNAL. Keep it in sync with upstream nuclei-templates/http/takeovers/ and subjack fingerprints when adding providers.


Deduplication & scoring

Dedupe key

Findings are merged by the tuple (hostname, takeover_provider, takeover_method). Merged findings carry:

  • sources: ordered list of tool names (subjack, nuclei_takeover, baddns)
  • confirmation_count: len(sources)
  • raw_by_source: {tool: raw_payload} for provenance
  • evidence: Subjack evidence is kept when both Subjack and another tool fire (higher precision)

Confidence scoring

Every deduped finding is scored 0-100 using additive rules:

ConditionDelta
Confirmed by 2+ tools+30
Subjack flagged as vulnerable+25
Provider in auto-exploitable list+20
Nuclei template match+15
Method = cname (most reliable)+10
Method = stale_a or mx (probabilistic)-15
Provider = unknown-10
provider_mismatch: the CNAME names another known provider-25
The CNAME target resolves and the provider is not auto-exploitable (the edge serves the customer)-30
The AI classifier read the page as a WAF block page-40
cert_provider_mismatch: a SAN names another provider's edge domain-25
A valid certificate (not expired, self-signed or mismatched) names the host, for every provider-35
cert_provider_default: a SAN names the provider's own edge domain and the certificate does not name the host (the edge's default certificate)+20
The 443 handshake fails entirely+10
The host served a normal 2xx page and the CNAME target is not NXDOMAIN-30

The certificate rows read the SANs only: an issuer alone never sets a mismatch or the default-certificate bonus.

Score is clamped to [0, 100], then mapped to a verdict:

ScoreVerdict
>= threshold + 10confirmed
>= thresholdlikely
otherwisemanual_review

Default threshold is 60, configurable via TAKEOVER_CONFIDENCE_THRESHOLD.

Severity mapping

VerdictSeverity (default)With TAKEOVER_MANUAL_REVIEW_AUTO_PUBLISH
confirmedhigh (or nuclei-assigned if present)unchanged
likelymedium (or nuclei-assigned if present)unchanged
manual_reviewinfomedium

manual_review defaults to info so it does not pollute the main alert stream. Flip TAKEOVER_MANUAL_REVIEW_AUTO_PUBLISH on when you want every unverified candidate surfaced in the findings table.


Full parameter reference

Master toggle

ParameterDefaultDescription
SUBDOMAIN_TAKEOVER_ENABLEDfalseMaster toggle. When off, the whole module is skipped; recon output contains { "skipped_reason": "disabled" }

Subjack

ParameterDefaultClampDescription
SUBJACK_ENABLEDtrue-Enable the Subjack layer (only applied if the master toggle is on)
SUBJACK_THREADS101-100Concurrent subjack workers (-t)
SUBJACK_TIMEOUT30-Per-request connection timeout in seconds (-timeout)
SUBJACK_SSLtrue-Force HTTPS on probes (-ssl)
SUBJACK_ALLfalse-Probe every subdomain, not just CNAME-bearing ones (-a)
SUBJACK_CHECK_NSfalse-Check NS takeovers (-ns)
SUBJACK_CHECK_ARfalse-Check stale A records (-ar). Probabilistic, requires human verification
SUBJACK_CHECK_MAILfalse-Check SPF/MX takeovers (-mail)
SUBJACK_RUN_TIMEOUT900>= 60Overall hard cap on the subjack subprocess (seconds)

Nuclei takeover templates

ParameterDefaultDescription
NUCLEI_TAKEOVERS_ENABLEDtrueEnable the Nuclei takeover layer
NUCLEI_TAKEOVER_RUN_TIMEOUT1800Overall hard cap on the nuclei takeover subprocess (seconds)
NUCLEI_DOCKER_IMAGEprojectdiscovery/nuclei:latestShared with the main Nuclei vuln scanner. Fixed, not a project setting

The following nuclei settings are inherited from the global Nuclei block: NUCLEI_BULK_SIZE, NUCLEI_CONCURRENCY, NUCLEI_TIMEOUT, NUCLEI_RETRIES, NUCLEI_SYSTEM_RESOLVERS, NUCLEI_FOLLOW_REDIRECTS, NUCLEI_MAX_REDIRECTS. Global NUCLEI_EXCLUDE_TAGS is not inherited (would accidentally exclude takeover tags).

Scoring & severity

ParameterDefaultDescription
TAKEOVER_SEVERITY["critical", "high", "medium"]Severity filter passed to Nuclei (via -severity)
TAKEOVER_RATE_LIMIT50Nuclei req/s rate limit for this layer (does not affect the global vuln scan)
TAKEOVER_CONFIDENCE_THRESHOLD60Minimum score for likely; threshold + 10 for confirmed
TAKEOVER_MANUAL_REVIEW_AUTO_PUBLISHfalseWhen true, manual_review findings are promoted from info to medium so they appear in the main findings table

BadDNS sidecar

ParameterDefaultDescription
BADDNS_ENABLEDfalseEnable the AGPL-3.0 BadDNS sidecar (opt-in)
BADDNS_DOCKER_IMAGEredamon-baddns:latestSidecar image tag, fixed (not a project setting). Build via docker compose --profile tools build baddns-scanner
BADDNS_MODULES["cname", "ns", "mx", "txt", "spf"]Active module list. 10 addressable modules: see table above
BADDNS_NAMESERVERS[]Optional custom DNS resolvers (comma-separated or list); empty = system
BADDNS_RUN_TIMEOUT1800Overall hard cap on the BadDNS run (seconds, at least 120). On timeout the container baddns-<run id>-<8 hex> is killed by name and the findings it printed are kept

Output structure

Results live under combined_result.subdomain_takeover:

{
  "findings": [
    {
      "id": "takeover_9d2e4b1a3f8c",
      "hostname": "promo.example.com",
      "cname_target": "promo-app.herokuapp.com",
      "takeover_provider": "heroku",
      "takeover_method": "cname",
      "evidence": "Subjack confirmed Heroku takeover",
      "severity": "high",
      "confidence": 85,
      "verdict": "confirmed",
      "sources": ["subjack", "nuclei_takeover"],
      "confirmation_count": 2,
      "raw_by_source": { "subjack": {...}, "nuclei_takeover": {...} },
      "detected_at": "2026-04-21T13:37:00Z"
    }
  ],
  "by_target": { "promo.example.com": [ {...} ] },
  "summary": {
    "total": 3,
    "confirmed": 1,
    "likely": 1,
    "manual_review": 1,
    "by_provider": { "heroku": 1, "aws-s3": 1, "unknown": 1 }
  },
  "scan_metadata": {
    "subjack_enabled": true,
    "nuclei_takeovers_enabled": true,
    "confidence_threshold": 60,
    "subdomains_scanned": 42,
    "alive_urls_scanned": 37,
    "duration_sec": 128.4,
    "scan_timestamp": "2026-04-21T13:37:00Z"
  }
}

id is a deterministic SHA1-based hash of hostname|provider|method so rescans update the same graph node instead of duplicating.

Upgrading: findings written by earlier releases may carry a provider the scan no longer derives: one an issuer alone named (aws-s3 or aws for an Amazon certificate, google, cloudflare, ...), or dangling-cname / dns-saas where the CNAME or a certificate SAN names the real one. Their id changes with it. Run python tooling/scripts/takeover_finding_rekey.py --all (a dry run), then --all --apply with the agent, webapp and recon orchestrator stopped, before the first takeover scan on the new release, then rescan. It moves each finding to its new id with its mute, Priority Board layers and references. Run it again after importing or restoring an older graph. A mute rule matching takeover_provider on one of the old values no longer matches a moved finding.


Graph schema

Input nodes (consumed)

The scanner never queries Neo4j directly during the full recon run -- all inputs come from the in-memory combined_result dict that earlier pipeline stages populated. The underlying graph provenance of those inputs is:

Graph nodeProduced byHow this module uses it
DomainSubdomain Discovery (GROUP 1)Apex target. Added to the subdomain list so the root itself is scanned. Used as the fallback attachment point when a finding hits the apex and no Subdomain exists
SubdomainSubdomain Discovery (GROUP 1), DNS reconPrimary target set for Subjack and BadDNS. Pulled from recon_data.dns.subdomains keys and the flat subdomains list
DNSRecord (CNAME)DNS recon (GROUP 1)Read via the DNS map (dns.subdomains[host].records.CNAME) to fill in cname_target and infer the provider when Subjack/Nuclei/BadDNS all mark it unknown
BaseURL / alive URLHttpx (GROUP 4)The Nuclei takeover layer targets only URLs with status_code < 500 from http_probe.by_url and the per-host live_urls lists. Dead hosts stay with Subjack/BadDNS

In Partial Recon, the scanner instead calls _build_vuln_scan_data_from_graph() which directly reads Subdomain, DNSRecord, and BaseURL nodes out of Neo4j for the project, plus any user-supplied subdomains injected by the modal.

Nodes that are not read: IP, Port, Service, Endpoint, Technology, Parameter, Header, Certificate, CVE, ExternalDomain, MitreData, Capec, Secret.

Output nodes (produced)

Graph nodeOperationNotes
VulnerabilityMERGE by idOne node per deduped finding. source="takeover_scan", type="subdomain_takeover". first_seen set on create, last_seen on every run, so rescans update in place
HAS_VULNERABILITY relationshipMERGEFrom the anchor host (Subdomain or Domain) to the Vulnerability
Subdomain (defensive)MERGE by nameOnly when the finding's hostname has no existing Subdomain and is not the apex. The placeholder is created with source="takeover_scan" so the Vulnerability is reachable from the graph page

Nodes that are not produced or modified: Domain, IP, Port, Service, Endpoint, BaseURL, DNSRecord, Technology, Parameter, Header, Certificate, CVE, MitreData, Capec, Secret, ExternalDomain. The takeover module is deliberately narrow: it writes one node type plus at most one relationship per finding.

Anchor attachment precedence

For every finding, the mixin tries three anchor strategies in order and stops on the first that succeeds:

  1. Match existing Subdomain with {name: hostname, user_id, project_id} and MERGE the HAS_VULNERABILITY edge to it.
  2. Match existing Domain (only if the hostname equals the project apex) and MERGE the edge to it instead. This handles takeovers on the bare apex that do not have a matching Subdomain node.
  3. Create a defensive Subdomain with source="takeover_scan" and attach the Vulnerability to it. This mirrors how the main Nuclei vuln mixin handles orphan findings and guarantees every Vulnerability is reachable from the graph page.

Properties written on each Vulnerability

PropertyValue
iddeterministic hash (takeover_<sha1_16>)
user_id, project_idtenant isolation
source"takeover_scan"
type"subdomain_takeover"
namee.g. "Subdomain Takeover -- Heroku (CNAME)"
severityhigh / medium / info (driven by verdict + scorer)
descriptionhuman summary with verdict + confidence + sources
hostnamelowercased subdomain
cname_targetresolved CNAME target (when available)
takeover_providercanonical slug
takeover_methodcname / dns / ns / mx / stale_a / txt / spf
confidence0-100 integer
sourceslist of confirming tool names
confirmation_countlen(sources)
verdictconfirmed / likely / manual_review
evidencetrimmed to 2,000 chars
tool_rawJSON-encoded per-source raw output (max 50,000 chars)
first_seen, last_seenISO timestamps

Rules of Engagement

Subdomain Takeover inherits the project-level RoE applied during GROUP 1 (subdomain discovery) and GROUP 4 (HTTP probe), and applies ROE_EXCLUDED_HOSTS again to its own lists in every mode (partial runs included), so a name that reached them another way (a urlscan takeover host, a user-typed subdomain) is still dropped.

Subjack and BadDNS resolve each name themselves, and the Nuclei takeover templates each URL's host, so they can land on any address the name has. While ROE_EXCLUDED_HOSTS holds an IP or CIDR entry, the module checks every name and URL host on every address the run knows for it (Never-touch hosts):

  • A name with any excluded address is not sent to any layer, a name with one excluded and one allowed address included.
  • A name with no known address is not sent either, because nothing shows where it lands. A dangling CNAME is such a name, so while an IP or CIDR entry is set the takeover scan does not check it. It is recorded as not checked, and the findings an earlier run made on it are kept ([-][RoE] takeover: not sent to N name(s) with no known address while RoE IP/CIDR exclusions are set (kept as not checked): ...).
  • The AI probe fetches only a host one of the layers was handed. A candidate on any other host, such as a Nuclei match reached through a redirect, keeps its static signal and is still scored and reported, without a probe ([-][Takeover-AI] N candidate(s) on a host this run did not admit -- not probed, their static signal stands).

An excluded name is logged as [-][RoE] takeover: not sent to N target(s) the Rules of Engagement exclude: ..., and every refusal is recorded as a coverage gap under the source roe_excluded. An IP-mode project keeps its own rule: a name goes only when every address it has is one of the scan's targets. With no IP or CIDR entry, the lists are filtered by name only.

In a partial run, a name read from the graph is checked the same way: the graph builder keeps every address the graph resolved it to, an excluded one included, so a name with one excluded and one allowed address is not sent. A typed subdomain is resolved when the run starts and refused like any other name.


Stealth mode

When stealth mode is enabled on the project, the takeover module is toned down:

SettingStealth Override
NUCLEI_TAKEOVERS_ENABLEDfalse
BADDNS_ENABLEDfalse
SUBJACK_ALLfalse
SUBJACK_CHECK_NStrue (DNS-only, safe)
SUBJACK_CHECK_MAILtrue (DNS-only, safe)
SUBJACK_THREADS3
TAKEOVER_RATE_LIMIT10

Subjack in DNS-only mode stays on: CNAME/NS/MX resolution does not generate HTTP traffic to the target and is safe at low concurrency. The HTTP-fingerprint Nuclei layer and the BadDNS sidecar are disabled outright.


Partial recon

Subdomain Takeover is available as a Partial Recon tool (tool_id="SubdomainTakeover"). The modal accepts user-provided custom subdomains that must be within the project scope (the entry must equal the apex or end with .<apex>). Out-of-scope entries are rejected with a log warning.

Partial-recon run behaviour:

  • SUBDOMAIN_TAKEOVER_ENABLED is force-set to true for the run, overriding the project toggle.
  • settings_overrides from the modal bypass stored project settings for that run.
  • User subdomains are resolved via the system resolver; dangling entries (no A/AAAA) are still scanned because they are the prime takeover candidates. While the Rules of Engagement hold an IP or CIDR exclusion, a typed name is refused when the run starts if it has no address or resolves to an excluded one, with a log line and a coverage gap.
  • A root domain is checked only when its scope group includes the root, as in a full run: a root whose group leaves it out is handed to neither Subjack nor BadDNS.
  • Graph-existing targets can be included or excluded via the "Include existing graph targets" checkbox. When both are empty, the run exits with a "no subdomains to scan" message.
  • With graph targets included, the hosts of the graph's unmuted takeover_page_seen findings join the list, inside the run's scope and RoE (the partial URLScan run writes them with the same verdict, from the graph's last HTTP probe and a CNAME query).
  • Confirmed findings are written to the graph as if the full pipeline ran, so repeated partial runs converge on the same Vulnerability.id instead of duplicating.

See Recon Pipeline Workflow -- Partial Recon for the modal layout.


Implementation notes

  • Subjack install path: baked into the recon image as a pure-Go binary from github.com/haccer/subjack (built with Go 1.25 in a separate Docker stage). Upstream has no release tarball, so the image pins @latest at build time.
  • BadDNS upstream version: pinned to baddns==2.1.0. Bump in scanners/baddns_scan/Dockerfile only after verifying the normalizer in recon/helpers/takeover_helpers.py::normalize_baddns_finding still matches the Finding JSON schema.
  • Shared work directory: the runner uses /tmp/redamon/redamon_takeover_*/ which is bind-mounted between the recon container and the host, so Docker-in-Docker siblings (nuclei, baddns) see the same paths. The directory is chmod 755 so the non-root baddns user in the sidecar can read target files.
  • Orphan container reaping: the BadDNS container is named baddns-<run id>-<8 hex>, so a run timeout kills it by name instead of leaving a daemon-owned container scanning on.
  • Never --amend: rescans produce the same finding_id by design, so MERGE (v:Vulnerability {id: $id}) in the mixin updates in place (first_seen sticks, last_seen moves).