November 19, 2026
Anatomy of an HTTP Request (Part 1): How DNS Misconfigurations Lead to Subdomain Takeover
When you start learning web application security, it is easy to treat an application like a black box: send a payload into a parameter…

By Sahil
4 min read
When you start learning web application security, it is easy to treat an application like a black box: send a payload into a parameter, watch the response, and see if something breaks.
That approach works in isolated labs, but it hits a wall against real-world applications. Production systems sit behind DNS resolvers, CDNs, WAFs, load balancers, reverse proxies, application frameworks, and downstream databases. Every vulnerability is simply a misconfiguration or broken trust assumption inside one of those layers — or in how two layers interpret the same request differently.
In this series, I am going to take one realistic HTTP request and trace its exact lifecycle from start to finish. At every stop, we will break down four things:
- What the component actually does in the request lifecycle.
- What architectural misconfiguration introduces a vulnerability.
- What probe to send to test for it.
- The exact baseline vs. anomalous response signature that confirms the flaw.
The Reference Request
Throughout every part of this series, we will follow this exact request which is an HTTP Request:
Why this request? Because it contains the core ingredients of modern web and API attack surfaces:
- An authenticated session (
Cookie: session=abc123) - A REST path parameter (
/users/15/profile) - A structured JSON body (
{"name": "Ghost", "role": "user"}) - A proxy trust header (
X-Forwarded-For: 1.2.3.4)
Before that POST request can reach an API handler, an authentication middleware, or even a web server, something has to happen outside the target's infrastructure entirely.
Component 1: DNS (Domain Name System)
What It Is and Where It Lives
DNS (Domain Name System) sits completely outside your target's web stack. It acts as the internet's public routing directory.
Before your browser initiates a TCP handshake or negotiates TLS, it asks a recursive DNS resolver a simple question: "What IP address does app.target.com map to?" Only after the resolver returns an answer does your machine know where to open a network socket.
How Our Request Touches It
Technically, our POST request never touches DNS. DNS resolution finishes before the HTTP packet is even constructed. However, DNS determines where that request is routed, and stale DNS records frequently expose legacy parts of the same domain ecosystem (*.target.com).
The Misconfiguration: Dangling CNAME Records
In modern cloud environments, engineering teams routinely spin up third-party services, an AWS S3 bucket for static assets, a GitHub Pages site for documentation, a Heroku instance for a staging build, or an Azure App Service and point a subdomain to it using a CNAME (Canonical Name) record:
The vulnerability happens during decommissioning. Months later, a developer deletes the S3 bucket or shuts down the cloud app to save costs, but nobody removes the CNAME record from the DNS zone.
That DNS record is now dangling: old.app.target.com still actively points to target-app.s3-website-us-east-1.amazonaws.com, even though that bucket name is no longer claimed on AWS.
Vulnerability Class: Subdomain Takeover
Because cloud providers allow any customer to register an available resource name, an attacker who spots this dangling CNAME can create a new S3 bucket named target-app in us-east-1. Immediately, [https://old.app.target.com](https://old.app.target.com) begins serving attacker-controlled HTML and JavaScript under a legitimate subdomain of target.com.
In a real engagement, this is far more than a cosmetic defacement issue:
- Session & Cookie Theft: If
target.comsets authentication cookies withDomain=.target.com, JavaScript running onold.app.target.comcan read them. - Same-Origin Policy (SOP) & CORS Bypass: Many applications whitelist
*.target.comin theirAccess-Control-Allow-Originpolicy, allowing the taken-over subdomain to make authenticated cross-origin API calls on a victim's behalf. - Credential Harvesting: Phishing pages hosted on an official company subdomain pass visual inspection and SSL certificate checks.
Detection Workflow: Recon to Verification
You do not find Subdomain Takeovers by fuzzing HTTP parameters, you catch them by correlating DNS resolution with HTTP response fingerprints.
Step 1: Enumerate Subdomains and Probe Live Hosts
# Discover subdomains and filter for active HTTP/HTTPS responses
subfinder -d target.com -silent | httpx -silent -status-code -title# Discover subdomains and filter for active HTTP/HTTPS responses
subfinder -d target.com -silent | httpx -silent -status-code -titleStep 2: Inspect DNS CNAME Records
For subdomains returning 404 errors or default cloud landing pages, query the underlying DNS record directly:
dig old.app.target.com CNAME +shortdig old.app.target.com CNAME +shortIf dig returns a third-party cloud hostname (such as .amazonaws.com, .github.io, .herokuapp.com, or .azurewebsites.net), inspect the HTTP response headers and body from that subdomain:
curl -i https://old.app.target.comcurl -i https://old.app.target.comBaseline vs. Anomalous Response Signatures
In manual VAPT and vulnerability research, confirming a bug comes down to comparing what a healthy system returns against the specific fingerprint of a broken state.
Normal Baseline:
DNS Behavior:
Subdomain resolves via A or CNAME to a live, claimed resource owned by the organization.
HTTP Response Signature:
Returns 200 OK (or an expected application redirect/auth prompt) with the organization's own application headers and HTML/JSON body.
Anomalous Signal (Vulnerable):
DNS Behavior:
Subdomain resolves cleanly via CNAME to an external cloud provider, proving the DNS zone still trusts that destination.
HTTP Response Signature:
Returns an HTTP 404 Not Found (or 403/503) served directly by the third-party cloud provider, containing an unclaimed-resource string in the body.
When inspecting the curl output, look for these exact strings in the response body:
- AWS S3:
NoSuchBucket/The specified bucket does not exist - GitHub Pages:
There isn't a GitHub Pages site here. - Heroku:
No such app - Microsoft Azure:
404 Web Site not found - Shopify:
Sorry, this shop is currently unavailable.
Operational Note for VAPT & Bug Bounty Testing: During client VAPT engagements or bug bounty programs, never claim a production subdomain on a third-party cloud provider without explicit written authorization — doing so can intercept live user traffic. A screenshot and raw output showing the dig CNAME resolution alongside the provider's unclaimed error response is sufficient proof of impact.