Skip to content
Access control Disclosed report Intermediate

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

  1. Creates a group with Ultimate trial
  2. Creates a public project lets say your-grp/foo-parent
  3. 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
  4. Define push rules in your-grp/foo-fork for example
a1.png
a1.png From the original on GitLab

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

f3.png
f3.png From the original on GitLab
  1. As owner creates a new file named test.exe in your-grp/foo-parent
  2. 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

  1. As developer role user use the projectSyncFork graphQL api

in the project your-grp/foo-fork

GraphQL

mutation m{  
	projectSyncFork(input:{clientMutationId:"111",projectPath:"your-grp/foo-fork",targetBranch:"main"}){  
		clientMutationId  
		errors  
		  
	}  
}

  1. After success, a new filed named test.exe is created in your-grp/foo-fork by developer user. This bypass the push rules of Prohibited 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:

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 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

  1. Create a group with Ultimate trial and a public project.
  2. Fork the project into another group with Ultimate trial.
  3. Define push rules on the fork, such as prohibiting files ending in jar or exe.
  4. Edit the protected branch rule to allow developers to push and merge.
  5. Create a file named test.exe in the parent project.
  6. 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.

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.