Skip to content
Access control Disclosed report Intermediate

locked file able to edit by dev role user using projectSyncFork graphQl api

The projectSyncFork GraphQL mutation does not check whether a file is locked, allowing a developer to update a locked file in a fork. An attacker with developer role could bypass the file lock and modify protected content.

GitLab

Originally disclosed on GitLab

  • Fixed in 5 days
  • Disclosed after 5 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 #1890808 by vaib25vicky on 2023-03-03, assigned to GitLab Team:

Report | Attachments | How To Reproduce

Report

Summary

Locked file is updated by another user of the project using projectSyncFork graphQL api.
projectSyncFork graphQL api don't check whether file is locked or not. And this allows another user who didn't locked the file to update it contents.

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. Updates your-grp/foo-parent file example README.md
5. Your fork your-grp/foo-fork should be showing 1 commit behind the upstream repository msg

f1.png
f1.png From the original on GitLab
  1. As owner locked the file README.md in your fork project your-grp/foo-fork. Now, only you can edit this file no one else.
f2.png
f2.png From the original on GitLab
  1. 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 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, your-grp/foo-fork lock file by owner README.md should be updated by developer user

Impact

projectSyncFork graphQL api don't check whether file is locked or not. And this allows another user who didn't locked the file to update it contents.
This bug bypasses the owner expectations from the locked file or directory feature and allows another users to update the contents.

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

The projectSyncFork GraphQL mutation lacks a check for file locks before updating files.

Impact

A developer could bypass file locks and modify locked files, violating owner expectations.

What the attacker needed

Ultimate trial group; public project; fork in another group; developer role user

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. Update a file in the parent project so the fork is behind.
  4. Lock the file in the fork project.
  5. Set protected branch rule to allow Developers and Maintainers to push and merge.
  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.

A file lock is meant to stop people from changing a file. The projectSyncFork feature lets you update a fork from its parent project, but it forgot to check if the file was locked. So a user with developer access could still change a locked file.

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.