Skip to content
Access control Disclosed report Beginner

Users with guest access can post notes to private merge requests, issues, and snippets

A user with only guest access to a project could post notes to private merge requests, issues, and snippets that they were not permitted to view. An attacker could add comments to these private objects through the API, though they could not read the objects themselves.

jobert Follow

Originally disclosed on HackerOne

Medium 4.3 View original
  • Triaged in 4 hours
  • Fixed in 22 days
  • Disclosed after 22 days

Vulnerability details

A user with guest access to a group / project can post notes to private merge requests, issues, and snippets.

Impact

It seems it only allows an attacker to post notes to objects that the user doesn't have access to. I tried creating notes with slash commands, but unfortunately that didn't work. The hypothesis was to assign myself to an issue or merge request, and then access the object through the API. I'm unsure whether this is a security bug, but when a user is assigned to a merge request, it cannot access the MR through the web application, but it can access the MR through the API.

Proof of concept

  1. As a group / project owner, invite someone with guest access
  2. As the same user, create a merge request (or issue or snippet, they all work) - this MR is not accessible by users with guest access
  3. Accept the invitation as a new user and create an API token for your account
  4. Now send a POST request to the notes API with a reference to the MR:

Request

curl -X POST -H "Private-Token: XXXX" http://gitlab-instance/api/v3/projects/1/merge_requests/2/notes -d 'body=Hello+world'

Response

JSON
{
  "id": 1,
  "body": "Hello world",
  "attachment": null,
  "author": {
    "name": "Jobert Abma",
    "username": "jobertabma",
    "id": 1,
    "state": "active",
    "avatar_url": "...",
    "web_url": "..."
  },
  "created_at": "2017-01-01T20:33:44.360Z",
  "updated_at": "2017-01-01T20:33:44.360Z",
  "system": false,
  "noteable_id": 2,
  "noteable_type": "MergeRequest",
  "upvote?": false,
  "downvote?": false
}

When requesting the discussion page of the private MR, you'll notice that the note was posted, even though the user does not have permissions to do so.

Screen_Shot_2017-01-01_at_21.45.42.png
Screen_Shot_2017-01-01_at_21.45.42.png From the original on HackerOne

Remediation

Make sure the correct ACL is checked before creating the note.

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

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 notes API endpoint did not verify that the user had permission to access the parent object (merge request, issue, or snippet) before allowing a note to be created.

Impact

An attacker with guest access could post notes to private merge requests, issues, and snippets, but could not read them; the report notes that slash commands did not work, limiting further impact.

What the attacker needed

Guest access to a group or project; an API token for the guest account

How it was found

  1. As a group or project owner, invite someone with guest access.
  2. As the same user, create a merge request (or issue or snippet) that is not accessible to guests.
  3. Accept the invitation as the new user and create an API token.
  4. Send a POST request to the notes API for the merge request.

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.

The report shows a guest could not view a private merge request but could still add a note to it using the API. The correct access check was not made before creating the note.

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 by jobert

View all

67 more disclosed reports, best first.

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.