CVE-2026-40179 Prometheus: Stored XSS via metric names and label values in web UI tooltips and metrics explorer
Attackers can execute arbitrary JavaScript in Prometheus web UI via unsanitized metric names, potentially leading to data exfiltration or system shutdown.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2026-40179?
CVE-2026-40179 is a medium-severity cross-site scripting vulnerability in prometheus, published on 15 Apr 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Official description
Prometheus is an open-source monitoring system and time series database. Versions 3.0 through 3.5.1 and 3.6.0 through 3.11.1 have stored cross-site scripting vulnerabilities in multiple components of the Prometheus web UI where metric names and label values are injected into innerHTML without escaping. In both the Mantine UI and old React UI, chart tooltips on the Graph page render metric names containing HTML/JavaScript without sanitization. In the old React UI, the Metric Explorer fuzzy search results use dangerouslySetInnerHTML without escaping, and heatmap cell tooltips interpolate le label values without sanitization. With Prometheus v3.x defaulting to UTF-8 metric and label name validation, characters like <, >, and " are now valid in metric names and labels. An attacker who can inject metrics via a compromised scrape target, remote write, or OTLP receiver endpoint can execute arbitrary JavaScript in the browser of any Prometheus user who views the metric in the Graph UI, potentially enabling configuration exfiltration, data deletion, or Prometheus shutdown depending on enabled flags. This issue has been fixed in versions 3.5.2 and 3.11.2. If developers are unable to immediately update, the following workarounds are recommended: ensure that the remote write receiver (--web.enable-remote-write-receiver) and the OTLP receiver (--web.enable-otlp-receiver) are not exposed to untrusted sources; verify that all scrape targets are trusted and not under attacker control; avoid enabling admin or mutating API endpoints (e.g., --web.enable-admin-api or --web.enable-lifecycle) in environments where untrusted data may be ingested; and refrain from clicking untrusted links, particularly those containing functions such as label_replace, as they may generate poisoned label names and values.
Weakness: CWE-79
Which versions are affected by CVE-2026-40179?
8 open source packages ship an affected version, including github.com/prometheus/prometheus and prometheus. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
github.com/prometheus/prometheus Go | All versions | 0.311.2-0.20260410083055-07c6232d159b |
github.com/prometheus/prometheus Go | All versions | 0.311.2-0.20260410083055-07c6232d159b |
github.com/prometheus/prometheus Go | All versions | 0.311.2-0.20260410083055-07c6232d159b |
github.com/prometheus/prometheus Go | From 3.0.0 | 3.5.2 |
github.com/prometheus/prometheus Go | From 3.0.0 | 3.5.2 |
github.com/prometheus/prometheus Go | From 3.6.0 | 3.11.2 |
2 more packages
github.com/prometheus/prometheus Go | From 3.6.0 | 3.11.2 |
prometheus Bitnami | All versions | 0.305.2, 0.311.2, 3.5.2, 3.11.2 |
Linux distribution packages (1)
golang-github-prometheus-prometheus openSUSE:Tumbleweed | All versions | 3.11.2-1.1 |
Products include Prometheus Prometheus.
How do I fix CVE-2026-40179?
Upgrade github.com/prometheus/prometheus to a fixed version for your release line: 0.311.2-0.20260410083055-07c6232d159b, 3.5.2 or 3.11.2.
Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.
Is CVE-2026-40179 being exploited?
There is no known exploitation of CVE-2026-40179 in the wild and no public exploit code.
Public exploit code: 1 proofs of concept on GitHub.
Other vulnerabilities in prometheus
- CVE-2026-42151 Prometheus Azure AD remote write OAuth client secret exposed via config API
- CVE-2026-42154 Prometheus: remote read endpoint allows denial of service via crafted snappy payload
- CVE-2021-29622 Arbitrary redirects under /new endpoint
- CVE-2019-3826 Cross-site scripting in prometheus
- CVE-2026-44903 Prometheus: Stored XSS via crafted histogram bucket label values in the heatmap display of the old Prometheus web UI
Sources
Also known as BIT-prometheus-2026-40179, CLEANSTART-2026-FB95411, CLEANSTART-2026-IU00943, CLEANSTART-2026-KZ65595, CLEANSTART-2026-PM96717, CLEANSTART-2026-PN08299 and 128 more.