beets has a Cross-site Scripting vulnerability
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, orcommentsare 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
- Source (attacker-controlled input)
- Item metadata values (for example
title,lyrics,comments) can contain attacker HTML payload.
- Data flow
- Templates in
beetsplug/web/templates/index.html:42-46,87-91render metadata with<%= ... %>. - Underscore runtime defines
<%= ... %>as raw interpolation (beetsplug/web/static/underscore.js:890-907).
- Sink (security-sensitive action)
- Frontend inserts rendered template output into DOM via
$(this.el).html(this.template(this.model.toJSON()));inbeetsplug/web/static/beets.js:182,208,220.
Exploitation Preconditions
- Victim opens the web UI page that renders attacker-controlled metadata.
- 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
- Replace raw interpolation
<%= ... %>with escaped output<%- ... %>for untrusted fields. - Avoid
.html(...)for untrusted template output; use text-safe rendering. - Sanitize metadata values on ingest and before rendering, including attribute contexts.
Affected software
Click a technology to see all vulnerabilities affecting it.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| Python (PyPI) | beets | < 2.10.0 | 2.10.0 |
References
- https://github.com/beetbox/beets/security/advisories/GHSA-3gxm-wfjx-m847
- https://nvd.nist.gov/vuln/detail/CVE-2026-42052
- https://github.com/beetbox/beets
- https://github.com/beetbox/beets/releases/tag/v2.10.0
- https://lists.debian.org/debian-lts-announce/2026/06/msg00030.html
- https://pypi.org/project/beets
- https://github.com/advisories/GHSA-3gxm-wfjx-m847
- CVSS vector
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- Weakness (CWE)
CWE-79- Platform
- Python (PyPI)
- Package
beets- Disclosed
- 29.04.2026
- Updated
- 11.10.2026 14:18
Sources and licenses
OSV / GitHub Advisory Database - PYSEC-2026-2397 - PyPA Advisory Database; CC BY 4.0
OSV / GitHub Advisory Database - GHSA-3gxm-wfjx-m847 - CC BY 4.0
Vulnerability history: beets
All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.
This is the only known vulnerability of this package.
Know which vulnerabilities affect your application
With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.