# Domain Takeover - gl-canary.freetls.fastly.net

A Fastly freetls subdomain whitelisted in gitlab.com's CSP could be claimed by any Fastly account, enabling CSP bypass and script execution.

- Payout: $200
- Severity: low
- Program: GitLab
- Found by: mike12
- Disclosed: 2023-05-30
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/716677
- Library page: https://bugbountylibrary.com/r/h1%3A716677
- Tags: area:web domain:web impact:integrity kind:bounty platform:hackerone sev:low tech:cdn technique:recon vuln:misconfiguration vuln:subdomain-takeover vuln:xss

**Target:** gitlab.com Content-Security-Policy / Fastly freetls subdomain
**Root cause:** gl-canary.freetls.fastly.net is trusted in gitlab.com's script-src/connect-src CSP, but Fastly's freetls subdomains are claimable by any user who creates a service with that name.
**Steps:**
1. Fetch gitlab.com and read the Content-Security-Policy header; note `gl-canary.freetls.fastly.net` in script-src/connect-src/style-src/worker-src.
2. Register at https://www.fastly.com/signup.
3. Go to https://manage.fastly.com/services/all and create a new service.
4. Set domain to `gl-canary.global.ssl.fastly.net`; Fastly auto-creates `gl-canary.freetls.fastly.net`.
5. Configure hosts to serve attacker-controlled JS from that domain.
**How found:** Read the CSP header on gitlab.com, spotted a third-party freetls.fastly.net subdomain in the allowlist, and recognized Fastly's free TLS naming scheme lets any account claim such subdomains.
**Exploitation:** Attacker claims the freetls subdomain via a free Fastly account, hosts malicious JS there, then leverages any XSS/injection on gitlab.com to load script from the now-trusted CSP origin, bypassing script-src restrictions.
**Escalation:** Could be reused elsewhere in GitLab (e.g., CDN references) beyond the CSP bypass.
**Insight:** Audit CSP allowlists for shared-hosting/CDN wildcard-style domains (e.g., *.freetls.fastly.net, *.herokuapp.com, *.s3.amazonaws.com) where subdomains are claimable by anyone; a trusted origin you can register is a CSP bypass.

