Skip to content
IDOR Disclosed report Intermediate

Attacker can delete (and read) private project webhooks

An attacker could delete and read webhooks belonging to any project, including private ones, by sending API requests to a project they own but referencing a webhook ID from another project. This exposed private webhook URLs and potentially API tokens.

jobert Follow

Originally disclosed on HackerOne

  • Triaged in under an hour
  • Fixed in 8 days
  • Disclosed after 8 days

Vulnerability details

An attacker can delete and read webhooks that are configured for all projects on a GitLab instance. This includes private projects. This is a bad vulnerability because these webhooks contain private (API) tokens most of the time.

Proof of concept

As a victim, create a project and a webhook. Make sure you know the unique ID of the webhook. You can find this by looking at the "Test hook" button. In this example, the ID is 1. Now as the attacker, which doesn't have access to the webhook, create another project. Since the attacker is the owner of this project, it can send API requests to /projects/:id and access its sub resources. By executing the following cURL request command, the webhook of the victim can be destroyed and read:

Bash
curl -X DELETE --header "PRIVATE-TOKEN: XXXXXXXXXXX" "http://gitlab-instance/api/v3/projects/2/hooks/1"

The attacker has access to project with ID 2, but the webhook with ID 1 belongs to a different project (see the response below). The response leaks the private webhook URL and on which events it would be fired. The request deletes the webhook, but the attacker can now keep digging with the leaked webhook URL.

JSON
{
  "id":1,
  "url":"http://secret.com/",
  "project_id":24,
  "created_at":"2016-04-24T22:16:58.044Z",
  "updated_at":"2016-04-24T22:16:58.044Z",
  "service_id":null,
  "push_events":true,
  "issues_events":false,
  "merge_requests_events":false,
  "tag_push_events":false,
  "note_events":false,
  "enable_ssl_verification":true,
  "build_events":false
}

Fix

The problem arises from lib/api/project_hooks.rb:104. Instead of calling user_project.hooks.find, it searches in all project hooks to fetch the object: ProjectHook.find. I attached the fix for this problem.

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

The API endpoint used a global lookup for webhooks instead of scoping the search to the user's project.

Impact

An attacker could read and delete webhooks of any project, potentially exposing private API tokens and disrupting integrations.

What the attacker needed

Attacker has a GitLab account; attacker can create a project; victim has a webhook with a known ID

How it was found

  1. As a victim, create a project and a webhook, and note the webhook's unique ID.
  2. As an attacker without access to the victim's webhook, create another project.
  3. Send an API request to the attacker's project endpoint but with the victim's webhook ID.
  4. The response leaks the private webhook URL and events, and the webhook is deleted.

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 webhook is a way for one application to send automatic messages to another, often including a secret token. The bug meant that when you asked to see or delete a webhook for your own project, the system didn't check that the webhook actually belonged to you. So an attacker could use their own project to access someone else's webhook.

What is IDOR?

One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.

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.

Insecure direct object reference (IDOR)

The lesson behind this report.

One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.