CVE-2026-40179: Github.com/prometheus/prometheus Cross-Site Scripting Vulnerability
MODERATECVE-2026-40179 is a MODERATE (CVSS 6.1) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Github.com/prometheus/prometheus libraries in the Go ecosystem. The issue involves prometheus has stored xss via metric names and label values in prometheus web ui tooltips and metrics explorer. Remediation is available by upgrading affected packages to version 3.5.2, 3.11.2, 0.311.2-0.20260410083055-07c6232d159b.
CVE-2026-40179 at a Glance
Security Impact
CVSS: 6.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).
How to Fix CVE-2026-40179
To remediate this vulnerability, upgrade all affected Github.com/prometheus/prometheus dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/prometheus/prometheus to 3.5.2
Upgrade github.com/prometheus/prometheus to 3.11.2
Upgrade github.com/prometheus/prometheus to 0.311.2-0.20260410083055-07c6232d159b
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/prometheus/prometheus
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-40179, inspect your project dependencies for Github.com/prometheus/prometheus:
inspect dependencies for github.com/prometheus/prometheus
Analyze the terminal output to locate any version of Github.com/prometheus/prometheus in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.5.2), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Github.com/prometheus/prometheus, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-40179 Affected Github.com/prometheus/prometheus Versions
3 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/prometheus/prometheus
|
Go |
≥ 3.0.0
< 3.5.2
|
3.5.2
|
|
github.com/prometheus/prometheus
|
Go |
≥ 3.6.0
< 3.11.2
|
3.11.2
|
|
github.com/prometheus/prometheus
|
Go |
< 0.311.2-0.20260410083055-07c6232d159b
|
0.311.2-0.20260410083055-07c6232d159b
|
References
Frequently Asked Questions
What is CVE-2026-40179?
Which Github.com/prometheus/prometheus versions are affected?
What version fixes CVE-2026-40179?
Is github.com/prometheus/prometheus affected?
What is the CVSS score of CVE-2026-40179?
What CWE is associated with CVE-2026-40179?
How can I check Go dependencies for CVE-2026-40179?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-vffh-x6r8-xx99",
"modified" : "2026-10-06T18:47:26Z",
"published" : "2026-04-13T16:39:16Z",
"aliases" : [ "CVE-2026-40179" ],
"summary" : "Prometheus has Stored XSS via metric names and label values in Prometheus web UI tooltips and metrics explorer",
"details" : "### Impact\n\nStored cross-site scripting (XSS) via crafted metric names in the Prometheus web UI:\n\n* **Old React UI + New Mantine UI:** When a user hovers over a chart tooltip on the Graph page, metric names containing HTML/JavaScript are injected into `innerHTML` without escaping, causing arbitrary script execution in the user's browser.\n* **Old React UI only:** When a user opens the Metric Explorer (globe icon next to the PromQL expression input field), and a metric name containing HTML/JavaScript is rendered in the fuzzy search results, it is injected into `innerHTML` without escaping, causing arbitrary script execution in the user's browser.\n* **Old React UI only:** When a user views a heatmap chart and hovers over a cell, the `le` label values of the underlying histogram buckets are interpolated into `innerHTML` without escaping. While `le` is conventionally a numeric bucket boundary, Prometheus does not enforce this — arbitrary UTF-8 strings are accepted as label values, allowing script injection via a crafted scrape target or remote write.\n\nWith Prometheus v3.x defaulting to UTF-8 metric and label name validation, characters like `<`, `>`, and `\"` are now valid in metric names and labels, making this exploitable.\n\nAn attacker who can inject metrics (via a compromised scrape target, remote write, or OTLP receiver endpoint) can execute JavaScript in the browser of any Prometheus user who views the metric in the Graph UI. From the XSS context, an attacker could for example:\n\n- Read `/api/v1/status/config` to extract sensitive configuration (although credentials / secrets are redacted by the server)\n- Call `/-/quit` to shut down Prometheus (only if `--web.enable-lifecycle` is set)\n- Call `/api/v1/admin/tsdb/delete_series` to delete data (only if `--web.enable-admin-api` is set)\n- Exfiltrate metric data to an external server\n\nBoth the new Mantine UI and the old React UI are affected. The vulnerable code paths are:\n\n- `web/ui/mantine-ui/src/pages/query/uPlotChartHelpers.ts` — tooltip `innerHTML` with unescaped `labels.__name__`\n- `web/ui/react-app/src/pages/graph/GraphHelpers.ts` — tooltip content with unescaped `labels.__name__`\n- `web/ui/react-app/src/pages/graph/MetricsExplorer.tsx` — fuzzy search results rendered via `dangerouslySetInnerHTML` without sanitization\n- `web/ui/react-app/src/vendor/flot/jquery.flot.heatmap.js` — heatmap tooltip with unescaped label values\n\n### Patches\n\nA patch has been published in Prometheus 3.5.2 LTS and Prometheus 3.11.2. The fix applies `escapeHTML()` to all user-controlled values (metric names and label values) before inserting them into `innerHTML`. This advisory will be updated with the patched version once released.\n\n### Workarounds\n\n- If using the remote write receiver (`--web.enable-remote-write-receiver`), ensure it is not exposed to untrusted sources.\n- If using the OTLP receiver (`--web.enable-otlp-receiver`), ensure it is not exposed to untrusted sources.\n- Ensure scrape targets are trusted and not under attacker control.\n- Do not enable admin / mutating API endpoints (e.g. `--web.enable-admin-api` or `web.enable-lifecycle`) in cases where you cannot prevent untrusted data from being ingested.\n- Users should avoid clicking untrusted links, especially those containing functions such as label_replace, as they may generate poisoned label names and values.\n\n### References\n\n- CVE-2019-10215 — prior stored DOM XSS vulnerability in Prometheus query history, fixed in v2.7.2\n\n### Acknowledgements\n\nThanks to @gladiator9797 (Duc Anh Nguyen from TinyxLab) for reporting this.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/prometheus/prometheus"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0"
}, {
"fixed" : "3.5.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.5.1"
}
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/prometheus/prometheus"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.6.0"
}, {
"fixed" : "3.11.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.11.1"
}
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/prometheus/prometheus"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.311.2-0.20260410083055-07c6232d159b"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/prometheus/prometheus/security/advisories/GHSA-vffh-x6r8-xx99"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-40179"
}, {
"type" : "WEB",
"url" : "https://github.com/prometheus/prometheus/pull/18506"
}, {
"type" : "WEB",
"url" : "https://github.com/prometheus/prometheus/commit/07c6232d159bfb474a077788be184d87adcfac3c"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/prometheus/prometheus"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-04-13T16:39:16Z",
"nvd_published_at" : "2026-04-15T23:16:09Z"
}
}