Skip to content
Access control Disclosed report Intermediate

Revoked User can approve a Merge Request created by him via approve/unapprove API which leads to Merge request info leak

A user demoted to Guest role could still use the approvals API to approve or unapprove a merge request they created, and the API response leaked merge request details they should no longer see. This allowed a revoked user to access confidential information.

GitLab

Originally disclosed on GitLab

  • Fixed in 6 months
  • Disclosed after 6 months

HackerOne report #1198317 by muthu_prakash on 2021-05-15, assigned to GitLab Team:

Report | How To Reproduce

Report

Summary

In Gitlab when a user is demoted to Guest role, the Guest user will not be able to view and edit the Merge requests in a project even if the merge request is created by him. But the Guest user can use the Approvals API to approve/unapprove the merge request even after the User is demoted to Guest. This API also leaks the Merge request details which the guest user is not supposed to view.

Steps to reproduce
  • Created a new Project with private access
  • Created a new file in master branch (Made some changes )
  • Invited a user with a maintainer role.
  • From the maintainer role account created a new branch named test, made some changes.
  • After that from project admin account I created a Merge request with source branch as test and target branch as master.
  • Assigned that merge request to the maintainer role access user.
  • After creating the merge request, from project admin account demoted the maintainer role user to Guest role
  • From demoted user account I created a personal access token with all the available scopes selected
  • Using API client sent a POST request to the approvals endpoint
    Sample endpoint:
  • This API endpoint will respond with 201 status with the merge request details which the Guest user is not supposed to approve and view.
Impact

Demoted users can approve the merge requests created by them and can view the confidential data of those merge requests once their role revoked. This leads to sensitive info disclosure to unauthorised users

What is the current bug behavior?

Demoted users can approve the merge requests created by them and can view the confidential data of those merge requests once their role is revoked

What is the expected correct behavior?

Demoted users should be blocked from approving the merge requests created by them and viewing the confidential data of those merge requests once their role is revoked

Output of checks

This bug happens on GitLab.com

Impact

Demoted users can approve the merge requests created by them and can view the confidential data of those merge requests once their role revoked. This leads to sensitive info disclosure to unauthorised users

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 approvals API endpoint did not re-check the user's current role or project membership before allowing the action and returning merge request data.

Impact

A demoted user could approve their own merge request and view confidential merge request details, leading to sensitive information disclosure.

What the attacker needed

A GitLab account; project with merge requests; user demoted to Guest role; personal access token with all scopes

The fix

The approvals API should check the user's current role and block demoted users from approving or viewing merge requests they no longer have access to.

How it was found

  1. Create a private project and a file in the master branch.
  2. Invite a user with maintainer role and have them create a branch with changes.
  3. As admin, create a merge request from that branch to master and assign it to the maintainer.
  4. Demote the maintainer to Guest role.
  5. As the demoted user, create a personal access token with all scopes.
  6. Send a POST request to the approve or unapprove API endpoint for that merge request.

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.

When someone's access to a project is reduced, they should lose the ability to see or change things. Here, a user whose role was lowered could still use a special web address (API) to approve a code change request and see its private details. The system did not check the user's new, lower permissions for that action.

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.