CVE-2026-97711: Serialize JavaScript: Cross-site scripting (XSS) via unescaped </script> in serialized function bodies

Published Sep 29, 2026
·
Updated

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 SCRIPTCLOSEREGEXP 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.

Affected Software

1 affected component
npm/serialize-javascript>=7.1.1<7.1.2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade serialize-javascript to a version that resolves this vulnerability.

    Fixed in 7.1.2

Event History

Sep 29, 2026
CVE Published
via MITRE·04:00 PM
Data Sourced
via MITRE·04:00 PM
DescriptionWeakness
Data Sourced
via NVD·04:17 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which uses are exposed to this issue?

Exposure requires serialize-javascript output containing a function value to be embedded in an HTML script element. Ordinary serialized data values and output generated with options.isJSON are unaffected.

2

What attacker control is needed for exploitation?

An attacker must be able to influence function source that is passed to serialize-javascript and have the resulting serialization embedded in a script element. A surviving </script> sequence can then close that element early and cause subsequent output to be interpreted as HTML in the page origin.

3

What should be done if the affected serializer behavior is in use?

Update serialize-javascript to version 7.1.2. Until updating is possible, avoid serializing attacker-influenced function values into script elements; use JSON-only output where compatible, since options.isJSON output is unaffected.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203