{"id":"CVE-2026-42052","aliases":["GHSA-3gxm-wfjx-m847","PYSEC-2026-2397"],"url":"https://o3.security/vulnerability/CVE-2026-42052","summary":"beets is Vulnerable to XSS","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.","published":"2026-05-04T17:06:23.162Z","modified":"2026-08-12T03:51:29.522107052Z","cvss":null,"epss":{"score":0.003,"percentile":0.22453,"asOf":"2026-08-12"},"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"PyPI","name":"beets","fixedVersion":"2.10.0"}],"fix":null,"references":[{"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"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/42xxx/CVE-2026-42052.json"},{"type":"ADVISORY","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"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-12T03:51:29.522107052Z"}}