Summary
Pimcore uses PHP's unserialize() on data from databases and filesystem files without restricting allowed classes, enabling unsafe object instantiation.
If an attacker can control these serialized data sources, they can inject malicious objects that may lead to remote code execution under affected Pimcore workflows.
Affected context
The vulnerability occurs in Pimcore components that deserialize data retrieved from persistent storage (database columns and filesystem-backed files) using PHP's unserialize() without an allowed_classes restriction.
It is relevant when application features such as authentication helpers, site configuration, custom layout handling, temporary storage, WebDAV asset services, or dashboard helpers read serialized payloads that can be influenced by users or integrated systems.
The risk is elevated in deployments where serialized fields or files are writable by untrusted tenants, external integrations, or compromised application code paths.
Exploit preconditions
- Attack surface: Pimcore features that load and unserialize data from the database or filesystem (e.g., authentication, site DAO, custom layouts, tmp store, WebDAV service, dashboard).
- Required access: Ability to inject or modify serialized data stored in targeted columns or files (through application inputs, API endpoints, import mechanisms, or indirect write access).
- Trigger point: Execution of unserialize() on attacker-controlled data during normal Pimcore operations such as login flows, dashboard loading, site or layout retrieval, asset access, or temporary store usage.
- Why exploitation is possible: Unserialize() is invoked without allowed_classes restrictions or validation, permitting construction of arbitrary PHP objects and execution of attacker-controlled magic methods or gadget chains.
Why this happens
The core issue is an unsafe deserialization pattern in which PHP's unserialize() is applied to data whose integrity and provenance are not strictly guaranteed.
Because allowed_classes is not used, the deserializer trusts the serialized structure and permits creation of arbitrary application or library objects.
This maps to CWE-502: Deserialization of Untrusted Data, where complex serialized inputs are treated as configuration or state rather than potential executable behavior, creating object injection opportunities and enabling gadget chains that execute code or perform sensitive actions during object lifecycle hooks.
Potential impact
- Remote code execution in the Pimcore application context
- Arbitrary method invocation via gadget chains in Pimcore or its dependencies
- Unauthorized access to or modification of stored data and configuration
- Escalation of privileges within the Pimcore instance or underlying hosting environment
- Abuse of file system operations, including reading, writing, or deleting application files
- Compromise of multi-tenant installations or integrated downstream systems
General mitigation guidance
Effective mitigation typically focuses on reducing trust in serialized data and constraining deserialization behavior.
Recommended patterns include:
- Avoiding PHP unserialize() for data that can be influenced by users or external systems and migrating to safer, schema-driven formats (e.g., JSON) where possible.
- Using allowed_classes and disallowing arbitrary classes when deserialization is unavoidable, restricting the object types that can be instantiated.
- Applying strict validation, integrity checks, and normalization to data before it is deserialized, and rejecting inputs that do not conform to expected structures.
- Minimizing reliance on serialization for long-lived storage of complex objects; instead store minimal, non-executable state and reconstruct objects from trusted configuration.
- Running Pimcore with least-privilege service accounts and hardened PHP configuration to reduce the blast radius if deserialization issues are exploited.
How teams detect issues like this
Organizations can detect unsafe PHP deserialization patterns through several complementary approaches:
- Static analysis rules that flag calls to unserialize() and similar APIs, especially when passed data from databases, files, or user-controlled inputs without allowed_classes restrictions.
- Targeted code reviews focusing on data access objects, temporary stores, authentication helpers, and integrations that read serialized content, verifying that deserialization is constrained and validated.
- Security-focused unit and integration tests that simulate attacker-controlled serialized payloads and exercise deserialization paths to detect unexpected object instantiation or side effects.
- Policy enforcement in CI/CD pipelines that disallow new uses of generic unserialize() or require explicit justification and defensive controls when deserialization is necessary.
- Periodic runtime monitoring for anomalous PHP object activity, unexpected file or network operations, or error patterns associated with malformed serialized data.

