TODOs for shared groups are not removed when group membership is removed
GitLab did not remove to-do items for members of a shared group after that group was removed from the parent group, so a former member could still retrieve the full details of private issues and merge requests via the REST API. An attacker could add to-dos to all resources in a shared group and keep reading their latest content after access was revoked.
GitLab
Originally disclosed on GitLab
- Fixed in 19 months
- Disclosed after 19 months
HackerOne report #789314 by xanbanx on 2020-02-05, assigned to @dcouture:
Hi GitLab Security Team,
Summary
I found a way to bypass the Todo redaction within GitLab. Normally, GitLab removes Todo after a one hour grace period when a user for example leaves a project or does not have access to the feature anymore. However, this is not applied in the case of sharing a group with a group. If a group is shared within a group, the group members receive Todos, e.g., when they are mentioned on issues.
However, when the shared group is removed from the group, Todos for all group members persist. By using the REST API of GitLab, a user can get much more associated information of the Todo. He now can receives for example the full issue, including the title, and description. Note, this is always the fresh and most recent version, which might have changed after the group was removed from the group.
Steps to reproduce
- Create a private group named
group_a - Add a user
foowithDeveloperrights to to the private groupgroup_a - Create a private group
group_band inside a private projectproject_bwith some issues - Go to the member page of
group_band invite the groupgroup_awithDeveloperrights - As user
foogo togroup_b/project_b's issue page and add a personal Todo via theAdd a To Dobutton in the sidebar of the issue - As the group owner, remove the group
group_aas a member fromgroup_b - Wait for one hour grace period
- As the user
foo, perform the following API call:curl --header "PRIVATE-TOKEN: <TOKEN>" https://example.gitlab.com/api/v4/todos
This now returns the old Todo from the previously shared group, which you don't have access to anymore.
This looks similar to the JSON response below. Note, this contains small parts of the private project of the private group but also the full details of the issue. The issue here is the most recent version. So if someone from the the project changes the issue description, you also see that here!
[
{
"id": 10,
"project": {
"id": 3,
"description": "",
"name": "project_b",
"name_with_namespace": "test_group_b / project_b",
"path": "project_b",
"path_with_namespace": "test_group_b/project_b",
"created_at": "2020-01-28T15:14:06.223Z"
},
"author": {
"id": 23,
"name": "foo",
"username": "foo",
"state": "active",
"avatar_url": "https://secure.gravatar.com/avatar/d113f53f93dcda1539232ee8?s=80&d=identicon",
"web_url": "https://example.gitlab.com/foo"
},
"action_name": "marked",
"target_type": "Issue",
"target": {
"id": 33,
"iid": 1,
"project_id": 3,
"title": "my issue",
"description": "this is a test",
"state": "opened",
"created_at": "2020-01-28T15:14:23.958Z",
"updated_at": "2020-01-28T15:14:23.958Z",
"closed_at": null,
"closed_by": null,
"labels": [],
"milestone": null,
"assignees": [],
"author": {
"id": 12,
"name": "test",
"username": "test",
"state": "active",
"avatar_url": "https://secure.gravatar.com/avatar/a12221e0b84c088f1ab6e02724b?s=80&d=identicon",
"web_url": "https://example.gitlab.com/test"
},
"assignee": null,
"user_notes_count": 0,
"merge_requests_count": 0,
"upvotes": 0,
"downvotes": 0,
"due_date": null,
"confidential": false,
"discussion_locked": null,
"web_url": "https://example.gitlab.com/test_group_b/project_b/issues/1",
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"task_completion_status": {
"count": 0,
"completed_count": 0
},
"has_tasks": false,
"_links": {
"self": "https://example.gitlab.com/api/v4/projects/16519214/issues/1",
"notes": "https://example.gitlab.com/api/v4/projects/16519214/issues/1/notes",
"award_emoji": "https://example.gitlab.com/api/v4/projects/16519214/issues/1/award_emoji",
"project": "https://example.gitlab.com/api/v4/projects/16519214"
},
"references": {
"short": "#1",
"relative": "#1",
"full": "test_group_b/project_b#1"
},
"subscribed": false,
"moved_to_id": null
},
"target_url": "https://example.gitlab.com/test_group_b/project_b/issues/1",
"body": "my issue",
"state": "pending",
"created_at": "2020-01-28T15:19:08.175Z"
}
]
Note, this does not only affect issues but also:
- Merge requests
- Epics
- Comment where you being mentioned
Impact
The impact of this vulnerability is actually quite high. A malicious user of the group, can simply add a personal todo on all issues and merge requests of the project. This can easily be one Add a To Do in the sidebar of an issue or merge request. After the group is removed from the project, the malicious user has access to all issues and merge requests. Note, this always returns the most recent version of the issue or merge request! The impact of this is higher to the one in #722001, as a malicious can add Todos on not just a single project but instead of all projects of the shared group. By using the REST Todo API (https://docs.gitlab.com/ee/api/issues.html#create-a-todo) an attacker can simply create a daily job to automatically mark todos on all resources he as access to. As the information disclosure is much larger (access to all projects of a group), I am rating this one as a High compared to #722001 where the access only affects one project.
/cc to [@]jmatos who dealt with #722001
What is the current bug behavior?
Todos are not redacted when the shared group is removed as a group member.
What is the expected correct behavior?
When the group is removed from the other group, wait for the 1h grace period, and then GitLab should remove all todos on the group for the group members.
Output of checks
This bug happens on GitLab.com running on GitLab Enterprise Edition 12.7.0-pre 8f00d67c760.
Best regards,
Xanbanx
Impact
See above.
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 to-do cleanup logic did not account for access granted through a shared group, so removing that group membership did not trigger redaction of the affected to-dos.
Impact
A former group member could continue to read the latest titles, descriptions and other details of private issues, merge requests and epics, and could automate adding to-dos across all projects of a shared group.
What the attacker needed
A GitLab account; membership in a group shared with another group; user adds a to-do before removal; one-hour grace period passes
The fix
GitLab should remove all to-dos for group members after the one-hour grace period when a shared group is removed from another group.
How it was found
- Create a private group and add a user as a Developer.
- Create another private group with a private project containing issues.
- Invite the first group into the second group with Developer rights.
- As the user, add a personal to-do on an issue in the project.
- Remove the first group from the second group and wait for the one-hour grace period.
- As the user, call the to-dos API and observe the old to-do still returns the private issue details.
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.
A to-do item is a personal reminder that links to an issue or merge request. GitLab normally deletes these reminders after access is lost, but when access came through a shared group, the reminders stayed and still showed the private content. This meant someone who should have lost access could keep reading the latest version of private issues.
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.