Summary
Hugging Face Accelerate contains a path traversal vulnerability in checkpoint-loading functions that trust file locations from sharded checkpoint indexes. An attacker who can influence those index entries may read arbitrary files or cause a worker to block indefinitely, resulting in denial of service.
Affected context
The vulnerability occurs in deployments using Accelerate checkpoint-loading functions such as load_checkpoint_in_model or load_checkpoint_and_dispatch with sharded checkpoint indexes. Risk is present when untrusted or attacker-controlled weight-map entries are processed without sufficient path containment checks, including environments where checkpoint metadata can be uploaded, replaced, or otherwise modified.
Exploit preconditions
- Attack surface: Checkpoint loading and sharded model-index processing
- Required access: Ability to influence checkpoint index metadata or the files referenced by it
- Trigger point: Loading a model through the affected checkpoint functions
- Why exploitation is possible: Weight-map paths are accepted without reliably restricting them to the intended checkpoint directory, allowing references outside that boundary or to blocking filesystem objects
Why this happens
The underlying issue is insufficient validation and canonicalization of filesystem paths obtained from checkpoint metadata. When path components are resolved without enforcing an intended base directory and permitted file type, attacker-controlled entries can escape the expected storage location or reference special filesystem objects. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal.
Potential impact
- An attacker may read sensitive files accessible to the model-loading process.
- The process may disclose credentials, configuration data, or runtime metadata.
- A worker may block indefinitely when directed to a named pipe or similar special file.
- Model-serving or training workloads could experience denial of service.
- Exposed secrets could enable further compromise of connected systems.
General mitigation guidance
Mitigation generally focuses on reducing trust in checkpoint metadata and enforcing filesystem boundaries.
Common defensive patterns include:
- Canonicalizing referenced paths and verifying that they remain within an approved checkpoint directory.
- Rejecting absolute paths, parent-directory traversal, and unexpected path forms.
- Allowing only regular files with expected extensions, ownership, and permissions.
- Treating checkpoint indexes and model artifacts as untrusted inputs unless their integrity is established.
- Using isolated, least-privileged workers with minimal access to sensitive host and application files.
- Applying resource limits and timeouts so abnormal filesystem behavior cannot indefinitely block workloads.
- Preferencing secure-by-default loader APIs and immutable, integrity-checked artifact storage.
How teams detect issues like this
High-level detection approaches include:
- Static analysis rules for filesystem joins and path resolution that lack canonicalization or containment checks.
- Code review searches for checkpoint metadata values being passed directly to file-opening APIs.
- Tests covering absolute paths, parent-directory components, symlink behavior, and special-file handling.
- Runtime monitoring for checkpoint processes accessing files outside approved model directories.
- Policy enforcement that permits model loaders to read only designated artifact paths and regular files.
- Automated security review tools can help identify path-handling patterns, but findings should be validated against deployment-specific trust boundaries.

