Skip to content
Subdomain takeover Disclosed report Intermediate

Subdomain takeover in Gitlab pages

An attacker could take over a dangling custom domain pointing to GitLab Pages by adding the domain to their own GitLab Pages project without verifying ownership, because GitLab Pages serves content for unverified domains for up to seven days. This could allow cookie theft, phishing, and bypassing of content security policies and CORS.

fdeleite Follow with jayesh25

Originally disclosed on HackerOne

  • Triaged in 39 hours
  • Fixed in 43 days
  • Paid in 43 days
  • Disclosed after 4 months

Summary

It's possible for an attacker to take over a dangling custom domain pointing to GitLabPages using `instanceX.gitlab.io'

The problems arises when adding a custom domain to Gitlab Pages, without the domain being verified it still servers content (allowing 7 days before disabling it)

Steps to reproduce

I did some tests with gitlab.com domains, docs-dev.gitlab.com worked correctly. The domain has the following fingerprints:

Dig

docs-dev.gitlab.com.    300     IN      CNAME   gitlab-com.gitlab.io.
gitlab-com.gitlab.io.   300     IN      A       35.185.44.232

And going to the URL shows:

HTTP/1.1 302 Found
content-type: text/html; charset=utf-8
location: https://projects.staging.gitlab.io/auth?domain=http://docs-dev.gitlab.com&state=giZFQTsOOFXvR_0po68zrg==
permissions-policy: interest-cohort=()
set-cookie: gitlab-pages=..._; Path=/auth; Expires=Tue, 28 May 2024 21:07:33 GMT; Max-Age=600; HttpOnly
vary: Origin
date: Tue, 28 May 2024 20:57:33 GMT
gitlab-lb: haproxy-pages-01-lb-gstg
gitlab-sv: pages-us-east1-c

HTTP/2 401 
content-type: text/html; charset=utf-8
permissions-policy: interest-cohort=()
vary: Origin
x-content-type-options: nosniff
content-length: 2872
date: Tue, 28 May 2024 20:57:34 GMT

  1. Create a GitLab pages using this project (https://gitlab.com/g15391522/pn1)
  2. Go to Deploy -> ** Pages **
  3. Disable Force HTTPS (requires valid certificates)
  4. Add the target custom domain and click in Save

Go to http://docs-dev.gitlab.com/

Now the content of the site will be :

image.png
image.png From the original on HackerOne

Impact

They could perform several attacks like:

  • Cookie Stealing
  • Phishing campaigns.
  • Bypass Content-Security Policies and CORS.

The original report as published on HackerOne, by fdeleite. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the lack of domain ownership verification before serving content for custom domains, combined with a grace period that allows unverified domains to remain active.

Impact

An attacker could perform cookie stealing, phishing campaigns, and bypass content security policies and CORS.

What the attacker needed

A GitLab account; a GitLab Pages project; a dangling custom domain pointing to GitLab Pages

How it was found

  1. Create a GitLab Pages site using a project.
  2. Go to Deploy then Pages.
  3. Disable Force HTTPS.
  4. Add the target custom domain and save.
  5. Visit the custom domain to see the attacker's content.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When a website uses a custom domain, it often points that domain to a hosting service like GitLab Pages. If the domain is no longer used by its original owner but still points to GitLab, an attacker can claim it by adding it to their own GitLab Pages project. GitLab Pages allows this for a short time without checking ownership, so the attacker can serve their own content on that domain.

What is Subdomain takeover?

A company's DNS still points at a cloud service it no longer uses, so anyone can claim it and serve content on the company's domain.

More by fdeleite

View all

18 more disclosed reports, best first.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Subdomain takeover

The lesson behind this report.

A company's DNS still points at a cloud service it no longer uses, so anyone can claim it and serve content on the company's domain.