CVE-2026-97711

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

Published Sep 29, 2026 CVSS 4.0 · 2.3 Low EPSS < 1% KEV · Not listed
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.

Analysis

AI-generated

Technical impact

Serialize JavaScript serializes values to a superset of JSON that includes function literals. An attacker can supply function source containing an unescaped closing script tag, which is not fully shielded by the library’s closing‑tag regex. When the serialized function is embedded directly inside a <script> element in a web page, the stray </script> prematurely terminates the element and the remaining text is parsed as HTML, allowing an attacker to inject arbitrary script content. Only function values are affected; ordinary data values and JSON‑only output are not impacted.

Affected Systems

The flaw exists in Yahoo's serialize‑javascript library, specifically in version 7.1.1. Releases from 7.1.1 up to, but not including, 7.1.2 are vulnerable, and the issue is fixed in 7.1.2.

Risk and Exploitability

The CVSS score is 2.3, indicating a low severity against confidentiality, integrity, and availability. The EPSS score is not available, and the vulnerability is not listed in the CISA KEV catalog. Exploitation requires that a web application embed the serialized function output directly into a <script> tag without proper escaping. The attack, therefore, depends on client‑side rendering code that trusts untrusted function bodies and is limited to scripts that run in the originating page context.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade serialize‑javascript to version 7.1.2 or later.
  • Audit all code paths that output serialized function bodies into <script> elements and ensure that the output is properly escaped or that function literals are not inserted directly.
  • If upgrading is not immediately possible, remove the use of function literals in serialized output or restrict the data to JSON‑only output, and apply sanitization to any dynamic content that may contain script tags.

Generated by OpenCVE AI on September 30, 2026 at 00:53 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-gfhx-hw2g-v5hg Serialize JavaScript: Cross-site scripting (XSS) via unescaped </script> in serialized function bodies
History
Type Values Removed Values Added
References
Metrics threat_severity

None

cvssV3_1

{'score': 6.1, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N'}

threat_severity

Moderate

Type Values Removed Values Added
First Time appeared Yahoo
Yahoo serialize-javascript
Vendors & Products Yahoo
Yahoo serialize-javascript
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
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.
Title Serialize JavaScript: Cross-site scripting (XSS) via unescaped </script> in serialized function bodies
Weaknesses CWE-79
References
Metrics cvssV4_0

{'score': 2.3, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N'}

Weaknesses
  • CWE-79

    Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Sep 29, 2026, 4:53 PM
Reserved
Sep 24, 2026, 9:43 PM
Status
Awaiting Analysis
Published
Sep 29, 2026, 4:17 PM
Modified
Sep 30, 2026, 7:38 PM
Severity
Moderate
Public date
Sep 29, 2026, 4:00 PM