Skip to content
SSRF Disclosed report Intermediate

Semi-blind SSRF using editor privileges in embedded Grafana

Grafana's alert notification webhook feature allowed users with Editor privileges to make server-side requests to arbitrary internal URLs, bypassing GitLab's SSRF protections. An attacker could send requests to local services, such as reloading Alertmanager or port scanning, by crafting a webhook with a custom HTTP method.

GitLab

Originally disclosed on GitLab

  • Fixed in 13 days
  • Disclosed after 13 days

HackerOne report #1034456 by myster on 2020-11-14, assigned to @cmaxim:

Report | Attachments | How To Reproduce

Report

Hi Team!

Grafana (all versions) supports configuration of notification channels for alerts with various methods including HTTP Webhooks (https://grafana.com/docs/grafana/latest/alerting/notifications/#webhook)

This allows users with at least Editor rights (less privileged than Admin) in Grafana to perform SSRF attacks on local instance and local network.

In the web interface Grafana limits the allowed methods to POST and PUT however by using curl or any other client, GET method or really any other method can also be specified making it possible to port scan local network.

Steps to reproduce:

  1. Enable alerting (https://gitlab.com/gitlab-org/gitlab/-/issues/28612) and create an editor user in Grafana (https://grafana.com/docs/grafana/latest/permissions/organization_roles/#editor-role).

Editor permissions at glance:

    Can view, add, and edit dashboards, panels, and alert rules in dashboards they have access to. This can be disabled on specific folders and dashboards.  
    Can create, update, or delete playlists.  
    Can access Explore.  
    Cannot add, edit, or delete data sources.  
    Cannot add, edit, or delete alert notification channels.  
    Cannot manage other organizations, users, and teams.  

I have for instance given multiple users editor permissions on my Gitlab grafana instance so that they can primarily edit dashboards and alerts. It is a regular use case as this is below admin user in terms of permissions.

  1. Visit https://gitlab/alerting/notifications and create a webhook type of notification channel, something like in attached image notification.png

  2. The request I have crafted in this screenshot sends a reload command to alertmanager and results in a reload of alertmanager process, demonstrating the first SSRF

  3. Second vector will be to modify the POST request for api/alert-notifications/test to provide our own method i.e GET which may be used for port scanning.

Request would look like following:

curl 'http://localhost/-/grafana/api/alert-notifications/test' -H 'User-Agent: Mozilla/5.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Referer: http://localhost/-/grafana/alerting/notification/new' -H 'content-type: application/json' -H 'x-grafana-org-id: 1' -H 'Origin: http://localhost' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Cookie: grafana_session=$session_id; known_sign_in=$id; sidebar_collapsed=false; _gitlab_session=$session' -H 'Sec-GPC: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data-raw '{"name":"test","type":"webhook","frequency":"15m","settings":{"httpMethod":"GET","autoResolve":true,"severity":"critical","uploadImage":false,"url":"http://localhost:3000/-/reload"}}'


{"message":"Test notification sent"}  

A message saying Test notification sent means the port is open and service running there responded with a 200. This allows a bypass of SSRF protection mechanisms in place in Gitlab itself disallowing local networks.

  1. Depending on other services running locally and features enabled, it may also be abused to perform operations like:

Prometheus admin actions:

Alertmanager actions:

Making redis exporter scrape any target:

I will be happy to probe further about possible impact on other APIs available only from localhost.

Please review.

Thanks!

Impact

  • SSRF protection bypass
  • Arbitrary requests to internal services as demonstrated above

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

How To Reproduce

Please add reproducibility information to this section:

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 webhook notification feature did not restrict the target URL or HTTP method, allowing Editor users to make arbitrary requests from the Grafana server.

Impact

An attacker with Editor privileges could bypass SSRF protections to send arbitrary requests to internal services, potentially performing actions like reloading Alertmanager, port scanning, or interacting with Prometheus and Redis exporter.

What the attacker needed

Editor privileges in Grafana; Alerting enabled

How it was found

  1. Enable alerting and create an editor user in Grafana.
  2. Visit the alerting notifications page and create a webhook notification channel.
  3. Craft a request to send a reload command to alertmanager, demonstrating SSRF.
  4. Modify the POST request for testing notifications to use a GET method for port scanning.

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.

Grafana lets users set up alerts that send webhooks to other services. The problem was that users with limited 'Editor' permissions could make the Grafana server send requests to any internal address, even though GitLab tried to block such requests. This could let an attacker interact with internal services that are not normally reachable from the internet.

What is SSRF?

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.