User Can Unlock File or Folder of Project That He Lock Even if The User Currently Dont Have Push Access To Project
A user who previously locked a file or folder in a GitLab project could still unlock it even after their access was reduced or removed, because the unlock action did not re-check current permissions. An attacker could use this to modify lock state without push access.
GitLab
Originally disclosed on GitLab
- Fixed in 3.2 years
- Disclosed after 3.2 years
HackerOne report #686801 by rafiem on 2019-09-03, assigned to jmatos_bgtvf:
Hi Team,
I have found improper access control in locking and unlocking files or folders in project. In this case, user that previously locked a file or folder in project can unlock them even if the user dont have permission to lock or unlock files and folders in the projects. In projects, user at least need to have access level of "Developer" to lock and unlock files. In public projects, even non project member can unlock the files or folder that he/she previously locked, meanwhile in private projects, the user needs to be atleast "Reporter" to unlock the file or folder he/she locked as "Developer" or higher. Sure, there is a Maintainer role that can lock and unlock any files and folder, but in this case, user that dont have push access to the project should not be make action on unlock file or folder, even if the file or folders is previously locked by them.
Proof of Concept
1.) User A have public project and private project
2.) User A invite User B as "Developer" to both of the project
3.) User B lock a file in User A private and public project
4.) User A then make User B as non-member in public project and down the access level of User B to "Reporter" in private project
5.) Notice that User B cannot unlocked the file when viewing the content of the file : https://gitlab.com/<User A>/<project name>/blob/<branch name>/<name of locked file> , it will give error response.
5.) But, User B can still unlock the file that he/she previously locked in : https://gitlab.com/<User A>/<project name>/path_locks
<>PoC video attached
Impact
Unauthorized User (that dont have push access) to the project can still unlock the file or folder that he/she previously locked
Best Regards,
@rafiem
Attachments
Warning: Attachments received through HackerOne, please exercise caution!
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 unlock action only checked that the user had created the lock, not whether they still had permission to modify locks.
Impact
An unauthorised user without push access could still unlock files or folders they had previously locked, potentially disrupting project workflows.
What the attacker needed
User previously locked a file; User's access later reduced or removed
How it was found
- User A has a public and a private project.
- User A invites User B as Developer to both projects.
- User B locks a file in both projects.
- User A removes User B from the public project and changes User B to Reporter in the private project.
- User B cannot unlock the file from the file view page.
- User B can still unlock the file from the path_locks page.
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, you can 'lock' a file to stop others from changing it. The report found that if someone locked a file and later lost their permission to edit the project, they could still unlock that file. This means the system didn't check their current rights when they tried to unlock.
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.