Skip to content
Account takeover Disclosed report Beginner

Gitlab Repo jacking for automate storage management

A GitLab documentation example referenced a GitLab account (gitlab-de) that was unclaimed, and the reporter registered it. An attacker could have used this account to inject malicious code into projects that follow the documentation, potentially leading to arbitrary code execution during builds.

GitLab

Originally disclosed on GitLab

  • Fixed in 4 months
  • Disclosed after 4 months

⚠️ Please read the process on how to fix security issues before starting to work on the issue. Vulnerabilities must be fixed in a security mirror.

HackerOne report #2534832 by sjn_scythe on 2024-06-04, assigned to GitLab Team:

Report | How To Reproduce

Report

Hello GitLab security team,

I am writing to bring to your attention a critical security concern regarding a Gitlab account https://gitlab.com/gitlab-de that I have recently discovered. I believe it poses a threat to the security of the GitLab platform and its users.

When I was going through the GitLab GitHub repository https://github.com/gitlabhq/gitlabhq/blob/afe697c0cdecb1d9fae51c519137f8f879dc5678/doc/user/storage_management_automation.md . I found that the URL https://gitlab.com/gitlab-de redirects to https://gitlab.com/gitlab-da and the account gitlab-de username was publicly available. The attacker could have taken advantage of it hence I took over the following account

Also, on https://docs.gitlab.com/ee/user/storage_management_automation.html

Steps to reproduce

  1. Go to https://docs.gitlab.com/ee/user/storage_management_automation.html
  2. Search for gitlab-de in the page you can see many results which is being used for various purpose

for.eg

export GL_PROJECT_ID=48057080

curl --silent --header "Authorization: Bearer $GITLAB_TOKEN" "https://gitlab.com/api/v4/projects/$GL_PROJECT_ID/registry/repositories" | jq --compact-output '.[]' | jq --compact-output '.id,.location' | jq  
4435617  
"registry.gitlab.com/gitlab-de/playground/container-package-gen-group/docker-alpine-generator"

curl --silent --header "Authorization: Bearer $GITLAB_TOKEN" "https://gitlab.com/api/v4/registry/repositories/4435617?size=true" | jq --compact-output '.id,.location,.size'  
4435617  
"registry.gitlab.com/gitlab-de/playground/container-package-gen-group/docker-alpine-generator"  
3401613  

PoC

So without the company's permission, I don't think it is ethical to collect the IPs.

here is a sample https://gitlab.com/gitlab-de/pocforgitlab

Impact

An attacker can inject malicious codes this would have led to arbitrary code execution on the affected server, as well as allowing the attacker to add backdoors inside the affected project(s) during the build process...

How To Reproduce

Please add reproducibility information to this section:

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

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 documentation referenced a GitLab account that was not owned or controlled by GitLab, leaving it open for anyone to register.

Impact

An attacker could inject malicious code, potentially leading to arbitrary code execution on affected servers and allowing backdoors to be added during the build process.

What the attacker needed

The account is unclaimed; attacker registers the account; victim follows the documentation

How it was found

  1. Go to the GitLab storage management automation documentation page.
  2. Search for 'gitlab-de' on the page to find references to that account.
  3. Observe that the account was unclaimed and could be registered.

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 company's documentation tells users to download or use something from an account name, that account should belong to the company. Here, the account was not registered, so anyone could create it. If someone else had created it, they could have put harmful code in the projects that the documentation points to, and users following the guide might run that code.

What is Account takeover?

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.