Project Maintainer can EDIT group badges
A user with Maintainer permission on a single project, but no access at the group level, could still edit group-level badges. By changing the badge identifier in the project badge update request, the attacker could modify badges belonging to the parent group.
GitLab
Originally disclosed on GitLab
- Fixed in 9 months
- Disclosed after 9 months
HackerOne report #751264 by ashish_r_padelkar on 2019-12-04, assigned to @ankelly:
Summary
Hello,
When user has explicit Maintainer permission on projects but not at group level, such users can still EDIT group level badges.
Steps to reproduce
- Add a user at project level as
maintainerbut don't give any access at group level. - Now login as above user with maintainer role in project
- Go to
https://gitlab.com/<GroupName>/<ProjectName>/editand EDIT any of your project level badge. You wont see EDIT button next to group badges as you dont have any permissions to EDIT it. - When you EDIT and save project Badges, you will see below request
PUT /api/v4/projects/15203433/badges/<Badge_ID> HTTP/1.1
Host: gitlab.com
Connection: close
Content-Length: 149
Accept: application/json, text/plain, */*
Origin: https://gitlab.com
X-CSRF-Token: ████
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36
Content-Type: application/json;charset=UTF-8
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Referer: https://gitlab.com/groupfor1/1projectfor/edit
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
Cookie: ████
{"name":"CCC","image_url":"https://gitlab.com/%{project_path}/badges/%{default_branch}/pipeline.svg","link_url":"https://gitlab.com/%{project_path}"}
- Just change the
<Badge_ID>in URL with group badge and send the requestPUT /api/v4/projects/15203433/badges/<Badge_ID> HTTP/1.1 - This will successfully change the group level badge!
What is the current bug behavior?
Project Maintainer can change group badges without any access to group
What is the expected correct behavior?
Project Maintainer shouldn't be allowed to change group level badges
Output of checks
This bug happens on GitLab.com. Tested on public group private project but it should work for private group private projects too
Regards,
Ashish
Impact
Project Maintainers can change group level badges
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 badge update endpoint looked up the badge by identifier without verifying that the badge belonged to the project the caller had permission on, so a project-level request could reach a group-level badge.
Impact
A project maintainer could change group-level badges despite having no group access, which could misrepresent the group's displayed information.
What the attacker needed
A project maintainer role; no group-level access; ability to send crafted API requests
How it was found
- Add a user as maintainer on a project only, with no group-level access.
- Log in as that user.
- Edit and save a project-level badge to capture the update request.
- Replace the badge identifier in the request with a group badge identifier and resend it.
- The group-level badge is changed successfully.
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.
A badge is a small image shown on a project or group page, such as a build status icon. The site checked whether you could edit badges on your project, but it did not check whether the badge you were changing actually belonged to the group above it. So a user with limited rights could quietly change something they were never meant to touch.
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.