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:
- Login to Gitlab as the instance admin.
- Browse to https://gitlab-instance/admin/hooks
- Create a hook pointing to a server under your control.
- Now browse to https://gitlab-instance/api/v4/hooks/1 (substitute 1 with the created hook's id)
- 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.
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
- Log in to GitLab as the instance admin.
- Go to the admin hooks page.
- Create a hook pointing to a server you control.
- Visit the API endpoint for that hook's ID.
- 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.