Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessInfluence serialized function source
-
DeliveryServer embeds output in script element
-
ExploitInner </script> survives regex escaping
-
ExecutionBrowser closes script early, parses HTML
-
ImpactAttacker JavaScript runs in page origin
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding, context-aware escaping
MITRE ATT&CK
2 techniques across 2 tactics: Initial Access, Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires serialize-javascript 7.1.1 (fixed in 7.1.2) AND the consuming application must serialize a FUNCTION value whose source string is attacker-influenced AND embed that serialized output inside an HTML <script> element. Ordinary data values and options.isJSON output are NOT affected. The attacker must craft function source containing a </script in plain-code position (e.g. 'x</script=+/') followed later by a real </script> so a single SCRIPT_CLOSE_REGEXP match spans and swallows the inner closing tag. Limiting factors: only the 7.1.1 release is vulnerable, only function serialization is affected, victim page rendering (user interaction) is needed to trigger the injected markup, and the impact is XSS in the page origin rather than server compromise - no confidentiality/integrity/availability impact to the vulnerable system itself. |
| Impact | This is a genuine but low-severity, narrow-window XSS. The vendor CVSS 4.0 vector (AV:N/AC:L/AT:P/PR:N/UI:P) yields only 2.3 because the impact is confined to subsequent-system integrity/confidentiality (SC:L/SI:L, VC/VI/VA all N) and requires both an attack requirement (AT:P) and passive user interaction (UI:P). No EPSS score, KEV listing, or public exploit was provided; per the precision rules this is 'no public exploit identified at time of analysis' (the exploit-shaped strings in the diff are regression tests shipped with the fix, PSECBUGS-117112, not weaponized public POC - do not conflate them). The decisive limiting factor is that ONLY function values are affected: an application must serialize a function whose source is attacker-influenced AND embed that output inside a <script> element, and only serialize-javascript versions 7.1.1 through 7.1.1 (fixed 7.1.2) are vulnerable. That is a very narrow production pattern - most consumers serialize data, not attacker-controlled functions - so despite the product's enormous footprint this is a real-but-low priority. Signals are consistent: low CVSS, no exploitation evidence, and a tightly-scoped trigger all agree this is not an urgent, widespread threat. |
| Exploit ScenarioDerived | An application uses serialize-javascript 7.1.1 to embed a function whose source string is influenced by attacker input, and injects the result into an inline <script> block. The attacker crafts function source such as 'return x</script=+/ + "</script><img src=x onerror=alert(1)>"' so the flawed SCRIPT_CLOSE_REGEXP swallows the inner </script> in one match, leaving it un-escaped; when the page renders, the surviving tag closes the script early and the remaining bytes parse as HTML, running attacker script in the page origin. No public exploit is known, though the fix commit ships regression tests demonstrating the vector. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Sep 29, 2026
Cross-site scripting in serialize-javascript 7.1.1 arises because function values serialized by the library are not fully protected against script-closing tags: the SCRIPT_CLOSE_REGEXP escaping pattern can match across and swallow a second closing tag, so a surviving </script> terminates the embedding script element early and the remaining output is parsed as HTML in the page origin. Exploitation requires an application on the narrow vulnerable release to serialize a function value whose source is attacker-influenced and embed that output inside an HTML <script> element, and a victim must load the resulting page (user interaction); ordinary data values and options.isJSON output are unaffected. The flaw is fixed in 7.1.2, and no public exploit was identified at time of analysis.
RemediationAI
Vendor-released patch: upgrade to serialize-javascript 7.1.2 or later (for example, npm install serialize-javascript@7.1.2), which corrects the SCRIPT_CLOSE_REGEXP over-match as well as the related non-string Function.toString() handling; see the GitHub security advisory GHSA-gfhx-hw2g-v5hg, release v7.1.2, and commit 2bdbaaff9cb8a4639135eb24cfcd383d3fefb534. If immediate upgrading is not possible, avoid serializing function values whose source may be attacker-influenced on 7.1.1, and do not embed the library's output directly inside a <script> element on that version-serving the same data through options.isJSON as an application/json response, or placing it in a non-executable context, removes the injection vector (ordinary data values and isJSON output are unaffected by the bug, so this trade-off is narrow rather than a general workaround). Escaping the </script sequence at the point of embedding or enforcing a Content Security Policy that disallows inline script offers defense in depth but does not replace the patch.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in npm
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
serialize-javascript converts JavaScript values into a JS-literal superset of JSON that can include regular expressions and functions; to safely embed its output inside an HTML <script> element it neutralizes sequences the HTML tokenizer would treat as an end tag. Before 7.1.2 the escaping pattern was /<\/script[^>]*>|<\/script(?=[\t\n\f\r \/>])/gi, and the first alternative's [^>]* could run from one </script past a subsequent </script> up to any later >, so a single match contained two closing-tag candidates while only one replacement was emitted, leaving the inner </script> verbatim in the output (CWE-79, improper neutralization of script-related HTML tags in a web page). The fixing commit 2bdbaaff9cb8a4639135eb24cfcd383d3fefb534 restricts the first alternative to [^<>]*, and additionally makes the native-code detection regexp non-global to avoid lastIndex state leaking between function checks and adds a TypeError guard requiring Function.toString() to return a string, closing related paths where a spoofed toString() could return an object whose replace() bypassed escaping. Only function serialization passes through this escaping logic; ordinary data values and options.isJSON output were never affected, and the resulting impact is JavaScript execution in the origin of the page that embeds the serialized value rather than any compromise of the vulnerable library host.
Know when JavaScript gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
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
AC:H because the attacker must control the serialized function source and its embedding into a script element; S:C and C:L/I:L for stored/reflected XSS crossing into the page origin; A:N.
Primary rating from Vendor (github).
CVSS VectorVendor: github
Lifecycle Timeline
2DescriptionCVE.org
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.
Blast Radius
ecosystem impact- 8 npm packages depend on serialize-javascript (7 direct, 1 indirect)
Ecosystem-wide dependent count for version 7.1.1.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.
More in JavaScript
View allCommand injection in simple-git, the Node.js library for running git commands and published on npm, affects all releases
Stored DOM-based cross-site scripting in Paella Player's closed-caption rendering path (paella-core before 2.12.11) allo
Authorization bypass in Wiki.js through 2.5.314 allows an authenticated user who has been granted access to at least one
Untrusted git configuration includes reachable through simple-git before 4.0.0 let an attacker execute arbitrary command
Improper memory allocation control in ExifReader before 4.41.1 allows remote attackers to exhaust heap memory and termin
Deeply nested brace patterns cause unbounded recursion in the npm brace-expansion library, exhausting the native stack a
Stack exhaustion in the npm library brace-expansion (all versions prior to 1.1.19, 2.1.5, 3.0.7, and 5.0.10) lets a craf
Server-side request forgery in Wiki.js through 2.5.314 lets an authenticated user who holds page-editing permissions for
The JavaScript library ip-address (npm) fails to treat the NAT64 local-use prefix 64:ff9b:1::/48 as private, so applicat
Authorization bypass in the @grpc/grpc-js-xds package (the xDS/RBAC extension for @grpc/grpc-js) lets a request for one
Cross-family subnet comparisons in the ip-address npm library (all versions before 10.7.1) can cause isInSubnet and isHo
Denial of service in the ip-address JavaScript/npm library (all versions prior to 10.7.1) lets remote attackers stall or
EUVD-2026-89027
GHSA-gfhx-hw2g-v5hg
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB