# Subdomain takeover of www█████████.affirm.com

Dangling S3 bucket referenced by www subdomain allowed takeover, letting attacker serve arbitrary content and obtain TLS certs for the Affirm domain.

- Payout: $500
- Severity: medium
- Program: Affirm
- Found by: ian
- Disclosed: 2021-08-18
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/1297689
- Library page: https://bugbountylibrary.com/r/h1%3A1297689
- Tags: area:cloud domain:cloud impact:integrity kind:bounty platform:hackerone sev:medium tech:aws tech:cdn tech:s3 vuln:misconfiguration vuln:subdomain-takeover

**Target:** AWS S3 bucket backing a www subdomain via CDN
**Root cause:** Subdomain's CDN origin pointed to an S3 bucket name that had been deleted, leaving the bucket name claimable by anyone.
**Steps:**
1. `curl https://www██████████.affirm.com` returns S3 `PermanentRedirect` error leaking `<Bucket>affirm-prod-www-cms████</Bucket>`
2. Register/claim the S3 bucket name `affirm-prod-www-cms████` in an AWS account
3. Upload `index.html` with attacker content
4. `curl https://s3.amazonaws.com/affirm-prod-www-cms████████/index.html` returns attacker content confirming control
**How found:** Observed the subdomain returned an S3 PermanentRedirect error revealing the underlying bucket name; recognized the bucket no longer existed and was claimable.
**Exploitation:** Attacker claims the dangling bucket name and uploads content; because the CDN origin still points to that bucket, attacker content is served on the Affirm subdomain. Attacker could also obtain a TLS cert for the domain and abuse domain-scoped cookies or OAuth whitelisting. Region mismatch (bucket in us-east-1 vs expected region) caused redirect errors, limiting full PoC.
**Escalation:** Potential chaining via OAuth domain whitelisting or domain-scoped cookies to reach account takeover, though not demonstrated.
**Insight:** S3 error responses (PermanentRedirect/NoSuchBucket) leak the exact bucket name behind a CDN origin — request the subdomain directly and read the XML error body to identify dangling bucket names worth claiming.

## Proof of concept (copied exactly from the original report)

**Curl showing domain points to unclaimed S3 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>
```

**Curl fetching attacker-controlled index.html from bucket**

```
% curl https://s3.amazonaws.com/affirm-prod-www-cms████████/index.html
<!-- taken over by hackerone.com/ian bugcrowd.com/iangcarroll ian@lhost.sh -->
```

