Guests can disclose the full source code of projects using custom group-level templates
A guest user could create a project from a group-level template they cannot read, disclosing the full source code of private projects. The attacker could also use templates from a group they are not a member of.
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 #2480126 by js_noob on 2024-04-26, assigned to GitLab Team:
Report | Attachments | How To Reproduce
Report
Summary
Hello team, according to the docs, only group members are allowed to use its templates to create projects in other groups. On the other hand, as known, guest users can't access the source code in private projects, you can verify this by searching for "View project code" here. However, a guest user can abuse the custom group-level templates and disclose the full source code of private projects associated with that template group.
In the below example, we have:
- A parent group:
- projects sub-group (no role for the attacker at the group level):
- private project - where the attacker has a guest role
- templates sub-group (attacker has developer role in this sub-group):
- projects sub-group (no role for the attacker at the group level):
The result is, that the attacker will create a project in the projects subgroup, using that project template that he can't read its source code, disclosing all of its code.
Steps to reproduce
As an owner:
- Create a group and apply the ultimate trial to it
- Create 2 subgroups in that group let's call them,
projectsandtemplates - Navigate to https://gitlab.com/groups/MAIN_GROUP/-/edit and under "Custom project templates", select the
templatessubgroup - Create a project in the
templatessubgroup - Invite USER_2 as a guest to that created project and as a developer to the
projectsgroup
As User 2:
- Verify that you can't access the source code of the project created in the
templatessubgroup - Verify that you can't create projects from the group templates in the
projectstemplate

- Navigate to the
projectssubgroup, and start creating a new project process - Upon submitting intercept the request, and add the following to the body of the fired request, but make sure to replace IDs
&project%5Btemplate_project_id%5D=PROJECT_IN_TEMPLATES_ID&project%5Buse_custom_template%5D=true&project%5Bgroup_with_project_templates_id%5D=TEMPLATES_SUBGROUP_ID
10. Verify that a new project is created from the template, disclosing all of the source code
Examples
What is the current bug behavior?
There are 2 issues here:
- Non-group members can use templates from that group and create them in other groups.
- Guests can create projects from templates they don't have "full-read" access to.
What is the expected correct behavior?
- Non-group members shouldn't be able to use templates from that group and create them in other groups, even if they are project members.
- Guests shouldn't be able to create projects from templates they don't have "full-read" access to.
Output of checks
This bug happens on GitLab.com
Impact
Guests can disclose the full source code of private projects.
Attachments
Warning: Attachments received through HackerOne, please exercise caution!
How To Reproduce
Please add reproducibility information to this section:
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 project creation endpoint did not check that the user had read access to the template project or was a member of the template group.
Impact
A guest could disclose the full source code of private projects by creating a new project from a template they cannot read.
What the attacker needed
Attacker has guest role on a private project; attacker has developer role in another subgroup; group-level templates configured; attacker can intercept requests
How it was found
- As an owner, create a group with two subgroups: projects and templates.
- Set the templates subgroup as the custom project templates group.
- Create a project in the templates subgroup.
- Invite the attacker as a guest to that project and as a developer to the projects subgroup.
- As the attacker, start creating a project in the projects subgroup and intercept the request.
- Add parameters to the request body to use the template project and template group, then submit.
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.
In GitLab, a guest is a low-permission user who normally cannot see private project code. A group-level template lets you create new projects from an existing project. The bug let a guest use a template from a private project they could not read, and the new project exposed all the code.
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.