Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
ReconAttacker injects crafted JSON payload via user input channel
-
DeliveryServer embeds payload in script type=application/json block
-
ExploitSWC minifier parses JSON unescaping \u003C to literal <
-
InstallSerialization writes unescaped < to output without calling escape_json_for_html_script
-
C2Closing script tag appears literally in minified HTML
-
ExecuteVictim browses page and browser tokenizer splits script element
-
ImpactInjected JavaScript executes in page origin
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding, context-aware escaping
MITRE ATT&CK
2 techniques across 2 tactics: Initial Access, Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Three concurrent conditions must be present: (1) the application uses swc_html_minifier or @swc/html to minify HTML at build time or per-request; (2) the HTML being minified contains at least one <script type='application/json'> or <script type='application/ld+json'> element whose content includes attacker-influenced data with a < character - typically data that was originally unicode-escaped as \u003C in JSON storage but gets unescaped during the parse/serialize cycle; and (3) a victim end user must load or navigate to the page containing the malicious minified output (CVSS UI:R). Applications serving only static, developer-authored JSON in script blocks with no user-supplied values are not exposed. The CVSS PR:N metric confirms no attacker authentication is required against the target application, but the attacker must have a channel - form submission, API call, URL parameter, or indirect data injection - to influence the JSON content that the minifier processes. |
| Impact | The vendor-assigned CVSS 3.1 score of 6.1 (AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N) is consistent with a classic reflected or stored XSS with cross-origin scope change: modest per-instance confidentiality and integrity impact but no availability impact. No EPSS data was provided; exploitation probability must be inferred from CVSS metrics alone. This vulnerability is not in the CISA KEV catalog at time of analysis, and no public exploit code has been identified. The real-world risk is conditional on deployment pattern: only applications that (1) actively use SWC's HTML minifier, (2) embed untrusted or attacker-influenced data inside JSON script blocks, and (3) serve the minified output to end users are exposed. Frameworks using SWC for SSR with dynamic structured-data injection (e.g., ld+json SEO blocks populated from user-controlled content) represent the highest-risk deployment scenario. The attack technique is trivially understood by any XSS researcher once the codepath is known, meaning dwell time between disclosure and exploitation attempts is likely short for affected applications. |
| Exploit ScenarioDerived | An attacker submits a user profile field or API parameter containing the value \u003C/script>\u003Cscript>alert(document.cookie)\u003C/script> - a valid unicode-escaped string in JSON. The application stores this and later renders it into a <script type='application/json'> block in a server-generated page. When SWC HTML minifier processes the page, it parses the JSON (unescaping \u003C to literal <), then re-serializes and writes the result back to the DOM node without escaping, producing a literal </script><script>alert(document.cookie)</script> sequence in the output HTML. Any victim who loads the minified page triggers the injected script, which executes in the page's full origin context. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Aug 11, 2026
Cross-site scripting in SWC's HTML minifier allows attacker-controlled JSON data embedded in application/json and application/ld+json script elements to break out of those elements and execute arbitrary JavaScript in the rendered page's origin. Applications that use swc_html_minifier or @swc/html to minify server-rendered HTML containing dynamic JSON script blocks are vulnerable - the minifier parsed JSON (unescaping unicode-escaped less-than signs) then re-serialized without re-escaping them, letting a crafted closing sequence terminate the script element prematurely. No public exploit has been identified at time of analysis, but the attack technique is a well-understood HTML parser quirk and the fix commit provides a clear reproduction case.
RemediationAI
Upgrade @swc/html to version 1.15.47-nightly-20260729.1 or later and swc_html_minifier to version 59.0.0 or later; these are the vendor-confirmed fixed releases documented at https://github.com/swc-project/swc/releases/tag/v1.15.47-nightly-20260729.1 and the security advisory GHSA-5qr2-v392-m9g8. If an immediate upgrade is not feasible, apply a compensating control by pre-escaping all < characters to \u003C in any JSON values destined for <script type='application/json'> or <script type='application/ld+json'> elements before they are passed to the SWC minifier; this prevents the HTML tokenizer from misinterpreting the serialized output. The trade-off of this workaround is that it introduces a bespoke encoding step that must be applied consistently across every code path that populates JSON script blocks - any gap reinstates the vulnerability. Restricting HTML minification to pages that contain only static, trusted JSON content (no user-supplied values) is an additional risk-reduction measure but is difficult to enforce reliably in dynamic SSR pipelines.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 4 packages in cargo, npm, euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
SWC is a Rust-based TypeScript/JavaScript compiler toolchain (CPE: cpe:2.3:a:swc-project:swc, cpe:2.3:a:swc-project:swc_html_minifier) that includes an HTML minifier in crates/swc_html_minifier/src/lib.rs. The vulnerable codepath, minifyJson, handled content inside <script type='application/json'> and <script type='application/ld+json'> elements by parsing the JSON (which unescapes unicode sequences such as \u003C back to literal <) and then re-serializing it without applying any HTML-safe escaping. The root cause maps to CWE-79 (Improper Neutralization of Input During Web Page Generation): HTML tokenizers process raw bytes and recognize </script as a closing tag before any JSON semantics apply, so a literal < character in serialized JSON can smuggle a closing sequence that the browser HTML parser acts on. The fix introduces escape_json_for_html_script, which replaces all < with \u003C after JSON serialization before the content is written back into the DOM node.
Know when Swc gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Network-delivered XSS requiring victim page load; no attacker auth needed; scope changes to victim browser origin; no availability impact.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
1DescriptionCVE.org
SWC is a TypeScript / JavaScript compiler written in Rust. Prior to @swc/html 1.15.47-nightly-20260729.1 and swc_html_minifier 59.0.0, the minifyJson processing in crates/swc_html_minifier/src/lib.rs parsed and serialized attacker-controlled JSON in application/json and application/ld+json script elements without the escape_json_for_html_script behavior to re-escape less-than signs, allowing a closing script sequence to terminate the element early and execute script in the generated page's origin. This issue is fixed in @swc/html 1.15.47-nightly-20260729.1 and swc_html_minifier 59.0.0.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.
EUVD-2026-56179
GHSA-5qr2-v392-m9g8
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB