bypass MR approval count by exploiting Race condition in merge request approval
A race condition in the merge request approval endpoint allowed a user to approve the same merge request multiple times by sending parallel requests. This could bypass the required number of approvals needed to merge.
GitLab
Originally disclosed on GitLab
- Fixed in 3 months
- Disclosed after 3 months
HackerOne report #470309 by flashdisk on 2018-12-20, assigned to asaba:
Hi,
Description:
I found a race condition issue when a user approves a merge request he can set a number of developers to approve the merge request in order to merge it, but this can be bypassed by firing the following HTTP request using multiple threads in parallel
POST /[user_name]/{project}/merge_requests/3/approvals HTTP/1.1
Host: gitlab.com
Connection: close
as an example at one of my projects I was able to approve the project twice as you see here:

Fix
add a lock on this endpoint when a user can approve a merge request.
thanks!
Impact
Race condition in merge request approval
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 approval endpoint lacks proper locking or atomicity, allowing concurrent requests to both pass the 'already approved' check and record multiple approvals.
Impact
An attacker could bypass the required number of approvals to merge a merge request.
What the attacker needed
Access to a project; ability to approve merge requests
How it was found
- Send multiple approval requests in parallel using multiple threads.
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.
Sending many approval requests at the same time can let a user approve a merge request more than once, bypassing the required approval count.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.