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-cpu 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-gpu · 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 framework that provides a comprehensive ecosystem for building and deploying machine learning models. It includes various tools and libraries for tasks such as data processing, model training, and serving. The 'saved_model_cli' tool is used for interacting with TensorFlow models, allowing users to run inference and manage model versions. However, it has been found to be vulnerable to a code injection attack, which could lead to severe security implications if exploited.
Vulnerability Detail
The vulnerability in TensorFlow's 'saved_model_cli' tool arises from an incomplete fix for a previous vulnerability (CVE-2021-41228). The tool allows users to execute arbitrary code through the 'input_exprs' argument, which can be manipulated to run malicious commands. This can lead to unauthorized access and control over the system, including the ability to open a reverse shell. The vulnerability is particularly concerning as it allows for unsafe execution of code, which could compromise the integrity and confidentiality of the system.
How To Fix
Latest published version: 2.21.0 as of 22 Oct 2026
pip install --upgrade "tensorflow-cpu==2.21.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-cpu==2.6.4" -
>= 2.7.0, < 2.7.22.7.2pip install --upgrade "tensorflow-cpu==2.7.2" -
>= 2.8.0, < 2.8.12.8.1pip install --upgrade "tensorflow-cpu==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, users should avoid using the 'input_exprs' argument in 'saved_model_cli' until they can update to a patched version. Additionally, ensure that the tool is not exposed to untrusted inputs.
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 version to mitigate this risk and ensure the security of their systems.
See every vulnerability recorded for tensorflow-cpu →
FAQ
CVE-2022-29216 is a code injection vulnerability found in TensorFlow's 'saved_model_cli' tool that allows for the execution of arbitrary code.
You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.
Exploitation of this vulnerability could lead to unauthorized access, control over the system, and execution of malicious commands, compromising system integrity.
You can update TensorFlow to the patched version by running the command: 'pip install --upgrade tensorflow-cpu'.
Yes, avoid using the 'input_exprs' argument in 'saved_model_cli' until you can update to a patched version.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.