{"id":"CVE-2026-72925","aliases":["CVE-2026-72925","GHSA-5qr2-v392-m9g8"],"related":[],"kind":"vulnerability","state":"published","title":"SWC HTML minifier may allow script element breakout when minifying embedded JSON","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"## 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 `<` characters. If the JSON\ncontained an escaped `</script>` 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});","format":"markdown","source":"ghsa"}],"published":"2026-08-11T14:45:12.907Z","modified":"2026-09-18T20:05:53.723Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"}],"cwes":["CWE-79","CWE-116"],"affected":[{"ranges":[{"version":"< 1.15.47","status":"affected"}],"vendor":"swc-project","product":"swc","source":"cvelist"},{"ranges":[{"version":"< 1.15.47-nightly-20260729.1","status":"affected"}],"vendor":"@swc","product":"html","source":"cvelist"},{"ranges":[{"version":"< 59.0.0","status":"affected"}],"vendor":"swc-project","product":"swc_html_minifier","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.15.47-nightly-20260729.1"}],"ecosystem":"npm","package":"@swc/html","purl":"pkg:npm/%40swc/html","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"59.0.0"}],"ecosystem":"crates.io","package":"swc_html_minifier","purl":"pkg:cargo/swc_html_minifier","source":"ghsa"}],"references":[{"url":"https://github.com/swc-project/swc/security/advisories/GHSA-5qr2-v392-m9g8","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/swc-project/swc/pull/12080","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/swc-project/swc/commit/e1877b44bdac8abc9fd51e984d584f40f6999832","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/swc-project/swc/releases/tag/v1.15.47","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/swc-project/swc/releases/tag/v1.15.47-nightly-20260729.1","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-72925","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/swc-project/swc","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-08-11T18:26:27.962Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-72925","url":"https://www.cve.org/CVERecord?id=CVE-2026-72925","licence":"CVE Terms of Use","modified":"2026-08-11T18:26:38.644Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-5qr2-v392-m9g8","url":"https://github.com/advisories/GHSA-5qr2-v392-m9g8","licence":"CC-BY-4.0","modified":"2026-09-08T18:15:03.995Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-72925","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-72925","licence":"Public domain","modified":"2026-09-18T20:05:53.723Z"}],"updatedAt":"2026-11-25T22:59:32.259Z","epss":{"score":0.00194,"percentile":0.09502,"date":"2026-12-01T12:00:22.000Z"}}