Loading...
Skip to main content

CVE-2026-72925 — Vulnerability in swc_html_minifier — CVE Details

MEDIUM

SWC HTML minifier may allow script element breakout when minifying embedded JSON

Published September 8, 2026Updated September 8, 2026Source: osv

Summary

## Impact `@swc/html` minifies JSON contained in `script` elements such as `application/json` and `application/ld+json` by parsing and serializing the JSON value. Before the patched versions, JSON serialization could convert escaped less-than signs such as `\u003C` into literal `<` characters. If the JSON contained an escaped `</script>` sequence, the generated HTML could terminate the containing script element early because HTML tokenization occurs before the JSON is consumed. Applications that minify HTML containing attacker-controlled JSON data could therefore transform inert data into active markup. A crafted payload could execute script in the origin of the generated page. ## Patches The issue is fixed in: - `@swc/html` 1.15.47 - `swc_html_minifier` 59.0.0 The minifier now re-escapes less-than signs after JSON serialization, preserving the script element boundary. ## Workarounds Users who cannot upgrade can disable JSON minification with: ```js await minify(html, { minifyJson: false, });

Advisory Timeline

  • First published September 8, 2026 (34 days ago).
  • Last revised September 8, 2026 — 0 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Cargo
Update swc_html_minifier to 59.0.0 or later
cargo update -p swc_html_minifier --precise 59.0.0
npm
Update @swc/html to 1.15.47-nightly-20260729.1 or later
npm install @swc/html@1.15.47-nightly-20260729.1

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (2)

Affects 2 ecosystems: crates.io (1), npm (1).

PackageEcosystemAffectedFixed In
swc_html_minifier
crates.io
All versions59.0.0
@swc/html
npm
All versions1.15.47-nightly-20260729.1

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

  • CWE-116
    Improper Encoding or EscapingMITRE
  • CWE-79
    Cross-site Scripting (XSS)MITRE

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 6.1 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Frequently Asked Questions

What is CVE-2026-72925?
SWC HTML minifier may allow script element breakout when minifying embedded JSON This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 6.1/10).
How do I check if my project is affected by CVE-2026-72925?
CVE-2026-72925 affects swc_html_minifier and @swc/html. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-72925 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
6.1

Exploitation requires specific conditions or has limited impact. Remediate within weeks.

Also Known As

GHSA-5qr2-v392-m9g8

Related CVEs

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies