/

CVE-2026-16723

Severity:

CRITICAL RISK

(9.0)

Critical JSON Deserialization (CWE-502) in fastjson RCE

CVE-2026-16723

Deferred

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-20, CWE-502

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.0)

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

A critical remote code execution vulnerability affects fastjson versions 1.2.68 through 1.2.83 due to unsafe JSON deserialization behavior in default configuration.

Under typical deployment conditions, attackers can craft malicious JSON payloads that trigger arbitrary code execution without requiring AutoType, gadget classes, or special classpath setup.

Affected context

This vulnerability appears in Java applications that use fastjson 1.2.68–1.2.83 for parsing untrusted JSON data, such as request bodies, API responses, or external configuration.

It is particularly relevant when user-controlled JSON is deserialized into application objects using stock fastjson defaults, without additional hardening, custom type restrictions, or isolation layers.

The issue manifests in environments where JSON input can reach fastjson's deserialization routines and where the JVM has access to functionality that can be abused indirectly during object construction or initialization.

Exploit preconditions

  • Attack surface: Any endpoint, message consumer, or processing path that accepts attacker-controlled JSON and passes it to fastjson for deserialization.
  • Required access: Ability to send or influence JSON data processed by the vulnerable fastjson instance (e.g., HTTP client, messaging producer, API caller).
  • Trigger point: Deserialization of a crafted JSON payload by fastjson's default configuration, typically during request handling or message processing.
  • Why exploitation is possible: The library's deserialization logic performs unsafe operations on unvalidated input, enabling construction or invocation paths that can be steered toward code execution without explicit AutoType enablement or classpath-specific gadgets.

Why this happens

The underlying bug class is unsafe deserialization of untrusted JSON, mapped to CWE-502 and reinforced by insufficient input validation (CWE-20).

Fastjson's default behavior implicitly trusts the structure and content of JSON data, allowing complex object graphs or special constructs to be instantiated and processed.

When deserialization logic does more than simple data binding—such as invoking methods or resolving types in ways that can affect program behavior—it opens a path where crafted input can indirectly trigger dangerous operations.

Abstractly, this pattern arises whenever a generic serialization framework is allowed to freely map attacker-controlled data into runtime objects whose initialization or access patterns can modify application state or reach powerful APIs.

Potential impact

  • Attackers can remotely execute arbitrary code within the affected Java process.
  • Applications may be fully compromised, allowing modification or exfiltration of sensitive data.
  • The vulnerable process could be used as a pivot point for further lateral movement within the environment.
  • Service availability can be disrupted through malicious payloads that cause crashes or resource exhaustion.
  • Security controls relying on application integrity can be bypassed or disabled via compromised code paths.

General mitigation guidance

Mitigation typically focuses on restricting deserialization behavior and reducing trust in JSON input.

Pattern-based approaches include:

  • Treating all JSON from external or user-controlled sources as untrusted and limiting deserialization to simple, well-defined data transfer objects.
  • Explicitly constraining allowed types and avoiding generic polymorphic deserialization that can instantiate arbitrary classes.
  • Introducing strict validation and sanitization of JSON structures before deserialization, rejecting unexpected fields or object graphs.
  • Applying least-privilege principles to the runtime environment so that even if deserialization misbehaves, available capabilities are minimized.
  • Encapsulating JSON parsing behind a hardened abstraction layer that enforces schema controls and defensive defaults, rather than exposing the raw library throughout the codebase.

How teams detect issues like this

High-level detection can combine code analysis, review practices, and policy enforcement:

  • Use static analysis or pattern-based scans to identify direct calls to fastjson deserialization APIs on untrusted input, especially generic parsing to Object or complex domain types.
  • During code review, flag any use of JSON deserialization that lacks explicit type restrictions, schema validation, or separation between external payloads and internal models.
  • Establish development policies that prohibit unsafe deserialization patterns, such as blind mapping of user-controlled JSON into arbitrary objects, and enforce them via CI checks.
  • Consider integrating automated security testing tools that simulate hostile JSON payloads against critical endpoints to observe abnormal behaviors indicative of unsafe deserialization.

Sources

SourceLink
github.comgithub.com/alibaba/fastjson2/wiki/Security-Advisory:-Remote-Code-Execution-in-fastjson-1.2.68%E2%80%931.2.83

Frequently asked

questions

Yes, it is remotely exploitable whenever an attacker can send crafted JSON to functionality that uses fastjson for deserialization under vulnerable versions and default settings.

An attacker generally needs the ability to interact with any interface—such as web APIs, message queues, or RPC endpoints—that passes their JSON to fastjson deserialization logic, but no local system access or classpath-specific gadgets are required.

The safest pattern is to eliminate unsafe deserialization paths by strictly limiting what types are deserialized, enforcing schemas, and confining fastjson usage to simple data transfer objects that do not trigger complex initialization or behavior during construction.

Future prevention relies on treating serialization frameworks as high-risk components: adopt secure-by-default libraries, enforce input validation and type whitelisting, document deserialization usage patterns, and include checks for unsafe deserialization in code review and automated security testing pipelines.

Find out what's already
exploitable in your codebase.