CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-72925

CVE-2026-72925: Cross-Site Scripting via Improper JSON Escaping in SWC HTML Minifier

Amit Schendel
Amit Schendel
Senior Security Researcher

Sep 8, 2026·7 min read·17 visits

Executive Summary (TL;DR)

SWC HTML minifier incorrectly converts safe Unicode-escaped less-than characters inside JSON blocks to raw less-than characters, allowing attackers to terminate script blocks early and execute arbitrary JavaScript (XSS) in victim browsers.

CVE-2026-72925 is a critical vulnerability in the SWC HTML minifier (@swc/html and swc_html_minifier) where safe Unicode-escaped characters in embedded JSON script tags are normalized into raw, unescaped characters during optimization, causing browser-side HTML injection and Cross-Site Scripting.

Vulnerability Overview

The @swc/html package and the underlying Rust-based swc_html_minifier crate are utilized within high-performance frontend build pipelines to compile, optimize, and minify HTML templates and static pages. To maximize execution speed, the Speedy Web Compiler (SWC) architecture parses the entire HTML document object model (DOM) into an Abstract Syntax Tree (AST), optimizes each node, and serializes the tree back into a minified string. This minification pipeline exposes a critical attack surface when handling structured metadata inside non-executable script tags.\n\nWeb applications commonly embed structured data using tags such as <script type="application/json"> or <script type="application/ld+json">. While browsers do not directly execute these blocks as scripts, the HTML parser still processes the containing text block under specific state rules. A vulnerability arises if the compiler's minification engine fails to preserve safety guarantees implemented by upstream application layers during the serialization of these embedded JSON payloads.\n\nCVE-2026-72925 describes an improper encoding vulnerability where safe Unicode-escaped sequences (such as \\u003C) are normalized into raw ASCII characters during the re-serialization of JSON blocks. Because the HTML parser evaluates the raw characters before the JSON is parsed, this normalization breaks the script container boundary, introducing an unauthenticated Cross-Site Scripting (XSS) vector. This analysis dissects the technical mechanics of the bug, the exact code-level failure, and the remediation path.

Root Cause Analysis

To understand the root cause of CVE-2026-72925, one must examine how web browsers parse script elements under the HTML5 standard. When the browser's tokenization engine encounters a <script> tag, it transitions into the Script Data State. In this state, the parser stops interpreting typical HTML markup, including elements, tags, and comments. It treats all characters as raw text until it matches an end tag open token (</) followed by the exact token sequence script (case-insensitive).\n\nThis behavior remains active even if the script tag's MIME type indicates non-executable data, such as application/json or application/ld+json. If a JSON block within a script tag contains a string like </script>, the parser interprets this string as the literal termination of the script block. To prevent this, secure application frameworks escape the less-than character as a Unicode escape sequence (\\u003C) when serializing JSON for inclusion in HTML documents. The browser's HTML parser reads \\u003C as a plain string, keeping the script block intact.\n\nIn vulnerable versions of swc_html_minifier, the JSON parser deserializes the embedded JSON payload to minify its structure, removing redundant whitespace and formatting. During the subsequent serialization step, the underlying JSON serializer normalizes the safe \\u003C representation back to its raw ASCII character <. Because this raw character is written directly into the final HTML token stream, the browser's parser encounters </script> as a literal element boundary rather than an escaped JSON string value.

Code Analysis

The vulnerability in swc_html_minifier resides in how the compiler processes script blocks designated as JSON containers. Prior to the fix, the compiler minified the JSON string and assigned the serialized output directly to the node data without post-processing. The following diff highlights the implementation of the fix within crates/swc_html_minifier/src/lib.rs under commit e1877b44bdac8abc9fd51e984d584f40f6999832.\n\nrust\n// Crates: swc_html_minifier\n// File: crates/swc_html_minifier/src/lib.rs\n\nimpl<C: MinifyCss> Minifier<'_, C> {\n // ... existing code ...\n\n+ /// Escapes serialized JSON so it cannot terminate its containing HTML\n+ /// `script` element.\n+ ///\n+ /// HTML tokenization recognizes `</script` before the JSON is parsed.\n+ /// Serializing an escaped `<` as a literal character can therefore turn\n+ /// JSON data into a different HTML element structure.\n+ fn escape_json_for_html_script(json: String) -> String {\n+ if json.contains('<') {\n+ json.replace('<', "\\\\u003C")\n+ } else {\n+ json\n+ }\n+ }\n\n fn need_minify_js(&self) -> bool {\n // ...\n\n\nDuring the AST traversal, the minifier visits the script nodes and performs the minimization. The patch intercepts the assignment of the minified string, ensuring that any literal < character is re-escaped before writeback:\n\nrust\nimpl<C: MinifyCss> VisitMut for Minifier<'_, C> {\n // ... inside the AST visit loop for script elements ...\n Some(MinifierType::Json) => {\n let minified =\n match self.minify_json(&n.data) {\n Some(v) => v,\n None => return,\n };\n\n- n.data = minified.into();\n+ n.data = Self::escape_json_for_html_script(minified).into();\n }\n\n\nThis fix successfully blocks the primary vector by replacing all raw < characters with their Unicode escape sequences (\\u003C). However, because it performs a simple string replacement after serialization, it relies heavily on the correctness of the preceding JSON parsing stages. If the incoming JSON payload is malformed in a way that escapes normal parsing but triggers the replacement logic incorrectly, parser differentials could still manifest, though no such variants are currently known.

Exploitation Methodology

Exploitation of CVE-2026-72925 requires that an attacker can inject arbitrary strings into a data field that is later embedded in an application's JSON configuration and processed by a vulnerable SWC build pipeline. The attacker does not need direct access to the build server; the exploit payload is compiled statically or dynamically into the application's client-facing assets. The primary prerequisite is that the backend application must serialize the payload into an embedded JSON script tag.\n\nmermaid\ngraph LR\n A["Attacker Input"] -->|"\u003C/script><script>alert(1)</script>"| B["Backend Server"]\n B -->|"Serializes HTML safely"| C["Safe HTML template"]\n C -->|"\u003C/script> safe Unicode"| D["Vulnerable SWC Minifier"]\n D -->|"Normalizes to raw </script>"| E["Compiles Unsafe HTML"]\n E -->|"Delivers Payload"| F["Victim Browser"]\n F -->|"Executes Script"| G["XSS Execution"]\n\n\nConsider a user profile configuration where a user can supply a custom configuration object. The backend properly sanitizes the database output, escaping the JSON to prevent immediate XSS. This produces the following safe HTML markup before minification:\n\nhtml\n<script type="application/json">\n {\n "theme": "dark",\n "custom_label": "\\u003C/script><script>alert(document.domain)</script>"\n }\n</script>\n\n\nWhen the vulnerable version of @swc/html processes this template, the serialization output normalizes the Unicode escape sequence. The resulting minified HTML contains a raw < character within the JSON string:\n\nhtml\n<script type=application/json>{"theme":"dark","custom_label":"</script><script>alert(document.domain)</script>"}</script>\n\n\nWhen the victim's browser loads the page, the HTML parser parses the script tag up to the first occurrence of </script>. It immediately closes the script context and treats the subsequent characters <script>alert(document.domain)</script> as a new, active executable script block. The browser then executes the arbitrary JavaScript in the context of the vulnerable application's origin.

Impact Assessment

The impact of CVE-2026-72925 is high-severity Cross-Site Scripting (XSS). An attacker who successfully exploits this vulnerability can execute arbitrary JavaScript code within the context of the victim's browser session. Depending on the design of the target web application, this execution can lead to the theft of session tokens, sensitive user data, and automated actions on behalf of the victim.\n\nThe CVSS v3.1 score of 6.1 (Medium) reflects the standard constraints of client-side exploitation. The attack vector is Network (AV:N), and complexity is Low (AC:L) since the exploit does not require specialized conditions. No privileges are required (PR:N) for the initial payload injection if the data-entry path is public. However, User Interaction (UI:R) is required because a victim must load the minified HTML asset in their browser. The Scope is Changed (S:C) because the vulnerability in the static compilation pipeline affects the browser execution environment.\n\nAccording to current intelligence, the EPSS score is 0.00194, indicating a very low current probability of automated exploit campaigns in the wild. The vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. However, because build tools are often integrated into continuous delivery (CI/CD) pipelines, vulnerabilities of this class can propagate rapidly to multiple production servers once a compromised source branch is merged.

Remediation and Detection

The primary remediation strategy is upgrading the SWC packages across all development and production environments. For Node.js-based environments, update the @swc/html dependency to version 1.15.47 or later. For Rust projects, update the swc crate to version 1.15.47 or later, and the swc_html_minifier crate to version 59.0.0 or later.\n\nTo identify vulnerable configurations programmatically, security teams can implement automated dependency scanning to detect out-of-date SWC packages in lockfiles. A manual verification can also be performed by compiling a test file. Create a file named test.html containing the following text:\n\nhtml\n<script type="application/json">{"test":"\\u003C/script>"}</script>\n\n\nCompile the file using your current SWC build configuration. If the output contains the raw string </script> inside the JSON object, the pipeline is vulnerable. If the output preserves \\u003C/script>, the fix is active. In environments where upgrading is not immediately possible, deploy a Web Application Firewall (WAF) rule to block or sanitize input payloads containing closing HTML tags inside JSON-like request structures.

Fix Analysis (1)

Technical Appendix

CVSS Score
6.1/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
EPSS Probability
0.19%
Top 91% most exploited

Affected Systems

@swc/htmlswcswc_html_minifier

Affected Versions Detail

Product
Affected Versions
Fixed Version
@swc/html
swc-project
< 1.15.471.15.47
swc
swc-project
< 1.15.471.15.47
swc_html_minifier
swc-project
< 59.0.059.0.0
AttributeDetail
CWE IDCWE-79 (Improper Neutralization of Input During Web Page Generation)
Attack VectorNetwork (AV:N/AC:L/PR:N/UI:R)
CVSS v3.1 Score6.1 (Medium)
EPSS Score0.00194 (Percentile: 9.11%)
ImpactStored / DOM-based Cross-Site Scripting (XSS)
Exploit StatusConceptual Proof-of-Concept
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1189Drive-by Compromise
Initial Access
T1185Browser Session Hijacking
Collection
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The software does not neutralize or incorrectly neutralizes user-controlled input before displaying it in a web browser, allowing scripts to be executed.

Vulnerability Timeline

Vulnerability patched via PR #12080 and commit e1877b44bdac8abc9fd51e984d584f40f6999832
2026-07-29
Release of patched nightly version 1.15.47-nightly-20260729.1
2026-07-29
GitHub Security Advisory GHSA-5qr2-v392-m9g8 published and CVE-2026-72925 assigned
2026-08-11
National Vulnerability Database (NVD) registers and scores the advisory
2026-08-11

References & Sources

  • [1]GitHub Security Advisory GHSA-5qr2-v392-m9g8
  • [2]Official SWC Fix Pull Request #12080
  • [3]Official SWC Fix Commit
  • [4]NVD Vulnerability Details

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•9 minutes ago•CVE-2026-126298
7.5

CVE-2026-126298: Quadratic Algorithmic Complexity Denial of Service in NLTK Tree.chomsky_normal_form

CVE-2026-126298 (also tracked as GHSA-r53h-rw34-8h97) is an algorithmic complexity Denial of Service (DoS) vulnerability in the Natural Language Toolkit (NLTK) Python library affecting all versions prior to 3.10.4. The vulnerability resides in the nltk.tree.transforms.chomsky_normal_form function and its corresponding public method Tree.chomsky_normal_form(). When transforming a parse tree into Chomsky Normal Form using the default right-factoring strategy, the function repeatedly invokes list.pop(0) inside a loop iterating over all children of a node. In CPython, removing the initial element of a standard list requires an O(N) memory shift operation, causing the overall binarization algorithm to degrade to O(N^2) quadratic time complexity relative to the width of a node. Furthermore, converting horizontal node width into vertical tree depth bypasses initial parsing depth bounds, triggering subsequent stack exhaustion (RecursionError) when recursive methods traverse the mutated structure. Unauthenticated remote attackers who can submit bracketed tree strings to applications invoking this transformation can exhaust single-threaded CPU resources or induce unhandled application exceptions.

