Skip to content
Subdomain takeover Write-up Advanced

Escalating subdomain takeover to steal sensitive stuff

A dangling subdomain could be taken over by an attacker, and because the parent domain's pages relied on document.domain for trust, the hijacked subdomain could read data and bypass protections meant to be limited to sibling subdomains. This let an attacker steal cookies and other sensitive data and bypass X-Frame-Options, CORS checks and URL validation.

ameya Follow

Published on blog.takemyhand.xyz

The original lives on blog.takemyhand.xyz

We do not hold its text, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 4 min read.

What the report shows

The write-up is titled "Escalating subdomain takeovers to steal cookies by abusing document.domain" and concerns the Postmates program. The asset named is blog.takemyhand.xyz. The researcher is credited as Ameya (@iamTakeMyHand). The report gives no severity, no CVSS score, no bounty figure and does not describe a fix.

The text is short. It opens with a heading for DOCUMENT.DOMAIN and then a section headed "Exploitation", followed by three screenshots and a list of three things that the technique allows an attacker to bypass. The report does not narrate the individual steps that led to the takeover, does not show the DNS records involved, and does not include any request, payload or command. There is therefore no code to reproduce here.

From the original on blog.takemyhand.xyz

The screenshots sit under the "Exploitation" heading and illustrate the exploitation stage. The report does not caption them, so what each one shows beyond that is not stated.

The list that follows the screenshots names the consequences the author attributes to the technique:

  • Bypassing X-Frame-Options : SAMEORIGIN
  • Bypassing CORS validation where the Access-Control-Allow-Origin is set to .example.com ( being any subdomain)
  • Bypassing URL validation wherever applicable (eg. open redirects to steal OAuth login tokens etc.

Root cause

The title and the DOCUMENT.DOMAIN heading point to the mechanism the author is describing: a subdomain that can be taken over, combined with the document.domain property. When a page sets document.domain to a parent domain, the browser relaxes the same-origin policy so that documents on sibling subdomains of that parent are treated as same-origin with each other. If one of those sibling subdomains is dangling and can be claimed by an attacker, the attacker's page can set the same document.domain value and then reach into the other subdomain's document, its cookies and its responses.

The report itself does not spell out which record was dangling or how the takeover was achieved. The report does not spell out the root cause; the title and heading suggest a taken-over subdomain combined with document.domain.

Impact

The report frames the impact through the three bypasses it lists. The report lists bypassing X-Frame-Options: SAMEORIGIN as one of the consequences. The report lists bypassing CORS validation where Access-Control-Allow-Origin is set to *.example.com. The report lists bypassing URL validation wherever applicable, citing open redirects to steal OAuth login tokens. The title also claims cookie theft. The report does not give a concrete victim flow, so these are the author's stated consequences rather than demonstrated ones.

How this kind of bug works

Subdomain takeover happens when a DNS record for a subdomain points at a service the organisation no longer controls, for example a cloud bucket, a hosting platform or a SaaS product that has been deprovisioned. The record still resolves, but the resource behind it is free for anyone to claim. An attacker registers the same name on the provider and now serves content from a hostname that belongs to the target's domain.

The document.domain twist makes the takeover more valuable. Browsers treat two hosts as same-origin only if scheme, host and port match. Setting document.domain to a common parent relaxes the host check for that document, so a.example.com and b.example.com that both opt in become mutually accessible. The relaxation is one-directional in the sense that both sides must set the same value, but an attacker who controls one side can set it freely. Any application that relies on document.domain to share state across subdomains therefore extends its trust boundary to every subdomain, including dangling ones.

Defences are layered: remove or reclaim dangling records, stop using document.domain and move to postMessage with explicit origin checks, and avoid CORS policies that reflect any subdomain of the parent domain.

How to test for it

  1. Enumerate subdomains passively and actively, then resolve each one and record the CNAME target.
  2. For each target, request the hostname and look for provider-specific error pages that indicate an unclaimed resource, such as a missing bucket or an unconfigured app.
  3. Confirm claimability by checking whether the provider allows registering that exact name. Do not actually claim resources you do not own without programme permission.
  4. Inspect pages on sibling subdomains for document.domain assignments, and inspect CORS responses for policies that trust arbitrary subdomains.
  5. A positive result is a hostname under the target's domain that you can demonstrably control, plus a sibling that trusts it through document.domain or a wildcard CORS rule.

Common false positives: a host that returns a generic 404 but is still served by the organisation, a CNAME to a provider where the name is reserved, and wildcard DNS that resolves every name without any claimable backing resource.

How it is fixed

Remove DNS records that point at deprovisioned services, and reclaim names on providers before releasing them. Replace document.domain usage with postMessage and strict origin allowlists. Tighten CORS so that Access-Control-Allow-Origin never reflects arbitrary subdomains, and keep X-Frame-Options or frame-ancestors policies in place as defence in depth.

Hunting notes

Takeover candidates cluster around marketing sites, blogs, status pages and staging environments, which are often spun up quickly and forgotten. Recon signals include CNAMEs to hosting and storage providers, NXDOMAIN responses from the provider while the DNS record still exists, and error pages naming a missing resource. To make a report land, show control of the hostname with a harmless proof file, then show the concrete trust relationship it breaks, such as a sibling page that sets document.domain or a CORS policy that accepts your host. Keep the demonstration read-only and within the programme's rules.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 7 min read.

What happened, in plain words

This report is about a bug called a subdomain takeover, made worse by a browser feature called document.domain. The researcher, Ameya (@iamTakeMyHand), published it under the title "Escalating subdomain takeovers to steal cookies by abusing document.domain" and it concerns the Postmates program. The asset named is blog.takemyhand.xyz. The report gives no severity, no CVSS score, no bounty figure and does not describe a fix.

A subdomain is a name that sits under a main domain, like blog.example.com under example.com. A DNS record is the entry that tells the internet where a name points, for example to a hosting service. A subdomain takeover happens when that record still points at a service the organisation no longer uses, and the name on that service is free for anyone to register. The record still resolves, but the content behind it is now under someone else's control.

The report itself is short. It opens with a heading for DOCUMENT.DOMAIN and then a section headed "Exploitation", followed by three screenshots and a list of three things the technique allows an attacker to bypass. It does not narrate the individual steps that led to the takeover, does not show the DNS records involved, and does not include any request, payload or command. There is therefore no code to reproduce here.

From the original on blog.takemyhand.xyz

The screenshots sit under the "Exploitation" heading and illustrate the exploitation stage. The report does not caption them, so what each one shows beyond that is not stated.

The list that follows the screenshots names the consequences the author attributes to the technique:

  • Bypassing X-Frame-Options : SAMEORIGIN
  • Bypassing CORS validation where the Access-Control-Allow-Origin is set to .example.com ( being any subdomain)
  • Bypassing URL validation wherever applicable (eg. open redirects to steal OAuth login tokens etc.

Why it matters

The title and the DOCUMENT.DOMAIN heading point to the mechanism the author is describing: a subdomain that can be taken over, combined with the document.domain property. When a page sets document.domain to a parent domain, the browser relaxes the same-origin policy so that documents on sibling subdomains of that parent are treated as same-origin with each other. The same-origin policy is the browser rule that stops one website from reading another website's data; it normally requires the scheme, host and port to match exactly. If one of those sibling subdomains is dangling and can be claimed by an attacker, the attacker's page can set the same document.domain value and then reach into the other subdomain's document, its cookies and its responses.

The report frames the impact through the three bypasses it lists. The report lists bypassing X-Frame-Options: SAMEORIGIN as one of the consequences. X-Frame-Options is a response header that tells the browser whether a page may be embedded in a frame; SAMEORIGIN means only pages from the same origin may do so. The report lists bypassing CORS validation where Access-Control-Allow-Origin is set to *.example.com. CORS (Cross-Origin Resource Sharing) is the mechanism by which a server tells the browser which other origins are allowed to read its responses; Access-Control-Allow-Origin is the header that carries that permission. The report lists bypassing URL validation wherever applicable, citing open redirects to steal OAuth login tokens. An open redirect is a link on a trusted site that sends the visitor to any address supplied in the URL; an OAuth login token is a short-lived credential a login system hands back after a successful sign-in. The title also claims cookie theft. A cookie is a small piece of data a site stores in your browser, often used to keep you logged in. The report does not give a concrete victim flow, so these are the author's stated consequences rather than demonstrated ones.

In general, how this kind of bug works

Subdomain takeover happens when a DNS record for a subdomain points at a service the organisation no longer controls, for example a cloud bucket, a hosting platform or a SaaS product that has been deprovisioned. The record still resolves, but the resource behind it is free for anyone to claim. An attacker registers the same name on the provider and now serves content from a hostname that belongs to the target's domain. A useful comparison is a forwarding address: if you move out but leave mail forwarding to an empty flat, whoever moves into that flat receives your letters.

The document.domain twist makes the takeover more valuable. Browsers treat two hosts as same-origin only if scheme, host and port match. Setting document.domain to a common parent relaxes the host check for that document, so a.example.com and b.example.com that both opt in become mutually accessible. The relaxation is one-directional in the sense that both sides must set the same value, but an attacker who controls one side can set it freely. Any application that relies on document.domain to share state across subdomains therefore extends its trust boundary to every subdomain, including dangling ones.

Defences are layered: remove or reclaim dangling records, stop using document.domain and move to postMessage with explicit origin checks, and avoid CORS policies that reflect any subdomain of the parent domain. postMessage is a browser API for sending messages between windows with an explicit target origin, so trust is stated rather than assumed.

How to test for it

  1. Enumerate subdomains passively and actively, then resolve each one and record the CNAME target. A CNAME is a DNS record that points one name at another name.
  2. For each target, request the hostname and look for provider-specific error pages that indicate an unclaimed resource, such as a missing bucket or an unconfigured app.
  3. Confirm claimability by checking whether the provider allows registering that exact name. Do not actually claim resources you do not own without programme permission.
  4. Inspect pages on sibling subdomains for document.domain assignments, and inspect CORS responses for policies that trust arbitrary subdomains.
  5. A positive result is a hostname under the target's domain that you can demonstrably control, plus a sibling that trusts it through document.domain or a wildcard CORS rule.

Common false positives: a host that returns a generic 404 but is still served by the organisation, a CNAME to a provider where the name is reserved, and wildcard DNS that resolves every name without any claimable backing resource.

How it is fixed

Remove DNS records that point at deprovisioned services, and reclaim names on providers before releasing them. Replace document.domain usage with postMessage and strict origin allowlists. Tighten CORS so that Access-Control-Allow-Origin never reflects arbitrary subdomains, and keep X-Frame-Options or frame-ancestors policies in place as defence in depth.

Hunting notes

Takeover candidates cluster around marketing sites, blogs, status pages and staging environments, which are often spun up quickly and forgotten. Recon signals include CNAMEs to hosting and storage providers, NXDOMAIN responses from the provider while the DNS record still exists, and error pages naming a missing resource. To make a report land, show control of the hostname with a harmless proof file, then show the concrete trust relationship it breaks, such as a sibling page that sets document.domain or a CORS policy that accepts your host. Keep the demonstration read-only and within the programme's rules.

Glossary

  • Subdomain: a name that sits under a main domain, like blog.example.com under example.com.
  • DNS record: an entry that tells the internet where a name points.
  • Subdomain takeover: claiming a subdomain whose DNS record still points at a service the organisation no longer controls.
  • Same-origin policy: the browser rule that stops one website from reading another website's data unless scheme, host and port match.
  • document.domain: a browser property that, when set to a parent domain, relaxes the same-origin policy between sibling subdomains.
  • Cookie: a small piece of data a site stores in your browser, often used to keep you logged in.
  • CORS: Cross-Origin Resource Sharing, the mechanism by which a server tells the browser which other origins may read its responses.
  • Access-Control-Allow-Origin: the CORS response header that carries that permission.
  • X-Frame-Options: a response header that tells the browser whether a page may be embedded in a frame; SAMEORIGIN means only pages from the same origin may do so.
  • Open redirect: a link on a trusted site that sends the visitor to any address supplied in the URL.
  • OAuth login token: a short-lived credential a login system hands back after a successful sign-in.
  • CNAME: a DNS record that points one name at another name.
  • postMessage: a browser API for sending messages between windows with an explicit target origin.

More by ameya

View all

1 more disclosed report, best first.

More from Postmates

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Subdomain takeover

The lesson behind this report.

A company's DNS still points at a cloud service it no longer uses, so anyone can claim it and serve content on the company's domain.