Skip to content
Access control Disclosed report Intermediate

Guest Users can re-edit their comments on Merge Requests which they no longer have access to

A guest user could re-edit their comments on a merge request after losing access to it, because the server did not properly check authorisation. An attacker could modify comments they no longer had permission to edit.

GitLab

Originally disclosed on GitLab

  • Fixed in 6 months
  • Disclosed after 6 months

HackerOne report #1212288 by cradlr on 2021-05-28, assigned to GitLab Team:

Report | Attachments | How To Reproduce

Report

Summary

A guest user can re-edit their comments in the Merge Request comment section when they no-longer have access to that Merge Request as a guest user.

We can fix this issue following the normal flow instead of the security flow, see https://gitlab.com/gitlab-org/gitlab/-/issues/332646#note_592596619.

Steps to reproduce
  1. I have used Firefox containers to gave multiple sessions in 1 browser. Create 2 user accounts in gitlab.com.
  2. From the main owner's account create a project -> create a Group. Invite a member to that Group with the privileges of owner.
  3. Create a project form the main owner's account under the group which has shared owner privileges.
  4. Switch to the invited user's session and Create an issue->Create a Merge Request.->Then add the file.
  5. Now comment on the Merge Request from the main owner's account and put a reply to that comment form the invited user's account.
  6. Re-edit the response made by the invited user and push that request to repeater.
  7. Change the permissions of the invited user's account to guest and assign that particular merge request to the main owner from the main owner's account.
  8. Refresh the session of the invited user's account. 404 error message shows up.
  9. Switch to repeater and edit the response and fire the request. We get a 500 Server error message.
  10. Verify the changes from the main owner's account.
====================PUT REQUEST===========================  
PUT /test-groups2/owner-subgroup/inherited/notes/588153581 HTTP/1.1  
Host: gitlab.com  
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0  
Accept: application/json, text/plain, */*  
Accept-Language: en-US,en;q=0.5  
Accept-Encoding: gzip, deflate  
Referer: https://gitlab.com/test-groups2/owner-subgroup/inherited/-/merge_requests/15  
X-CSRF-Token: REDACTED
X-Requested-With: XMLHttpRequest  
Content-Type: application/json;charset=utf-8  
Content-Length: 96  
Origin: https://gitlab.com  
Connection: close  
Cookie: REDACTED

{"target_type":"merge_request","target_id":101955619,"note":{"note":"hola. !rrrrrrrrrrrrrrrrr"}}

======================Response================================================  
HTTP/1.1 500 Internal Server Error  
Date: Fri, 28 May 2021 21:24:40 GMT  
Content-Type: text/html; charset=utf-8  
Content-Length: 2926  
Connection: close  
Cache-Control: no-cache, no-store, max-age=0, must-revalidate  
Expires: Fri, 01 Jan 1990 00:00:00 GMT  
Pragma: no-cache  
X-Request-Id: 01F6TDTTP0E8VFGAW32MFJX5QX  
X-Runtime: 0.305979  
GitLab-LB: fe-06-lb-gprd  
GitLab-SV: web-33-sv-gprd  
CF-Cache-Status: DYNAMIC  
cf-request-id: 0a5676826400004e68cabbd000000001  
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"  
Strict-Transport-Security: max-age=31536000  
X-Content-Type-Options: nosniff  
Server: cloudflare  
CF-RAY: 656a8d170d744e68-FRA  
==========================================================================

Thanks,
Cradlr

Impact

Improper authorization leads to the re-edit of the comment for a guest user.

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

The original report as published on GitLab. Images and videos are our own copies; raw HTML is shown as text. View it on GitLab.

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 application did not re-check the user's current permissions when processing the edit request, allowing an action that should have been blocked.

What the attacker needed

Two user accounts; one user must be a guest in the project; the guest must have previously commented on a merge request

The fix

The report suggests fixing the issue following the normal flow instead of the security flow, but does not provide specific details.

How it was found

  1. Create two user accounts and set up a group with one as owner and the other as a member with owner privileges.
  2. Create a project under the group and, as the invited user, create an issue and a merge request, then add a file.
  3. As the main owner, comment on the merge request; as the invited user, reply to that comment.
  4. Capture the edit request for the invited user's reply and send it to a repeater tool.
  5. Change the invited user's role to guest and assign the merge request to the main owner.
  6. Refresh the invited user's session (which shows a 404 error), then resend the captured edit request and observe a 500 error; verify the change from the main owner's account.

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 you change a user's permissions, they should not be able to do things they could before. Here, a user whose role was reduced to guest could still edit their old comments on a merge request they could no longer see. This is a problem because it lets someone change content after they should have lost that ability.

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.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.