Alon Barad
Alon Barad
0 views•12 min read
•about 1 hour ago•CVE-2026-126299
7.5

CVE-2026-126299: Quadratic Algorithmic Complexity Denial of Service in NLTK CCG Lexicon Parser

An algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) before version 3.10.4 allows remote unauthenticated attackers to cause a denial of service via crafted Combinatory Categorial Grammar (CCG) lexicon strings. The parser in nltk.ccg.lexicon.fromstring performs repeated immutable string slicing, concatenation, and regex tail capturing, resulting in O(n^2) CPU consumption when processing wide, flat category definitions.

Alon Barad
Alon Barad
3 views•10 min read
•about 2 hours ago•CVE-2026-126295
7.1

CVE-2026-126295: Path Traversal and Unconfined File Access in NLTK BllipParser

CVE-2026-126295 (also tracked as GHSA-fg9w-wfp5-j933) is a path confinement bypass vulnerability in the Natural Language Toolkit (NLTK) affecting versions 3.10.0 prior to 3.10.4. The flaw resides in nltk/parse/bllip.py within the BllipParser class and its factory method BllipParser.from_unified_model_dir(). Unlike sibling tool wrappers in NLTK that enforce data-root confinement via the nltk.pathsec module, BllipParser passes caller-supplied filesystem paths directly into the third-party bllipparser native C extension without validation. When an application passes untrusted input as model paths or directories to BllipParser, an attacker can force the native extension to open arbitrary files on the local filesystem. This leads to information disclosure through parser diagnostic oracles, local model tampering via shared directories, and denial of service by hanging worker threads on blocking special files (such as FIFOs or device nodes) or exhausting memory via oversized files.

Amit Schendel
Amit Schendel
2 views•11 min read
•about 3 hours ago•CVE-2026-126300
5.3

CVE-2026-126300: Algorithmic Complexity Denial of Service in NLTK TreebankWordTokenizer.span_tokenize

CVE-2026-126300 (GHSA-ffr9-mgrr-wcvr) is an inefficient algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) Python library affecting versions 3.2.5 prior to 3.10.4. The flaw resides in the quote-restoration routine of TreebankWordTokenizer.span_tokenize and NLTKWordTokenizer.span_tokenize, where repeated calls to list.pop(0) over matched quote tokens introduce quadratic O(n^2) time complexity. An unauthenticated remote attacker who supplies input containing long sequences of double-quote characters can exhaust CPU resources and degrade service availability.

Amit Schendel
Amit Schendel
3 views•10 min read
•about 4 hours ago•GHSA-GPWC-27CW-RH9R
5.3

CVE-2026-126301: Quadratic CPU Exhaustion in NLTK LegalitySyllableTokenizer

The Natural Language Toolkit (NLTK) versions 3.6 through 3.10.3 contain an algorithmic complexity vulnerability in the LegalitySyllableTokenizer.tokenize method. When processing tokens composed of continuous runs of vowels, an unguarded string reversal and set membership lookup loop executes in quadratic time relative to the input token length. Remote attackers capable of submitting arbitrary text to applications utilizing this tokenizer can trigger sustained single-core CPU exhaustion and application-level denial of service.

Amit Schendel
Amit Schendel
4 views•10 min read
•about 5 hours ago•CVE-2026-126304
8.7

CVE-2026-126304: Symlink Path Traversal in NLTK YCOECorpusReader

CVE-2026-126304 is a symlink path traversal vulnerability (CWE-59) in the Natural Language Toolkit (NLTK) versions 3.10.0 prior to 3.10.4. The YCOECorpusReader class constructs internal sub-readers for the 'psd' and 'pos' subdirectories using FileSystemPathPointer.join(), which relies exclusively on lexical string-prefix validation rather than canonical path resolution. An attacker who supplies a crafted YCOE corpus containing symbolic links in place of the 'psd' or 'pos' subdirectories can bypass directory confinement and read arbitrary files from sibling corpora or sensitive directories within the NLTK data sandbox.

Amit Schendel
Amit Schendel
6 views•9 min read