CVE-2026-42052: Beets Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-3gxm-wfjx-m847
CWE-79
Published
Advisory Summary

CVE-2026-42052 is a MODERATE cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Beets libraries in the PyPI ecosystem. The issue involves beets has a cross-site scripting vulnerability. Remediation is available by upgrading affected packages to version 2.10.0.

CVE-2026-42052 at a Glance

CVE Identifier CVE-2026-42052
GHSA Identifier GHSA-3gxm-wfjx-m847
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Beets
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix CVE-2026-42052

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

beets fixed: 2.10.0
pip install beets>=2.10.0
Verify Direct and Transitive Dependencies

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

pip show beets

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-42052, inspect your installed packages using pip:

pip show beets

Analyze the terminal output to locate any version of Beets in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.10.0), your application is affected.

Note: The pip show beets command checks currently installed packages in your active Python environment.

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 Beets, 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

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) - Item metadata values (for example `title`, `lyrics`, `comments`) can contain attacker HTML payload. 2. Data flow - Templates in `beetsplug/web/templates/index.html:42-46,87-91` render metadata with `<%= ... %>`. - Underscore runtime defines `<%= ... %>` as raw interpolation (`beetsplug/web/static/underscore.js:890-907`). 3. Sink (security-sensitive action) - 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.

CVE-2026-42052 Affected Beets Versions

1 component(s)
Fixed Versions:
2.10.0
Product / Package Ecosystem Affected Versions Fixed Version
beets
PyPI
< 2.10.0
2.10.0

References

Frequently Asked Questions

What is CVE-2026-42052?
CVE-2026-42052 is a security vulnerability in Beets involving beets has a Cross-site Scripting vulnerability under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Beets versions are affected?
Affected versions include releases prior to 2.10.0 across affected packages: beets.
What version fixes CVE-2026-42052?
Upgrading to 2.10.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is beets affected?
Yes, beets is affected in releases prior to 2.10.0. Upgrade your dependency to 2.10.0 or later.
What CWE is associated with CVE-2026-42052?
CVE-2026-42052 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 PyPI dependencies for CVE-2026-42052?
Run the dependency tree command: 'pip show beets'. 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-3gxm-wfjx-m847",
  "modified" : "2026-06-24T00:30:30Z",
  "published" : "2026-04-29T18:29:00Z",
  "aliases" : [ "CVE-2026-42052" ],
  "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. \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 `<%= ... %>` 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.\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 `<%= ... %>`.\n- Underscore runtime defines `<%= ... %>` 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 `<%= ... %>` with escaped output `<%- ... %>` 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.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "beets"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.10.0"
      } ]
    } ]
  } ],
  "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"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2026/06/msg00030.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-29T18:29:00Z",
    "nvd_published_at" : "2026-05-04T18:16:30Z"
  }
}