push rule bypass using projectSyncFork graphQl api
The projectSyncFork GraphQL mutation did not enforce push rules, allowing a developer to sync a fork and introduce a file that violated the prohibited file name rule. An attacker could bypass push rules to add disallowed files.
GitLab
Originally disclosed on GitLab
- Fixed in 4 days
- Disclosed after 4 days
⚠️ 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 #1890962 by vaib25vicky on 2023-03-03, assigned to GitLab Team:
Report | Attachments | How To Reproduce
Report
Summary
projectSyncFork graphQL api don't check push rules and thus allows bypassing them.
`
Steps to reproduce on Gitlab.com
As owner of the group your-grp
- Creates a group with Ultimate trial
- Creates a public project lets say
your-grp/foo-parent - Creates fork of this project, either in the same group or different group (make sure other group also has Ultimate trial). Lets say
your-grp/foo-fork - Define push rules in
your-grp/foo-forkfor example

It means that commit user must end with email @[@]sub.company.com and file ending with jar or exe are prohibited.
5. As owner edit protected branch rule Allowed to push and merge with value Developer & Maintainer in your-grp/foo-fork

- As owner creates a new file named
test.exeinyour-grp/foo-parent - As owner invites another user with developer role to the fork project
your-grp/foo-fork
As developer of the project your-grp/foo-fork
- As developer role user use the projectSyncFork graphQL api
in the project your-grp/foo-fork
mutation m{
projectSyncFork(input:{clientMutationId:"111",projectPath:"your-grp/foo-fork",targetBranch:"main"}){
clientMutationId
errors
}
}
- After success, a new filed named
test.exeis created inyour-grp/foo-forkby developer user. This bypass the push rules ofProhibited file names:(jar|exe)$
Impact
projectSyncFork graphQL api don't check push rules and thus allows bypassing them. By using this bug all push rules can be bypass by the attacker
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 projectSyncFork mutation did not apply the same push rule validations as regular git pushes.
Impact
An attacker with developer role could bypass push rules to introduce prohibited files, such as executables, into a repository.
What the attacker needed
Ultimate trial group; Developer role on fork project; Push rules configured on fork
How it was found
- Create a group with Ultimate trial and a public project.
- Fork the project into another group with Ultimate trial.
- Define push rules on the fork, such as prohibiting files ending in jar or exe.
- Edit the protected branch rule to allow developers to push and merge.
- Create a file named test.exe in the parent project.
- Invite a user with developer role to the fork project.
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.
Push rules are restrictions on what can be pushed to a repository, like blocking certain file types. The projectSyncFork feature lets you update a fork with changes from its parent, but it skipped those checks. So a user with developer access could bring in a forbidden file, like an executable, even though normal pushes would be blocked.
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.