Reporter can read branch names and pipeline details even when the Repository option is disabled in the project via GET /api/v4/projects/{id}/packages

⚠️ 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 #3183740 by iamgk808 on 2025-06-09, assigned to @katwu:

Report | Attachments | How To Reproduce

Report

Summary

Once the Repository option is disabled in a project, no one can view the project code, branches, merge requests, or CI/CD details. However, I found a way where an attacker can still read branch names and pipeline details even when the Repository option is disabled
image.png
image.png

Steps to reproduce

two users - victim, attacker

Victim steps:

  1. Create a new group called hackerone & apply GitLab Ultimate trial to it

  2. In the group, create a private project called project-1

  3. In project-1, create a new branch called fix-bug-report
    image.png
    image.png

  4. In the fix-bug-report branch, create a file called package.json and add the following content, ==also replace 70651278 with your project ID==

{
  "name": "my-package",  
  "version": "1.0.0",  
  "publishConfig": {  
    "registry": "https://gitlab.com/api/v4/projects/70651278/packages/npm/"  
  }  
}
  1. Create another file called .gitlab-ci.yml
image: node:20

stages:  
  - publish

variables:  
  NODE_AUTH_TOKEN: "${CI_JOB_TOKEN}"

before_script:  
  - npm install

publish:  
  stage: publish  
  script:  
    - echo "//gitlab.com/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${NODE_AUTH_TOKEN}" > .npmrc  
    - npm publish

image.png

  1. A pipeline will run & create a package in deploy > Package registry& you can see the branch name & commit details
    image.png

  2. Then go to settings > project permissions & turn off the Repository option & save it
    image.png

  3. In deploy > Package registry, as you can see, the branch name & commit details are hidden
    image.png

  4. Now go to the project-1 >members section & invite the attacker user with the reporter role
    image.png

Attacker steps:

  1. go to project-1 & note the project id

image.png

  1. In this URL, change the 70651278 - with your project ID

https://gitlab.com/api/v4/projects/70651278/packages

  1. The attacker can see the branch names and pipeline details

image.png

Impact

An attacker can read branch names and pipeline details even when the Repository option is disabled in the project

Examples
What is the current bug behavior?

An attacker can read branch names and pipeline details even when the Repository option is disabled in the project

What is the expected correct behavior?

No one should be able to read the Repository contents

Relevant logs and/or screenshots
Output of checks

Impact

An attacker can read branch names and pipeline details even when the Repository option is disabled in the project

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

  • image.png
  • image.png
  • image.png
  • image.png
  • image.png
  • image.png
  • image.png
  • image.png
  • image.png
  • image.png

How To Reproduce

Please add reproducibility information to this section:

Assignee Loading
Time tracking Loading