Summary
Fujitsu Research's OneCompression library unsafely deserializes PyTorch checkpoint files when loading quantized models. If an attacker can place or cause the library to load a crafted model.pt file from a selected model directory, arbitrary Python code may execute with the library process's privileges.
Affected context
The vulnerability affects OneCompression deployments that use QuantizedModelLoader.load_quantized_model_pt() to load a checkpoint from a caller-selected model directory. Risk arises when the selected model.pt file is not fully trusted and the loader invokes PyTorch deserialization with pickle-enabled behavior, as occurs in library versions before 1.2.1.
Exploit preconditions
- Attack surface: Model checkpoint loading through the OneCompression quantized model loader
- Required access: Ability to supply, replace, or influence the
model.ptfile or its containing model directory - Trigger point: Invocation of
QuantizedModelLoader.load_quantized_model_pt() - Why exploitation is possible: The loader unconditionally enables general-purpose PyTorch deserialization, allowing embedded Python object behavior to run during checkpoint loading
Why this happens
The underlying bug is the use of torch.load with weights_only=False for an input checkpoint whose trustworthiness is not enforced. This enables Python pickle machinery to reconstruct arbitrary objects during deserialization, rather than restricting loading to inert tensor data and approved structures. The behavior maps to CWE-502: Deserialization of Untrusted Data, because attacker-controlled serialized content is processed as executable object-construction logic.
Potential impact
- An attacker may execute arbitrary Python code in the OneCompression process.
- The process could run system commands with its available operating-system privileges.
- Sensitive model files, credentials, or environment data could be accessed.
- The host or workload could be compromised further through post-exploitation activity.
- Model integrity and downstream inference results could be affected.
General mitigation guidance
Mitigation generally focuses on removing executable deserialization behavior from untrusted model-loading paths.
Common defensive patterns include:
- Prefer tensor-only or otherwise restricted checkpoint loading modes that do not reconstruct arbitrary Python objects.
- Treat model files and model directories as untrusted inputs unless their provenance and integrity are verified.
- Enforce strict model schemas and allowlists for supported checkpoint contents.
- Use cryptographic integrity and authenticity checks before loading artifacts.
- Isolate model-loading workloads and apply least-privilege process, filesystem, and network permissions.
- Avoid allowing callers to select arbitrary model directories without authorization and policy enforcement.
- Keep model artifacts separate from credentials and other sensitive runtime resources.
How teams detect issues like this
Detection approaches may include:
- Static analysis rules identifying
torch.loadcalls that enable general pickle deserialization or omit restricted loading controls. - Code review checks for model paths derived from callers, uploads, shared storage, or other untrusted sources.
- Dependency and policy scans that flag unsafe deserialization APIs in machine-learning pipelines.
- Runtime monitoring for unexpected child processes, system-command execution, filesystem access, or outbound connections during model loading.
- CI policies requiring artifact provenance, integrity verification, and approved checkpoint formats.
- Automated review tools can help identify unsafe loader configurations, but findings should be validated against actual trust boundaries.

