Skip to content
CORS Write-up Intermediate

# Chaining Subdomain Takeovers with CORS Misconfigurations for Se

A dangling CNAME record pointed a legacy subdomain to a cloud host, and the API gateway reflected any origin matching the parent domain with credentials allowed. An attacker who could run code on any subdomain of the parent domain could read authenticated user data from the API.

Prince T Philip Follow

Published on medium.com

An elegant exploit often relies not on a single critical vulnerability, but on the clever chaining of two seemingly low or medium-severity flaws. Individually, a dangling DNS record or a relaxed Cross-Origin Resource Sharing (CORS) policy might cause minor compliance alerts.

Prince T Philip, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the API gateway used a wildcard regular expression to reflect any origin under the parent domain while allowing credentials, instead of a strict static whitelist.

Impact

The dangling subdomain could not actually be taken over because the cloud provider required DNS verification, but the wildcard CORS policy still means any compromised subdomain could be used to read authenticated user data.

What the attacker needed

A dangling subdomain under the parent domain; API reflects any subdomain origin with credentials; attacker can run code on a subdomain; victim has an active session and visits the subdomain

The fix

The report recommends purging dangling DNS records and replacing dynamic wildcard CORS reflection with a strict static whitelist of fully qualified domain names.

How it was found

  1. Find a legacy subdomain with a dangling CNAME pointing to cloud hosting.
  2. Confirm the cloud host returns a generic 404 with no active resource.
  3. Send a request to the API with an Origin header set to the dangling subdomain.
  4. Observe the API reflects that origin and sets the credentials flag to true.
  5. Lure an authenticated victim to the subdomain and run script that fetches the API.
  6. Read the sensitive JSON response and exfiltrate it to an attacker server.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A subdomain had a DNS record pointing to a cloud service that no longer hosted anything, so the subdomain was effectively unused. Separately, the main API trusted any website whose address ended with the company's domain and allowed it to send the user's cookies. If an attacker could put their own code on any company subdomain, the API would happily return private user data to that code.

What is CORS?

A permissive cross-origin policy lets another site read responses with the user's credentials.

More by Prince T Philip

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

CORS misconfiguration

The lesson behind this report.

A permissive cross-origin policy lets another site read responses with the user's credentials.