CVE-2026-136431: PyTorch URL Loader Runs Attacker Code

A flaw in PyTorch's standard helper for fetching pretrained weights can let a crafted file run code on the machine that loads it. Tracked as CVE-2026-136431, the issue sits in torch.hub.load_state_dict_from_url, which downloads a weights file from a web address and loads it. The helper still defaults to weights_only=False, the unsafe setting from before PyTorch 2.6 made the safe loader the default for torch.load, so the downloaded file passes through the full Python unpickler, which will execute code hidden inside it.
The unsafe default survived the 2.6 fix
The restricted unpickler introduced in PyTorch 2.6 only allows tensors and a short list of safe types, and it became the default for plain torch.load. But load_state_dict_from_url kept the old default, and its hash check is off unless the caller turns it on. Anyone who calls the helper with a URL they do not fully control, such as a model zoo link, a config-driven loader or a snippet copied from a tutorial, hands the file's author code execution in their own process.
Rejected as known behaviour, published as a zero-day
The Zero Day Initiative reported the flaw on 27 August 2026, and PyTorch rejected it as a known issue on 1 September, pointing to its security policy, which treats running an untrusted model as running untrusted code. ZDI gave notice on 3 November and published advisory ZDI-26-1058 on 24 November. The flaw affects PyTorch 2.13.0, scores 7.8, and needs the victim to load a malicious file. There is no patch: the advice is to load weights only from sources you trust, prefer the safetensors format, and set TORCH_FORCE_WEIGHTS_ONLY_LOAD=1 in training and inference environments. No exploitation in the wild has been reported.