Skip to content
Business logic Disclosed report Beginner

Developers can block other users from creating files in the project

A developer could lock a file that does not exist, which then prevented other users from creating a file with that name. This could block the creation of important files such as the CI configuration.

GitLab

Originally disclosed on GitLab

  • Fixed in 2 hours
  • Disclosed after 2 hours

⚠️ 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 #1933595 by js_noob on 2023-04-04, assigned to @ottilia_westerlund:

Report | Attachments | How To Reproduce

Report

Summary

Hello team, a developer can block other project users from creating files. This can be done because of a missing check in the file locking mechanism, when a developer locks a file that doesn't exist it blocks all other users from creating a file with the same name.

Steps to reproduce

As an owner:

  1. Create a project and initalize with a readme
  2. Add a developer

As the developer:

  1. Attemp to lock any file in the project and intercept the request, the request should look something similar to the following
POST /api/graphql HTTP/2  
Host: gitlab.com  
Cookie: YOUR_COOKIES  
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0  
Accept: */*  
Accept-Language: en-US,en;q=0.5  
Accept-Encoding: gzip, deflate  
Referer: https://gitlab.com/test645811/project-1/-/blob/main/index.js  
Content-Type: application/json  
X-Csrf-Token: TGR94u0t2Bg8Z4OvrzJAdkDm07yFeUNtLKKH9xamVu5EmalVs6bWhBom4-ZovArmmG586uw3WCFeoOljSm3maQ  
X-Gitlab-Feature-Category: source_code_management  
Content-Length: 523  
Origin: https://gitlab.com  
Sec-Fetch-Dest: empty  
Sec-Fetch-Mode: cors  
Sec-Fetch-Site: same-origin  
Te: trailers

[{"operationName":"toggleLock","variables":{"filePath":"index.js","projectPath":"GROUP/PROJECT","lock":true},"query":"mutation toggleLock($projectPath: ID!, $filePath: String!, $lock: Boolean!) {\n  projectSetLocked(\n    input: {projectPath: $projectPath, filePath: $filePath, lock: $lock}\n  ) {\n    project {\n      id\n      pathLocks {\n        nodes {\n          id\n          path\n          __typename\n        }\n        __typename\n      }\n      __typename\n    }\n    errors\n    __typename\n  }\n}\n"}]  
  1. Change the filePath to the file path you want to block other users from creating, lets say lock.txt

As the owner:

  1. Try creating a new file called filePath
  2. Verify that you are blocked by custom lock
Solution

I believe the easiet solution in this case would be is just verifying the the file exists before appyling the lock.

Video/POC
bandicam_2023-04-04_10-40-54-684.mp4 From the original on GitLab

Impact

Developers can block other users from creating files, this could be a real issue in case of know files (ex: .gitlab-ci.yml)

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 file locking mechanism did not verify that the file existed before applying the lock.

Impact

Developers could block other users from creating files, which could be a real issue for known files such as the CI configuration.

What the attacker needed

A GitLab account with developer role; ability to intercept HTTP requests

The fix

The file should be verified to exist before applying the lock.

How it was found

  1. As an owner, create a project and add a developer.
  2. As the developer, attempt to lock any file and intercept the request.
  3. Change the filePath in the request to the name of a file that does not exist.
  4. As the owner, try to create a new file with that name and observe that it is blocked.

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 developer can lock a file to prevent others from editing it. The bug was that the lock could be placed on a file that was not there yet, so when someone tried to create that file later, they were blocked. This is like putting a reserved sign on an empty parking space so no one else can park there.

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.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.