GHSA-3GXM-WFJX-M847

Vulnerability from github – Published: 2026-04-29 18:29 – Updated: 2026-05-08 01:25
VLAI
Summary
beets has a Cross-site Scripting vulnerability
Details

During code logic analyis, an area that may lead to unintended behavior under specific conditions was discovered.

Overview

  • Verified Version: 80cd21554124da07d17a4f962c7d770a4f70d0f2
  • Vulnerability Type: Stored XSS
  • Affected Location: beetsplug/web/templates/index.html:42
  • Trigger Scenario: Metadata fields such as title, lyrics, or comments are rendered with raw template interpolation and inserted into DOM via .html(...).

Root Cause

The bundled web UI uses Underscore template interpolation mode <%= ... %> for untrusted metadata fields. In this runtime, <%= ... %> is raw insertion and HTML escaping is only performed by <%- ... %>. Rendered output is then inserted with .html(...), allowing attacker-controlled markup to become active DOM.

Source-to-Sink Chain

  1. Source (attacker-controlled input)
  2. Item metadata values (for example title, lyrics, comments) can contain attacker HTML payload.

  3. Data flow

  4. Templates in beetsplug/web/templates/index.html:42-46,87-91 render metadata with <%= ... %>.
  5. Underscore runtime defines <%= ... %> as raw interpolation (beetsplug/web/static/underscore.js:890-907).

  6. Sink (security-sensitive action)

  7. Frontend inserts rendered template output into DOM via $(this.el).html(this.template(this.model.toJSON())); in beetsplug/web/static/beets.js:182,208,220.

Exploitation Preconditions

  1. Victim opens the web UI page that renders attacker-controlled metadata.
  2. Metadata includes executable HTML/JS payload.

Risk

Stored payload executes in the web UI context and can perform actions available to that origin.

Impact

Attacker can run arbitrary JavaScript in the victim browser, exfiltrate viewable data, and perform UI-driven actions as the victim session.

Remediation

  1. Replace raw interpolation <%= ... %> with escaped output <%- ... %> for untrusted fields.
  2. Avoid .html(...) for untrusted template output; use text-safe rendering.
  3. Sanitize metadata values on ingest and before rendering, including attribute contexts.
Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "beets"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "2.10.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-42052"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-79"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-04-29T18:29:00Z",
    "nvd_published_at": "2026-05-04T18:16:30Z",
    "severity": "MODERATE"
  },
  "details": "During code logic analyis, an area that may lead to unintended behavior under specific conditions was discovered. \n\n## Overview\n- Verified Version: `80cd21554124da07d17a4f962c7d770a4f70d0f2`\n- Vulnerability Type: Stored XSS\n- Affected Location: `beetsplug/web/templates/index.html:42`\n- Trigger Scenario: Metadata fields such as `title`, `lyrics`, or `comments` are rendered with raw template interpolation and inserted into DOM via `.html(...)`.\n\n## Root Cause\nThe bundled web UI uses Underscore template interpolation mode `\u003c%= ... %\u003e` for untrusted metadata fields. In this runtime, `\u003c%= ... %\u003e` is raw insertion and HTML escaping is only performed by `\u003c%- ... %\u003e`. Rendered output is then inserted with `.html(...)`, allowing attacker-controlled markup to become active DOM.\n\n## Source-to-Sink Chain\n1. Source (attacker-controlled input)\n- Item metadata values (for example `title`, `lyrics`, `comments`) can contain attacker HTML payload.\n\n2. Data flow\n- Templates in `beetsplug/web/templates/index.html:42-46,87-91` render metadata with `\u003c%= ... %\u003e`.\n- Underscore runtime defines `\u003c%= ... %\u003e` as raw interpolation (`beetsplug/web/static/underscore.js:890-907`).\n\n3. Sink (security-sensitive action)\n- Frontend inserts rendered template output into DOM via `$(this.el).html(this.template(this.model.toJSON()));` in `beetsplug/web/static/beets.js:182,208,220`.\n\n## Exploitation Preconditions\n1. Victim opens the web UI page that renders attacker-controlled metadata.\n2. Metadata includes executable HTML/JS payload.\n\n## Risk\nStored payload executes in the web UI context and can perform actions available to that origin.\n\n## Impact\nAttacker can run arbitrary JavaScript in the victim browser, exfiltrate viewable data, and perform UI-driven actions as the victim session.\n\n## Remediation\n1. Replace raw interpolation `\u003c%= ... %\u003e` with escaped output `\u003c%- ... %\u003e` for untrusted fields.\n2. Avoid `.html(...)` for untrusted template output; use text-safe rendering.\n3. Sanitize metadata values on ingest and before rendering, including attribute contexts.",
  "id": "GHSA-3gxm-wfjx-m847",
  "modified": "2026-05-08T01:25:19Z",
  "published": "2026-04-29T18:29:00Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/beetbox/beets/security/advisories/GHSA-3gxm-wfjx-m847"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-42052"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/beetbox/beets"
    },
    {
      "type": "WEB",
      "url": "https://github.com/beetbox/beets/releases/tag/v2.10.0"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
      "type": "CVSS_V4"
    }
  ],
  "summary": "beets has a Cross-site Scripting vulnerability"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.

Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…