Summary
Laravel Reverb versions 1.6.3 and below deserialize data from Redis using PHP's unserialize() without restricting which classes can be instantiated, enabling unsafe object construction.
When horizontal scaling is enabled and an attacker can influence Redis contents, this flaw can lead to remote code execution within the Reverb process, especially in deployments where Redis is exposed without strong access controls.
Affected context
This vulnerability affects Laravel applications using Reverb as a real-time WebSocket backend when:
- Reverb horizontal scaling is enabled (
REVERB_SCALING_ENABLED=true) - Redis is used as the channel backend for scaling communication
- Data from Redis is consumed and passed directly to
unserialize()in the Reverb process
The risk is higher in environments where Redis is reachable over the network without strict authentication or is shared between multiple services or tenants.
Exploit preconditions
- Attack surface: Network-accessible Redis instance used by Laravel Reverb for scaling.
- Required access: Ability to write or manipulate messages in the Redis channel consumed by Reverb (e.g., unauthenticated or weakly protected Redis, compromised co-tenant service, or internal attacker with Redis access).
- Trigger point: Reverb node reads messages from Redis and calls
unserialize()on attacker-controlled data as part of its inter-node communication logic. - Why exploitation is possible:
unserialize()is invoked on untrusted data without a class whitelist or deserialization constraints, allowing instantiation of gadget classes that execute attacker-controlled behavior during object construction or destruction.
Why this happens
The underlying issue is an unsafe deserialization pattern in the Reverb scaling implementation.
Data read from Redis is treated as trusted and passed directly into PHP's unserialize() without using safer alternatives (such as JSON-based formats) or restricting which classes may be created.
This maps to CWE-502: Deserialization of Untrusted Data, where untrusted input is deserialized into live objects that may contain "magic" methods (constructors, destructors, or hooks) that can be abused as gadgets to achieve arbitrary code execution.
Potential impact
- Remote code execution within the PHP process running Laravel Reverb.
- Full compromise of the Reverb node, including the ability to read or modify in-memory secrets and configuration.
- Interception, modification, or injection of real-time WebSocket messages, leading to data tampering or session abuse.
- Lateral movement within the hosting environment or underlying infrastructure, depending on the privileges of the compromised process.
- Denial of service by causing crashes, resource exhaustion, or unstable behavior through malicious payloads.
General mitigation guidance
Long-term mitigation focuses on eliminating unsafe deserialization and reducing trust in infrastructure messaging channels:
- Replace PHP
unserialize()for inter-node communication with safer, data-only formats (e.g., JSON, MessagePack) that do not instantiate arbitrary classes. - Where deserialization is unavoidable, use constrained mechanisms (such as class whitelists or purpose-specific DTOs) instead of arbitrary object graphs, and avoid invoking magic methods on untrusted data paths.
- Treat Redis and other broker backends as untrusted transport layers; design protocols so that messages are validated and parsed defensively before use.
- Apply least-privilege principles to the Reverb process and associated credentials so that a compromise has limited blast radius.
- Isolate messaging infrastructure on private networks with strong authentication and network segmentation, reducing exposure to untrusted write access.
How teams detect issues like this
Typical detection approaches include:
- Static analysis rules that flag use of
unserialize()on data originating from external systems such as Redis, message queues, or HTTP input, especially without a defined class whitelist. - Code review checklists that call out serialization/deserialization logic as high-risk, requiring reviewers to verify input trust boundaries and object instantiation constraints.
- Runtime monitoring and logging around deserialization code paths to detect anomalous payload shapes, unexpected class names, or spikes in deserialization failures.
- Security policy enforcement in CI/CD (using SAST or custom linters) to prevent new unsafe deserialization code from being merged and to highlight integrations that assume "trusted" infrastructure data.

