Skip to content
Access control Disclosed report Beginner

Guest user with Admin merge request permissions can see the approval rules

A guest user with the admin_merge_request custom permission could view merge request approval rules via the API, even though the documentation states this permission does not allow viewing approval rules. An attacker with such a role could see approval rules they should not have access to.

GitLab

Originally disclosed on GitLab

  • Fixed in 40 days
  • Disclosed after 40 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 #2274176 by ashish_r_padelkar on 2023-12-05, assigned to @cmaxim:

Report | Attachments | How To Reproduce

Report

Summary

Hello,

As per this documentation, https://docs.gitlab.com/ee/user/custom_roles.html#available-permissions, admin_merge_request permission doesnt allow to view merge request approval rules.

Screenshot_2023-12-05_at_11.20.54_PM.png
Screenshot_2023-12-05_at_11.20.54_PM.png From the original on GitLab

However, using API, such users can.

Steps to reproduce

1.Go to https://gitlab.com/groups/groupnov2023/-/settings/roles_and_permissions and create a role AdminMergeRole_1 with Guest template with admin_merge_request permission.

2.Now go to https://gitlab.com/groups/groupnov2023/-/group_members and add User_A with above role AdminMergeRole_1.

3.Create a new merge request at https://gitlab.com/groupnov2023/Novproject/-/merge_requests. While creating merge request, you will be able to create approval rules like below.Create couple of approval rules.

Screenshot_2023-12-05_at_11.25.47_PM.png
Screenshot_2023-12-05_at_11.25.47_PM.png From the original on GitLab

4.Login as User_A.

5.Go to the merge request created above at https://gitlab.com/groupnov2023/Novproject/-/merge_requests/1.

6.You wont be able to edit the merge request as intended so you can not view or edit approval rules.

7.However, you can use this API https://gitlab.com/api/v4/projects/48419568/merge_requests/1/approval_settings and you will be able to see the Approval Rules in response which is against the documentation of the Admin merge request permissions.

They can also see all the approval rules created by group owners at https://gitlab.com/api/v4/projects/48419568/approval_settings

What is the current bug behavior?

Guest user with Admin merge request permissions can see the approval rules which is against the documentation.

What is the expected correct behavior?

API https://gitlab.com/api/v4/projects/48419568/merge_requests/1/approval_settings should not be accessible to such users.

Output of checks

This bug happens on GitLab.com

Regards,
Ashish

Impact

Guest user with Admin merge request permissions can see the approval rules

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 API endpoint for approval settings did not check the admin_merge_request permission correctly, allowing users with that permission to access approval rules despite documentation stating otherwise.

What the attacker needed

A custom role with admin_merge_request permission; a user assigned that role; a merge request with approval rules

How it was found

  1. Create a custom role with Guest template and admin_merge_request permission.
  2. Add a user with that role to the group.
  3. Create a merge request with approval rules.
  4. Log in as the user with the custom role.
  5. Access the merge request approval settings API endpoint to view approval rules.

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, custom roles let you give users specific permissions. The admin_merge_request permission is meant to let someone manage merge requests but not see approval rules. However, the API did not enforce this restriction, so a user with that permission could see approval rules they should not see.

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.