CVE-2021-41228: TensorFlow saved_model_cli Code Injection Vulnerability
Summary
CVE-2021-41228: Code injection in saved_model_cli. Affects tensorflow across 3 version ranges.
>= 2.4.0, < 2.4.4
>= 2.5.0, < 2.5.2
>= 2.6.0, < 2.6.1
Fixed in 2.4.4, 2.5.2 or 2.6.1, depending on the release line you run. How to fix ↓
Also tracked for
- tensorflow · PyPI
- tensorflow · PyPI
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
The same CVE-2021-41228 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 platform for machine learning. It provides a comprehensive ecosystem of tools, libraries, and resources for developing and deploying machine learning models. TensorFlow's saved_model_cli tool is used for inspecting and manipulating TensorFlow SavedModels. SavedModels are a serialized format for TensorFlow models that can be used for inference or transfer learning. The saved_model_cli tool allows users to interact with SavedModels through a command-line interface. However, a vulnerability has been discovered in the tool that allows for code injection.
Vulnerability Detail
The vulnerability in TensorFlow's saved_model_cli tool arises from the use of eval on user-supplied strings. This allows an attacker to inject arbitrary code into the tool, which can then be executed on the platform where the CLI tool runs. Although the impact of this vulnerability is not severe because the tool is typically run manually, it still poses a risk as it can enable unauthorized code execution. The vulnerability has been assigned the CVE identifier CVE-2021-41228 and has a CVSSv3 score of 9.8 (Critical).
How To Fix
Fixed versions by release line
The minimum fixed version depends on the release line you run.
-
>= 2.4.0, < 2.4.42.4.4 -
>= 2.5.0, < 2.5.22.5.2 -
>= 2.6.0, < 2.6.12.6.1
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
There is no specific workaround provided for this vulnerability. However, users can minimize the risk by being cautious when using the saved_model_cli tool and avoiding the execution of untrusted or unknown code.
Conclusion
The vulnerability in TensorFlow's saved_model_cli tool allows for code injection, which can lead to unauthorized code execution on the platform where the tool is used. Although the impact is not severe due to the manual nature of the tool, it is still important to apply the provided patch and update to the patched versions of TensorFlow to mitigate the risk. For further support on vulnerability remediation, you can reach out to DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open source platform for machine learning developed by Google. It provides a comprehensive set of tools, libraries, and resources for building and deploying machine learning models.
The saved_model_cli tool is a command-line interface provided by TensorFlow for inspecting and manipulating TensorFlow SavedModels. SavedModels are a serialized format for TensorFlow models that can be used for inference or transfer learning.
The vulnerability arises from the use of eval on user-supplied strings in the saved_model_cli tool. This allows an attacker to inject arbitrary code into the tool, which can then be executed on the platform where the CLI tool runs.
The impact of this vulnerability is not severe as the saved_model_cli tool is typically run manually. However, it still poses a risk as it can enable unauthorized code execution on the platform where the tool is used.
To mitigate this vulnerability, it is recommended to update TensorFlow to the patched versions (2.7.0, 2.6.1, 2.5.2, or 2.4.4) that include the fix. Additionally, users should exercise caution when using the saved_model_cli tool and avoid executing untrusted or unknown code.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.