Skip to article

How Continuous DNS Auditing Strengthens Penetration Testing

12 min read
By Vikas Gupta

DNS penetration testing and continuous auditing closing the visibility gap
Table of Contents

When organizations plan a penetration test, most of the attention goes toward web applications, APIs, cloud infrastructure, authentication systems, and exposed services. DNS is usually treated as background plumbing that just works. According to Akamai's security research, dangling DNS records remain one of the most overlooked attack surfaces in modern infrastructure.

Many high-impact findings during external security assessments originate from DNS exposure rather than application vulnerabilities. Stale records, forgotten subdomains, dangling cloud resources, misconfigured email authentication, and exposed staging environments are consistently present, even in organizations with mature security programs.

The reason is not negligence. Infrastructure changes constantly. New SaaS platforms get onboarded, developers spin up temporary environments, cloud infrastructure migrates, vendors change, and old records are rarely cleaned up. Traditional penetration tests produce a point-in-time snapshot. The DNS attack surface evolves continuously in the background.

This is where continuous DNS auditing becomes important.

DNS Is Primary Reconnaissance Fuel, Not Just Infrastructure

Most people associate DNS with domain-to-IP mapping. Modern DNS records expose far more than that. For an attacker performing passive reconnaissance, a target organization's DNS zone is a detailed map of its infrastructure, vendor relationships, and internal naming conventions.

What an attacker learns about your organization from passive DNS reconnaissance alone
Fig. 01. What an attacker learns about your organization from passive DNS reconnaissance alone.

DNS records reveal:

CategoryWhat Gets Exposed
InfrastructureThird-party services, cloud providers (AWS, GCP, Azure), CDN endpoints, load balancers
Internal PatternsNaming conventions (dev-, staging-, internal-, admin-), environment hierarchy
Email StackSPF mechanisms, DKIM selectors, MX records, DMARC policy (p=none vs p=reject)
Legacy SystemsForgotten applications, decommissioned servers still resolving, old disaster recovery sites
Temporary AssetsMigration environments, CI/CD artifacts, developer sandboxes, vendor PoCs
DependenciesExternal vendor integrations, API endpoints, third-party SaaS delegations

Many organizations do not realize how much operational intelligence their DNS exposes over time. Historical records frequently reveal forgotten infrastructure, deprecated cloud providers, and temporary deployments that nobody is actively tracking. For more on this, see how forgotten subdomains and ghost DNS records accumulate.

Common DNS Risks Found During Security Assessments

Several categories of DNS issues appear consistently during penetration testing engagements. Understanding them helps security teams prioritize what to look for and what continuous auditing should catch between assessments.

1. Dangling DNS Records and Subdomain Takeover

Subdomain takeover occurs when a DNS record points to a resource that no longer exists, and an attacker claims that resource. This is especially common with abandoned cloud services (S3 buckets, Azure Blob containers, Heroku apps, Cloudflare Pages) and decommissioned third-party SaaS platforms.

How a subdomain takeover progresses from a forgotten CNAME to an active phishing portal
Fig. 02. How a subdomain takeover progresses from a forgotten CNAME to an active phishing portal.

When a takeover succeeds, an attacker can:

  • Host phishing pages under a trusted corporate domain
  • Steal credentials or session tokens via legitimate-looking forms
  • Distribute malware with the domain's existing reputation
  • Use the trusted domain for internal social engineering

Common technical indicators:

  • CNAME docs.example.com pointing to a deleted GitHub Pages site
  • CNAME support.example.com pointing to an unused Freshdesk workspace
  • A record for dev.example.com pointing to a terminated EC2 instance whose IP has been reassigned

See the subdomain takeover documentation and CNAME to expired domain checks for detection details.

2. Orphaned Nameserver Delegations

Organizations migrate DNS providers but sometimes leave old NS delegations intact in the parent zone. If the previous provider's namespace becomes available for registration, an attacker can claim it and inherit the trust relationship.

This is dangerous because:

  • Infrastructure is decommissioned but the DNS trust relationship still exists publicly
  • Child zones may still resolve through orphaned NS records
  • An attacker who registers the dropped namespace inherits all subdomain trust from that delegation

DNSAudit checks for this under dangling NS records and DNS delegation integrity.

3. Non-Production Infrastructure Left Publicly Exposed

