Skip to content
Access control Disclosed report Beginner

A guest user is capable of commenting on a task by using the graphql api `createWorkItemNote` operation

A guest user could comment on a task via the GraphQL API despite the UI being locked, because the API did not enforce the required permission. An attacker with guest access could post comments on tasks, bypassing the intended restriction.

GitLab

Originally disclosed on GitLab

  • Fixed in 48 days
  • Disclosed after 48 days

⚠️ Please read the process on how to fix security issues before starting to work on the issue. Vulnerabilities must be fixed in a security mirror.

HackerOne report #1926528 by ricardobrito on 2023-03-30, assigned to @ngeorge1:

Report | Attachments | How To Reproduce

Report

Context

Gitlab introduced in version 15.10 the ability to View system notes and add comments on tasks.

Summary

According to the interface, only project members can comment on a task, and when I visit a task as a guest user, the interface is locked:

Screenshot_2023-03-31_at_4.01.25_AM.png
Screenshot_2023-03-31_at_4.01.25_AM.png From the original on GitLab

However this can be bypassed and a guest can successfully comment on a task by using the following graphql request:

[{"operationName":"createWorkItemNote","variables":{"input":{"noteableId":"gid://gitlab/WorkItem/126000336","body":"Comment by guest","discussionId":null}},"query":"mutation createWorkItemNote($input: CreateNoteInput!) {\n  createNote(input: $input) {\n    note {\n      id\n      discussion {\n        id\n        notes {\n          nodes {\n            ...WorkItemNote\n            __typename\n          }\n          __typename\n        }\n        __typename\n      }\n      __typename\n    }\n    errors\n    __typename\n  }\n}\n\nfragment WorkItemNote on Note {\n  id\n  body\n  bodyHtml\n  system\n  internal\n  systemNoteIconName\n  createdAt\n  lastEditedAt\n  url\n  lastEditedBy {\n    ...User\n    webPath\n    __typename\n  }\n  discussion {\n    id\n    __typename\n  }\n  author {\n    ...User\n    __typename\n  }\n  userPermissions {\n    adminNote\n    awardEmoji\n    readNote\n    createNote\n    resolveNote\n    repositionNote\n    __typename\n  }\n  __typename\n}\n\nfragment User on User {\n  id\n  avatarUrl\n  name\n  username\n  webUrl\n  __typename\n}\n"}]  

After which the comment is successfully created. Here is a POC video with better details:

As you can see in the POC the guest is not allowed to add a comment to a task, which according to the documentation at least reporter role is needed. However, by using the API, the guest user can successfully comment.

This bug happens on gitlab.com

Impact

A guest user is capable of commenting on a task by using the graphqp api

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

How To Reproduce

Please add reproducibility information to this section:

  1. UserA creates a project and creates an issue and then a task in the issue.
  2. UserB is added to the project as a Developer
  3. UserB now add a comment to the task created in Step 1. Capture the graphql request "operationName":"createWorkItemNote" for later use.
  4. Now UserA change the membership of UserB to Guest. Visit the task in step 1 and UI is locked to add comments.
  5. Now replay the graphql request with a new comment added in body attribute. Visit the task in step 1 and UI is still locked to add comments but the comment added in Step 4 can be seen added to the task.

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 GraphQL mutation for creating work item notes did not verify that the user had the required role (reporter or higher) to comment on tasks.

Impact

A guest user could post comments on tasks, which should require at least reporter role.

What the attacker needed

A GitLab account; guest access to a project; a task in the project; ability to send GraphQL requests

How it was found

  1. UserA creates a project, an issue, and a task in the issue.
  2. UserB is added to the project as a Developer.
  3. UserB adds a comment to the task and captures the GraphQL request for createWorkItemNote.
  4. UserA changes UserB's membership to Guest; the UI is locked for commenting.
  5. UserB replays the captured GraphQL request with a new comment in the body; the comment is added despite the UI being locked.

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.

In GitLab, a guest is a user with limited permissions, such as viewing but not commenting. The web interface correctly blocked guests from commenting on tasks, but the underlying API did not check permissions properly, so a guest could still send a request to add a comment. This is a permission bypass.

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.