MRs author can bypass merge requests approval rules and trick maintainers into accepting the MR
The merge request approval UI incorrectly showed 'merge request approved' when the MR author added themselves as an approver, even though no one had approved. An attacker could exploit this to trick maintainers into accepting an unapproved merge request.
GitLab
Originally disclosed on GitLab
- Fixed in 50 days
- Disclosed after 50 days
HackerOne report #953994 by vaib25vicky on 2020-08-08, assigned to @ngeorge1:
Hi,
In project settings merge requests approval rules is defined as

There is a bug in UI which displays merge request approved when MR author change the approver to himself. This doesn't happen if any user other than author is added as approver

The correct message should be like Requires approval from <name> which is displayed to other approvers but when author is the approver this is not happening.

Steps to reproduce
(Step-by-step guide to reproduce the issue, including:)
- Create a test public project having settings

- Login as other user who is not a member of the project
- Creates a MR and in the approval rules edit the
test

- Delete the current approver and add a public group where you are the member

- You'll see that
merge request approvedis displayed even though no one approve the MR

Impact
If maintainer has set that MR should be approve by security team before accepting then this bug can trick maintainers into accepting an unapproved MR in the project.
What is the current bug behavior?
The bug is displaying merge request is approved even when no one approve the MR
What is the expected correct behavior?
The correct behaviour should be Requires approval from <name> even when author make himself the approver
Output of checks
This bug happens on GitLab.com
Impact
MRs author can bypass merge requests approval rules and trick maintainers into accepting unapproved MR
Attachments
Warning: Attachments received through HackerOne, please exercise caution! [REDACTED]
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 UI logic for displaying approval status did not account for the case where the MR author is also an approver, incorrectly treating the author's own addition as an approval.
Impact
A maintainer could be tricked into accepting an unapproved merge request, bypassing the intended approval rules.
What the attacker needed
Public project with approval rules; attacker not a project member; attacker can create MR
How it was found
- Create a test public project with merge request approval rules set.
- Log in as a user who is not a member of the project.
- Create a merge request and edit the approval rule.
- Delete the current approver and add a public group where you are a member.
- Observe that 'merge request approved' is displayed even though no one approved the MR.
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, merge requests can require approval before they are merged. The interface wrongly displayed that the request was approved when the author made themselves the approver, even though no approval had actually happened. This could fool a maintainer into merging code that should have been checked.
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.