Able to create project with unlimited repository size by Project Import
A low-privilege user could bypass the repository size limit by editing the project export file to set the size limit to zero before importing. This allowed creating a project with an unlimited repository size.
GitLab
Originally disclosed on GitLab
- Fixed in 3.0 years
- Disclosed after 3.0 years
HackerOne report #420258 by ngalog on 2018-10-07:
Impact
Attacker could create a project with unlimited repository size as low level privilege user
Description
This is achieved by using the project import function, by changing the value of "repository_size_limit":null to "repository_size_limit":0 in project.json in gitlab export file, then tar with modified project.json, and import the tar file, it will allow user to create project with unlimted repository size
Steps to reproduce
- create project, export the project, download the export
- untar the profile with this cmd
tar -vxzf export.tar.gz - use your favourite text editor to change the project.json, from
"repository_size_limit":nullto"repository_size_limit":0 - tar all files back with this cmd
tar -cvzf import.tar.gz - upload the tar import to gitlab.com
You will notice that repostiory now has unlimtied repo size.
PoC: Look at https://gitlab.com/golduserngalog/importinifinete/
You will see the repo size is unlimited
Impact
Attacker could create a project with unlimited repository size as low level privilege user
Proposed solution
Ignore repository_size_limit during Import and rely on a default/inherited value/whichever way it's configured.
Implementation plan
- ~backend Add
:repository_size_limittoexcluded_attributes.projectin https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/import_export/project/import_export.yml#L162, - ~backend remove
:repository_size_limitfrom:Projectin https://gitlab.com/gitlab-org/gitlab/blob/master/spec/lib/gitlab/import_export/safe_model_attributes.yml#L559,
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
The import process trusted the repository_size_limit value from the uploaded export file instead of ignoring it and applying the instance's default or configured limit.
Impact
A low-privilege user could create a project with an unlimited repository size.
What the attacker needed
A low-privilege account; ability to export and import projects
How it was found
- Create a project and export it, then download the export.
- Extract the export archive.
- Edit project.json to change the repository size limit from null to zero.
- Repackage the files into a new archive.
- Upload the modified archive as a project import.
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.
GitLab lets you export a project to a file and import it later. The export file contains settings, including a limit on how large the repository can be. By editing that file to set the limit to zero, the importer treated zero as 'no limit', so the user got an unlimited repository.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.