CVE-2026-115897: serialize-javascript cross-site scripting via unescaped script tag

CVE-2026-115897 · Severity: medium · CVSS 4.7 · Published 2026-10-23

serialize-javascript is a library that converts JavaScript objects and functions into serialized strings for transmission or storage. Versions 7.0.1 through 7.1.2 fail to escape closing script tags at the end of function bodies, allowing attackers to inject malicious HTML and JavaScript (such as image onerror handlers) when a spoofed function's toString() method is serialized. This could lead to account takeover or data theft in applications that use this library to serialize untrusted functions.

Technologies: serialize-javascript (npm), Yahoo Serialize-Javascript. Vendors: npm, Yahoo.

Quick answers

Is CVE-2026-115897 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-115897 being exploited in the wild.
How severe is CVE-2026-115897?
Medium severity, with a CVSS score of 4.7, published 23 October 2026.
Which products and versions are affected?
serialize-javascript (npm) SEMVER:introduced=0,fixed=7.1.3; Yahoo Serialize-Javascript 7.0.1 before 7.1.3.
Is there a fix for CVE-2026-115897?
Yes. serialize-javascript (npm): upgrade to 7.1.3 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-115897 attacked?
It is attacked over the network.
Am I affected by CVE-2026-115897?
Check whether you run serialize-javascript (npm) or Yahoo Serialize-Javascript at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • serialize-javascript (npm): upgrade to 7.1.3 or later
    npm install serialize-javascript@7.1.3

Technical details

The vulnerability is a cross-site scripting (XSS) flaw in the escapeFunctionBody() function. When serializing a function, if its source code ends with an unescaped </script> sequence, the subsequent delimiter (such as a newline from the space option) leaves the closing tag unescaped, allowing an attacker controlling the function's toString() to break out of the script context and inject arbitrary markup. The fix applies escaping to </script> at the end of serialized function bodies.

Affected products

  • Yahoo serialize-javascript 7.0.1 before 7.1.3

Identifiers

  • CVE-2026-115897
  • CVE-2026-115754
  • GHSA-m5mm-p8h7-m29v

Timeline

  • 2026-10-23: disclosed
  • 2026-10-22: patched

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.