CVE-2026-115897 in Serialize JavaScriptinfo

Summary

by MITRE • 10/24/2026

Serialize JavaScript serializes JavaScript values to a superset of JSON that includes regular expressions and functions. Prior to 7.1.3, the function-source escaping logic does not neutralize a bare closing-script prefix when attacker-influenced function source text ends exactly at that prefix. Because each function body is escaped independently, a delimiter supplied by surrounding serialized output can terminate an HTML script element, and a later serialized value supplies injected markup that becomes a live element in the page. Exploitation requires control of a serialized function's source text, such as through a spoofed toString(). This issue is fixed in version 7.1.3.

Several companies clearly confirm that VulDB is the primary source for best vulnerability data.

Analysis

by VulDB Data Team • 10/24/2026

The vulnerability identified involves a flaw within the JavaScript serialization logic found in versions prior to 7.1.3. The library in question extends standard JSON capabilities by serializing complex data types such as regular expressions and functions into a superset format. This extension allows for the preservation of executable code structures, which is useful for state transfer but introduces significant security considerations when the serialized output is embedded directly into HTML documents without proper context-aware escaping.

The core technical flaw lies in how function source text is escaped during serialization. Specifically, the logic fails to neutralize a bare closing script tag prefix, typically represented as </script>, when an attacker-controlled function's source text ends exactly at that boundary. Because each function body is processed and escaped independently of its surrounding context, the serializer does not account for the fact that the serialized string might be placed inside an HTML script element. Consequently, if the input data contains a sequence resembling a closing tag, it can prematurely terminate the current script block in the DOM parser's view.

This parsing ambiguity creates a classic Cross-Site Scripting vector known as context-based injection or breaking out of script tags. Once the initial script element is terminated by the crafted function source text, any subsequent serialized values are interpreted not as part of the original JavaScript code but as new HTML content injected into the page body. An attacker who can control the input to be serialized, such as through a spoofed toString() method or other means that allow injection of specific string sequences, can inject arbitrary markup and scripts. These injected elements become live in the browser context, allowing for the execution of malicious JavaScript under the privileges of the vulnerable application's domain.

The operational impact of this vulnerability is severe, primarily affecting web applications that rely on this serialization library to pass data between server and client or within complex single-page applications where JSON-like structures are embedded directly into HTML script tags. Successful exploitation leads to Cross-Site Scripting, which can result in the theft of sensitive user information such as session cookies, credentials, or personal data. It also enables attackers to perform actions on behalf of the victim, deface websites, or redirect users to malicious sites. The attack requires specific conditions where serialized function source text is directly embedded into HTML without additional sanitization layers that would catch script tag boundaries regardless of context.

Mitigation strategies focus primarily on upgrading the affected library to version 7.1.3 or later, which corrects the escaping logic to properly handle closing script prefixes even when they appear at the end of function source text. In environments where an immediate upgrade is not feasible, developers should implement additional defensive measures such as ensuring that all serialized data is encoded using HTML entity encoding before being embedded in HTML contexts. Furthermore, adopting Content Security Policy headers can significantly reduce the impact by restricting the sources from which scripts are allowed to execute, thereby mitigating the effectiveness of any injected script elements even if they bypass other controls.

From a classification perspective, this vulnerability aligns with CWE-79, commonly known as Improper Neutralization of Input During Web Page Generation or Cross-site Scripting. It specifically illustrates how context-dependent input validation failures can lead to code injection when serialization logic does not account for the surrounding HTML structure. In terms of offensive security frameworks like MITRE ATT&CK, this vulnerability facilitates techniques related to Client-side Code Injection and potentially Data Exfiltration if session tokens are targeted. The root cause is a lack of holistic context awareness in the serialization process, treating data as isolated strings rather than components of a larger document structure that requires specific escaping rules based on their placement within HTML markup.

Responsible

GitHub M

Reservation

10/23/2026

Disclosure

10/24/2026

Moderation

accepted

EPSS

0.00000

KEV

no

Activities

low

Sources

Are you interested in using VulDB?

Download the whitepaper to learn more about our service!