Elasticsearch leaks default branch name for public projects with private repositories
A search feature in GitLab disclosed the default branch name of public projects with private repositories by manipulating URL parameters. An attacker could learn the default branch name without having access to the repository.
GitLab
Originally disclosed on GitLab
- Fixed in 40 days
- Disclosed after 40 days
HackerOne report #1418431 by rpadovani on 2021-12-07, assigned to @rshambhuni:
Report | Attachments | How To Reproduce
Report
Summary
Building the right search query, it is possible to retrieve the default branch name of a public project with private repository access.
Steps to reproduce
- The project needs to have Elasticsearch indexing active;
- You do a search for anything at project level
- You change the parameters of the URL. In particular, you set
scope=blob, andrepository_ref=null - The result page will tell you
Advanced search is disabled since null is not the default branch; search on <default_branch> instead.
Impact
Disclosure of the name of the default branch of any public project with private repo.
Examples
What is the current bug behavior?
While I cannot access the code, I can retrieve the default branch name
What is the expected correct behavior?
The advice of on which branch should I search, should be deactivated if I cannot access the repo
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
Impact
Disclosure of the name of the default branch of any public project with private repo.
Attachments
Warning: Attachments received through HackerOne, please exercise caution!
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 search feature did not check whether the user had permission to access the repository before revealing the default branch name in an error message.
Impact
An attacker could learn the default branch name of any public project with a private repository, which is normally not accessible.
What the attacker needed
Elasticsearch indexing enabled; Public project with private repository
How it was found
- Ensure the project has Elasticsearch indexing active.
- Perform a search at the project level.
- Change the URL parameters to set scope=blob and repository_ref=null.
- Observe the result page revealing the default branch name.
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.
GitLab has a search function that can search code. When you search within a project, it normally searches the default branch. If you try to search a branch that doesn't exist, it tells you the correct branch name. The bug is that it gave this hint even when you don't have permission to see the code, revealing the branch name.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.