Skip to content

UI: Fix stored XSS via unescaped metric names and labels#18506

Merged
roidelapluie merged 1 commit into
prometheus:release-3.11from
roidelapluie:roidelapluie/backport-xss-issue
Apr 10, 2026
Merged

UI: Fix stored XSS via unescaped metric names and labels#18506
roidelapluie merged 1 commit into
prometheus:release-3.11from
roidelapluie:roidelapluie/backport-xss-issue

Conversation

@roidelapluie

Copy link
Copy Markdown
Member

Metric names, label names, and label values containing HTML/JavaScript were inserted into innerHTML without escaping in several UI code paths, enabling stored XSS attacks via crafted metrics. This mostly becomes exploitable in Prometheus 3.x, since it defaults to allowing any UTF-8 characters in metric and label names.

Apply escapeHTML() to all user-controlled values before innerHTML insertion in:

  • Mantine UI chart tooltip
  • Old React UI chart tooltip
  • Old React UI metrics explorer fuzzy search
  • Old React UI heatmap tooltip

See GHSA-vffh-x6r8-xx99

Which issue(s) does the PR fix:

Release notes for end users (ALL commits must be considered).

Reviewers should verify clarity and quality.

[SECURITY] UI: Fix stored XSS via unescaped metric names and labels in chart tooltips and metrics explorer. GHSA-vffh-x6r8-xx99

Metric names, label names, and label values containing HTML/JavaScript were
inserted into `innerHTML` without escaping in several UI code paths, enabling
stored XSS attacks via crafted metrics. This mostly becomes exploitable in
Prometheus 3.x, since it defaults to allowing any UTF-8 characters in metric
and label names.

Apply `escapeHTML()` to all user-controlled values before innerHTML
insertion in:

* Mantine UI chart tooltip
* Old React UI chart tooltip
* Old React UI metrics explorer fuzzy search
* Old React UI heatmap tooltip

See GHSA-vffh-x6r8-xx99

Signed-off-by: Julius Volz <[email protected]>
@roidelapluie
roidelapluie requested review from a team and juliusv as code owners April 10, 2026 09:28

@juliusv juliusv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@roidelapluie
roidelapluie merged commit e95d2e3 into prometheus:release-3.11 Apr 10, 2026
40 checks passed
eleboucher pushed a commit to eleboucher/homelab that referenced this pull request Apr 13, 2026
… v3.11.2) (#152)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [quay.io/prometheus/prometheus](https://github.com/prometheus/prometheus) | patch | `v3.11.1` → `v3.11.2` |

---

### Release Notes

<details>
<summary>prometheus/prometheus (quay.io/prometheus/prometheus)</summary>

### [`v3.11.2`](https://github.com/prometheus/prometheus/releases/tag/v3.11.2): 3.11.2 / 2026-04-13

[Compare Source](prometheus/prometheus@v3.11.1...v3.11.2)

This release has a fix for a Stored XSS vulnerability that can be triggered via crafted metric names and label values in Prometheus web UI tooltips and metrics explorer. Thanks to Duc Anh Nguyen from TinyxLab for reporting it.

- \[SECURITY] UI: Fix stored XSS via unescaped metric names and labels. CVE-2026-40179. [#&#8203;18506](prometheus/prometheus#18506)
- \[ENHANCEMENT] Consul SD: Introduce `health_filter` field for Health API filtering. [#&#8203;18499](prometheus/prometheus#18499)
- \[BUGFIX] Consul SD: Fix filter parameter being incorrectly applied to the Health API. [#&#8203;18499](prometheus/prometheus#18499)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDEuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEwMS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19-->

Reviewed-on: https://git.erwanleboucher.dev/eleboucher/homelab/pulls/152
Co-authored-by: bot-owl <[email protected]>
Co-committed-by: bot-owl <[email protected]>
vporoshok added a commit to deckhouse/prompp that referenced this pull request May 16, 2026
…React UI (CVE-2026-40179, CVE-2026-44903, CVE-2026-44990) (#336)

* fix(ui): escape metric names and label values in React UI (CVE-2026-40179, CVE-2026-44903)

Backports upstream prometheus/prometheus#18506 (GHSA-vffh-x6r8-xx99 /
CVE-2026-40179) and prometheus/prometheus#18588 (GHSA-fw8g-cg8f-9j28 /
CVE-2026-44903) for the React web UI we still ship.

Affected sinks now call escapeHTML before interpolation into innerHTML:
- Graph tooltips: __name__ and label keys (GraphHelpers.ts)
- Metrics Explorer fuzzy search: escapeHTML option on Fuzzy
- Heatmap bucket tooltip: le label (jquery.flot.heatmap.js)
- Heatmap y-axis tick labels: le label (Graph.tsx)

This blocks stored XSS in the Prometheus UI from metric names/label
values ingested via scrape, remote-write or OTLP receivers when
UTF-8 metric/label names allow <, > and " characters.

Co-authored-by: Cursor <[email protected]>

* fix(ui): pre-escape Flags fuzzy output before sanitize-html (CVE-2026-44990)

Defense-in-depth for GHSA-rpr9-rxv7-x643 (sanitize-html xmp raw-text
passthrough), for which no upstream patch is released yet.

The Flags page renders fuzzy-search results through sanitize-html
with allowedTags=['strong']. Under the default config sanitize-html
preserves the content of disallowed <xmp> tags verbatim, so a flag
value containing <xmp>...</xmp> would survive sanitization.

Set escapeHTML: true on the Fuzzy instance (same pattern we just used
in MetricsExplorer for CVE-2026-40179) so the search output is fully
entity-encoded except for the <strong> match markers. sanitize-html
then sees only the strong tags plus harmless entity-encoded text and
the xmp bypass is unreachable.

Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: Cursor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants