Subdomain Takeover due to unclaimed domain pointing to AWS
A subdomain of data.gov was left as a DNS CNAME pointing to an unclaimed AWS CloudFront distribution. An attacker could claim that CloudFront hostname and serve their own content under the trusted subdomain, enabling phishing or credential theft.
- Triaged in 27 hours
- Fixed in 3 months
- Paid in 2 months
- Disclosed after 18 months
Summary by the researcher
This type of vulnerability has been patched. It's no longer possible to take over CNAME via Cloudfront without control of the DNS.
Read here for more information:https://blog.zsec.uk/subdomainhijack/
The report
Note: I know this is on an out of scope domain, however felt it should still be raised as it was the only subdomain of data.gov to be vulnerable.
Issue Details
The consultant identified that subdomain https://18f.domains.api.data.gov/ is pointing to dn9rrjaiux2m0.cloudfront.net via a DNS CNAME record. When browsing to the subdomain an AWS cloudflare error is displayed.
The subdomain "https://18f.domains.api.data.gov/" was (and still is) a CNAME pointing to a AWS Cloudfront CDN server (depending on your location, the latter will resolve differently):
nslookup 18f.domains.api.data.gov
Server: 213.186.33.99
Address: 213.186.33.99#53
Non-authoritative answer:
18f.domains.api.data.gov canonical name = dn9rrjaiux2m0.cloudfront.net.
Name: dn9rrjaiux2m0.cloudfront.net
Address: 52.85.89.116
Name: dn9rrjaiux2m0.cloudfront.net
Address: 52.85.89.87
Name: dn9rrjaiux2m0.cloudfront.net
Address: 52.85.89.105
Name: dn9rrjaiux2m0.cloudfront.net
Address: 52.85.89.202
Name: dn9rrjaiux2m0.cloudfront.net
Address: 52.85.89.145
Name: dn9rrjaiux2m0.cloudfront.net
Address: 52.85.89.21
Name: dn9rrjaiux2m0.cloudfront.net
Address: 52.85.89.64
Name: dn9rrjaiux2m0.cloudfront.net
Address: 52.85.89.161
Name: dn9rrjaiux2m0.cloudfront.net
Address: 2600:9000:2045:d000:3:f914:5e00:93a1
Name: dn9rrjaiux2m0.cloudfront.net
Address: 2600:9000:2045:6600:3:f914:5e00:93a1
Name: dn9rrjaiux2m0.cloudfront.net
Address: 2600:9000:2045:6400:3:f914:5e00:93a1
Name: dn9rrjaiux2m0.cloudfront.net
Address: 2600:9000:2045:5000:3:f914:5e00:93a1
Name: dn9rrjaiux2m0.cloudfront.net
Address: 2600:9000:2045:be00:3:f914:5e00:93a1
Name: dn9rrjaiux2m0.cloudfront.net
Address: 2600:9000:2045:c400:3:f914:5e00:93a1
Name: dn9rrjaiux2m0.cloudfront.net
Address: 2600:9000:2045:4400:3:f914:5e00:93a1
Name: dn9rrjaiux2m0.cloudfront.net
Address: 2600:9000:2045:7000:3:f914:5e00:93a1
However, the hostname was not claimed any more on Cloudfront, resulting in a Cloudfront error page when visiting the subdomain before the takeover.
Subsequently, a new Amazon Cloudfront CDN endpoint was created and linked to an attacker-controlled origin server. For the new Cloudfront CDN endpoint, 18f.domains.api.data.gov was designated as hostname successfully:

This concluded the subdomain takeover:

