/

CVE-2026-54512

Severity:

HIGH RISK

(8.1)

Polymorphic Deserialization Bypass (CWE-502) in Jackson

CVE-2026-54512

Analyzed

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-184, CWE-502

Impact:

Deserialization allow-list bypass enabling arbitrary gadget instantiation

Severity:

HIGH RISK

(8.1)

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 flaw in Jackson Databind's polymorphic type validation allows attackers to sneak forbidden classes into generic type parameters when polymorphic typing is enabled.

If an attacker can control type identifiers in JSON input, they may bypass the PolymorphicTypeValidator allow-list and trigger deserialization of unsafe gadget classes, potentially leading to remote code execution or other severe impacts.

Affected context

This vulnerability arises in Java applications that use Jackson Databind with polymorphic typing enabled and rely on PolymorphicTypeValidator (PTV) to restrict deserialization targets.

It becomes relevant when incoming data can supply or influence type identifiers, especially canonical type strings that include generic parameters (such as java.util.List<com.evil.Gadget>).

The issue is most pronounced in API endpoints, message processors, or serialization frameworks that accept untrusted JSON and depend on PTV for enforcing deserialization safety.

Exploit preconditions

  • Attack surface: Any JSON-based input path using Jackson Databind polymorphic deserialization (e.g., REST APIs, message queues, RPC payloads).
  • Required access: Ability to send or control serialized data that includes type identifiers, typically through client-controlled request bodies or messages.
  • Trigger point: Polymorphic deserialization of a type ID string containing generic parameters while PTV is configured to allow specific container types.
  • Why exploitation is possible: DatabindContext._resolveAndValidateGeneric() validates only the raw container class name against PTV and never validates nested generic type arguments. As a result, an attacker can embed a denied or gadget class as a generic parameter of an approved container, causing Jackson to load, instantiate, and populate that class during deserialization.

Why this happens

The underlying bug is a validation gap in the polymorphic type resolution logic within Jackson Databind.

When a type identifier includes generic parameters, the code path validates only the outer container type (the substring before <) against PolymorphicTypeValidator and then constructs the full canonical type using TypeFactory without re-applying validation to inner type arguments.

This maps to CWE-184: Incomplete List of Disallowed Inputs, because the validation covers only part of the type structure, and to CWE-502: Unsafe Deserialization, since untrusted input is allowed to drive class loading and object instantiation.

Conceptually, the pattern is: trust is granted to an entire generic type graph based solely on the container, leaving nested types unchecked and enabling attackers to smuggle in unsafe gadget classes.

Potential impact

  • Attackers may cause instantiation of explicitly disallowed gadget classes via generic type parameters.
  • Deserialized objects could execute arbitrary code if gadget chains or dangerous class behaviors are present.
  • Application-level data integrity and confidentiality can be compromised through malicious object graphs.
  • Security controls relying on Jackson's PolymorphicTypeValidator allow-lists can be bypassed.
  • Further exploitation may enable remote code execution, privilege escalation, or system compromise depending on gadget availability.

General mitigation guidance

Effective mitigation focuses on reducing trust in polymorphic type information and tightening deserialization boundaries.

Recommended patterns include:

  • Avoiding or strictly limiting Jackson's polymorphic typing for data from untrusted or semi-trusted sources; prefer explicit, statically mapped types instead of attacker-controlled type IDs.
  • Designing allow-lists that treat complex generic structures conservatively, and applying validation to complete type graphs rather than only container classes.
  • Segmenting deserialization contexts so that sensitive or powerful types are never reachable from untrusted data, even if type validation fails.
  • Applying least-privilege principles to deserialized objects by eliminating gadget classes and avoiding dangerous behaviors (such as code execution in constructors or setters).
  • Encapsulating deserialization behind domain-specific DTOs that do not expose internal implementation classes or generic type parameters to external callers.

How teams detect issues like this

Detection typically involves reviewing both configuration and code paths that rely on polymorphic deserialization:

  • Use static analysis or custom rules to flag uses of polymorphic typing (@JsonTypeInfo, default typing, etc.) on input paths that may consume untrusted data.
  • During code review, look for places where PolymorphicTypeValidator is assumed to enforce strict safety, and verify how generic type identifiers are handled.
  • Implement policy checks in CI/CD pipelines that disallow or require approval for polymorphic deserialization settings, especially those that allow broad type ranges.
  • Monitor application logs and telemetry for unusual type identifiers or canonical type strings arriving from external inputs.
  • Consider using automated security testing tools that generate hostile type ID payloads to exercise deserialization entry points and confirm validation behavior.

Sources

SourceLink
github.comgithub.com/FasterXML/jackson-databind/commit/434d6c511de7fdd9872f29157aafb6162d12d8d5
github.comgithub.com/FasterXML/jackson-databind/issues/5988
github.comgithub.com/FasterXML/jackson-databind/security/advisories/GHSA-j3rv-43j4-c7qm

Frequently asked

questions

Not always. Exploitability depends on whether untrusted or attacker-controlled data can inject type identifiers into Jackson's polymorphic deserialization process. If type IDs are fully controlled by the server or are not exposed, the practical risk is reduced.

An attacker needs the ability to send JSON or other serialized data that is deserialized by Jackson with polymorphic typing enabled and evaluated by PolymorphicTypeValidator. In many applications, this corresponds to normal client access to an API endpoint or message ingestion mechanism.

The safest approach is to remove or minimize polymorphic deserialization for untrusted data and to favor explicit, strongly typed DTOs. Where polymorphic typing must be used, ensure that validation covers the full generic type graph and that powerful or gadget-prone classes are never reachable from external inputs.

Future prevention involves treating deserialization mechanisms as security-sensitive components: avoid attacker-controlled type information, enforce strict allow-lists that consider nested types, perform threat modeling around serialization features, and use automated checks and reviews to catch unsafe deserialization patterns early in the development lifecycle.

Find out what's already
exploitable in your codebase.