[ CVE-2026-97711 · Published 29 Sep 2026 ]
Serialize JavaScript: Cross-site scripting (XSS) via unescaped </script> in serialized function bodies
[ Description ]Official description
Serialize JavaScript serializes JavaScript values to a superset of JSON that includes regular expressions and functions. From 7.1.1 until 7.1.2, function values serialized by serialize-javascript are not fully protected against script-closing tags in attacker-influenced function source because SCRIPT_CLOSE_REGEXP can consume a second closing tag inside one match. When the serialized function is embedded in a script element, the surviving closing tag terminates the element early and causes the remaining output to be parsed as HTML, enabling cross-site scripting in the page origin. Only function values are affected; ordinary data values and options.isJSON output are unaffected. This issue is fixed in version 7.1.2.
[ Fixes ]Fixes and patches
- serialize-javascript 7.1.2Fixed version · GitHub Advisories · npm package serialize-javascript: upgrade to 7.1.2 or later (affected >= 7.1.1, < 7.1.2)
[ Packages ]Affected open-source packages
- serialize-javascript npmAffected >= 7.1.1, < 7.1.2 · fixed in 7.1.2 · GHSA-gfhx-hw2g-v5hg