CVE-2022-45907 PyTorch vulnerable to arbitrary code execution

Critical 9.8 Published Updated

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.

PackageAffectedFixed in
torch PyPIAll versions1.13.1
torch PyPIAll versions1.13.1
torch PyPIAll versions1.13.1
pytorch BitnamiAll versions1.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.

Sources

Also known as BIT-pytorch-2022-45907, DEBIAN-CVE-2022-45907, GHSA-47fc-vmwq-366v, PYSEC-2022-43015, UBUNTU-CVE-2022-45907.

Is CVE-2022-45907 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free