Group Maintainers can Create/Delete Deploy tokens using API
A group maintainer could create and delete group deploy tokens through the API, even though the UI restricts these actions to group owners. An attacker with maintainer rights could create a deploy token to access repositories or delete existing tokens, disrupting deployments.
GitLab
Originally disclosed on GitLab
- Fixed in 3 months
- Disclosed after 3 months
HackerOne report #828154 by ashish_r_padelkar on 2020-03-24, assigned to @dcouture:
Summary
Hello,
New API release in 12.9 of Deploy tokens,A group maintainer is able to create/delete group deploy tokens which i think is not intended. These create/delete functionality is only available to group owners in group settings in UI.
https://docs.gitlab.com/ee/api/deploy_tokens.html#create-a-group-deploy-token
Steps to reproduce
- As a group maintainer, just run the below API
curl --request POST --header "PRIVATE-TOKEN: <Token>" --header "Content-Type: application/json" --data '{"name": "My deploy token", "expires_at": "2098-02-02", "username": "custom-user", "scopes": ["read_repository"]}' "https://gitlab.com/api/v4/groups/<ID>/deploy_tokens/"
-
This will create a group level deploy token.
-
You can also delete the tokens created by group admin using below API
curl --request DELETE --header "PRIVATE-TOKEN: <Token>" "https://gitlab.com/api/v4/groups/<ID>/deploy_tokens/<ID>"
What is the current bug behavior?
Group Maintainers are able to create/delete group deploy tokens
What is the expected correct behavior?
Group Maintainers shouldnt be allowed to create /delete deploy tokens
Output of checks
This bug happens on GitLab.com and probably on omnibus installations too!
Regards,
Ashish
Impact
Group Maintainers are able to create/delete deploy tokens
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 API endpoint for group deploy tokens did not enforce the same owner-only permission check that the UI applies.
Impact
A group maintainer could create deploy tokens to access repositories and delete existing tokens, potentially disrupting deployments.
What the attacker needed
A GitLab account with maintainer role in a group
How it was found
- As a group maintainer, send a POST request to the group deploy tokens API endpoint with a token and JSON data.
- The API creates a group-level deploy token.
- Send a DELETE request to the group deploy tokens API endpoint with a token and the token ID to delete a token created by a group admin.
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 deploy token is a special credential used by automated systems to access code repositories. The report says that users with the 'maintainer' role could create or delete these tokens using the API, even though the web interface only allows 'owners' to do so. This means a maintainer could gain extra access or disrupt deployments.
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.