Downloads · 30 days
0
aslein1413/poc-torch-package-rce
poc-torch-package-rce is a machine learning model from aslein1413. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
torch.package.PackageImporter(path).loadpickle(...) unpickles with a fully unrestricted unpickler. Unlike torch.load (which defaults to weightsonly=True), this API has no safe option at all, so loading an untrusted pa…
Downloads · 30 days
0
Access
Public
Updated Jul 16, 2026
Repo size
1.7 KB
Likes
0
Public
Click a slice to open those files.
.pt1.7 KB · 29%
From the Hugging Face model README
torch.package.PackageImporter(path).load_pickle(...) unpickles with a fully
unrestricted unpickler. Unlike torch.load (which defaults to weights_only=True),
this API has no safe option at all, so loading an untrusted package runs code.
evil_importtime.pt is the self-contained variant: the archive interns its own module,
and the pickled object only references a class in it. Resolving that class runs the
module's top-level code from inside the archive, so no external module and no denylisted
global is needed.
evil_importtime.pt — malicious package; loading it runs code and writes /tmp/MARKER_importtime.txt.verify.py — loads it with the standard PackageImporter(...).load_pickle("data","obj.pkl").build.py — how the package was authored (torch.package.PackageExporter).pip install torch
python verify.py
# marker after : True
# import-time-RCE uid=0
Confirmed on a clean python:3.12-slim container with stock torch 2.13.0 (uid=0).
Any code that loads a user-supplied torch.package runs attacker code as the host process, on the default and only load path. There is no pickle blob for a scanner to flag in the import-time variant, so ModelScan reports it clean.