# CVE-2026-24747: PyTorch arbitrary code execution in weights_only unpickler

Source: https://junglewise.ai/threats/cve-2026-24747-pytorch-arbitrary-code-execution-in-weights-only-unpickler  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-01-27. Updated: 2026-06-30  
License: CC BY 4.0 with a link back

CVE-2026-24747 · Severity: high · CVSS 8.8 · Published 2026-01-27

PyTorch is a widely used software library for building and training artificial intelligence models. A security flaw was found in how it handles saved model files, even when using a 'safe' loading mode. If a user is tricked into opening a malicious model file, an attacker could take control of the computer running the software, potentially leading to data theft or system compromise.

Technologies: [torch (PyPI)](https://junglewise.ai/threats/technologies/torch). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2026-24747 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-24747 being exploited in the wild.

**How severe is CVE-2026-24747?** High severity, with a CVSS score of 8.8, published 27 January 2026.

**Which products and versions are affected?** pytorch (PyPI) ECOSYSTEM:introduced=0,fixed=2.10.0; torch (PyPI) < 2.10.0, ECOSYSTEM:introduced=0,fixed=2.10.0.

**Is there a fix for CVE-2026-24747?** Yes. pytorch (PyPI): upgrade to 2.10.0 or later; torch (PyPI): upgrade to 2.10.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-24747 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-24747?** Check whether you run pytorch (PyPI) or torch (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- pytorch (PyPI): upgrade to 2.10.0 or later

  ```sh
  pip install "pytorch>=2.10.0"
  ```

- torch (PyPI): upgrade to 2.10.0 or later

  ```sh
  pip install "torch>=2.10.0"
  ```


## Technical details

A vulnerability exists in PyTorch's 'weights_only' unpickler (used during torch.load) due to improper validation of pickle opcodes and storage metadata. Specifically, the unpickler fails to restrict SETITEM and SETITEMS opcodes, which can be applied to non-dictionary types to cause heap memory corruption. Additionally, it does not properly validate the element count against actual data in the archive. An attacker can exploit this by crafting a malicious .pth checkpoint file that, when loaded by a victim, triggers memory corruption and potentially arbitrary code execution. This issue is fixed in PyTorch version 2.10.0.

## Affected products

- PyTorch Foundation PyTorch < 2.10.0
- Red Hat OpenShift AI 2.25 2.25.7

## Identifiers

- CVE-2026-24747
- GHSA-63cw-57p8-fm3p
- PYSEC-2026-1856
- PYSEC-2026-2286

## Timeline

- 2026-01-21: patched: PyTorch version 2.10.0 released.
- 2026-01-26: advisory: GitHub Security Advisory GHSA-63cw-57p8-fm3p published.
- 2026-01-27: disclosed: CVE-2026-24747 published to NVD.
- 2026-06-10: patched: Red Hat released updates for OpenShift AI.

## References

- [https://github.com/pytorch/pytorch/163122/commit/954dc5183ee9205cbe79876ad05dd2d9ae752139](https://github.com/pytorch/pytorch/163122/commit/954dc5183ee9205cbe79876ad05dd2d9ae752139)
- [https://github.com/pytorch/pytorch/issues/163105](https://github.com/pytorch/pytorch/issues/163105)
- [https://github.com/pytorch/pytorch/releases/tag/v2.10.0](https://github.com/pytorch/pytorch/releases/tag/v2.10.0)
- [https://github.com/pytorch/pytorch/security/advisories/GHSA-63cw-57p8-fm3p](https://github.com/pytorch/pytorch/security/advisories/GHSA-63cw-57p8-fm3p)
- [https://access.redhat.com/errata/RHSA-2026:24977](https://access.redhat.com/errata/RHSA-2026:24977)
- [https://access.redhat.com/security/cve/CVE-2026-24747](https://access.redhat.com/security/cve/CVE-2026-24747)
- [https://bugzilla.redhat.com/show_bug.cgi?id=2433612](https://bugzilla.redhat.com/show_bug.cgi?id=2433612)

## Related threats

- [PYSEC-2026-1970 - PyTorch Improper Resource Shutdown or Release vulnerability](https://junglewise.ai/threats/cve-2025-3730-pytorch-improper-resource-shutdown-or-release-vulnerability)
- [PYSEC-2026-139 - A vulnerability was identified in PyTorch 2.10.0. The affected element is an unknown function of the…](https://junglewise.ai/threats/cve-2026-4538-pysec-2026-139-a-vulnerability-was-identified-in-pytorch-2-10-0)
- [PyTorch denial of service in torch.profiler.profile](https://junglewise.ai/threats/cve-2025-63396-pytorch-denial-of-service-in-torch-profiler-profile)
- [PYSEC-2025-209 - 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.](https://junglewise.ai/threats/cve-2025-55560-pysec-2025-209-an-issue-in-pytorch-v2-7-0-can-lead-to-a-denial-of)
- [PYSEC-2025-208 - A buffer overflow occurs in pytorch v2.7.0 when a PyTorch model consists of torch.nn.Conv2d…](https://junglewise.ai/threats/cve-2025-55558-pysec-2025-208-a-buffer-overflow-occurs-in-pytorch-v2-7-0-when-a)
