Summary
Pyro's ParamStoreDict.load() deserializes parameter files with torch.load configured to allow arbitrary Python objects. If a user loads a crafted file, deserialization may execute code with the privileges of the Python process.
Affected context
The issue occurs when Pyro loads parameter files through ParamStoreDict.load() and the file is not trusted. The risk depends on whether an attacker can supply or influence a file that a user or application subsequently loads.
Exploit preconditions
- Attack surface: Parameter-file loading in Pyro
- Required access: Ability to provide or influence a parameter file; direct access to the target process is not necessarily required
- Trigger point: A user or application calls
ParamStoreDict.load()on the crafted file - Why exploitation is possible:
torch.loadis used withweights_only=False, allowing arbitrary Python objects to be unpickled
Why this happens
The underlying bug is unsafe deserialization: ParamStoreDict.load() uses a loading configuration that permits pickle data to reconstruct arbitrary Python objects. Pickle reconstruction can invoke behavior during loading, so treating an untrusted parameter file as data can instead cause code to run. This maps to CWE-502: Deserialization of Untrusted Data.
Potential impact
- Arbitrary code may execute with the privileges of the Python process.
- An attacker could access or modify data available to that process.
- The affected environment could be further compromised, depending on the process's permissions and surrounding controls.
General mitigation guidance
Defensive approaches focus on avoiding unsafe deserialization of untrusted files. Prefer restricted, weights-only loading or a non-executable data format when compatible, and treat parameter files from external or user-controlled sources as untrusted. Where deserialization cannot be avoided, validate inputs and limit the loading process's privileges and access to sensitive resources.
How teams detect issues like this
Review code and dependencies for calls to torch.load that permit unrestricted object loading, especially in paths that process uploaded, downloaded, or otherwise user-influenced files. Static analysis and code review can flag unsafe deserialization APIs and trace file provenance to loading functions. Policy checks can require restricted loading modes and document approved exceptions.

