Skip to content
CSRF Disclosed report Beginner

CSRF in System hooks execution through API

A GET request to an API endpoint for system hooks triggers the hook's execution, allowing an attacker to cause an admin's browser to send a request and execute the hook without the admin's intent.

GitLab

Originally disclosed on GitLab

  • Fixed in 2.2 years
  • Disclosed after 2.2 years

HackerOne report #471274 by mishre on 2018-12-22:

Summary: Gitlab allows admins (of the whole deployment) to configure system hooks, which will be executed upon certain actions (across all projects). However, it seems that there exists an endpoint which sends a test web hook when being browsed by an admin.

Description: When the admin is logged and an attacker lures him to browse https://gitlab-instance/api/v4/hooks/{hook-id} the hook is executed with test parameters possibly causing undesired actions to be performed (sending requests which the admin didn't want to send). An attacker can cause a silent execution of the web hook, by luring the admin to browse his own site (while including an image on that site poiting to the mentioned endpoint) or by luring the admin on clicking a link.

Steps To Reproduce:

  1. Login to Gitlab as the instance admin.
  2. Browse to https://gitlab-instance/admin/hooks
  3. Create a hook pointing to a server under your control.
  4. Now browse to https://gitlab-instance/api/v4/hooks/1 (substitute 1 with the created hook's id)
  5. To verify this actually executed the hook - check your hook server logs, you should see a request with the following header: X-Gitlab-Event

Impact

An attacker can cause system hooks to be executed undesirably.

Security Team Recommendation

Change the HTTP method to POST to be consistent with the solution in https://gitlab.com/gitlab-org/gitlab-ce/issues/42604.

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 API endpoint that tests a system hook uses the GET method, which can be triggered by a simple link or image request, instead of a method like POST that requires deliberate action.

Impact

An attacker could cause system hooks to be executed undesirably, potentially sending requests the admin did not intend.

What the attacker needed

Admin access to GitLab instance; attacker can lure admin to a link or page

The fix

The HTTP method should be changed to POST to be consistent with a previous fix.

How it was found

  1. Log in to GitLab as the instance admin.
  2. Go to the admin hooks page.
  3. Create a hook pointing to a server you control.
  4. Visit the API endpoint for that hook's ID.
  5. Check your server logs to confirm the hook was executed.

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.

System hooks are automated messages sent to another server when something happens in GitLab. The problem is that simply visiting a web address can trigger one of these messages, so an attacker could trick a logged-in admin into visiting that address and cause the message to be sent without the admin meaning to.

What is CSRF?

Another site makes a signed-in user's browser perform an action they did not intend.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site request forgery (CSRF)

The lesson behind this report.

Another site makes a signed-in user's browser perform an action they did not intend.