Summary
ZenML's CloudpickleMaterializer can deserialize a malicious artifact file from a shared artifact store without adequately restricting its contents. An attacker who can replace an artifact may cause arbitrary code execution when a user or pipeline materializes it.
Affected context
The vulnerability occurs in ZenML deployments that use the CloudpickleMaterializer with a shared artifact store and load stored artifacts through an unsanitized cloudpickle deserialization path. Risk depends on an attacker having write access to the artifact location and on another user or pipeline subsequently materializing the modified artifact.
Exploit preconditions
- Attack surface: Shared artifact storage and the artifact materialization workflow
- Required access: Write access sufficient to replace or modify a stored artifact file
- Trigger point: A user or pipeline materializes the affected artifact
- Why exploitation is possible: The application passes attacker-controlled serialized data to
cloudpickle.load(), which can reconstruct objects and invoke embedded reduction behavior during deserialization
Why this happens
The underlying bug is the treatment of attacker-controlled cloudpickle data as trusted serialized state. Pickle-compatible formats can encode object reconstruction behavior, including callable execution through mechanisms such as __reduce__. Loading such data without a restricted format, trust boundary, or integrity control maps to CWE-502: Deserialization of Untrusted Data.
Potential impact
- Arbitrary system commands may execute in the ZenML process environment
- Application credentials, environment variables, or stored data could be exposed
- Pipelines or workers could be compromised
- Artifact contents may be poisoned or altered
- An attacker could gain opportunities for lateral movement, depending on runtime privileges and network access
General mitigation guidance
Mitigation generally focuses on removing implicit trust from serialized artifacts and limiting the privileges of materialization workers.
Common defensive patterns include:
- Prefer safe, non-executable serialization formats with explicit schemas
- Use restricted deserialization mechanisms that cannot reconstruct arbitrary classes or callables
- Verify artifact integrity and provenance before materialization
- Enforce strong access controls and immutable or append-only policies for shared artifact stores
- Separate artifact publication permissions from artifact consumption permissions
- Run materialization workloads with least privilege, restricted network access, and minimal filesystem permissions
- Treat artifacts from external or untrusted producers as untrusted input throughout the pipeline
How teams detect issues like this
Detection approaches commonly include:
- Static analysis rules identifying
pickle,cloudpickle, or equivalent unrestricted load operations - Code review checks for deserialization of data retrieved from shared stores or user-controlled locations
- Repository policies requiring approved serialization formats and integrity verification
- Runtime monitoring for unexpected process creation, command execution, or access to sensitive files by materialization workers
- Artifact-store audit logging for unusual replacements, ownership changes, or writes to previously published artifacts
- Automated security review tools that flag unsafe deserialization and excessive worker privileges

