Private/internal repository enumeration via bruteforce on a vulnerable URL
GitLab returned different Content-Type headers for existing private repositories versus non-existent ones when accessed unauthenticated. An attacker could use this difference to enumerate private repository names via brute-force.
GitLab
Originally disclosed on GitLab
- Fixed in 4 months
- Disclosed after 4 months
HackerOne report #637903 by brxxn on 2019-07-09:
Summary
This bug allows an attacker to determine whether or not a private repository exists. By navigating to https://gitlab.com/[owner]/[repo]/blob/master/test.txt while being signed out, you can determine whether or not a private repository exists. If it does not exist, it will respond with a text/plain response. Otherwise, it will respond with a text/html response. It does not allow file enumeration.
Knowing this, an automated tool could be created to determine whether or not a private repository exists. Combined with a dictionary attack, brute-force could be used to discover work-in-progress or unannounced projects for a company.
Steps to reproduce
- Open two browser sessions
- On one browser session, create a private or internal repository.
- On the other browser session, visit the following URL:
https://gitlab.com/[owner]/[repo]/blob/master/test.txt - Notice that it shows the login page.
- Go to a non-existent repository.
- The non-existent repository shows a
text/plainresponse without a login form.
Examples
Private project that exists: https://gitlab.com/brxxn/private-test-project/blob/master/test.txt
Project that does not exist: https://gitlab.com/brxxn/does-not-exist/blob/master/test.txt
What is the current bug behavior?
Links to non-existent repositories return a text/plain response, when it should return the HTML response with a login form.
What is the expected correct behavior?
The response contains HTML when the text/plain response.
Output of checks
This bug happens on GitLab.com
Impact
Users and corporations could have private projects hosted on a private GitLab instance or on GitLab.com discovered or upcoming ones revealed. An attacker could easily create a tool to brute-force URLs with a dictionary and checking the Content-Type header for a particular organization or user.
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 application handled non-existent repositories differently from existing private ones, returning a plain text response instead of the standard HTML login page.
Impact
An attacker could brute-force repository names to discover private or unannounced projects, without accessing file contents.
What the attacker needed
No authentication required; knowledge of owner name; dictionary of repository names
How it was found
- Open two browser sessions.
- In one session, create a private or internal repository.
- In the other session, visit the repository's blob URL for a file.
- Observe that it shows the login page.
- Visit a non-existent repository's blob URL.
- Observe that it returns a text/plain response without a login form.
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.
When you visit a private repository without logging in, GitLab should show a login page. But for repositories that don't exist, it returned a plain text error instead. This difference let attackers guess which private repository names exist by checking the response type.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.