43 known bugs in torch, with affected versions, fixes and workarounds. Sourced from upstream issue trackers.
| Severity | Affected | Fixed in | Title | Status | Source |
|---|
| high | any | 2.2.0 | Pytorch use-after-free vulnerability Pytorch before version v2.2.0 was discovered to contain a use-after-free vulnerability in torch/csrc/jit/mobile/interpreter.cpp. | fixed | osv:GHSA-pg7h-5qx3-wjr3 |
| high | any | 2.2.0 | PyTorch heap buffer overflow vulnerability PyTorch before v2.2.0 was discovered to contain a heap buffer overflow vulnerability in the component /runtime/vararg_functions.cpp. This vulnerability allows attackers to cause a Denial of Service (DoS) via a crafted input. | fixed | osv:GHSA-5pcm-hx3q-hm94 |
| medium | any | 2.10.0 | PYSEC-2026-2286: advisory PyTorch is a Python package that provides tensor computation. Prior to version 2.10.0, a vulnerability in PyTorch's `weights_only` unpickler allows an attacker to craft a malicious checkpoint file (`.pth`) that, when loaded with `torch.load(..., weights_only=True)`, can corrupt memory and potentially lead to arbitrary code execution. Version 2.10.0 fixes the issue. | fixed | osv:PYSEC-2026-2286 |
| medium | any | 2.8.0 | PyTorch Improper Resource Shutdown or Release vulnerability A vulnerability, which was classified as problematic, was found in PyTorch 2.6.0. Affected is the function torch.nn.functional.ctc_loss of the file aten/src/ATen/native/LossCTC.cpp. The manipulation leads to denial of service. An attack has to be approached locally. The exploit has been disclosed to the public and may be used. The name of the patch is 46fc5d8e360127361211cb237d5f9eef0223e567. It is recommended to apply a patch to fix this issue. | fixed | osv:PYSEC-2026-1970 |
| medium | any | \u2014 | PYSEC-2026-139: advisory A vulnerability was identified in PyTorch 2.10.0. The affected element is an unknown function of the component pt2 Loading Handler. The manipulation leads to deserialization. The attack can only be performed from a local environment. The exploit is publicly available and might be used. The project was informed of the problem early through a pull request but has not reacted yet. | open | osv:PYSEC-2026-139 |
| medium | any | 2.6.0 | PYSEC-2025-41: advisory PyTorch is a Python package that provides tensor computation with strong GPU acceleration and deep neural networks built on a tape-based autograd system. In version 2.5.1 and prior, a Remote Command Execution (RCE) vulnerability exists in PyTorch when loading a model using torch.load with weights_only=True. This issue has been patched in version 2.6.0. | fixed | osv:PYSEC-2025-41 |
| medium | any | \u2014 | PYSEC-2025-210: advisory An issue was discovered in PyTorch v2.5 and v2.7.1. Omission of profiler.stop() can cause torch.profiler.profile (PythonTracer) to crash or hang during finalization, leading to a Denial of Service (DoS). | open | osv:PYSEC-2025-210 |
| medium | any | 2.7.1 | PYSEC-2025-209: advisory An issue in pytorch v2.7.0 can lead to a Denial of Service (DoS) when a PyTorch model consists of torch.Tensor.to_sparse() and torch.Tensor.to_dense() and is compiled by Inductor. | fixed | osv:PYSEC-2025-209 |
| medium | any | 2.7.1 | PYSEC-2025-208: advisory A buffer overflow occurs in pytorch v2.7.0 when a PyTorch model consists of torch.nn.Conv2d, torch.nn.functional.hardshrink, and torch.Tensor.view-torch.mv() and is compiled by Inductor, leading to a Denial of Service (DoS). | fixed | osv:PYSEC-2025-208 |
| medium | any | 2.7.1 | PYSEC-2025-207: advisory A Name Error occurs in pytorch v2.7.0 when a PyTorch model consists of torch.cummin and is compiled by Inductor, leading to a Denial of Service (DoS). | fixed | osv:PYSEC-2025-207 |
| medium | any | 2.9.0 | PYSEC-2025-206: advisory pytorch v2.8.0 was discovered to contain an integer overflow in the component torch.nan_to_num-.long(). | fixed | osv:PYSEC-2025-206 |
| medium | any | 2.7.1 | PYSEC-2025-205: advisory A syntax error in the component proxy_tensor.py of pytorch v2.7.0 allows attackers to cause a Denial of Service (DoS). | fixed | osv:PYSEC-2025-205 |
| medium | any | 2.9.0 | PYSEC-2025-204: advisory pytorch v2.8.0 was discovered to display unexpected behavior when the components torch.rot90 and torch.randn_like are used together. | fixed | osv:PYSEC-2025-204 |
| medium | any | 2.9.0 | PYSEC-2025-203: advisory An issue in the component torch.linalg.lu of pytorch v2.8.0 allows attackers to cause a Denial of Service (DoS) when performing a slice operation. | fixed | osv:PYSEC-2025-203 |
| medium | 2.6.0 | 2.7.0 | PYSEC-2025-202: advisory PyTorch before 3.7.0 has a bernoulli_p decompose function in decompositions.py even though it lacks full consistency with the eager CPU implementation, negatively affecting nn.Dropout1d, nn.Dropout2d, and nn.Dropout3d for fallback_random=True. | fixed | osv:PYSEC-2025-202 |
| medium | 2.6.0 | 2.7.0 | PYSEC-2025-201: advisory In PyTorch before 2.7.0, bitwise_right_shift produces incorrect output for certain out-of-bounds values of the "other" argument. | fixed | osv:PYSEC-2025-201 |
| medium | 2.6.0 | 2.7.0 | PYSEC-2025-200: advisory In PyTorch before 2.7.0, when torch.compile is used, FractionalMaxPool2d has inconsistent results. | fixed | osv:PYSEC-2025-200 |
| medium | 2.6.0 | 2.7.0 | PYSEC-2025-199: advisory In PyTorch before 2.7.0, when inductor is used, nn.Fold has an assertion error. | fixed | osv:PYSEC-2025-199 |
| medium | any | 2.7.0 | PYSEC-2025-198: advisory In PyTorch through 2.6.0, when eager is used, nn.PairwiseDistance(p=2) produces incorrect results. | fixed | osv:PYSEC-2025-198 |
| medium | any | \u2014 | PYSEC-2025-197: advisory A vulnerability, which was classified as problematic, has been found in PyTorch 2.6.0. This issue affects the function torch.cuda.memory.caching_allocator_delete of the file c10/cuda/CUDACachingAllocator.cpp. The manipulation leads to memory corruption. An attack has to be approached locally. The exploit has been disclosed to the public and may be used. | open | osv:PYSEC-2025-197 |
| medium | any | \u2014 | PYSEC-2025-196: advisory A vulnerability classified as problematic has been found in PyTorch 2.6.0. Affected is the function torch.jit.jit_module_from_flatbuffer. The manipulation leads to memory corruption. Local access is required to approach this attack. The exploit has been disclosed to the public and may be used. | open | osv:PYSEC-2025-196 |
| medium | any | \u2014 | PYSEC-2025-195: advisory A vulnerability classified as critical was found in PyTorch 2.6.0. This vulnerability affects the function torch.lstm_cell. The manipulation leads to memory corruption. The attack needs to be approached locally. The exploit has been disclosed to the public and may be used. | open | osv:PYSEC-2025-195 |
| medium | any | \u2014 | PYSEC-2025-194: advisory A vulnerability classified as critical has been found in PyTorch 2.6.0. This affects the function torch.jit.script. The manipulation leads to memory corruption. It is possible to launch the attack on the local host. The exploit has been disclosed to the public and may be used. | open | osv:PYSEC-2025-194 |
| medium | any | \u2014 | PYSEC-2025-193: advisory A vulnerability was found in PyTorch 2.6.0. It has been rated as critical. Affected by this issue is the function torch.nn.utils.rnn.unpack_sequence. The manipulation leads to memory corruption. Attacking locally is a requirement. The exploit has been disclosed to the public and may be used. | open | osv:PYSEC-2025-193 |
| medium | any | \u2014 | PYSEC-2025-192: advisory A vulnerability was found in PyTorch 2.6.0. It has been declared as critical. Affected by this vulnerability is the function torch.nn.utils.rnn.pad_packed_sequence. The manipulation leads to memory corruption. Local access is required to approach this attack. The exploit has been disclosed to the public and may be used. | open | osv:PYSEC-2025-192 |
| medium | any | \u2014 | PYSEC-2025-191: advisory A vulnerability, which was classified as problematic, has been found in PyTorch 2.6.0+cu124. Affected by this issue is the function torch.mkldnn_max_pool2d. The manipulation leads to denial of service. An attack has to be approached locally. The exploit has been disclosed to the public and may be used. The real existence of this vulnerability is still doubted at the moment. The security policy of the project warns to use unknown models which might establish malicious effects. | open | osv:PYSEC-2025-191 |
| medium | any | \u2014 | PYSEC-2025-190: advisory A vulnerability was found in PyTorch 2.6.0+cu124. It has been rated as problematic. Affected by this issue is the function nnq_Sigmoid of the component Quantized Sigmoid Module. The manipulation of the argument scale/zero_point leads to improper initialization. The attack needs to be approached locally. The complexity of an attack is rather high. The exploitation is known to be difficult. The exploit has been disclosed to the public and may be used. | open | osv:PYSEC-2025-190 |
| medium | any | \u2014 | PYSEC-2025-189: advisory A vulnerability was found in PyTorch 2.6.0+cu124. It has been declared as critical. Affected by this vulnerability is the function torch.ops.profiler._call_end_callbacks_on_jit_fut of the component Tuple Handler. The manipulation of the argument None leads to memory corruption. The attack can be launched remotely. The complexity of an attack is rather high. The exploitation appears to be difficult. | open | osv:PYSEC-2025-189 |
| medium | any | 2.5.0 | PYSEC-2024-259: advisory In PyTorch <=2.4.1, the RemoteModule has Deserialization RCE. NOTE: this is disputed by multiple parties because this is intended behavior in PyTorch distributed computing. | fixed | osv:PYSEC-2024-259 |
| medium | any | b5c3a17c2c207ebefcb85043f0cf94be9b2fef81 | PYSEC-2024-252: advisory PyTorch before v2.2.0 was discovered to contain a heap buffer overflow vulnerability in the component /runtime/vararg_functions.cpp. This vulnerability allows attackers to cause a Denial of Service (DoS) via a crafted input. | fixed | osv:PYSEC-2024-252 |
| medium | any | 9c7071b0e324f9fb68ab881283d6b8d388a4bcd2 | PYSEC-2024-251: advisory Pytorch before version v2.2.0 was discovered to contain a use-after-free vulnerability in torch/csrc/jit/mobile/interpreter.cpp. | fixed | osv:PYSEC-2024-251 |
| medium | any | 7c35874ad664e74c8e4252d67521f3986eadb0e6 | PYSEC-2024-250: advisory Pytorch before v2.2.0 has an Out-of-bounds Read vulnerability via the component torch/csrc/jit/mobile/flatbuffer_loader.cpp. | fixed | osv:PYSEC-2024-250 |
| medium | any | 767f6aa49fe20a2766b9843d01e3b7f7793df6a3 | PYSEC-2022-43015: advisory In PyTorch before trunk/89695, torch.jit.annotations.parse_type_line can cause arbitrary code execution because eval is used unsafely. | fixed | osv:PYSEC-2022-43015 |
| medium | any | 2.9.1 | PyTorch is vulnerable to memory corruption through its unpack_sequence function A vulnerability was found in PyTorch 2.6.0. It has been rated as critical. Affected by this issue is the function torch.nn.utils.rnn.unpack_sequence. The manipulation leads to memory corruption. Attacking locally is a requirement. The exploit has been disclosed to the public and may be used.
A patch is available through commit [4945180](https://github.com/pytorch/pytorch/commit/494518046816d29099b7d056a74ffa5c244fdcdd). | fixed | osv:GHSA-vgrw-7cvw-pwgx |
| medium | any | \u2014 | PyTorch is Vulnerable to Memory Consumption through pad_packed_sequence Function A vulnerability was found in PyTorch 2.6.0. It has been declared as critical. Affected by this vulnerability is the function torch.nn.utils.rnn.pad_packed_sequence. The manipulation leads to memory corruption. Local access is required to approach this attack. The exploit has been disclosed to the public and may be used. | open | osv:GHSA-f4hp-rmr7-r7v8 |
| medium | any | 2.8.0 | PyTorch Improper Resource Shutdown or Release vulnerability A vulnerability, which was classified as problematic, was found in PyTorch 2.6.0. Affected is the function torch.nn.functional.ctc_loss of the file aten/src/ATen/native/LossCTC.cpp. The manipulation leads to denial of service. An attack has to be approached locally. The exploit has been disclosed to the public and may be used. The name of the patch is 46fc5d8e360127361211cb237d5f9eef0223e567. It is recommended to apply a patch to fix this issue. | fixed | osv:GHSA-887c-mr87-cxwp |
| low | any | \u2014 | PyTorch: Manipulation of the argument scale/zero_point leads to improper initialization via Quantized Sigmoid Module A vulnerability was found in PyTorch 2.6.0+cu124. It has been rated as problematic. Affected by this issue is the function nnq_Sigmoid of the component Quantized Sigmoid Module. The manipulation of the argument scale/zero_point leads to improper initialization. The attack needs to be approached locally. The complexity of an attack is rather high. The exploitation is known to be difficult. The exploit has been disclosed to the public and may be used. | open | osv:GHSA-x3gm-94wq-g975 |
| low | any | 2.13.0 | PyTorch is vulnerable to memory corruption through its torch.jit.script function A vulnerability classified as critical has been found in PyTorch 2.6.0. This affects the function torch.jit.script. The manipulation leads to memory corruption. It is possible to launch the attack on the local host. The exploit has been disclosed to the public and may be used. | fixed | osv:GHSA-rrmf-rvhw-rf47 |
| low | any | 2.10.0 | PyTorch is vulnerable to memory corruption through its torch.lstm_cell function A vulnerability classified as critical was found in PyTorch 2.6.0. This vulnerability affects the function torch.lstm_cell. The manipulation leads to memory corruption. The attack needs to be approached locally. The exploit has been disclosed to the public and may be used.
A patch is available through commit [999d94b](https://github.com/pytorch/pytorch/commit/999d94b5ede5f4ec111ba7dd144129e2c2725b03). | fixed | osv:GHSA-qfhq-4f3w-5fph |
| low | any | \u2014 | PyTorch Tuple Handler is Vulnerable to Memory Corruption through Manipulation of None Argument A vulnerability was found in PyTorch 2.6.0+cu124. It has been declared as critical. Affected by this vulnerability is the function torch.ops.profiler._call_end_callbacks_on_jit_fut of the component Tuple Handler. The manipulation of the argument None leads to memory corruption. The attack can be launched remotely. The complexity of an attack is rather high. The exploitation appears to be difficult. | open | osv:GHSA-c678-jfcj-6jmf |
| low | any | 2.7.1-rc1 | PyTorch susceptible to local Denial of Service A vulnerability, which was classified as problematic, has been found in PyTorch 2.6.0+cu124. Affected by this issue is the function torch.mkldnn_max_pool2d. The manipulation leads to denial of service. An attack has to be approached locally. The exploit has been disclosed to the public and may be used. | fixed | osv:GHSA-3749-ghw9-m3mg |
| critical | any | 2.6.0 | PyTorch: `torch.load` with `weights_only=True` leads to remote code execution # Description
I found a Remote Command Execution (RCE) vulnerability in PyTorch. When loading model using torch.load with weights_only=True, it can still achieve RCE.
# Background knowledge
https://github.com/pytorch/pytorch/security
As you can see, the PyTorch official documentation considers using `torch.load()` with `weights_only=True` to be safe.

Since everyone knows that weights_only=False is unsafe, so they will use the weights_only=True to mitigate the seucirty issue.
But now, I just proved that even if you use weights_only=True, it can still achieve RCE.
# Credit
This vulnerability was found by Ji'an Zhou. | fixed | osv:GHSA-53q9-r3pm-6pq6 |
| critical | any | 1.13.1 | PyTorch vulnerable to arbitrary code execution In PyTorch before trunk/89695, torch.jit.annotations.parse_type_line can cause arbitrary code execution because eval is used unsafely. The fix for this issue is available in version 1.13.1. There is a release checker in [issue #89855](https://github.com/pytorch/pytorch/issues/89855). | fixed | osv:GHSA-47fc-vmwq-366v |
Get this data programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/bugs/pypi/torch