DNS records regularly expose systems outside standard security monitoring perimeters:

  • Old admin panels: admin-legacy, cp, plesk
  • Temporary testing environments: test-2023, qa-staging
  • Development APIs: api-dev, staging-api
  • Legacy applications still resolving: old-app, v1-api
  • Internal tooling accidentally exposed: jira-internal, confluence-dev

These systems often receive zero security maintenance because the teams responsible have forgotten they are publicly reachable. They are rarely in scope for scheduled audits and almost never patched. The exposed sensitive subdomains check covers this category, and the subdomain finder tool can help enumerate them.

4. Weak Email Authentication: SPF, DKIM, and DMARC

Misconfigured email authentication is consistently one of the most common findings and directly enables phishing campaigns against an organization's users and partners.

RecordCommon IssueRisk
SPFOverly permissive policy such as +all or excessive third-party includesAttackers can spoof the organization's email domain
DKIMMissing selector, expired key, incorrect TXT formatEmail fails authentication and is spoofable
DMARCp=none with no rua or ruf reportingNo visibility into active spoofing attempts

For deeper reading on why SPF, DKIM, and DMARC together are still not always enough, see SPF, DKIM, and DMARC: Why They're Not Enough to Stop Email Spoofing.

5. Dangerous Wildcard DNS Records

Wildcard DNS records that resolve non-existent subdomains (for example, *.example.com pointing to a single IP) create visibility and security challenges that are easy to underestimate.

The main problems they introduce:

  • They interfere with subdomain enumeration, making it harder to identify abandoned or takeover-prone assets
  • They generate false positives during reconnaissance, masking real findings
  • In large environments, they can unintentionally expose internal applications or development services to external discovery

See wildcard DNS detection or try the wildcard DNS detector tool. For background on how wildcard records work, the DNS wildcard records guide covers the mechanics.

6. Malware Hidden in TXT Records

An emerging class of threats uses TXT records to hide obfuscated payloads: base64-encoded C2 URLs, encoded IPs, or decentralized command structures that use DNS as a delivery and communication mechanism.

Detecting these requires obfuscation-aware analysis, not simple record lookups. Standard DNS audits that only check record validity will miss them entirely. The TXT malware records check can be used for manual spot checks. For broader context on what TXT records expose, see DNS TXT record exposure in Fortune 500 organizations.

Why Annual Penetration Tests Miss DNS Exposure

A penetration test conducted once or twice yearly is useful, but it produces a snapshot of a specific moment. External DNS infrastructure changes continuously, and most of that change happens between assessments.

The 11-month window between a dangling record being created and discovered during the next annual pentest
Fig. 03. The 11-month window between a dangling record being created and discovered during the next annual pentest.

The Infrastructure Drift Problem

New DNS records appear overnight through:

  • Cloud deployments via Terraform, CloudFormation, or Pulumi
  • CI/CD workflows that auto-deploy to feature branch or PR preview environments
  • Vendor integrations where a new SaaS platform automatically creates DNS records
  • Temporary developer environments that never get cleaned up
  • Infrastructure migrations using blue-green or canary patterns
  • Acquisitions and mergers that bring in inherited DNS zones and merged namespaces

A concrete example of how the gap gets exploited:

WhenWhat Happens
JanuaryPenetration test completes with no DNS issues found
FebruaryDeveloper deploys staging-newfeature.example.com pointing to a deleted AWS alias
MarchAttacker claims the dangling record and sets up a phishing portal under the corporate domain
DecemberNext annual pentest discovers the takeover, 11 months after it happened

Continuous DNS auditing closes this gap. Instead of discovering issues during an annual assessment or during incident response, security teams get visibility into infrastructure drift as it happens.

What Continuous DNS Auditing Actually Checks

Modern continuous DNS auditing covers a breadth of security signals that is not practical to maintain manually across large DNS estates. DNSAudit.io scans over 50 signals automatically across the following categories:

