CVE-2022-45907

In PyTorch before trunk/89695, torch.jit.annotations.parse_type_line can cause arbitrary code execution because eval is used unsafely

Critical · published November 26, 2022

CVSS v3.1
9.8
EPSS
1%
Percentile
70.0
In the wild
Unconfirmed
What it is

🚨 An unsafe use of `eval` in PyTorch can lead to arbitrary code execution! It's like handing a stranger the keys to your car while blindfolded. 🔥 Think of `eval` as a chef who blindly follows a recipe without checking the ingredients. If someone hands them a recipe that includes expired or harmful items, it could result in a disastrous meal—or in this case, a compromised system. An attacker can exploit this vulnerability to execute any code they want, potentially gaining control of your environment. This could mean unauthorized access to sensitive data or even full system takeover, leading to devastating consequences for your operations.

Put simply

Think of `eval` as a chef who blindly follows a recipe without checking the ingredients. If someone hands them a recipe that includes expired or harmful items, it could result in a disastrous meal—or in this case, a compromised system. The vulnerability lies in the `torch.jit.annotations.parse_type_line` function, which uses `eval` without proper safeguards. This allows arbitrary code execution when an attacker can manipulate the input to this function, effectively executing their code on the server.

What to do

An attacker can exploit this vulnerability to execute any code they want, potentially gaining control of your environment. This could mean unauthorized access to sensitive data or even full system takeover, leading to devastating consequences for your operations. Update your PyTorch installation to the latest version where this issue is fixed. Review your code to ensure safe handling of input to functions utilizing `eval`. Implement security best practices to minimize the risk of similar vulnerabilities in the future. You've got this! Take these steps, and you'll be back to secure coding in no time. 🛡️

The record
Technical detail
CVSS v3.1
9.8 · CRITICAL
Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS v4.0
Not supplied
EPSS
0.01290 · 70.0th percentile
Published
2022-11-26T00:00Z
EPSS history
Timeline
  • 26 NOV 00:00Z
    In PyTorch before trunk/89695, torch.jit.annotations.parse_type_line can cause arbitrary code execution because eval is used unsafely
    cvelistv5