Risk Breakdown
- Risk: High
- Difficulty to Exploit: Medium
- CVSS3 Score: 7.7 AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:L/E:P/RL:O/RC:R
Affected URLs
- 18f.domains.api.data.gov
Attack Scenario
- TTS starts using a new service, eg an external Support Ticketing-service, in this case aws.
- TTS points a subdomain to the Support Ticketing-service, eg 18f.domains.api.data.gov
- TTS stops using this service but does not remove the subdomain redirection pointing to the ticketing system.
- Attacker signs up for the Service and claims the domain as theirs. No verification is done by the Service Provider, and the DNS-setup is already correctly setup.
- Attacker can now build a complete clone of the real site, add a login form, redirect the user, steal credentials (e.g. admin accounts), cookies and/or completely destroy business credibility for your company.
Recommendation
The most effective way to remediate this issue would be to remove the DNS entry entirely however if this is not possible, consider pointing the DNS entry at a redirect of some description to prevent potential hostile take over.
Impact
Sub-domain take over attacks can happen when a company creates a dns entry that points to a third party service, however forgets about the third party application leaving it vulnerable to be hijacked by another party. Hackers can claim subdomains with the help of external services. This attack is practically non-traceable.
Context
This report concerns a subdomain of data.gov, specifically 18f.domains.api.data.gov, which was configured as a DNS CNAME pointing at an Amazon CloudFront distribution. CloudFront is a content delivery network: you create a distribution, give it an origin (the server it pulls content from), and CloudFront hands you a hostname such as dn9rrjaiux2m0.cloudfront.net. You then point your own DNS name at that hostname with a CNAME, and visitors to your name are served through the CDN.
The researcher notes at the outset that the domain was out of scope for the programme, but raised it anyway because it was the only subdomain of data.gov to be vulnerable.
Setup
The only tooling shown in the report is nslookup, used to resolve the subdomain and confirm the CNAME chain. No accounts, roles or versions are described. The precondition for the attack is simply that the DNS record still exists while the CloudFront distribution it points to has been released by its original owner.
Finding it
The researcher identified that https://18f.domains.api.data.gov/ was pointing to dn9rrjaiux2m0.cloudfront.net via a DNS CNAME record. Browsing to the subdomain returned an AWS error page rather than content.
The resolution was confirmed with nslookup:
nslookup 18f.domains.api.data.gov
Server: [redacted]
Address: [redacted]#53
Non-authoritative answer:
18f.domains.api.data.gov canonical name = dn9rrjaiux2m0.cloudfront.net.
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
The important line is the first answer: 18f.domains.api.data.gov has canonical name = dn9rrjaiux2m0.cloudfront.net. Everything after it is the set of A and AAAA records that the CloudFront hostname resolves to, which vary by location, as the researcher notes. The CNAME itself is what matters: the data.gov name delegates its content to a CloudFront distribution that the researcher does not control.
The hostname was no longer claimed on CloudFront, which is why visiting the subdomain produced a CloudFront error page before the takeover. In other words, the DNS side of the pairing was still live while the CloudFront side had been abandoned.
Exploitation
Step 1: Create a CloudFront distribution with an attacker-controlled origin
The researcher created a new Amazon CloudFront CDN endpoint and linked it to an attacker-controlled origin server. This is an ordinary CloudFront setup: the distribution is yours, so you choose what it serves.
Step 2: Claim the dangling hostname on the new distribution
For the new CloudFront endpoint, 18f.domains.api.data.gov was designated as the hostname, and the designation succeeded. Because the DNS CNAME already pointed at CloudFront, and CloudFront accepted the unclaimed name on a distribution the researcher controlled, requests for the data.gov subdomain were now served from the attacker's origin.

Step 3: Confirm the takeover
With the hostname claimed, the subdomain served the attacker's content, which concluded the subdomain takeover.

