Skip to content
Access control Disclosed report Intermediate

Issues from other project can be closed via merge request description when auto-merge is enabled

When auto-merge is enabled, an attacker can edit the merge request description to reference an issue from another project, causing that issue to be closed without permission when the merge request is merged. The attacker can close issues they do not have access to.

GitLab

Originally disclosed on GitLab

  • Fixed in 4 months
  • Disclosed after 4 months

⚠️ 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 #2781521 by xorz on 2024-10-15, assigned to GitLab Team:

Report | Attachments | How To Reproduce

Report

Summary

The doc of User responsibility when merging says " In both cases, the merge request widget shows information about the issue to close on merge", but it can be skipped and not shown to the reviewer by editing the merge request description to Closes test-group/project-b#1 when running auto merge.

Steps to reproduce
  1. setup a Gitlab instance with Ultimate license

** Login as Victim **

  1. create public project-a
  2. upload the CI yaml file project-a-ci-config.yml to .gitlab-ci.yml
  3. create public project-b
  4. create an issue and copy the issue reference test-group/project-b#1

** Login as Attacker **

  1. fork the project-a to project-a-fork
  2. create a merge request to project-a with a commit

** Login as Victim **

  1. click on Set to auto merge

** Login as Attacker **

  1. edit the merge request description to Closes test-group/project-b#1

  2. wait for the merge request to be merged

  3. then you should see the test-group/project-b#1 was closed by the Victim

Impact
  1. Attacker can close issues without permission by editing the merge request description.
Examples
What is the current bug behavior?
  1. Attacker can close issues without permissions.
What is the expected correct behavior?
  1. Attacker should not be able to close issues without permissions.
Relevant logs and/or screenshots
close-issues-with-auto-merge.mp4 From the original on GitLab
Output of checks
System information  
System:		  
Proxy:		no  
Current User:	git  
Using RVM:	no  
Ruby Version:	3.1.5p253  
Gem Version:	3.5.17  
Bundler Version:2.5.11  
Rake Version:	13.0.6  
Redis Version:	7.0.15  
Sidekiq Version:7.2.4  
Go Version:	unknown

GitLab information  
Version:	17.4.2-ee  
Revision:	e85e7bae1a9  
Directory:	/opt/gitlab/embedded/service/gitlab-rails  
DB Adapter:	PostgreSQL  
DB Version:	14.11  
URL:		http://gitlab.test  
HTTP Clone URL:	http://gitlab.test/some-group/some-project.git  
SSH Clone URL:	[email protected]:some-group/some-project.git  
Elasticsearch:	no  
Geo:		no  
Using LDAP:	no  
Using Omniauth:	yes  
Omniauth Providers:

GitLab Shell  
Version:	14.39.0  
Repository storages:  
- default: 	unix:/var/opt/gitlab/gitaly/gitaly.socket  
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell

Gitaly  
- default Address: 	unix:/var/opt/gitlab/gitaly/gitaly.socket  
- default Version: 	17.4.2  
- default Git Version: 	2.46.0  

Impact

  1. Attacker can close issues without permission by editing the merge request description.

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 merge request widget does not update or re-check the issues to be closed after the description is edited when auto-merge is enabled, so the victim does not see the change.

What the attacker needed

GitLab Ultimate license; Victim creates public projects; Attacker can fork project and create merge request; Victim enables auto-merge

How it was found

  1. Victim creates a public project and uploads a CI configuration.
  2. Victim creates another public project with an issue.
  3. Attacker forks the first project and creates a merge request.
  4. Victim sets the merge request to auto-merge.
  5. Attacker edits the merge request description to reference the issue from the other project.
  6. The merge request is merged and the issue is closed.

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, a merge request can automatically close issues when it is merged if the description contains a special phrase like 'Closes #123'. Normally, the person merging sees which issues will be closed. Here, because auto-merge was set, the attacker could change the description after the victim set auto-merge, and the victim did not see the updated list of issues to be closed. So the attacker could make the merge request close an issue in a different project that they do not have permission to close.

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.