Sub-Domain Takeover at http://www.codefi.consensys.net/
A subdomain of the target was mapped to a third-party hosting provider but had not been claimed, so anyone could register it and serve their own content. An attacker could then host malicious pages on the trusted subdomain, potentially reading cookies, performing cross-site scripting, or bypassing content security policies.
Originally disclosed on HackerOne
- Triaged in 6 days
- Fixed in 14 days
- Paid in 3 days
- Disclosed after 3 months
Summary by the researcher
This is my first bounty and report and itzzz just amazing.❤️
The report
Summary:
Subdomain takeovers:
A subdomain takeover occurs when an attacker gains control over a subdomain of a target domain. Typically, this happens when the subdomain has a canonical name (CNAME) in the Domain Name System (DNS), but no host is providing content for it. This can happen because either a virtual host hasn't been published yet or a virtual host has been removed. An attacker can take over that subdomain by providing their own virtual host and then hosting their own content for it.
If an attacker can do this, they can potentially read cookies set from the main domain, perform cross-site scripting, or circumvent content security policies, thereby enabling them to capture protected information (including logins) or send malicious content to unsuspecting users.
Steps To Reproduce:
- GO to http://consensys.net and find its sub-domains using Subfinder.
- now find sub-domains status code.
- Search for 404 code.
- its showing :-
Domain Not Claimed This domain has been mapped to Squarespace, but it has not yet been claimed by a website. If this is your domain, claim it in the Domains tab of your Website Manager. 5. now create a account at Squarespace, create a website template and then go to use a domain i own. 6. then copy and paste http://www.codefi.consensys.net/ and boom sub-domain takeover completed.
Supporting Material/References:
POC is attached below.
How to prevent it ?
Preventing subdomain takeovers is a matter of order of operations in lifecycle management for virtual hosts and DNS. Depending on the size of the organization, this may require communication and coordination across multiple departments, which can only increase the likelihood for a vulnerable misconfiguration.
Define standard processes for provisioning and deprovisioning hosts. Do all steps as closely together as possible. Start provisioning by claiming the virtual host; create DNS records last. Start deprovisioning by removing DNS records first. Create an inventory of all of your organization's domains and their hosting providers, and update it as things change, to ensure that nothing is left dangling.
Impact
Risks of a Subdomain Takeover:-
Various risks could be the result of a subdomain takeover.
- Bypassing CSRF protection
- Phishing
- Leak of OAuth 2.0 Tokens
- The redirect is only performed if the target URL is trusted. If all subdomains are trusted as target URL, an attacker might be able to get OAuth 2.0 tokens via a target URL which points to a compromised subdomain.
- Bypass Content Security Policy
- A, AAAA and CNAME Records
Attachments
Context
This report describes a subdomain takeover on www.codefi.consensys.net, a subdomain of the Consensys domain, reported to the MetaMask program on HackerOne. The researcher frames the issue with a general definition: a subdomain takeover happens when an attacker gains control over a subdomain of a target domain. Typically this occurs when the subdomain has a canonical name (CNAME) record in DNS but no host is providing content for it, either because a virtual host has not been published yet or because one has been removed. An attacker can then take over the subdomain by providing their own virtual host and hosting their own content for it.
The researcher notes that if an attacker can do this, they can potentially read cookies set from the main domain, perform cross-site scripting, or circumvent content security policies, enabling them to capture protected information (including logins) or send malicious content to unsuspecting users.
Setup
The report lists no accounts, roles, versions or special preconditions beyond the tools used during recon. The workflow relies on:
- Subfinder, to enumerate subdomains of
consensys.net. - A way to check the HTTP status code of each discovered subdomain.
- A free Squarespace account, used to claim the dangling domain.
Finding it
The researcher started from the main site and enumerated its subdomains with Subfinder, then checked the status code returned by each subdomain and looked for 404 responses. One of those subdomains, www.codefi.consensys.net, returned a page with the following text:
Domain Not Claimed
This domain has been mapped to Squarespace, but it has not yet been claimed by a website. If this is your domain, claim it in the Domains tab of your Website Manager.
That message is the signal: the DNS record for the subdomain points at Squarespace, but no Squarespace site has claimed the domain, so the mapping is dangling and anyone with a Squarespace account can attach a site to it.
Exploitation
Step 1: Enumerate subdomains
The researcher went to http://consensys.net and used Subfinder to find its subdomains.
Step 2: Check status codes
Each discovered subdomain was queried for its HTTP status code.
Step 3: Look for 404 responses
The researcher searched for subdomains returning 404. www.codefi.consensys.net was among them and served the Squarespace "Domain Not Claimed" page quoted above.
Step 4: Claim the domain at Squarespace
The researcher created an account at Squarespace, created a website template, and then went to the option to use a domain they own. In that flow they entered:
http://www.codefi.consensys.net/
According to the report, the subdomain takeover was then complete: the Squarespace site was now served on the Consensys subdomain.
The report states that a proof of concept is attached below, but the attachment is not reproduced here.
Root cause
The subdomain's DNS record points to Squarespace, but no Squarespace site had claimed the domain, so the hosting side of the mapping was unowned. Because Squarespace lets any account claim a domain that is mapped to it but not yet claimed, the first person to add the domain in the Website Manager takes control of the content served on that hostname. The report does not describe the DNS record itself beyond the general CNAME explanation, and does not identify which team created or removed the mapping.
Impact
The report lists the following risks of a subdomain takeover:
- Bypassing CSRF protection
- Phishing
- Leak of OAuth 2.0 tokens
- The redirect is only performed if the target URL is trusted. If all subdomains are trusted as target URLs, an attacker might be able to get OAuth 2.0 tokens via a target URL which points to a compromised subdomain.
- Bypass Content Security Policy
- A, AAAA and CNAME records
More generally, the researcher notes that an attacker controlling the subdomain can potentially read cookies set from the main domain, perform cross-site scripting, or circumvent content security policies, and thereby capture protected information (including logins) or send malicious content to unsuspecting users. These are stated as potential consequences; the report does not demonstrate any of them beyond serving attacker-controlled content on the subdomain.
Fix
The report gives prevention guidance rather than describing a specific remediation applied to this host. Preventing subdomain takeovers is a matter of order of operations in lifecycle management for virtual hosts and DNS. Depending on the size of the organisation, this may require communication and coordination across multiple departments, which can only increase the likelihood of a vulnerable misconfiguration.
- Define standard processes for provisioning and deprovisioning hosts, and do all steps as closely together as possible.
- Start provisioning by claiming the virtual host; create DNS records last.
- Start deprovisioning by removing DNS records first.
- Create an inventory of all of the organisation's domains and their hosting providers, and update it as things change, so that nothing is left dangling.
Variants to test
- Enumerate subdomains with Subfinder and request each one, flagging any that return
404or a provider-specific "unclaimed" page. A positive result is a page telling you the domain is mapped to a hosting provider but not yet claimed. - Look for provider fingerprints in the response body, such as the Squarespace "Domain Not Claimed" text, on any subdomain of the target. A positive result is the same message naming the target's hostname.
- Check CNAME records for hosts pointing at third-party platforms (the report mentions A, AAAA and CNAME records as relevant). A positive result is a CNAME to a provider where the corresponding site no longer exists.
- Attempt to claim the dangling domain in the provider's dashboard using the exact hostname. A positive result is the provider accepting the domain and serving your content on it.
Hunting notes
This kind of bug hides in forgotten DNS records: subdomains that were once pointed at a hosting platform and whose site was later removed, leaving the mapping dangling. During recon, the useful signals are subdomains returning 404 and provider-specific "not claimed" pages in the response body, plus CNAME records pointing at third-party platforms. The researcher showed impact by claiming the domain in a Squarespace account and serving content on the Consensys subdomain.
What happened, in plain words
A website can have many smaller addresses under its main name. The main name here is consensys.net, and www.codefi.consensys.net is one of its subdomains. Think of the main domain as a company building and the subdomains as separate doors with their own nameplates.
Each of those doors can be handed off to a different company to run. In this case, the nameplate for www.codefi.consensys.net was set up to point at Squarespace, a service that lets anyone build and host a website. But nobody at Consensys had actually claimed that address inside Squarespace. The nameplate existed, the door was there, but the room behind it was empty and unlocked.
The researcher found that empty door, signed up for a free Squarespace account, and claimed the address. From that moment, Squarespace served the researcher's own website on a Consensys subdomain. That is what people call a subdomain takeover: someone outside the organisation ends up controlling what visitors see at one of the organisation's own addresses.
The report was sent to the MetaMask program on HackerOne, a platform where security researchers report bugs to companies.
The idea behind it
Before the steps, the researcher explains the concept in general terms. A subdomain takeover happens when an attacker gains control over a subdomain of a target domain. Typically this happens when the subdomain has a canonical name (CNAME) record in DNS but no host is providing content for it, either because a virtual host has not been published yet or because one has been removed. An attacker can then take over the subdomain by providing their own virtual host and hosting their own content for it.
A few of those words need unpacking.
DNS is the internet's address book. Humans type names like consensys.net; computers need numbers. DNS translates one into the other. Every time you open a website, your browser quietly asks a DNS server "where does this name live?" and gets an answer back.
A CNAME record is one entry in that address book that says "this name is really just another name for that other name." It is like a mail forwarding note: letters for the old address get sent on to the new one. Companies use CNAMEs constantly to point their own subdomains at outside services, such as a website builder, a shop platform or a helpdesk.
A virtual host is the way one physical server can host many different websites. The server looks at the name in the request and decides which site to show. If the name is registered with the server, you get that site. If the name is not registered with anyone, you get an error or a placeholder page.
The dangerous combination is a CNAME pointing at an outside service plus no site registered for that name at the service. The forwarding note still exists, but the destination is empty. Anyone who can register that name at the outside service gets to decide what appears when someone visits the company's subdomain.
The researcher notes that if an attacker can do this, they can potentially read cookies set from the main domain, perform cross-site scripting, or circumvent content security policies, enabling them to capture protected information (including logins) or send malicious content to unsuspecting users.
A cookie is a small piece of data a website asks your browser to store and send back on later visits. It is how a site remembers that you are logged in. Cookies can be scoped to a whole domain, which means a cookie set by the main site may also be sent to its subdomains. If an attacker controls one subdomain, that cookie may reach them.
Cross-site scripting, usually shortened to XSS, means getting your own code to run inside someone else's website as if it belonged there. Visitors trust the site, so they trust the code.
A content security policy is a rule list a site gives the browser saying which sources of code and content are allowed. If a subdomain is on the trusted list, content served from that subdomain is allowed, even if an outsider is the one serving it.
Setting up
The report lists no accounts, roles, versions or special preconditions beyond the tools used during recon. The workflow relies on:
- Subfinder, to enumerate subdomains of
consensys.net. - A way to check the HTTP status code of each discovered subdomain.
- A free Squarespace account, used to claim the dangling domain.
Subfinder is a free command-line tool that collects subdomains for a given domain from public sources. You give it a name, it gives you back a list of addresses that belong to it. It is like asking a librarian for every book published under one imprint.
An HTTP status code is the three-digit number a web server sends back with every response. 200 means "here is the page". 404 means "I do not have anything at this address". 403 means "not allowed". These numbers are useful during recon because they tell you, at a glance, which addresses have something behind them and which do not.
Recon, short for reconnaissance, is the information-gathering phase before any testing. It is the equivalent of walking around a building and noting which doors are open before trying any handles.
Finding it
The researcher started from the main site and enumerated its subdomains with Subfinder, then checked the status code returned by each subdomain and looked for 404 responses. One of those subdomains, www.codefi.consensys.net, returned a page with the following text:
Domain Not Claimed
This domain has been mapped to Squarespace, but it has not yet been claimed by a website. If this is your domain, claim it in the Domains tab of your Website Manager.
Line by line, this is what the page says:
Domain Not Claimedis the headline. Squarespace is telling the visitor that the name has been registered in its system as a destination, but no customer has taken ownership of it.This domain has been mapped to Squarespace, but it has not yet been claimed by a website.confirms the dangling state. The mapping exists on the Squarespace side, but no site is attached to it.If this is your domain, claim it in the Domains tab of your Website Manager.is an invitation. Squarespace is openly telling anyone who reaches this page how to take the name, and it has no way of knowing whether the person reading it actually owns the domain.
That message is the signal: the DNS record for the subdomain points at Squarespace, but no Squarespace site has claimed the domain, so the mapping is dangling and anyone with a Squarespace account can attach a site to it. The researcher did not need to guess anything; the hosting provider itself printed the confirmation on the page.
Exploitation
Step 1: Enumerate subdomains
The researcher went to http://consensys.net and used Subfinder to find its subdomains. The reason for starting here is that you cannot test what you cannot see. A large organisation usually has dozens or hundreds of subdomains, many of them created for campaigns, internal tools or old projects, and nobody remembers all of them. Subfinder produces the list that the rest of the work depends on.
Step 2: Check status codes
Each discovered subdomain was queried for its HTTP status code. The reason is filtering: with a long list, you want to sort the addresses into groups quickly. Some will answer normally, some will refuse, some will say they have nothing. The last group is the interesting one, because a subdomain that answers "nothing here" may still be pointed at an outside service by its DNS record.
Step 3: Look for 404 responses
The researcher searched for subdomains returning 404. www.codefi.consensys.net was among them and served the Squarespace "Domain Not Claimed" page quoted above. A 404 on its own is not a bug; plenty of addresses legitimately have no page. What makes it worth a closer look is the body of the response: here it named a hosting provider and said the domain was unclaimed, which turns a boring 404 into a lead.
Step 4: Claim the domain at Squarespace
The researcher created an account at Squarespace, created a website template, and then went to the option to use a domain they own. In that flow they entered:
http://www.codefi.consensys.net/
This single line is the hostname of the Consensys subdomain, written the way a browser address bar would show it. The researcher typed the target's own address into Squarespace's "connect a domain" form. According to the report, the subdomain takeover was then complete.
According to the report, the subdomain takeover was then complete: the Squarespace site was now served on the Consensys subdomain.
The report states that a proof of concept is attached below, but the attachment is not reproduced here.
Why it worked
The subdomain's DNS record points to Squarespace, but no Squarespace site had claimed the domain, so the hosting side of the mapping was unowned. Because Squarespace lets any account claim a domain that is mapped to it but not yet claimed, the first person to add the domain in the Website Manager takes control of the content served on that hostname. The report does not describe the DNS record itself beyond the general CNAME explanation, and does not identify which team created or removed the mapping.
A useful comparison is a forwarding address at a post office. The old tenant fills in a card saying "send my mail to this new address", then moves out and never tells the new address to expect anything. The post office keeps forwarding. Eventually a stranger walks in, rents that new address, and starts receiving the old tenant's mail. Nobody broke a lock; the forwarding card simply outlived the tenant.
Impact
The report lists the following risks of a subdomain takeover:
- Bypassing CSRF protection
- Phishing
- Leak of OAuth 2.0 tokens
- The redirect is only performed if the target URL is trusted. If all subdomains are trusted as target URLs, an attacker might be able to get OAuth 2.0 tokens via a target URL which points to a compromised subdomain.
- Bypass Content Security Policy
- A, AAAA and CNAME records
Some of these need explaining.
CSRF, cross-site request forgery, is an attack where a malicious page quietly makes your browser send a request to a site where you are already logged in, so the site thinks the request came from you. Defences against CSRF often rely on checking where a request came from, and a subdomain of the trusted site can pass those checks.
Phishing is tricking people into handing over information by pretending to be someone they trust. A real Consensys subdomain in the address bar is far more convincing than a lookalike domain, which is why a takeover makes phishing easier.
OAuth 2.0 is a common way for websites to let you log in with another service, or to let one app act on your behalf on another. It works with tokens, which are strings that prove you are allowed to do something, much like a cloakroom ticket proves a coat is yours. If an app trusts any address under a domain when deciding where to send a token, a subdomain controlled by an attacker can receive it.
A and AAAA records are the other main kinds of DNS entry. An A record maps a name to an IPv4 address, and an AAAA record maps a name to an IPv6 address. Together with CNAME records, they are the entries that decide where a subdomain actually sends visitors, which is why they matter when hunting for dangling mappings.
More generally, the researcher notes that an attacker controlling the subdomain can potentially read cookies set from the main domain, perform cross-site scripting, or circumvent content security policies, and thereby capture protected information (including logins) or send malicious content to unsuspecting users. These are stated as potential consequences; the report does not demonstrate any of them beyond serving attacker-controlled content on the subdomain.
How to prevent it
The report gives prevention guidance rather than describing a specific remediation applied to this host. Preventing subdomain takeovers is a matter of order of operations in lifecycle management for virtual hosts and DNS. Depending on the size of the organisation, this may require communication and coordination across multiple departments, which can only increase the likelihood of a vulnerable misconfiguration.
- Define standard processes for provisioning and deprovisioning hosts, and do all steps as closely together as possible.
- Start provisioning by claiming the virtual host; create DNS records last.
- Start deprovisioning by removing DNS records first.
- Create an inventory of all of the organisation's domains and their hosting providers, and update it as things change, so that nothing is left dangling.
In plain terms: when you set something up, claim the destination first and point the name at it second, so there is never a moment when the name points at nothing. When you tear something down, remove the name first and release the destination second, for the same reason. And keep a list of every domain and where it points, because the bugs come from the entries nobody remembers.
Variants to test
- Enumerate subdomains with Subfinder and request each one, flagging any that return
404or a provider-specific "unclaimed" page. A positive result is a page telling you the domain is mapped to a hosting provider but not yet claimed. - Look for provider fingerprints in the response body, such as the Squarespace "Domain Not Claimed" text, on any subdomain of the target. A positive result is the same message naming the target's hostname.
- Check CNAME records for hosts pointing at third-party platforms (the report mentions A, AAAA and CNAME records as relevant). A positive result is a CNAME to a provider where the corresponding site no longer exists.
- Attempt to claim the dangling domain in the provider's dashboard using the exact hostname. A positive result is the provider accepting the domain and serving your content on it.
Hunting notes
This kind of bug hides in forgotten DNS records: subdomains that were once pointed at a hosting platform and whose site was later removed, leaving the mapping dangling. During recon, the useful signals are subdomains returning 404 and provider-specific "not claimed" pages in the response body, plus CNAME records pointing at third-party platforms. The researcher showed impact by claiming the domain in a Squarespace account and serving content on the Consensys subdomain.
Glossary
- Subdomain: a name that sits under a main domain, such as
www.codefi.consensys.netunderconsensys.net. - Subdomain takeover: a situation where an outsider gains control of a subdomain and decides what visitors see there.
- DNS: the internet's address book, translating names into the addresses computers use.
- CNAME record: a DNS entry saying one name is an alias for another name.
- A record: a DNS entry mapping a name to an IPv4 address.
- AAAA record: a DNS entry mapping a name to an IPv6 address.
- Virtual host: a site registered on a shared server under a particular name, so the server knows which content to show.
- Dangling mapping: a DNS entry pointing at an outside service where no site has claimed the name.
- Subfinder: a free tool that collects subdomains for a given domain from public sources.
- HTTP status code: the three-digit number a server returns with each response, such as
200or404. - 404: the status code meaning nothing exists at the requested address.
- Recon: the information-gathering phase before testing.
- Cookie: a small piece of data a site asks the browser to store and send back later, often used to keep you logged in.
- Cross-site scripting (XSS): getting attacker code to run inside someone else's website as if it belonged there.
- Content security policy: a rule list telling the browser which sources of content a site is allowed to load.
- CSRF: cross-site request forgery, where a malicious page makes your logged-in browser send a request you did not intend.
- Phishing: tricking people into giving up information by pretending to be a trusted party.
- OAuth 2.0: a common system for letting apps log you in or act for you across services.
- Token: a string that proves you are allowed to do something, like a cloakroom ticket.
- Squarespace: a website building and hosting service where anyone can create an account and attach a domain.
- Bounty: a payment a company makes to a researcher who reports a valid security bug.
- Severity: the rating a program gives a bug to express how serious it is.
- HackerOne: a platform where researchers report security bugs to companies.