CVE-2022-45907 PyTorch vulnerable to arbitrary code execution
Attackers can execute arbitrary code via unsafe eval in PyTorch's type line parser, affecting developers using the library.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2022-45907?
CVE-2022-45907 is a critical code injection vulnerability in n/a, published on 26 Nov 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
In PyTorch before trunk/89695, torch.jit.annotations.parse_type_line can cause arbitrary code execution because eval is used unsafely.
Weakness: CWE-94
Which versions are affected by CVE-2022-45907?
4 open source packages ship an affected version, including torch and pytorch. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
torch PyPI | All versions | 1.13.1 |
torch PyPI | All versions | 1.13.1 |
torch PyPI | All versions | 1.13.1 |
pytorch Bitnami | All versions | 1.13.1 |
Products include Linuxfoundation Pytorch.
How do I fix CVE-2022-45907?
Upgrade torch to 1.13.1 or later.
Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.
Is CVE-2022-45907 being exploited?
There is no known exploitation of CVE-2022-45907 in the wild and no public exploit code.
Other vulnerabilities in n/a
- CVE-2024-48063 Deserialization in n/a
- CVE-2025-32434 PyTorch: `torch.load` with `weights_only=True` leads to remote code execution
- CVE-2026-24747 PyTorch Vulnerable to Remote Code Execution via Untrusted Checkpoint Files
- CVE-2024-31583 Pytorch use-after-free vulnerability
- CVE-2025-55551 Denial of service in n/a
Sources
Also known as BIT-pytorch-2022-45907, DEBIAN-CVE-2022-45907, GHSA-47fc-vmwq-366v, PYSEC-2022-43015, UBUNTU-CVE-2022-45907.