Zero-Day Deserialization Vulnerability in PyTorch Allows Remote Code Execution
A critical deserialization vulnerability in PyTorch Foundation's torch_save_to_dcp function allows remote attackers to execute arbitrary code on affected installations.

A significant security vulnerability has been disclosed in PyTorch Foundation's popular open-source machine learning framework, PyTorch. Identified as ZDI-26-1059, the flaw resides within the torch_save_to_dcp function and permits remote attackers to achieve arbitrary code execution on vulnerable systems.
The vulnerability stems from a deserialization flaw, where the torch_save_to_dcp utility fails to properly validate user-supplied data. This oversight allows an attacker to craft malicious data that, when deserialized by the affected PyTorch component, leads to the execution of arbitrary code within the context of the current user. Exploitation requires user interaction, typically by tricking a victim into opening a specially crafted file or visiting a malicious webpage that triggers the vulnerable function.
With a CVSS score of 7.8, this vulnerability is classified as critical, indicating a high level of risk to users and organizations relying on PyTorch for their machine learning workloads. The ability to execute arbitrary code remotely can lead to a complete compromise of the affected system, enabling attackers to steal sensitive data, deploy malware, or disrupt operations.
The Zero Day Initiative (ZDI) reported the vulnerability to the vendor on August 26, 2026. However, the vendor initially rejected the report, classifying it as expected behavior and closing the advisory. Following this, ZDI notified the vendor of their intention to publish the advisory as a zero-day on November 3, 2026, leading to the coordinated public release on November 24, 2026.
Given the nature of the vulnerability, which involves deserialization of untrusted data, the primary mitigation strategy recommended is to restrict interaction with the product. This means users should exercise extreme caution when opening files or accessing content that might trigger the torch_save_to_dcp function, especially if the source is not fully trusted.
This disclosure highlights a recurring theme in the cybersecurity landscape: vulnerabilities in libraries and frameworks used for data processing and serialization. As machine learning models become more complex and data pipelines more intricate, the security of the underlying tools, such as PyTorch, becomes paramount. The vendor's initial rejection of the vulnerability report also underscores the challenges in coordinating security disclosures and ensuring timely patching.
While no specific patches have been released by the vendor at the time of this advisory, the public disclosure by ZDI serves as a critical alert to the PyTorch community. Users are strongly advised to stay informed about any future updates or patches released by PyTorch Foundation and to implement strict security practices when handling external data or files.
This new advisory details a deserialization vulnerability in PyTorch Foundation's load_state_dict_from_url function, distinct from the previously reported torch_save_to_dcp flaw. While both allow for remote code execution, this specific vulnerability requires user interaction, such as visiting a malicious page or opening a malicious file, to be exploited. The vendor initially rejected the report, considering it known, before ZDI's notification of intent to publish as a 0-day advisory.
This advisory, ZDI-26-1054, details a deserialization vulnerability within PyTorch's FileSystemReader component. While the previous report focused on a vulnerability in torch_save_to_dcp, this new finding specifically targets the FileSystemReader class, allowing remote attackers to execute arbitrary code by exploiting the lack of proper validation of user-supplied data leading to deserialization of untrusted data. The CVSS score for this vulnerability is rated at 7.8.
This advisory, ZDI-26-1055, details a remote code execution vulnerability in PyTorch Foundation's load_compiled_function component, distinct from the previously reported torch_save_to_dcp flaw. The vulnerability arises from the deserialization of untrusted data due to insufficient input validation, requiring user interaction via a malicious file. The vendor initially rejected the report, citing expected behavior, but ZDI provided further evidence, leading to this public disclosure.