Skip to content
Access control Disclosed report Beginner

Reject manually pushing a merge commit when merge request approval requirements are not met

A user with push permissions could bypass merge request approval requirements by merging locally and pushing the resulting merge commit, which closed the merge request without the required approvals. The attacker could merge their own code into a protected branch despite the merge request settings.

GitLab

Originally disclosed on GitLab

  • Fixed in 3.5 years
  • Disclosed after 3.5 years

Problem to solve

A user with push permissions can push a merge commit, closing the open merge request, and potentially bypassing merge requirements.

This is not a security issue because the user has push permissions, and can already push whatever they want.

Further details

When configuring merge request approval requirements, push permissions should be restricted typically, to prevent the merge request controls being bypassed.

<details><summary>Original HackerOne report</summary>

HackerOne report #683906 by hd7exploit on 2019-08-28, assigned to jmatos_bgtvf:

Summary

Improper Access Control on Merge Request, lead to a User can merge his code into a branch without Merge Request setting.

Steps to reproduce

2 users created as below:
-Coda1 as Developer
-Coda3 as Owner

  1. Coda1 create a branch Master2.
  2. Coda3 create a branch Master1.
  3. Coda1 create a Merge Request from Master2 to Master1 and assign Coda3 for approval.
  4. Coda1, On user interface of Merge Request, Coda1 can not merge Merge Request because of setting as image 2.setting.png
  5. Coda1 can bypass the setting via merging Master2 into Master1 on locally, then push Master1 to Gitlab as image 1.Result.png

Impact

User can merge MR without Merge Request setting.

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

</details>

Proposal

If there is an open merge request, and a merge commit it pushed for that merge request, it should be rejected unless all approval requirements have been met.

Links / references

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 server did not check whether an incoming push contained a merge commit for an open merge request that had not yet met its approval requirements.

Impact

A user with push permissions could merge code into a branch without the required merge request approvals, bypassing the configured controls.

What the attacker needed

Push permissions to the repository; an open merge request with approval requirements

How it was found

  1. Create two users: one as Developer and one as Owner.
  2. The Developer creates a branch, and the Owner creates another branch.
  3. The Developer opens a merge request from their branch to the Owner's branch and assigns the Owner for approval.
  4. The Developer cannot merge the merge request through the interface because of the approval setting.
  5. The Developer merges the branches locally and pushes the result to the target branch, bypassing the setting.

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.

A merge request is a way to propose changes to a code repository and have them reviewed before they are added. Normally, a project can require that certain people approve the merge request before the code is merged. This report shows that someone with permission to push code directly could skip that approval step by doing the merge on their own computer and then pushing the result to the server.

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.