Private merge request titles leaked to unauthorized users via pipeline widget
GitLab's pipeline view displayed related merge request titles to users who lacked permission to view merge requests, such as unauthenticated users on public projects with restricted merge requests or guest users in private projects. An attacker could read the titles of private merge requests, leaking potentially sensitive information.
GitLab
Originally disclosed on GitLab
- Fixed in 4 months
- Disclosed after 4 months
HackerOne report #717675 by xanbanx on 2019-10-18, assigned to @jeremymatos:
Hi GitLab Security Team,
Summary
GitLab recently added a feature to render the related merge requests on the pipelines view.
Here, GitLab is missing proper access control and always shows the related merge requests regardless if the visiting user has access to merge requests. In particular, the title of the merge requests are leaked to anyone who can visit pipelines but not the merge request. This leak can happen in two cases: First, in restricted public repos (merge requests are restricted) and for guest users in private projects. Guest users do not have access to the repository and to merge requests.
Steps to reproduce
Tested on GitLab Enterprise Edition 12.3.0-pre 0e052976891 (Canary)
- Create a public project and restrict merge requests to project members only
- Enable GitLab CI, push some code, and create a merge request
- As an unauthenticated user, goto
https://gitlab.com/<namespace>/<project>/pipelines/<pipeline-id>to view the pipeline. In the commit widget, the title of the related merge request is shown although the user does not have access to merge requests.
The same happens to for guest users of private projects
- Create a private project, push some code, and create a merge request
- Add a guest user to the project
- As the guest user, visit the pipeline in the frontend via
https://gitlab.com/<namespace>/<project>/pipelines/<pipeline-id>. Again, the title of the merge request is leaked to the guest user, who does not have access to the repository and merge requests.
Impact
Unauthorized users without access to merge requests can read the merge request titles showing on pipelines. Seems to have a similar impact as #435093
Examples
As an unauthenticated user, goto https://gitlab.com/wter23/test-mr-leak/pipelines/89855619 (Canary enabled). Here, you see the title of the related merge requests being leaked although you don't have access to the merge request.
What is the current bug behavior?
Users without access to merge requests can read the merge request title on the pipeline view.
What is the expected correct behavior?
The related merge request is not rendered if the visiting user does not have access to merge requests.
When looking into the code, it seems the PipelinePresenter#all_related_merge_requests in https://gitlab.com/gitlab-org/gitlab/blob/master/app%2Fpresenters%2Fci%2Fpipeline_presenter.rb#L128 returns merge requests although the user might not have access to merge requests.
Output of checks
This bug happens on GitLab.com
Best regards,
Xanbanx
Impact
See above.
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
Impact
Unauthorised users without access to merge requests could read the merge request titles shown on pipelines.
What the attacker needed
Public project with restricted merge requests; or private project with a guest user; no authentication needed for public case
The fix
The related merge request should not be rendered if the visiting user does not have access to merge requests.
How it was found
- Create a public project and restrict merge requests to project members only
- Enable GitLab CI, push some code, and create a merge request
- As an unauthenticated user, visit the pipeline page to see the merge request title
- Create a private project, push code, and create a merge request
- Add a guest user to the project
- As the guest user, visit the pipeline page to see the merge request title
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 proposed code change. Normally, only project members can see them. The pipeline page, which shows automated build results, also listed the titles of related merge requests without checking if the viewer was allowed to see them. So someone who could see the pipeline page could also read those titles.
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.