Cross-site Scripting (XSS)serialize-javascript is a package to serialize JavaScript to a superset of JSON that includes regular expressions and functions.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via escapeFunctionBody() in index.js, which escapes each function body in isolation and therefore fails to detect a </script sequence that appears at the very end of a serialized function body. Because the regex SCRIPT_CLOSE_REGEXP did not anchor to end-of-string, a function body terminating with the bare prefix </script was emitted unescaped, allowing a subsequent serialized value to supply the closing > and inject arbitrary markup into the surrounding HTML page.
How to fix Cross-site Scripting (XSS)? Upgrade serialize-javascript to version 7.1.3 or higher.
| |
Cross-site Scripting (XSS)serialize-javascript is a package to serialize JavaScript to a superset of JSON that includes regular expressions and functions.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via escapeFunctionBody(), which escapes each function body in isolation. When a serialized function body ends with the bare token </script, the function does not see the delimiter that the surrounding output supplies next (such as the newline added by the space option), so the sequence is emitted unescaped. An attacker who can influence a serialized function body can close the enclosing <script> tag and inject arbitrary markup into the page, leading to cross-site scripting.
How to fix Cross-site Scripting (XSS)? Upgrade serialize-javascript to version 7.1.3 or higher.
| |
Cross-site Scripting (XSS)serialize-javascript is a package to serialize JavaScript to a superset of JSON that includes regular expressions and functions.
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via a regex flaw in SCRIPT_CLOSE_REGEXP that allows a live </script> tag to survive serialization. The previous pattern [^>]* permitted a single match to span from one </script to the next > anywhere in the function source, swallowing a complete </script> in between. Because only one replacement is emitted per match, the swallowed tag is re-emitted verbatim in the output. When the serialized value is embedded in an HTML page as the README documents, the injected tag terminates the script element and the remainder of the payload is parsed as HTML, enabling script injection. A function body reaches the vulnerable shape when </script appears in code position (e.g., as part of a comparison against a regex literal) followed by a </script> inside a later string literal.
Note: This is only exploitable when the serialized output is embedded directly in an HTML page inside a <script> element, as described in the package README.
How to fix Cross-site Scripting (XSS)? Upgrade serialize-javascript to version 7.1.2 or higher.
| |
Allocation of Resources Without Limits or Throttlingserialize-javascript is a package to serialize JavaScript to a superset of JSON that includes regular expressions and functions.
Affected versions of this package are vulnerable to Allocation of Resources Without Limits or Throttling through the serialize function when handling specially crafted array-like objects with a very large length property. An attacker can cause excessive CPU consumption and make the application unresponsive by submitting such objects for serialization.
Note: While direct exploitation is difficult, it becomes a high-priority threat if the environment is also vulnerable to prototype pollution or insecure YAML deserialization.
How to fix Allocation of Resources Without Limits or Throttling? Upgrade serialize-javascript to version 7.0.5 or higher.
| |