Skip to content
Access control Disclosed report Intermediate

Disclosure of Template File from Private Project

An API endpoint for group-level file templates lacked access control, allowing an unauthenticated user to retrieve a template file from a private project. This could expose sensitive information contained in configuration files such as Dockerfiles.

GitLab

Originally disclosed on GitLab

  • Fixed in 3.8 years
  • Disclosed after 3.8 years

HackerOne report #453050 by ngalog on 2018-11-30:

Summary:

There is a new feature in 11.5, which allow user to add custom private template file to a group, that when the group project create a new file, they can use the template.

There is no access control at that endpoint, which allow unauthorized user to view private project's template even they are not allowed to.

Setting Up the Environment:

  • Create a public group with gold plan
  • Create a private project for example with name privateproject
  • In Public Group set privateproject file as template, as documented in (here)[https://docs.gitlab.com/ee/user/admin_area/settings/instance_template_repository.html#configuration] and (here)[https://docs.gitlab.com/ee/user/group/#group-level-file-templates-premium]
  • Then create a folder in privateproject with name Dockerfile and create a file inside that directory name test.dockerfile
  • Create another public project in the public group, jot down the id
  • finally, as a unauthenticated user, visit https://gitlab.com/api/v4/projects/{public_project_id_in_group}/templates/dockerfiles/test

You will see the template file that is supposed to be private from public user

Real life poc in gitlab.com:

Link for my public project: https://gitlab.com/new-jjj-groupaaa/newnewthing/

Link for my private template file: https://gitlab.com/api/v4/projects/9696224/templates/dockerfiles/cuyoyo

Link for my private project with private template file: https://gitlab.com/new-jjj-groupaaa/awesome

Dockerfile and other config file could easily contains private info for that group, that is why I think this has high impact

Impact

Disclosure of Template File from Private Project

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 template API endpoint did not verify that the requesting user had access to the private project that supplied the template.

Impact

An unauthenticated attacker could read private template files, which may contain sensitive configuration details.

What the attacker needed

A public group with a gold plan; a private project used as template source; a public project in the same group; no authentication required

How it was found

  1. Create a public group with a gold plan.
  2. Create a private project and set a file from it as a group-level template.
  3. Create a public project in the same group and note its ID.
  4. As an unauthenticated user, request the template endpoint using the public project's ID and the template name.
  5. Observe the private template file contents returned.

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.

A private project is meant to be visible only to authorised users. The template feature let a group reuse files from a private project, but the API that served those templates did not check whether the requester was allowed to see the private project. As a result, anyone could fetch the file using a public project's ID.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.