/

CVE-2026-42472

Severity:

CRITICAL RISK

(9.8)

Unsafe Deserialization in MixPHP Framework Redis

CVE-2026-42472

Deferred

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Remote Code Execution and Full Application Compromise

Severity:

CRITICAL RISK

(9.8)

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

MixPHP Framework 2.x through 2.2.17 contains an unsafe deserialization flaw where the Redis-backed session and cache handlers call unserialize() on data retrieved from Redis without sufficient trust boundaries.

If an attacker can influence or inject serialized payloads into the Redis store, they may be able to trigger gadget chains in the PHP application, potentially leading to remote code execution or complete application compromise.

Affected context

This vulnerability appears in applications built on MixPHP Framework 2.x–2.2.17 that use the Redis-based session or cache storage via the RedisHandler object.

It is relevant where:

  • PHP's native unserialize() is used for restoring session or cache data from Redis
  • Redis is reachable by multiple services or tenants, or is otherwise not fully isolated
  • Application code or third-party libraries include classes with magic methods (e.g., __wakeup, __destruct) that can form deserialization gadget chains

The issue is most severe when Redis content can be modified by attackers directly or indirectly through other vulnerable components.

Exploit preconditions

  • Attack surface: Application instances using MixPHP Redis session or cache handlers.
  • Required access: Ability to write or manipulate serialized data stored in Redis (e.g., compromised Redis, weak isolation, SSRF into Redis, or another flaw that lets an attacker control data before it is stored).
  • Trigger point: Any request that causes MixPHP to read from Redis and call unserialize() in the RedisHandler for session restoration or cache retrieval.
  • Why exploitation is possible: unserialize() treats attacker-controlled strings as PHP object graphs, allowing invocation of methods on existing classes that may perform sensitive actions during object construction, wakeup, or destruction.

Why this happens

The core issue is the use of PHP's unserialize() on data that is not guaranteed to be fully trusted or integrity-protected.

This maps directly to CWE-502: Deserialization of Untrusted Data, where serialized representations are processed as executable object graphs.

In this pattern, the session and cache layers are implemented with generic serialization and deserialization logic instead of using safer formats (e.g., JSON) or strong authenticity checks.

As a result, if an attacker can introduce arbitrary serialized data into Redis, the framework will reconstruct objects with potentially dangerous magic methods, forming a gadget chain that can be abused for remote code execution or other high-impact actions.

Potential impact

  • Execution of arbitrary PHP code via gadget chains in application or library classes
  • Complete takeover of the web application runtime
  • Unauthorized access to or modification of session data, including impersonation of other users
  • Tampering with cached application data, leading to data integrity issues or logic manipulation
  • Pivoting to backend systems, such as databases or internal services, using compromised application privileges

General mitigation guidance

Effective mitigation centers on avoiding unsafe deserialization and tightening trust around stateful data:

  • Replace unserialize() for session and cache data with safer, data-only formats such as JSON, CBOR, or msgpack that do not rehydrate PHP objects.
  • If legacy serialization must be preserved, enforce strong integrity and authenticity controls (e.g., HMAC signing of values) so only framework-generated data is ever deserialized.
  • Restrict the set of classes that can be instantiated from serialized data by using structured, explicit mapping or whitelisting patterns.
  • Limit the presence of dangerous magic methods (__wakeup, __destruct, __toString, etc.) in classes that can appear in serialized data, and ensure such methods avoid performing side effects on deserialization.
  • Harden Redis deployment: isolate it per application, require authentication, and restrict network access to trusted clients, reducing opportunities for data injection.
  • Apply least-privilege principles so that, even if exploitation occurs, the PHP process and its associated credentials have minimal access.

How teams detect issues like this

Teams can identify and monitor this issue through a combination of static and runtime techniques:

  • Use static analysis or code search to detect calls to unserialize() in session, cache, or other I/O-adjacent components, especially within the Redis handler.
  • During code review, flag usage of generic serialization for cross-boundary data (e.g., cache, sessions, queues, or messages) and require justification or alternative patterns.
  • Implement security-focused unit and integration tests that attempt to deserialize crafted payloads, verifying that unsafe behavior is not reachable.
  • Configure application firewalls, logging, and monitoring to alert on unexpected Redis access patterns, anomalous serialized payloads, or unusual error traces linked to deserialization.
  • Optionally employ SAST/IAST tools capable of modeling data flow from external sources into unserialize() to detect deserialization of potentially untrusted data.

Sources

SourceLink
gist.github.comgist.github.com/sgInnora/fa46386840fe978a30d7e53c458f2975
github.comgithub.com/mix-php/mix
github.comgithub.com/mix-php/mix/blob/v2.2.17/src/sync-invoke/src/Server.php

Frequently asked

questions

It can be, depending on the architecture. If user-controlled input is stored into Redis and later deserialized by the MixPHP handlers, an attacker may trigger exploitation via normal web requests. In other setups, direct or indirect access to Redis is required.

Not necessarily. Direct Redis access increases risk, but exploitation may also be possible if another weakness allows an attacker to influence the values written into Redis before MixPHP calls unserialize().

The most robust pattern is to stop using unserialize() for session and cache data, switching to structured, data-only serialization formats (like JSON) and treating Redis as a simple key–value store rather than an object transport mechanism.

Establish a policy that forbids deserialization of untrusted or cross-boundary data, prefer data-only formats, and include checks in code review and automated analysis specifically targeting unsafe deserialization patterns and dangerous magic methods.

Find out what's already
exploitable in your codebase.