Skip to content

Security: Unsafe deserialization via torch.load in checkpoint loader#483

Open
tuanaiseo wants to merge 2 commits intoopen-mmlab:mainfrom
tuanaiseo:contribai/fix/security/unsafe-deserialization-via-torch-load-in
Open

Security: Unsafe deserialization via torch.load in checkpoint loader#483
tuanaiseo wants to merge 2 commits intoopen-mmlab:mainfrom
tuanaiseo:contribai/fix/security/unsafe-deserialization-via-torch-load-in

Conversation

@tuanaiseo
Copy link
Copy Markdown

Problem

The checkpoint loader directly calls torch.load(filepath, map_location=device) on a path without trust validation. torch.load uses pickle under the hood and can execute arbitrary code when loading a malicious checkpoint.

Severity: high
File: models/tta/ldm/inference_utils/utils.py

Solution

Treat checkpoints as untrusted input. Prefer safetensors for model weights, or enforce strict trust boundaries and signature/hash verification before loading. If using PyTorch >=2.0, consider safer loading patterns and avoid arbitrary pickled objects.

Changes

  • models/tta/ldm/inference_utils/utils.py (modified)
  • models/tta/picoaudio/picoaudio/audioldm/hifigan/utilities.py (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

The checkpoint loader directly calls `torch.load(filepath, map_location=device)` on a path without trust validation. `torch.load` uses pickle under the hood and can execute arbitrary code when loading a malicious checkpoint.

Affected files: utils.py, utilities.py

Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com>
The checkpoint loader directly calls `torch.load(filepath, map_location=device)` on a path without trust validation. `torch.load` uses pickle under the hood and can execute arbitrary code when loading a malicious checkpoint.

Affected files: utils.py, utilities.py

Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant