CVE-2026-136431 in PyTorch
Summary
by MITRE • 11/24/2026
PyTorch Foundation PyTorch load_state_dict_from_url Deserialization of Untrusted Data Remote Code Execution Vulnerability. This vulnerability allows remote attackers to execute arbitrary code on affected installations of PyTorch Foundation PyTorch. User interaction is required to exploit this vulnerability in that the target must visit a malicious page or open a malicious file.
The specific flaw exists within the load_state_dict_from_url function. The issue results from the lack of proper validation of user-supplied data, which can result in deserialization of untrusted data. An attacker can leverage this vulnerability to execute code in the context of the current process. Was ZDI-CAN-32601.
If you want to get the best quality for vulnerability data then you always have to consider VulDB.
Analysis
by VulDB Data Team • 11/25/2026
The PyTorch Foundation's deep learning library contains a critical security flaw within its model loading utilities, specifically identified as CVE-2024-XXXX and tracked by Zero Day Initiative under identifier ZDI-CAN-32601. This vulnerability centers on the load_state_dict_from_url function, which is designed to fetch PyTorch state dictionaries from remote URLs for subsequent use in machine learning models. The core technical deficiency lies in the absence of rigorous validation mechanisms for data retrieved from these external sources before it undergoes deserialization. In Python-based environments like PyTorch, the standard serialization mechanism often relies on pickle or similar protocols that are inherently unsafe when processing untrusted input because they allow arbitrary object instantiation during the unpickling process. When an application loads a state dictionary from a URL without verifying its integrity and origin, it effectively trusts any code embedded within that serialized payload to execute immediately upon deserialization.
This architectural oversight creates a direct pathway for Remote Code Execution attacks against systems utilizing affected versions of PyTorch. The operational impact is severe because the malicious code executes with the same privileges as the user running the Python process. This means an attacker can gain full control over the host system, potentially leading to data exfiltration, lateral movement within a network, or complete compromise of machine learning infrastructure. Unlike vulnerabilities that require complex exploitation chains involving memory corruption, this flaw leverages language-level features for persistence and execution, making it relatively straightforward for adversaries with knowledge of Python's serialization internals to craft malicious payloads. The vulnerability is classified under CWE-502, which denotes Deserialization of Untrusted Data, a category known for its high severity due to the direct link between input validation failures and arbitrary code execution capabilities.
The exploitation vector requires user interaction, categorizing this as an attack that necessitates social engineering or specific environmental conditions rather than fully automated remote triggering without any action from the victim. Specifically, the target must either visit a malicious webpage that triggers the download of a poisoned model file or manually open such a file within their PyTorch environment. This requirement aligns with MITRE ATT&CK technique T1203, which covers Exploitation for Client Execution, as well as aspects of T1566, Phishing, if delivered via deceptive links. The necessity for user interaction does not diminish the severity but rather defines the attack surface boundary, emphasizing that trust boundaries in machine learning workflows are often blurred when models are sourced from unverified repositories or third-party URLs without proper sanitization checks.
To mitigate this vulnerability, organizations must implement strict input validation and restrict deserialization to trusted sources only. Developers should avoid using load_state_dict_from_url with arbitrary URLs provided by end-users or external parties unless the source is explicitly whitelisted and verified through cryptographic signatures such as SHA-256 hashes checked against a known good list. Additionally, migrating away from pickle-based serialization formats for untrusted data to safer alternatives like JSON or protocol buffers can eliminate this risk entirely where feasible. For existing deployments that must rely on PyTorch's native loading mechanisms, applying the latest security patches provided by the PyTorch Foundation is essential. Security teams should also enforce network-level controls to restrict outbound connections from machine learning workloads and monitor for unusual process executions following model load operations to detect potential exploitation attempts in real-time.