Reporter users who are demoted as guest can still update the test cases created by them
A user who was demoted from reporter to guest could still update test cases they had created via a GraphQL mutation, even though the UI prevented editing. An attacker could modify test case content despite having a lower role.
GitLab
Originally disclosed on GitLab
- Fixed in 21 hours
- Disclosed after 21 hours
HackerOne report #1034490 by ashish_r_padelkar on 2020-11-14, assigned to @cmaxim:
Report | How To Reproduce
Report
Summary
Hello,
It is possible for users who were reporters before but are demoted to guest role can update the test cases created by them.
Steps to reproduce
- Login as reporter in any project and create a test case at
/-/quality/test_cases. - Admin demotes the above reporter user to
Guestnow. - Login as guest again and navigate to UI
/-/quality/test_cases, open the test case created above and you will see that you are not able to EDIT it but you can run a below graphql query.
[{"operationName":"updateTestCase","variables":{"updateTestCaseInput":{"projectPath":"publicgroup_test/project2","iid":"26","title":"www1234","description":"wwww"}},"query":"mutation updateTestCase($updateTestCaseInput: UpdateIssueInput!) {\n updateIssue(input: $updateTestCaseInput) {\n clientMutationId\n errors\n issue {\n ...TestCase\n __typename\n }\n __typename\n }\n}\n\nfragment TestCase on Issue {\n id\n title\n titleHtml\n description\n descriptionHtml\n state\n createdAt\n updatedAt\n updatedBy {\n ...Author\n __typename\n }\n webUrl\n blocked\n confidential\n moved\n movedTo {\n webUrl\n __typename\n }\n author {\n ...Author\n __typename\n }\n labels {\n nodes {\n ...Label\n __typename\n }\n __typename\n }\n currentUserTodos(first: 1) {\n nodes {\n id\n state\n __typename\n }\n __typename\n }\n __typename\n}\n\nfragment Author on User {\n id\n avatarUrl\n name\n username\n webUrl\n __typename\n}\n\nfragment Label on Label {\n id\n title\n description\n color\n textColor\n __typename\n}\n"}]
Replace the values of iid(Test case created by the user) and projectPath in above request.
What is the current bug behavior?
Reporter user who are demoted as guest can still update the test cases created by them.
What is the expected correct behavior?
Users should not be able to update the such test cases when roles are demoted
Output of checks
This bug happens on GitLab.com GitLab Enterprise Edition 13.6.0-pre 19ee559f49a
Regards,
Ashish
Impact
Reporter user who are demoted as guest can still update the test cases created by them.
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
Root cause
Likely the GraphQL mutation for updating test cases did not check the user's current role, only that they were the author.
What the attacker needed
A reporter account; ability to create a test case; admin demotes user to guest
How it was found
- Log in as a reporter and create a test case.
- Admin demotes the reporter to guest.
- Log in as guest and send a GraphQL mutation to update the test case.
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.
When a user's role is changed to a lower level, they should lose the ability to change things they previously created. Here, the system still allowed them to edit their old test cases through a direct API request, even though the normal interface blocked it.
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.