Vulnerabilities in pkg:golang/github.com/prometheus/alertmanager

PACKAGE
Advisory Identifier: GHSA-v86x-5fm3-5p7j
Advisory Summary

CVE-2023-40577 is a MODERATE (CVSS 5.4) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Github.com/prometheus/alertmanager libraries in the Go ecosystem. The issue involves alertmanager ui is vulnerable to stored xss via the /api/v1/alerts endpoint. Remediation is available by upgrading affected packages to version 0.25.1.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/prometheus/alertmanager

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/prometheus/alertmanager. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-v86x-5fm3-5p7j CVE-2023-40577 MODERATE Alertmanager UI is vulnerable to stored XSS via the /api/v1/alerts endpoint

CVE-2023-40577 at a Glance

CVE Identifier CVE-2023-40577
GHSA Identifier GHSA-v86x-5fm3-5p7j
Severity MODERATE
CVSS v3.1 Base Score 5.4
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Github.com/prometheus/alertmanager
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.4

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2023-40577

To remediate this vulnerability, upgrade all affected Github.com/prometheus/alertmanager dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/prometheus/alertmanager fixed: 0.25.1
Upgrade github.com/prometheus/alertmanager to 0.25.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/prometheus/alertmanager

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-40577, inspect your project dependencies for Github.com/prometheus/alertmanager:

inspect dependencies for github.com/prometheus/alertmanager

Analyze the terminal output to locate any version of Github.com/prometheus/alertmanager in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.25.1), 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/alertmanager, 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

### Impact An attacker with the permission to perform POST requests on the /api/v1/alerts endpoint could be able to execute arbitrary JavaScript code on the users of Prometheus Alertmanager. ### Patches Users can upgrade to Alertmanager v0.2.51. ### Workarounds Users can setup a reverse proxy in front of the Alertmanager web server to forbid access to the /api/v1/alerts endpoint. ### References N/A

CVE-2023-40577 Affected Github.com/prometheus/alertmanager Versions

1 component(s)
Fixed Versions:
0.25.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/prometheus/alertmanager
Go
< 0.25.1
0.25.1

References

Frequently Asked Questions

What is CVE-2023-40577?
CVE-2023-40577 is a security vulnerability in Github.com/prometheus/alertmanager involving Alertmanager UI is vulnerable to stored XSS via the /api/v1/alerts endpoint under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Github.com/prometheus/alertmanager versions are affected?
Affected versions include releases prior to 0.25.1 across affected packages: github.com/prometheus/alertmanager.
What version fixes CVE-2023-40577?
Upgrading to 0.25.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/prometheus/alertmanager affected?
Yes, github.com/prometheus/alertmanager is affected in releases prior to 0.25.1. Upgrade your dependency to 0.25.1 or later.
What is the CVSS score of CVE-2023-40577?
CVE-2023-40577 has a CVSS v3.1 base score of 5.4 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2023-40577?
CVE-2023-40577 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (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.).
How can I check Go dependencies for CVE-2023-40577?
Run the dependency tree command: 'inspect dependencies for github.com/prometheus/alertmanager'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-v86x-5fm3-5p7j",
  "modified" : "2023-09-01T17:34:29Z",
  "published" : "2023-08-23T20:42:43Z",
  "aliases" : [ "CVE-2023-40577" ],
  "summary" : "Alertmanager UI is vulnerable to stored XSS via the /api/v1/alerts endpoint",
  "details" : "### Impact\n\nAn attacker with the permission to perform POST requests on the /api/v1/alerts endpoint could be able to execute arbitrary JavaScript code on the users of Prometheus Alertmanager.\n\n### Patches\n\nUsers can upgrade to Alertmanager v0.2.51.\n\n### Workarounds\n\nUsers can setup a reverse proxy in front of the Alertmanager web server to forbid access to the /api/v1/alerts endpoint.\n\n### References\n\nN/A\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/prometheus/alertmanager"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.25.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.25.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/prometheus/alertmanager/security/advisories/GHSA-v86x-5fm3-5p7j"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-40577"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/prometheus/alertmanager"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2023/10/msg00011.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-08-23T20:42:43Z",
    "nvd_published_at" : "2023-08-25T01:15:09Z"
  }
}