Subdomain takeover of www█████████.affirm.com
A subdomain of affirm.com pointed to an AWS S3 bucket that no longer existed, allowing the researcher to claim the bucket and serve arbitrary content on that domain. This could enable phishing, OAuth token theft, or cookie theft if the domain was trusted.
- Fixed in 2 days
- Paid in 2 days
- Disclosed after 9 days
Summary
Hi there, assuming you want this report as your policy mentions Affirm resources with third-parties, but the scope was a little unclear. Regardless, www█████.affirm.com points to an AWS S3 bucket affirm-prod-www-cms█████████ that no longer exists. I was able to take control of this bucket and put my own content onto it. I can now serve content on this domain, obtain a TLS certificate for this domain, etc.
If any customers or servers are pointing to anything within this domain, I could serve them arbitrary/malicious content. I could also use this in case your domain whitelists your own domain for OAuth, or if there are cookies scoped to the entire domain. Usually this can have a high impact.
Note: S3 has a weird quirk where the bucket's region may cause errors if a request to a bucket is addressed to the wrong region. I assume your CDN points to ████-2, but my bucket is in us-east-1. When you make a request to this domain, S3 shows a redirect error because of this. If I wanted to move the bucket to the correct region (for the PoC to fully work), it would put it at risk of being claimed by attackers/others. Hopefully, this is enough for you.
PoC
To see that the domain points to the affirm-prod-www-cms█████ bucket:
% curl https://www██████████.affirm.com
[...]
<Code>PermanentRedirect</Code>
<Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message>
<Endpoint>s3.amazonaws.com</Endpoint>
<Bucket>affirm-prod-www-cms████</Bucket>
[...]
Following this redirect, to see the PoC:
% curl https://s3.amazonaws.com/affirm-prod-www-cms████████/index.html
<!-- taken over by hackerone.com/ian bugcrowd.com/iangcarroll [email protected] -->
Impact
Subdomain takeover
Context
Affirm runs a public web presence, and one of its hostnames, www█████████.affirm.com, was served through a content delivery layer that in turn pulled its content from an AWS S3 bucket. The bucket in question was named affirm-prod-www-cms█████████. The report was filed under the Affirm program on HackerOne by the researcher ian, rated medium severity with a CVSS score of 5.3, classified as a business logic error, and paid a bounty of 500.00 USD. It was disclosed on 2021-08-18.
The researcher opens by noting that the scope was a little unclear, and that they assumed the report was wanted because the policy mentions Affirm resources hosted with third parties. The core observation is simple: the hostname pointed at an S3 bucket that no longer existed, which left the bucket name free for anyone to claim.
Setup
The only tool shown in the report is curl, used from a shell. No accounts, roles, credentials or versions are described. The precondition is the state of the target itself: a public hostname whose DNS or CDN configuration still references an S3 bucket that has since been deleted, and a bucket name that is globally claimable in S3.
Finding it
The researcher noticed that www█████.affirm.com points to an S3 bucket, affirm-prod-www-cms█████████, that no longer exists. Because S3 bucket names are global, a deleted bucket whose name is still referenced by a live hostname can be recreated by anyone. The researcher recreated it and put their own content on it, which gave them the ability to serve content on the domain and to obtain a TLS certificate for it.
Exploitation
Step 1: Confirm the hostname points at the bucket
The first request fetches the hostname directly and shows the S3 error that reveals the bucket name:
% curl https://www██████████.affirm.com
[...]
<Code>PermanentRedirect</Code>
<Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message>
<Endpoint>s3.amazonaws.com</Endpoint>
<Bucket>affirm-prod-www-cms████</Bucket>
[...]
The response is an S3 PermanentRedirect error. The <Bucket> element names affirm-prod-www-cms████, which is the bucket the hostname is wired to. The <Endpoint> element is s3.amazonaws.com. This confirms both that the hostname is backed by S3 and which bucket name an attacker would need to claim.
Step 2: Claim the bucket and serve content
The researcher recreated the bucket under that name and uploaded their own content. Fetching the object directly from S3 returns the marker they placed:
% curl https://s3.amazonaws.com/affirm-prod-www-cms████████/index.html
<!-- taken over by hackerone.com/ian bugcrowd.com/iangcarroll [redacted] -->
The response body is an HTML comment left as proof of control. The bucket was in a different region from the one the CDN points to, so requests to the domain showed a redirect error rather than this content.
A note on the region
The researcher explains an S3 quirk: a bucket's region can cause errors if a request to the bucket is addressed to the wrong region. They assume the CDN points to ████-2, while their bucket is in us-east-1. As a result, a request to the domain shows a redirect error. Moving the bucket to the correct region would make the proof of concept fully work, but it would also put the bucket at risk of being claimed by attackers or others, so they left it where it was and considered the evidence sufficient.
Root cause
The hostname still referenced an S3 bucket that had been deleted. S3 bucket names are global, so once the bucket is gone, anyone can create a bucket with the same name and inherit whatever traffic still points at it. The report does not describe any control that would have prevented this.
Impact
The researcher could serve their own content on www█████.affirm.com and obtain a TLS certificate for the domain. If any customers or servers point to anything within the domain, the attacker could serve them arbitrary or malicious content. The same position could be used if the domain whitelists its own domain for OAuth, or if cookies are scoped to the entire domain. The researcher notes that this can usually have a high impact, while the platform recorded the issue as medium severity (CVSS 5.3).
Fix
The report does not state what was changed. The measure it implies is to stop pointing the hostname at a bucket that no longer exists, and to avoid leaving referenced bucket names free for others to claim.
Variants to test
- Check other Affirm-style hostnames for S3 error responses. A positive result is a
PermanentRedirecterror naming a bucket that can be created. - Try to create the named bucket and upload an
index.html. A positive result is your marker being returned when fetching the object from S3. - Look for hostnames whose CDN or DNS configuration still references third-party storage that has been decommissioned. A positive result is the same takeover path on a different hostname.
- Consider the OAuth and cookie angles the researcher raises: a hostname you control that is whitelisted for OAuth, or one that shares a cookie scope with the main domain. A positive result is a login flow or session that trusts content from the taken-over hostname.
Hunting notes
This kind of bug hides where infrastructure has been retired but the public entry point has not: hostnames still wired to S3 buckets, CDN origins or other third-party storage that no longer exists. During recon, the signal is an S3 error page or redirect on a hostname that should serve normal content, especially one that names a bucket in the response body. The researcher showed enough impact by claiming the bucket, serving a marker from it, and explaining the follow-on risks (content served to customers or servers, TLS certificates, OAuth whitelisting, domain-scoped cookies), while being explicit about the region limitation that kept the full proof from working.
What happened, in plain words
A company called Affirm has a website address, www█████████.affirm.com. Behind the scenes, that address did not serve pages from a normal web server. Instead, it was set up to fetch its content from a storage service run by Amazon called S3. Think of S3 as a giant public locker room: each locker has a name, and anyone with the right name can put things inside it.
The locker Affirm's website was pointing at was called affirm-prod-www-cms█████████. At some point that locker was emptied and deleted, but the website address was never updated. It kept pointing at the locker name. Because S3 locker names are unique across the whole world, and because a deleted name becomes free again, anyone who knows the name can walk in and create a new locker with exactly that name.
That is what the researcher ian did. They recreated the locker, put their own file inside it, and from that moment on they controlled what the Affirm address could serve. They could also get a security certificate (the padlock in the browser) for the domain.
The report was filed on HackerOne under the Affirm program. It was rated medium severity with a CVSS score of 5.3, classified as a business logic error, paid a bounty of 500.00 USD, and disclosed on 2021-08-18.
This class of bug is called a subdomain takeover. A subdomain is a smaller address under a main domain, like www.example.com under example.com. A takeover happens when a subdomain still points at some outside service that has been abandoned, and an outsider can claim that service and answer on the subdomain's behalf.
The setup
The report shows only one tool: curl. curl is a command-line program that fetches a web address and prints the raw reply, without drawing a page. It is useful because it shows what the server actually sends, including error messages a browser would hide.
No accounts, roles, credentials or software versions are described. The only precondition is the state of the target itself: a public hostname whose DNS or CDN configuration still references an S3 bucket that has since been deleted, and a bucket name that anyone in the world can claim.
Two terms in that sentence need unpacking:
- DNS is the internet's phone book. It translates a name people type, like
www.affirm.com, into the address of a machine that answers. - CDN stands for content delivery network. It is a layer of servers spread around the world that cache and forward content so pages load quickly. A CDN often has an "origin", the place it fetches fresh content from, and here that origin was an S3 bucket.
Finding it
The researcher noticed that www█████.affirm.com points to an S3 bucket, affirm-prod-www-cms█████████, that no longer exists. Because S3 bucket names are global, a deleted bucket whose name is still referenced by a live hostname can be recreated by anyone. The researcher recreated it and put their own content on it, which gave them the ability to serve content on the domain and to obtain a TLS certificate for it.
TLS is the technology behind the padlock and the https:// prefix. A TLS certificate is a signed document proving that a server really is the domain it claims to be. Certificate authorities will issue one to whoever can demonstrate control of the domain, and controlling the content behind the domain is one way to demonstrate that.
Exploitation
Step 1: Confirm the hostname points at the bucket
The first request fetches the hostname directly. The goal is to prove two things at once: that the address is backed by S3, and which bucket name it is wired to.
% curl https://www██████████.affirm.com
[...]
<Code>PermanentRedirect</Code>
<Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message>
<Endpoint>s3.amazonaws.com</Endpoint>
<Bucket>affirm-prod-www-cms████</Bucket>
[...]
Line by line:
% curl https://www██████████.affirm.comruns curl against the Affirm hostname over HTTPS. The%is just the shell prompt shown in the report.[...]marks parts of the output the researcher trimmed out.<Code>PermanentRedirect</Code>is the error code S3 returned. It means "this request reached the right service, but you must talk to it at a different address".<Message>...</Message>is the human-readable version of the same error, telling the caller to send future requests to the specified endpoint.<Endpoint>s3.amazonaws.com</Endpoint>names the address the request should have gone to. This is the giveaway that the hostname is backed by S3.<Bucket>affirm-prod-www-cms████</Bucket>names the bucket the hostname is wired to. This is the name an attacker would need to claim.- The final
[...]trims the rest of the response.
So this single request confirms both facts needed to proceed: the hostname is backed by S3, and the bucket name is affirm-prod-www-cms████.
Step 2: Claim the bucket and serve content
The researcher recreated the bucket under that name and uploaded their own content. Fetching the object directly from S3 returns the marker they placed:
% curl https://s3.amazonaws.com/affirm-prod-www-cms████████/index.html
<!-- taken over by hackerone.com/ian bugcrowd.com/iangcarroll [redacted] -->
Line by line:
% curl https://s3.amazonaws.com/affirm-prod-www-cms████████/index.htmlasks S3 directly, by its own address, for a file calledindex.htmlinside the bucket.index.htmlis the conventional name for a website's front page.- The second line is the entire reply: an HTML comment. In HTML, anything between
<!--and-->is a comment, which browsers do not display. It is a convenient way to leave a note that proves who controls the file without changing how a page looks.
The response body is an HTML comment left as proof of control. The bucket was in a different region from the one the CDN points to, so requests to the domain showed a redirect error rather than this content.
A note on the region
The researcher explains an S3 quirk: a bucket's region can cause errors if a request to the bucket is addressed to the wrong region. A region is a geographic area where a cloud provider runs data centres, such as us-east-1. S3 expects requests for a bucket to be sent to the endpoint for the region where that bucket lives; send them elsewhere and it answers with a redirect instead of the file.
The researcher assumes the CDN points to ████-2, while their bucket is in us-east-1. As a result, a request to the domain shows a redirect error. Moving the bucket to the correct region would make the proof of concept fully work, but it would also put the bucket at risk of being claimed by attackers or others, so they left it where it was and considered the evidence sufficient.
The researcher chose a slightly incomplete demonstration over handing the prize to someone else.
Root cause
The hostname still referenced an S3 bucket that had been deleted. S3 bucket names are global, so once the bucket is gone, anyone can create a bucket with the same name and inherit whatever traffic still points at it. The report does not describe any control that would have prevented this.
A useful comparison: it is like cancelling a phone number but leaving it printed on the company's business cards. The number goes back into the pool, and the next person to take it starts receiving calls meant for the company.
Impact
The researcher could serve their own content on www█████.affirm.com and obtain a TLS certificate for the domain. If any customers or servers point to anything within the domain, the attacker could serve them arbitrary or malicious content. The same position could be used if the domain whitelists its own domain for OAuth, or if cookies are scoped to the entire domain. The researcher notes that this can usually have a high impact, while the platform recorded the issue as medium severity (CVSS 5.3).
Three of those follow-on risks deserve a plain explanation:
- OAuth is a way for one website to ask another, "is this person who they say they are?" A site that trusts its own domain during that check could be fooled if an attacker controls a hostname inside that domain.
- A cookie is a small piece of data a website stores in your browser, often to remember that you are logged in. If a cookie is scoped to the whole domain, it is sent to every hostname under it, including a taken-over one.
- CVSS is a standard scoring system for the severity of a security issue. 5.3 sits in the medium band.
Fix
The report does not state what was changed. The measure it implies is to stop pointing the hostname at a bucket that no longer exists, and to avoid leaving referenced bucket names free for others to claim.
Variants to test
These are the ways the same idea can be tried elsewhere. Each one is a small experiment with a clear pass or fail.
- Check other Affirm-style hostnames for S3 error responses. A positive result is a
PermanentRedirecterror naming a bucket that can be created. - Try to create the named bucket and upload an
index.html. A positive result is your marker being returned when fetching the object from S3. - Look for hostnames whose CDN or DNS configuration still references third-party storage that has been decommissioned. A positive result is the same takeover path on a different hostname.
- Consider the OAuth and cookie angles the researcher raises: a hostname you control that is whitelisted for OAuth, or one that shares a cookie scope with the main domain. A positive result is a login flow or session that trusts content from the taken-over hostname.
Hunting notes
This kind of bug hides where infrastructure has been retired but the public entry point has not: hostnames still wired to S3 buckets, CDN origins or other third-party storage that no longer exists. During recon, the signal is an S3 error page or redirect on a hostname that should serve normal content, especially one that names a bucket in the response body. The researcher showed enough impact by claiming the bucket, serving a marker from it, and explaining the follow-on risks (content served to customers or servers, TLS certificates, OAuth whitelisting, domain-scoped cookies), while being explicit about the region limitation that kept the full proof from working.
Glossary
- Subdomain: a smaller address under a main domain, such as
www.example.comunderexample.com. - Subdomain takeover: claiming an abandoned outside service that a subdomain still points at, so you answer on that subdomain's behalf.
- S3: Amazon's object storage service, where files live in named containers called buckets.
- Bucket: a named container in S3. Bucket names are unique across the whole service, so a deleted name becomes free for anyone.
- DNS: the internet's phone book, translating names into the addresses of machines that answer.
- CDN: content delivery network, a layer of servers that cache and forward content, fetching fresh copies from an origin.
- Origin: the place a CDN fetches fresh content from, here an S3 bucket.
- Hostname: a name for a machine or service on the internet, such as
www.affirm.com. - curl: a command-line program that fetches a web address and prints the raw reply.
- TLS: the technology behind
https://and the browser padlock, encrypting traffic and proving the server's identity. - TLS certificate: a signed document proving a server really is the domain it claims to be.
- Region: a geographic area where a cloud provider runs data centres, such as
us-east-1. - Endpoint: the specific address a service must be contacted at, here
s3.amazonaws.com. - PermanentRedirect: an S3 error meaning the request reached the right service but must be sent to a different address.
- NoSuchBucket: an S3 error meaning the named bucket does not exist.
- HTML comment: text between
<!--and-->that browsers do not display. - OAuth: a way for one website to ask another whether a person is who they claim to be.
- Cookie: a small piece of data a website stores in your browser, often to remember that you are logged in.
- CVSS: a standard scoring system for the severity of a security issue.
- Business logic error: a flaw in how a system is set up or used rather than in its code, such as leaving a name free to claim.
- Proof of concept (PoC): a small demonstration that a vulnerability is real and exploitable.