Signal CategorySpecific Checks
DNSSECMissing signatures, insecure zones, validation failures
Email AuthenticationSPF mechanisms (softfail vs hardfail), DKIM selector validity, DMARC policy strength
TXT RecordsOversized records, suspicious patterns, base64-encoded payloads, malware signatures
SubdomainsForgotten or non-production assets (dev-, staging-, test-), ghost records
NameserversAbandoned providers, inconsistent NS across parent and child zones, old TLD delegations
WildcardsDangerous wildcard records masking dangling entries, wildcard-overlap risks
Cloud ExposureAWS S3, Azure Blob, Heroku, Cloudflare Pages dangling CNAMEs, GCP bucket misconfigurations
IP ReputationBlacklisted IPs, ASN changes indicating migration, geolocation anomalies
Malware DetectionDDNS patterns, parked domain indicators, obfuscated C2 in TXT, flat-pack malware campaigns

For a comprehensive list of all checks and what each one looks for, see the DNSAudit.io documentation. The missing DNSSEC risks guide and the top DNS misconfigurations article cover the most frequently encountered issues in detail.

How Continuous DNS Visibility Improves Penetration Testing

From a penetration tester's perspective, continuous DNS intelligence changes how an engagement starts. Rather than spending a significant portion of the assessment performing passive reconnaissance and asset discovery manually, teams begin with an up-to-date infrastructure picture already in hand.

What You GainImpact on the Assessment
Faster discoveryHidden attack surfaces identified in minutes, not days
Earlier takeover detectionDangling records caught before the engagement even starts
Accurate scopingReliable external asset inventory from day one
Prioritized findingsFocus on high-risk assets: wildcards, weak DMARC, orphaned NS
Expanded coverageInfrastructure the organization forgot exists gets included
Repeatable baselineCurrent state compared against historical snapshots to identify new exposure

In many engagements, the highest-impact findings come from infrastructure the organization did not realize was externally accessible. Continuous DNS auditing surfaces those assets before the formal assessment begins, which means more time is spent on actual exploitation and validation rather than reconnaissance.

The Operations Problem Behind DNS Exposure

DNS protocols are robust and well-specified. The problem is not the protocol. It is operational execution.

  • Manual DNS audits happen quarterly at best, and often not at all
  • Developer-deployed records bypass security review entirely
  • Acquisition DNS zones remain unscanned for months after the transaction closes
  • Infrastructure-as-code tools like Terraform and CloudFormation add records without validation against security policy
  • SaaS onboarding flows auto-create DNS entries with weak defaults that nobody reviews

This is an operations problem as much as a technical one. The velocity of modern infrastructure change means that quarterly manual audits will always be behind. Continuous automation is the only way to keep pace. See also: top 10 most common DNS mistakes after migrations.

Why Security Leaders Should Care About DNS Auditing

For CISOs and security managers, continuous DNS auditing connects to a broader set of program concerns:

  • External Attack Surface Management (EASM): accurate inventory of all externally reachable assets
  • Brand protection: prevent phishing using trusted corporate domains through subdomain takeover
  • Phishing resistance: enforced DMARC at p=reject combined with DKIM and SPF reduces email spoofing success
  • Third-party risk visibility: DNS dependencies reveal all vendor integrations
  • Cloud governance: detect shadow cloud resources before they become breaches
  • Asset inventory accuracy: close gaps between CMDB records and actual external footprint

You cannot secure infrastructure you do not know exists. As environments distribute across cloud providers, SaaS platforms, and third-party integrations, DNS becomes one of the most reliable sources of external infrastructure intelligence available.

Treat DNS as a Dynamic Security Layer, Not Static Infrastructure

Attackers monitor DNS continuously because it reflects how infrastructure evolves over time. Security teams need to do the same.

Continuous DNS auditing gives organizations ongoing visibility into one of the most dynamic and overlooked parts of their attack surface. Combined with regular penetration testing, it moves security teams from reactive point-in-time assessments toward proactive exposure management.

For penetration testing teams specifically, integrating continuous DNS intelligence into an engagement workflow means finding more critical issues faster, with less manual reconnaissance overhead, and delivering higher-value findings to clients.

DNSAudit.io handles continuous DNS auditing across your full estate without requiring someone to manually audit every quarter. You can run a scan against your domain directly from the homepage with no account required, or explore the use cases to see how other teams are using it.

Vikas Gupta

Vikas Gupta

I'm Vikas, a security researcher focused on application security and attack surface management. I've spent my career working in cybersecurity, specializing in vulnerability research, automation, and threat detection. At DNSAudit, I help build new detection signatures and perform threat research to uncover exposure before it becomes a problem.