{"id":"CVE-2026-72925","aliases":["EUVD-2026-56179","GHSA-5qr2-v392-m9g8"],"status":"published","title":"SWC HTML minifier may allow script element breakout when minifying embedded JSON","description":"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.","severity":{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-11","score":0.00338,"percentile":0.27536,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-116","CWE-79"],"published":"2026-08-11T14:45:12Z","modified":"2026-10-28T02:30:44Z","fixes":[{"ecosystem":"npm","package":"@swc/html","fixed_in":["1.15.47-nightly-20260729.1"],"sources":["ghsa","osv"]},{"ecosystem":"crates.io","package":"swc_html_minifier","fixed_in":["59.0.0"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"@swc/html","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.15.47-nightly-20260729.1"}]}]},{"source":"ghsa","ecosystem":"crates.io","package":"swc_html_minifier","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"59.0.0"}]}]},{"source":"osv","ecosystem":"npm","package":"@swc/html","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"1.15.47-nightly-20260729.1"}]}]},{"source":"osv","ecosystem":"crates.io","package":"swc_html_minifier","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"59.0.0"}]}]}],"products":[{"vendor":"@swc","product":"html"},{"vendor":"swc-project","product":"swc"},{"vendor":"swc-project","product":"swc_html_minifier"}],"references":[{"url":"https://github.com/swc-project/swc/security/advisories/GHSA-5qr2-v392-m9g8","tags":["x_refsource_CONFIRM","advisory","web"]},{"url":"https://github.com/swc-project/swc/pull/12080","tags":["x_refsource_MISC","fix","web"]},{"url":"https://github.com/swc-project/swc/commit/e1877b44bdac8abc9fd51e984d584f40f6999832","tags":["x_refsource_MISC","fix","web"]},{"url":"https://github.com/swc-project/swc/releases/tag/v1.15.47","tags":["x_refsource_MISC","web"]},{"url":"https://github.com/swc-project/swc/releases/tag/v1.15.47-nightly-20260729.1","tags":["x_refsource_MISC","web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-72925","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-5qr2-v392-m9g8"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/72xxx/CVE-2026-72925.json","tags":["advisory"]},{"url":"https://github.com/swc-project/swc","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2026-72925","title":"SWC HTML minifier may allow script element breakout when minifying embedded JSON","description":"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.","status":"published","published":"2026-08-11T14:45:12.907Z","modified":"2026-08-11T18:26:38.644Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"cna"}],"cwes":["CWE-79","CWE-116"],"updated_at":"2026-11-02T14:19:51.663093Z"}],"euvd":[{"id":"EUVD-2026-56179","description":"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.","status":"published","published":"2026-08-11T14:45:12Z","modified":"2026-08-11T18:26:38Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"updated_at":"2026-11-02T18:01:59.481615Z"}],"ghsa":[{"id":"GHSA-5qr2-v392-m9g8","title":"SWC HTML minifier may allow script element breakout when minifying embedded JSON","description":"## Impact\n\n`@swc/html` minifies JSON contained in `script` elements such as\n`application/json` and `application/ld+json` by parsing and serializing the\nJSON value.\n\nBefore the patched versions, JSON serialization could convert escaped\nless-than signs such as `\\u003C` into literal `\u003c` characters. If the JSON\ncontained an escaped `\u003c/script\u003e` sequence, the generated HTML could terminate\nthe containing script element early because HTML tokenization occurs before\nthe JSON is consumed.\n\nApplications that minify HTML containing attacker-controlled JSON data could\ntherefore transform inert data into active markup. A crafted payload could\nexecute script in the origin of the generated page.\n\n## Patches\n\nThe issue is fixed in:\n\n- `@swc/html` 1.15.47\n- `swc_html_minifier` 59.0.0\n\nThe minifier now re-escapes less-than signs after JSON serialization, preserving\nthe script element boundary.\n\n## Workarounds\n\nUsers who cannot upgrade can disable JSON minification with:\n\n```js\nawait minify(html, {\n  minifyJson: false,\n});","status":"published","published":"2026-09-08T17:58:00Z","modified":"2026-09-08T17:58:02Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"cwes":["CWE-79","CWE-116"],"updated_at":"2026-11-02T14:41:13.477974Z"}],"nvd":[{"id":"CVE-2026-72925","description":"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.","status":"published","published":"2026-08-11T15:17:38.497Z","modified":"2026-09-18T20:05:53.723Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"secondary"}],"cwes":["CWE-79","CWE-116"],"updated_at":"2026-11-02T14:12:36.499002Z"}],"osv":[{"id":"CVE-2026-72925","title":"SWC HTML minifier may allow script element breakout when minifying embedded JSON","description":"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.","status":"published","published":"2026-08-11T14:45:12.907Z","modified":"2026-10-28T02:30:44.047342123Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"cwes":["CWE-116","CWE-79"],"updated_at":"2026-11-02T15:45:15.88521Z"},{"id":"GHSA-5qr2-v392-m9g8","title":"SWC HTML minifier may allow script element breakout when minifying embedded JSON","description":"## Impact\n\n`@swc/html` minifies JSON contained in `script` elements such as\n`application/json` and `application/ld+json` by parsing and serializing the\nJSON value.\n\nBefore the patched versions, JSON serialization could convert escaped\nless-than signs such as `\\u003C` into literal `\u003c` characters. If the JSON\ncontained an escaped `\u003c/script\u003e` sequence, the generated HTML could terminate\nthe containing script element early because HTML tokenization occurs before\nthe JSON is consumed.\n\nApplications that minify HTML containing attacker-controlled JSON data could\ntherefore transform inert data into active markup. A crafted payload could\nexecute script in the origin of the generated page.\n\n## Patches\n\nThe issue is fixed in:\n\n- `@swc/html` 1.15.47\n- `swc_html_minifier` 59.0.0\n\nThe minifier now re-escapes less-than signs after JSON serialization, preserving\nthe script element boundary.\n\n## Workarounds\n\nUsers who cannot upgrade can disable JSON minification with:\n\n```js\nawait minify(html, {\n  minifyJson: false,\n});","status":"published","published":"2026-09-08T17:58:00Z","modified":"2026-09-08T18:15:03.995774389Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"cwes":["CWE-116","CWE-79"],"updated_at":"2026-11-02T15:46:38.553953Z"}]}}
