CVE-2021-29598: TensorFlow SVDF TFLite Operator Division by Zero Vulnerability
Summary
CVE-2021-29598: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-cpu across 5 version ranges.
< 2.1.4
>= 2.2.0, < 2.2.3
>= 2.3.0, < 2.3.3
>= 2.4.0, < 2.4.2
< 6841e522a3e7d48706a02e8819836e809f738682
Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓
Also tracked for
- tensorflow · Bitnami
- tensorflow · PyPI
- tensorflow · PyPI
- tensorflow-gpu · PyPI
The same CVE-2021-29598 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 end-to-end open source platform for machine learning. It provides a comprehensive ecosystem of tools, libraries, and resources for developing and deploying machine learning models. The SVDF (Singular Value Decomposition Filter) TFLite operator is a component of TensorFlow that is used for processing sequential data. It performs matrix operations and is commonly used in natural language processing and time series analysis tasks. However, the implementation of the SVDF TFLite operator in TensorFlow is vulnerable to a division by zero error.
Vulnerability Detail
The vulnerability in the SVDF TFLite operator arises from a lack of proper input validation. An attacker can craft a malicious model in such a way that the params->rank parameter is set to zero. This triggers a division by zero error during the execution of the SVDF operator, leading to a crash or unexpected behavior. The impact of this vulnerability depends on the context in which TensorFlow is used. In certain scenarios, it could potentially be exploited to cause denial of service or enable arbitrary code execution.
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.1.42.1.4pip install --upgrade "tensorflow-cpu==2.1.4" -
>= 2.2.0, < 2.2.32.2.3pip install --upgrade "tensorflow-cpu==2.2.3" -
>= 2.3.0, < 2.3.32.3.3pip install --upgrade "tensorflow-cpu==2.3.3" -
>= 2.4.0, < 2.4.22.4.2pip install --upgrade "tensorflow-cpu==2.4.2"
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 can implement input validation checks in their code to ensure that the params->rank parameter is never set to zero. This can be done by adding a conditional statement before invoking the SVDF operator. Here is an example in Python:
if params.rank == 0:
params.rank = 1
Conclusion
The SVDF TFLite operator in TensorFlow is vulnerable to a division by zero error. This vulnerability can be mitigated by updating to the latest version of TensorFlow or applying the provided patches. Users can also implement input validation checks as a temporary workaround. For further assistance and support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow-cpu →
FAQ
TensorFlow is an open source platform for machine learning that provides a comprehensive set of tools and libraries for developing and deploying machine learning models.
The SVDF TFLite operator is a component of TensorFlow that performs matrix operations for processing sequential data. It is commonly used in natural language processing and time series analysis tasks.
The impact of this vulnerability depends on the context in which TensorFlow is used. In certain scenarios, it could potentially be exploited to cause denial of service or enable arbitrary code execution.
To fix this vulnerability, users should update their TensorFlow installations to the latest version. Specifically, users of TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3, and TensorFlow 2.1.4 should apply the respective patches.
Yes, as a temporary workaround, users can implement input validation checks in their code to ensure that the params->rank parameter is never set to zero. This can be done by adding a conditional statement before invoking the SVDF operator.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.