/

CVE-2026-23737

Severity:

HIGH RISK

(7.5)

Unsafe Deserialization in Seroval fromJSON/fromCrossJSON

CVE-2026-23737

Analyzed

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Remote Code Execution

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Seroval versions 1.4.0 and below contain an unsafe JSON deserialization flaw that can lead to arbitrary JavaScript code execution when processing specially crafted serialized values.

In client-to-server transmission scenarios, an attacker who can influence serialized payloads and understand how they are later used can abuse constant value and error deserialization logic to indirectly trigger unsafe JS evaluation.

Affected context

This issue arises in applications that use Seroval (≤1.4.0) to stringify and then deserialize complex JavaScript values across a client–server boundary, particularly via the fromJSON and fromCrossJSON APIs.

The vulnerability tends to surface where:

  • Client-controlled or partially untrusted data is serialized with Seroval on one side and deserialized on the other, and
  • The reconstructed objects or errors are later passed into higher-privilege logic (for example, evaluation paths, error handling frameworks, or dynamic dispatch) without strict validation.

It does not affect deployments that never deserialize attacker-controlled Seroval payloads or only use Seroval for purely local, trusted state.

Exploit preconditions

  • Attack surface: Client-to-server (or cross-context) interfaces that accept Seroval-encoded JSON and invoke fromJSON or fromCrossJSON.
  • Required access: Ability to submit or influence serialized payloads over at least four separate requests to the same deserialization entry point, along with some understanding of how the resulting values are consumed.
  • Trigger point: Deserialization of crafted data followed by runtime processing that reaches the unsafe evaluation paths exposed via constant value or error reconstruction.
  • Why exploitation is possible: The deserialization logic implicitly trusts structural metadata in the serialized form and allows overriding of constant values and error representations in ways that can be coerced into indirect code execution, matching the unsafe deserialization pattern described in CWE-502.

Why this happens

The root cause is an unsafe deserialization design in which JSON data is treated as a fully trusted description of complex JavaScript values, including constants and error objects.

Seroval's fromJSON and fromCrossJSON accept structured input that can control how certain internal constructs are reconstructed, effectively granting the data the authority to influence program behavior beyond plain data assignment.

Because there is no strong boundary between "data" and "behavior" in these reconstruction routines, an attacker can craft payload sequences that steer deserialization toward internal evaluation-like mechanisms or dangerous code paths.

This maps directly to CWE-502: Unsafe Deserialization, where serialized input can cause the creation or activation of objects with side effects that were not intended by the receiving code.

Potential impact

  • Execution of arbitrary JavaScript code in the server or privileged runtime context that processes the deserialized objects
  • Bypass of application-level security checks that assume serialized data is passive and non-executable
  • Unauthorized access to in-memory data accessible from the exploited execution context
  • Escalation of privileges within the application, such as impersonating other users or tampering with protected state
  • Facilitation of secondary attacks, such as data exfiltration or logic manipulation in downstream components

General mitigation guidance

Effective mitigation focuses on tightening deserialization boundaries and reducing the expressive power of incoming data:

  • Prefer data-only serialization formats for untrusted inputs, restricting deserialization to primitives and plain objects without special constructors or error semantics.
  • Treat all cross-boundary Seroval payloads as untrusted; validate structure and whitelisted fields before passing them into any deserialization routine.
  • Avoid patterns where deserialized values can influence dynamic code execution, such as feeding reconstructed objects into evaluators, interpreters, or reflection-heavy dispatch mechanisms.
  • Isolate deserialization and subsequent processing into low-privilege components or sandboxes, ensuring that a compromised deserialization path cannot impact the broader application.
  • Apply the principle of least privilege to any code that processes or routes deserialized data, limiting the capabilities of routines that operate directly on reconstructed objects or errors.

Adopting secure-by-default serialization choices and keeping behavioral logic separate from data reconstruction significantly reduces the risk of similar flaws.

How teams detect issues like this

Organizations can approach detection by targeting both code patterns and runtime behavior:

  • Static analysis: Flag usages of fromJSON, fromCrossJSON, or similar Seroval deserializers where the source data originates from HTTP requests, message queues, or other untrusted channels.
  • Code review: Look for deserialization sites that:
  • Accept data from clients or external services without robust validation,
  • Reconstruct complex objects, errors, or constants, and
  • Forward deserialized values into dynamic dispatch, plugin systems, or any form of indirect evaluation.
  • Policy enforcement: Introduce guidelines that prohibit deserializing rich objects from untrusted input and require explicit justification for using advanced Seroval features over simpler JSON-based data structures.
  • Automated tooling: Integrate linters or SAST tools that understand common unsafe deserialization APIs and can surface their use in CI, especially in request handlers and RPC endpoints.
  • Runtime monitoring: Add logging or telemetry around deserialization endpoints to detect unusual patterns such as repeated crafted requests or unexpected object shapes emerging from deserialization.

Sources

SourceLink
github.comgithub.com/lxsmnsyc/seroval/commit/ce9408ebc87312fcad345a73c172212f2a798060
github.comgithub.com/lxsmnsyc/seroval/security/advisories/GHSA-3rxj-6cgf-8cfw

Frequently asked

questions

Exploitability depends on whether an attacker can control Seroval-encoded payloads that are later deserialized with fromJSON or fromCrossJSON and then processed in a way that reaches the unsafe evaluation paths.

The requirement for multiple coordinated requests and some insight into application behavior raises the bar, but in many client–server scenarios that still lies within a realistic attacker capability.

An attacker generally needs the ability to send at least four crafted requests to the same logical function or endpoint that uses Seroval for serialization and deserialization.

They must also have partial knowledge of how the application consumes the reconstructed values, which can often be inferred from observed behavior, API contracts, or documentation.

The safest pattern is to treat Seroval data as untrusted and limit deserialization to benign, data-only structures.

Avoid reconstructing complex objects, constants, or error types from untrusted sources, and refactor code so that cross-boundary communication uses simple JSON or similarly constrained formats where possible.

Establish architectural rules that forbid deserializing rich objects from untrusted input and require data-only contracts at trust boundaries.

Combine these rules with automated checks in CI, security-focused code review for any new serialization mechanisms, and a preference for libraries and APIs that are designed with safe-by-default deserialization semantics.

Find out what's already
exploitable in your codebase.