Project Reporters/Developers can see usage quota using graphql
The GraphQL endpoint returned project storage statistics to users with Reporter or Developer roles, even though the permissions documentation says only Maintainers may view usage quota. An attacker with a low-privileged project role could therefore read storage usage figures they were not meant to see.
GitLab
Originally disclosed on GitLab
- Fixed in 4 months
- Disclosed after 4 months
HackerOne report #1392773 by ashish_r_padelkar on 2021-11-06, assigned to @ngeorge1:
Report | How To Reproduce
Report
Summary
Hello,
As per permission documentation at https://docs.gitlab.com/ee/user/permissions.html View Usage quota can only been seen by project Maintainers.
However, using the graphql query, user with reporter or developer roles can too see these info.
Steps to reproduce
-
Login as Reporter or Developer in any project and navigate to
https://gitlab.com/<NameSpace>/<ProjectName>/-/usage_quotas#storage-quota-taband you will receive 404 error page which is expected behaviour as per documentation. -
Now run a below graphql query . (This graphql query is actually sent in background when maintainers open their usage quota page)
POST /api/graphql HTTP/2
Host: gitlab.com
Cookie: <YourCookie>
Content-Length: 451
X-Gitlab-Feature-Category: utilization
X-Csrf-Token: <YourCSRFToken>
Sec-Ch-Ua-Mobile: ?0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36
Content-Type: application/json
Accept: */*
Sec-Ch-Ua-Platform: "macOS"
Sec-Ch-Ua: "Google Chrome";v="95", "Chromium";v="95", ";Not A Brand";v="99"
Origin: https://gitlab.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://gitlab.com/g2423/githubimport/-/usage_quotas
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
[{"operationName":"getProjectStorageCount","variables":{"fullPath":"g2423/githubimport"},"query":"query getProjectStorageCount($fullPath: ID!) {\n project(fullPath: $fullPath) {\n id\n statistics {\n buildArtifactsSize\n pipelineArtifactsSize\n lfsObjectsSize\n packagesSize\n repositorySize\n snippetsSize\n storageSize\n uploadsSize\n wikiSize\n __typename\n }\n __typename\n }\n}\n"}]
Replace fullPath with your project full path and send the request.
- You should see all the usage quota in response which is expected to be seen only by project Maintainers as per documentation.
What is the current bug behavior?
Project reporters or developers can see usage quota using graphql query.
What is the expected correct behavior?
Only Maintainers should be able to see this as per documentation.
Output of checks
This bug happens on GitLab.com
Regards,
Ashish
Impact
Project Reporters/Developers can see usage quota using graphql
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 GraphQL resolver for project statistics did not enforce the Maintainer-only permission that the web page enforced.
What the attacker needed
A Reporter or Developer role in a project; an authenticated session
How it was found
- Log in as a Reporter or Developer and open the usage quota page, which returns a 404 as expected.
- Send a GraphQL request asking for the project's storage statistics, using the project's full path.
- Observe the usage quota figures returned in the response.
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.
The usage quota web page refused junior users, but a GraphQL query still returned the storage figures to them.
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.