CVE-2026-115754: serialize-javascript 7.0.1 before 7.1.3 XSS via unescaped </script in function body
serialize-javascript from 7.0.1 before 7.1.3 contains a cross-site scripting vulnerability that allows attackers to break out of HTML script elements by ending serialized function source text with an unescaped </script. Attackers controlling a function's source via a spoofed toString() can combine surrounding output delimiters and later values to inject live markup such as img onerror handlers.
Affected Software
Event History
Frequently Asked Questions
Which deployments are exposed?
Deployments using serialize-javascript versions 7.0.1 through before 7.1.3 are affected when serialized output is placed inside an HTML script element. The issue is relevant where attacker-controlled input can influence a function's source representation.
What does an attacker need to exploit this?
An attacker needs to control a function's source through a spoofed toString() result and have the application serialize that function into HTML script output. Exploitation also relies on combining output delimiters and later values to form injected markup.
What should be done to remediate the issue?
Update serialize-javascript to version 7.1.3 or later. If updating cannot happen immediately, avoid placing serialized function output influenced by untrusted input into HTML script elements.