Summary
The Adversarial Robustness Toolbox (ART) Kubeflow component unsafely deserializes PyTorch model files using torch.load() without the weights_only=True restriction, allowing arbitrary Python object loading via Pickle.
If an attacker can cause the pipeline to load a malicious model file, they can execute arbitrary code in the Kubeflow environment, resulting in remote code execution during robustness evaluation.
Affected context
This vulnerability appears in Kubeflow-based robustness evaluation pipelines that integrate ART and load PyTorch models from external storage.
The risk is present when:
- Model weights or artifacts are loaded from user-controlled or semi-trusted locations (e.g., object storage, shared buckets), and
- The Kubeflow component directly passes these paths or
model_idvalues totorch.load()without restricting what can be deserialized.
Environments where multiple teams or automated systems can influence model artifacts or pipeline parameters are particularly exposed.
Exploit preconditions
- Attack surface: The model loading interface of the ART Kubeflow component (e.g., model file paths,
model_idinputs, or referenced object storage locations). - Required access: Ability to upload or modify model files in a storage location used by the pipeline, or to influence the
model_id/path so it points to an attacker-controlled artifact. - Trigger point: Execution of robustness evaluation or related Kubeflow pipeline steps that invoke
torch.load()on the compromised model file. - Why exploitation is possible:
torch.load()withoutweights_only=Truewill unpickle arbitrary Python objects embedded in the model file, and Pickle object construction hooks can execute attacker-controlled code during deserialization.
Why this happens
The core issue is the use of a generic, Pickle-backed deserialization mechanism on data that may be influenced by untrusted parties.
In this case, the ART Kubeflow component uses torch.load() in its default mode, which leverages Python's Pickle protocol and is capable of reconstructing arbitrary Python objects, not just tensor weights.
Because no restriction (such as weights_only=True or a custom, safe loading routine) is applied, and the origin of the model files is not strongly trusted or validated, the code effectively treats serialized input as executable logic.
This pattern matches CWE-502: Deserialization of Untrusted Data, where a deserializer with broad capabilities is applied to untrusted or semi-trusted data inputs.
Potential impact
- Remote code execution within the Kubeflow pipeline worker or container context
- Theft or tampering of training data, test data, or model artifacts accessible from the compromised environment
- Manipulation of robustness evaluation results, including targeted data or model poisoning
- Lateral movement to other services or nodes reachable from the compromised Kubeflow runtime
- Disruption of ML workflows, including denial of service for robustness or evaluation jobs
General mitigation guidance
Effective mitigation focuses on limiting what deserialization can do and constraining trust boundaries around model artifacts:
- Prefer restricted deserialization APIs for PyTorch models, such as using
torch.load()withweights_only=Trueor equivalent patterns that deserialize only tensors and state dictionaries, not arbitrary Python objects. - Treat model files as untrusted input by default; apply strict validation and allowlists for model sources (e.g., approved buckets, signed artifacts, or CI-produced models only).
- Where possible, separate model transport from executable logic, using formats that do not rely on Pickle (e.g., TorchScript, ONNX, or other non-code-based representations).
- Apply least-privilege configurations to Kubeflow workers so that, if code execution occurs, the process has minimal access to filesystem, network, and cloud metadata.
- Introduce defense-in-depth controls such as read-only mount points for model directories and network segmentation around Kubeflow pipelines.
How teams detect issues like this
Detection generally combines code-level inspection with runtime monitoring:
- Use static analysis or code search to flag uses of
torch.load()(and other Pickle-backed APIs) that lack explicit security parameters (e.g., missingweights_only=True) or operate on non-constant paths. - Add code review checklists that require reviewers to scrutinize any deserialization of model artifacts, especially in ML pipelines interacting with shared or external storage.
- Implement CI policies or linters that block merges when unsafe deserialization patterns are detected in Kubeflow components or related utilities.
- At runtime, monitor for unexpected process behavior during model loading (e.g., network calls, shell invocation, or file modifications originating from a model load step) using host-based intrusion detection or container security tools.

