Skip to content
Access control Disclosed report Intermediate

Removed Developer can continue viewing the source code of a private project

A removed developer could continue viewing the source code of a private project by creating a private fork and merge requests before removal. After removal, the attacker could still see updated source code through the merge requests in their fork.

GitLab

Originally disclosed on GitLab

  • Fixed in 7 days
  • Disclosed after 7 days

⚠️ 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 #2082551 by theluci on 2023-07-24, assigned to @cmaxim:

Report | Attachments | How To Reproduce

Report

Hello,

Background

Gitlab provides a feature to create a fork of a project.
Gitlab also provides a feature using which Developers can create merge requests between forks.

Vulnerability

When a merge request is created from a private project victim-project to one of its forks victim-project-fork (Private project as well), Only the members of the victim-project-fork has the ability to view, edit as well as delete the merge request.

A malicious developer of victim-project can utilize the above to create a merge request from victim-project to victim-project-fork and continue viewing the source code and repository of victim-project even after malicious developer has been removed.

Attack flow looks as follows,

  • victim is the Owner of victim-project
  • attacker is a Developer of victim-project
  1. attacker creates a private fork of victim-project in his Personal namespace victim-project-fork.
  2. attacker creates merge requests from every branch in victim-project to their respective branches in victim-project-fork.
  3. attacker is removed from victim-project.
  4. victim makes some changes in victim-project.
  5. attacker goes to the merge requests in victim-project-fork and continues to be able to view the repository and source code of victim-project.

Steps to reproduce

  1. victim creates a private group victim-group and a private project victim-project inside.

  2. victim goes to victim-group membership page https://gitlab.com/groups/<victim-group>/-/group_members and adds attacker as Developer.

  3. victim goes to victim-project and creates branch another-branch.

  4. attacker goes to victim-project and creates a private fork in his Personal namespace victim-project-fork.

  5. attacker goes to https://gitlab.com/<victim-group>/<victim-project>/-/merge_requests/new,

    • attacker creates a merge request from another-branch in victim-project to another-branch in victim-project-fork
    • attacker creates a merge request from main branch in victim-project to main branch in victim-project-fork
  6. victim removes attacker from victim-group.

  7. victim goes to victim-project and makes some changes in main branch as well as another-branch.

  8. attacker goes to victim-project-fork.

  9. attacker goes to https://gitlab.com/<attacker_username>/<victim-project-fork>/-/merge_requests and selects the required merge request.

  10. attacker goes to Changes tab and is able to see the updated source code in victim-project.

As can be seen, attacker is able to view the repository and source code of victim-project.

POC

24july-1.mp4 From the original on GitLab

Output of checks

This bug happens on GitLab.com (Probably on instance too).

Impact

A Removed Developer can continue viewing source code of a private project

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, merge requests between a private project and its fork retain access to the source project's repository even after the user is removed from the source project.

What the attacker needed

Attacker is a Developer in the victim project; attacker creates a private fork; attacker creates merge requests before removal; victim removes attacker and updates code

How it was found

  1. Victim creates a private group and a private project inside it.
  2. Victim adds attacker as Developer to the group.
  3. Victim creates a branch in the project.
  4. Attacker creates a private fork in their personal namespace.
  5. Attacker creates merge requests from branches in the victim project to corresponding branches in the fork.
  6. Victim removes attacker from the group and makes changes to branches.

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 developer can create a copy (fork) of a project and propose changes (merge requests) between the original and the fork. Normally, when someone is removed from a project, they lose access. Here, the removed developer kept access to the original project's code through the merge requests they had created earlier.

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.