Skip to content

Potential PHP Object Injection via Unrestricted @type in unserialize()

High
jrbasso published GHSA-v7m3-fpcr-h7m2 Feb 19, 2026

Package

composer zumba/json-serializer (Composer)

Affected versions

<3.2.3

Patched versions

>3.2.3

Description

Description

The zumba/json-serializer library allows deserialization of PHP objects from JSON using a special @type field.

Prior to version 3.2.3, the deserializer would instantiate any class specified in the @type field without restriction. When processing untrusted JSON input, this behavior may allow an attacker to instantiate arbitrary classes available in the application.

If a vulnerable application passes attacker-controlled JSON into JsonSerializer::unserialize() and contains classes with dangerous magic methods (such as __wakeup() or __destruct()), this may lead to PHP Object Injection and potentially Remote Code Execution (RCE), depending on available gadget chains in the application or its dependencies.

This behavior is similar in risk profile to PHP's native unserialize() when used without the allowed_classes restriction.

Impact

This vulnerability allows instantiation of arbitrary PHP classes via the @type field when deserializing JSON.

Applications are impacted only if:

  • Untrusted or attacker-controlled JSON is passed into JsonSerializer::unserialize(), and
  • The application or its dependencies contain classes that can be leveraged as a gadget chain.

Successful exploitation may lead to:

  • Arbitrary code execution
  • Data exfiltration
  • File manipulation
  • Denial of service

Applications that only deserialize trusted data are not affected.

Patches

This issue is mitigated in version 3.2.3.

Version 3.2.3 introduces the method: setAllowedClasses(?array $allowedClasses)

This allows applications to restrict which classes may be instantiated during deserialization, similar to PHP's native unserialize() allowed_classes option.

Users should upgrade to version 3.2.3 or later and configure an appropriate class allowlist.

Workarounds

If upgrading is not immediately possible, applications should ensure that:

  • JsonSerializer::unserialize() is never called on untrusted or attacker-controlled JSON.
  • JSON input is validated and sanitized before deserialization.
  • Object instantiation via @type is disabled in application logic where possible.

After upgrading, users can mitigate risk by explicitly configuring:

$serializer->setAllowedClasses([]);

to disable all object instantiation, or by providing a strict allowlist of safe classes.

References

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

CVE ID

CVE-2026-27206

Weaknesses

Deserialization of Untrusted Data

The product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid. Learn more on MITRE.

Credits