CVE-2022-29216: TensorFlow Code Injection Vulnerability in saved_model_cli
Summary
CVE-2022-29216: Code injection in saved_model_cli in TensorFlow. Affects tensorflow-gpu across 3 version ranges.
< 2.6.4
>= 2.7.0, < 2.7.2
>= 2.8.0, < 2.8.1
Fixed in 2.6.4, 2.7.2 or 2.8.1, depending on the release line you run. How to fix ↓
Also tracked for
- tensorflow · PyPI
- tensorflow-cpu · PyPI
- tensorflow · Bitnami
- tensorflow · PyPI
The same CVE-2022-29216 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
TensorFlow is an open-source machine learning library widely used for various applications, including deep learning and neural networks. It provides tools for building and training models, and one of its components, saved_model_cli, is used for serving and managing saved models. However, this tool has a vulnerability that allows for code injection, which could lead to severe security risks.
Vulnerability Detail
The vulnerability in TensorFlow's saved_model_cli tool stems from an incomplete fix for a previous issue (CVE-2021-41228). It allows users to execute arbitrary code through the input_exprs argument, which can lead to a code injection attack. For example, an attacker could run a command to open a reverse shell, compromising the system's security. The vulnerability arises from the use of the eval function in the code, which can execute arbitrary expressions, making it a significant security concern.
How To Fix
Latest published version: 2.12.0 as of 22 Oct 2026
pip install --upgrade "tensorflow-gpu==2.12.0"
Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.
If you can't move to the latest
The minimum fixed version depends on the release line you run.
-
< 2.6.42.6.4pip install --upgrade "tensorflow-gpu==2.6.4" -
>= 2.7.0, < 2.7.22.7.2pip install --upgrade "tensorflow-gpu==2.7.2" -
>= 2.8.0, < 2.8.12.8.1pip install --upgrade "tensorflow-gpu==2.8.1"
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
As a temporary workaround, avoid using the saved_model_cli tool with the input_exprs argument until you can update to a patched version. If you must use it, ensure that the input expressions are safe and do not contain any executable code.
Conclusion
The CVE-2022-29216 vulnerability in TensorFlow's saved_model_cli tool poses a significant risk due to its potential for code injection. Users are strongly advised to update to the latest patched versions to secure their applications. Additionally, temporary workarounds should be employed until an update can be performed.
See every vulnerability recorded for tensorflow-gpu →
FAQ
CVE-2022-29216 is a code injection vulnerability found in TensorFlow's saved_model_cli tool, allowing attackers to execute arbitrary code.
You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without any signup.
The vulnerability can lead to unauthorized code execution, potentially allowing attackers to gain control over the system or access sensitive data.
If you cannot update TensorFlow right away, avoid using the vulnerable features of saved_model_cli and ensure that any input expressions are safe.
The CVSS score of this vulnerability is 7.8, indicating a high severity level.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-gpu.