Root cause
The mistake is a dangling DNS record. A CNAME was left in place pointing at a third-party service after the organisation stopped using that service, and the third-party service did not verify that whoever claims a hostname actually controls the DNS name in question. Because the DNS setup was already correct from CloudFront's point of view, anyone who could create a distribution and add the hostname inherited the traffic for 18f.domains.api.data.gov.
The report's attack scenario generalises this:
- TTS starts using a new service, eg an external Support Ticketing-service, in this case aws.
- TTS points a subdomain to the Support Ticketing-service, eg 18f.domains.api.data.gov
- TTS stops using this service but does not remove the subdomain redirection pointing to the ticketing system.
- Attacker signs up for the Service and claims the domain as theirs. No verification is done by the Service Provider, and the DNS-setup is already correctly setup.
- Attacker can now build a complete clone of the real site, add a login form, redirect the user, steal credentials (e.g. admin accounts), cookies and/or completely destroy business credibility for your company.
The researcher also notes in the summary that this class of vulnerability has since been patched: it is no longer possible to take over a CNAME via CloudFront without control of the DNS. The researcher notes that this type of vulnerability has been patched.
Impact
The report rates the risk as High, difficulty to exploit as Medium, with a CVSS3 score of 7.7 (AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:L/E:P/RL:O/RC:R). The affected URL is 18f.domains.api.data.gov.
In the researcher's description, subdomain takeover happens when a company creates a DNS entry pointing to a third-party service and then forgets about the third-party application, leaving it open to being hijacked by another party. Hackers can claim subdomains with the help of external services, and the attack is described as practically non-traceable. The concrete consequences listed are building a complete clone of the real site, adding a login form, redirecting users, and stealing credentials such as admin accounts and cookies, or damaging business credibility. These outcomes depend on users trusting and visiting the hijacked name; the report does not demonstrate credential theft, only control of the content served on the subdomain.
Fix
The recommendation is to remove the DNS entry entirely, which is the most effective remediation. If removal is not possible, the alternative given is to point the DNS entry at a redirect of some description to prevent a potential hostile takeover. The researcher notes that this type of vulnerability has been patched: it is no longer possible to take over a CNAME via CloudFront without control of the DNS.
Variants to test
- Other CDN and SaaS CNAMEs. Enumerate subdomains and resolve them; a CNAME to a third-party hostname whose response is a provider error page (rather than the organisation's content) is a candidate. A positive result is a provider-specific "no such distribution" or "unrecognised hostname" page while the DNS record still resolves.
- Abandoned cloud storage names. Look for CNAMEs or direct references to object storage buckets; a positive result is a bucket name that can be registered by you and then serves content under the organisation's hostname.
- Stale records after service migration. Check subdomains tied to services the organisation has visibly stopped using; a positive result is a record that still resolves but whose backend no longer recognises the hostname.
- Provider-side hostname claiming. For any provider that lets you attach a custom hostname to a resource you create, try adding the target's hostname; a positive result is the provider accepting it without a DNS or file-based verification step.
- Wildcard and multi-level records. Test deeper names under a delegated zone, since a forgotten record at a lower level is easy to miss; a positive result is the same dangling pattern at a name that is not on the main inventory.
What happened, in plain words
A government website had a subdomain, a smaller name that sits under a main domain, that was set up to hand off its visitors to a large content delivery service run by Amazon. The organisation that owned the subdomain stopped using that service but left the hand-off instruction in place. Because of that, someone else was able to sign up for the same service, claim the abandoned name as their own, and start serving their own content on the government subdomain. This is called a subdomain takeover.
To follow the story you only need a few ideas:
- A domain name is the address you type into a browser, like
data.gov. It is the human-friendly version of a numeric address on the internet. - A subdomain is a name placed in front of a domain, like
18f.domains.api.data.gov. Organisations use subdomains to separate different services under one main name. - DNS (Domain Name System) is the internet's address book. It translates names into the numeric addresses computers use to find each other.
- A CNAME record is a DNS entry that says "this name is really just another name, go look that one up instead". It is like a mail-forwarding note: post sent to your old address gets redirected to a new one.
- A CDN (content delivery network) is a service that stores and serves copies of a website's files from many locations so pages load quickly for visitors everywhere. Amazon CloudFront is one such service.
At the very start of the report the researcher notes that the domain was out of scope for the programme, meaning it was not officially part of the set of targets the programme invited testing on, but raised it anyway because it was the only subdomain of data.gov to be vulnerable.
Setup
The only tool shown in the report is nslookup, a small command-line program that asks DNS servers what a name resolves to. Think of it as ringing the internet's directory enquiries and asking "what number does this name have?". No accounts, roles or software versions are described. The one condition the attack needs is simple: the DNS record still exists, while the CloudFront distribution it points at has been released by whoever originally owned it.
Finding it
The researcher found that https://18f.domains.api.data.gov/ was pointing to dn9rrjaiux2m0.cloudfront.net through a DNS CNAME record. When the researcher opened the subdomain in a browser, instead of a normal page there was an AWS error page. That error is the clue: the name still resolves to somewhere, but the service behind it is no longer serving anything for that name. It is like a forwarding address that still works but leads to an empty flat.
To confirm the hand-off, the researcher ran nslookup:
nslookup 18f.domains.api.data.gov
Server: [redacted]
Address: [redacted]#53
Non-authoritative answer:
18f.domains.api.data.gov canonical name = dn9rrjaiux2m0.cloudfront.net.
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Name: dn9rrjaiux2m0.cloudfront.net
Address: [redacted]
Line by line, in plain words:
nslookup 18f.domains.api.data.govis the question: "what does this name resolve to?".Server: [redacted]andAddress: [redacted]#53say which DNS server answered the question. The#53is the standard port number for DNS traffic.Non-authoritative answer:means the answer came from a server that had cached it rather than the one officially responsible for the name. It is still a valid answer, just not straight from the source.18f.domains.api.data.gov canonical name = dn9rrjaiux2m0.cloudfront.net.is the key line. "Canonical name" is the formal term for a CNAME: it says thedata.govsubdomain is really just another name for the CloudFront hostname.- Every
Name:andAddress:pair after that lists the numeric addresses the CloudFront hostname itself resolves to. Some are IPv4 addresses (the familiar four-number form) and some are IPv6 addresses (the longer form with colons). The researcher notes these vary depending on where you are in the world, because a CDN deliberately answers with nearby servers.
The CNAME is what matters. The data.gov name was handing its visitors over to a CloudFront distribution that the researcher did not control. And that hostname was no longer claimed on CloudFront, which is exactly why the browser showed a CloudFront error page before the takeover: the DNS side of the arrangement was still live, but the CloudFront side had been abandoned.
Exploitation
Step 1: Create a CloudFront distribution with an attacker-controlled origin
The researcher created a new Amazon CloudFront CDN endpoint and linked it to an origin server the researcher controlled. An origin is the place a CDN fetches the real content from, like the warehouse behind a chain of shops. Because the distribution belonged to the researcher, the researcher decided what it would serve.
Step 2: Claim the dangling hostname on the new distribution
For the new CloudFront endpoint, 18f.domains.api.data.gov was designated as the hostname, and the designation succeeded. In other words, the researcher told CloudFront "please answer to this government name too", and CloudFront agreed. Because the DNS CNAME already pointed at CloudFront, and CloudFront accepted the unclaimed name on a distribution the researcher controlled, requests for the data.gov subdomain were now served from the attacker's origin.

Step 3: Confirm the takeover
With the hostname claimed, the subdomain served the attacker's content. That concluded the subdomain takeover.

Root cause
The mistake is a dangling DNS record: a CNAME left in place pointing at a third-party service after the organisation stopped using that service. The third-party service did not check that whoever claims a hostname actually controls the DNS name in question. Because the DNS setup already looked correct from CloudFront's point of view, anyone who could create a distribution and add the hostname inherited the traffic for 18f.domains.api.data.gov. It is like cancelling a lease but leaving the key under the mat, and the landlord handing a new tenant the same key without checking who they are.
The report's attack scenario generalises this:
- TTS starts using a new service, eg an external Support Ticketing-service, in this case aws.
- TTS points a subdomain to the Support Ticketing-service, eg 18f.domains.api.data.gov
- TTS stops using this service but does not remove the subdomain redirection pointing to the ticketing system.
- Attacker signs up for the Service and claims the domain as theirs. No verification is done by the Service Provider, and the DNS-setup is already correctly setup.
- Attacker can now build a complete clone of the real site, add a login form, redirect the user, steal credentials (e.g. admin accounts), cookies and/or completely destroy business credibility for your company.
Step by step, in plain words:
- An organisation (referred to as TTS in the scenario) starts using an outside service, for example a support ticketing system, in this case hosted on AWS.
- It points one of its subdomains at that service, so visitors to the subdomain reach the service.
- Later it stops using the service but forgets to remove the subdomain redirection.
- An attacker signs up for the same service and claims the domain as their own. The service provider does no verification, and the DNS setup is already in place, so the claim goes through.
- The attacker can now build a complete clone of the real site, add a login form, redirect users, steal credentials such as admin accounts and cookies, or completely destroy the company's credibility.
A cookie is a small piece of data a website stores in your browser so it can recognise you on later visits, for example to keep you logged in. If an attacker controls the site your browser is talking to, they can potentially capture that data. The report describes these outcomes as possibilities; it does not show credentials being stolen, only control of the content served on the subdomain.
The researcher also notes in the summary that this class of vulnerability has since been patched: it is no longer possible to take over a CNAME via CloudFront without control of the DNS. The researcher notes that this type of vulnerability has been patched.
Impact
The report rates the risk as High, difficulty to exploit as Medium, with a CVSS3 score of 7.7 (AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:L/E:P/RL:O/RC:R). CVSS is a standard scoring system for the severity of a security flaw; the string in brackets is the set of measurements that produce the number. The affected URL is 18f.domains.api.data.gov.
In the researcher's description, subdomain takeover happens when a company creates a DNS entry pointing to a third-party service and then forgets about the third-party application, leaving it open to being hijacked by another party. Hackers can claim subdomains with the help of external services, and the attack is described as practically non-traceable. The concrete consequences listed are building a complete clone of the real site, adding a login form, redirecting users, and stealing credentials such as admin accounts and cookies, or damaging business credibility. These outcomes depend on users trusting and visiting the hijacked name; the report does not demonstrate credential theft, only control of the content served on the subdomain.
Fix
The recommendation is to remove the DNS entry entirely, which is the most effective remediation. If removal is not possible, the alternative given is to point the DNS entry at a redirect of some description to prevent a potential hostile takeover. The researcher notes that this type of vulnerability has been patched: it is no longer possible to take over a CNAME via CloudFront without control of the DNS.
Variants to test
- Other CDN and SaaS CNAMEs. Enumerate subdomains and resolve them; a CNAME to a third-party hostname whose response is a provider error page (rather than the organisation's content) is a candidate. A positive result is a provider-specific "no such distribution" or "unrecognised hostname" page while the DNS record still resolves.
- Abandoned cloud storage names. Look for CNAMEs or direct references to object storage buckets; a positive result is a bucket name that can be registered by you and then serves content under the organisation's hostname.
- Stale records after service migration. Check subdomains tied to services the organisation has visibly stopped using; a positive result is a record that still resolves but whose backend no longer recognises the hostname.
- Provider-side hostname claiming. For any provider that lets you attach a custom hostname to a resource you create, try adding the target's hostname; a positive result is the provider accepting it without a DNS or file-based verification step.
- Wildcard and multi-level records. Test deeper names under a delegated zone, since a forgotten record at a lower level is easy to miss; a positive result is the same dangling pattern at a name that is not on the main inventory.
Glossary
- Domain name: the human-friendly address of a site on the internet, such as
data.gov. - Subdomain: a name placed in front of a domain to separate services, such as
18f.domains.api.data.govunderdata.gov. - DNS (Domain Name System): the internet's address book, translating names into numeric addresses.
- CNAME record: a DNS entry saying one name is an alias for another, so lookups are redirected to the second name.
- Canonical name: the formal term for the target of a CNAME record.
- CDN (content delivery network): a service that serves copies of a site's content from many locations so it loads quickly.
- Amazon CloudFront: Amazon's CDN service, which gives you a hostname and serves content from an origin you choose.
- Distribution: a CloudFront setup that pairs a hostname with an origin server.
- Origin: the server a CDN fetches the real content from.
- Hostname: a name a server or service answers to, such as
dn9rrjaiux2m0.cloudfront.net. - nslookup: a command-line tool that asks DNS servers what a name resolves to.
- Non-authoritative answer: a DNS answer that came from a caching server rather than the server officially responsible for the name.
- IPv4 / IPv6: the two formats of numeric internet addresses; IPv4 uses four numbers, IPv6 uses a longer form with colons.
- Subdomain takeover: taking control of a subdomain by claiming an abandoned third-party service that the subdomain still points at.
- Dangling DNS record: a DNS entry left pointing at a service that is no longer in use or no longer recognises the name.
- Cookie: a small piece of data a site stores in your browser to recognise you on later visits, for example to keep you logged in.
- Credentials: the details used to prove who you are, such as a username and password.
- CVSS: a standard scoring system for the severity of a security flaw.
- Remediation: the fix that removes or reduces a vulnerability.
- SaaS: software delivered over the internet by a provider rather than installed on your own machines.
- Object storage bucket: a named container for files in a cloud storage service.
- Wildcard record: a DNS entry that matches many names at once, often used to cover all subdomains of a zone.
- Delegated zone: a portion of the DNS namespace handed to a particular set of name servers to manage.