CVE-2021-29599: TensorFlow - Division by Zero Vulnerability

tensorflow Updated 02 Oct 2025

Summary

14/05/2021
Yes i
Low
2.5

CVE-2021-29599: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow 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 < b22786e7e9b7bdb6a56936ff29cc7e9968d7bc1d

Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓

Also tracked for

The same CVE-2021-29599 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

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. TensorFlow is widely used in various domains, including research, industry, and academia. The vulnerability discussed here affects the TensorFlow package, specifically the Split TFLite operator.

Vulnerability Detail

The implementation of the Split TFLite operator in TensorFlow is vulnerable to a division by zero error. This vulnerability can be exploited by an attacker who crafts a malicious model in such a way that the num_splits parameter is set to 0. When this model is executed, a division by zero error occurs, leading to a potential crash or undefined behavior. The vulnerability has been identified in the source code of TensorFlow and has been assigned the identifier CVE-2021-29599. It was reported on May 14, 2021, and the fix will be included in TensorFlow 2.5.0. To address this issue, the TensorFlow team will also backport the fix to earlier versions, including TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3, and TensorFlow 2.1.4.

How To Fix

Latest published version: 2.21.0 as of 22 Oct 2026

pip install --upgrade "tensorflow==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.4 2.1.4
    pip install --upgrade "tensorflow==2.1.4"
  • >= 2.2.0, < 2.2.3 2.2.3
    pip install --upgrade "tensorflow==2.2.3"
  • >= 2.3.0, < 2.3.3 2.3.3
    pip install --upgrade "tensorflow==2.3.3"
  • >= 2.4.0, < 2.4.2 2.4.2
    pip install --upgrade "tensorflow==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 manually modify the affected code in the TensorFlow package to handle the division by zero scenario. One possible approach is to add a check for the num_splits parameter and ensure it is not zero before performing the division operation. Here is an example of how the code can be modified:

// Original code
if (num_splits > 0) {
  // Perform division
}

// Modified code
if (num_splits > 0) {
  // Perform division
} else {
  // Handle division by zero error
}

Conclusion

The division by zero vulnerability in the Split TFLite operator of TensorFlow can be exploited by an attacker to cause a crash or undefined behavior. To mitigate this risk, it is crucial to update TensorFlow to the latest version or apply the recommended fixes for the affected versions. For further assistance and support in addressing this vulnerability, please contact DevNack.com.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

TensorFlow is an open source platform for machine learning that provides a comprehensive set of tools and resources for developing and deploying machine learning models.

The Split TFLite operator is a component in TensorFlow that allows for splitting a tensor into multiple sub-tensors along a specified dimension.

An attacker can exploit this vulnerability by crafting a malicious model in which the num_splits parameter is set to 0. When this model is executed, a division by zero error occurs, potentially leading to a crash or undefined behavior.

The vulnerability affects TensorFlow versions 2.1.4 and later, including TensorFlow 2.2.3, TensorFlow 2.3.3, TensorFlow 2.4.2, and TensorFlow 2.5.0 (prior to the fix).

To fix this vulnerability, it is recommended to update TensorFlow to the latest version available. If you are using TensorFlow 2.5.0 or later, the vulnerability will be automatically addressed. For users of earlier versions, it is advised to upgrade to the respective fixed versions: TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3, or TensorFlow 2.1.4.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Latest published version: 2.21.0 as of 22 Oct 2026

pip install --upgrade "tensorflow==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.4 2.1.4
    pip install --upgrade "tensorflow==2.1.4"
  • >= 2.2.0, < 2.2.3 2.2.3
    pip install --upgrade "tensorflow==2.2.3"
  • >= 2.3.0, < 2.3.3 2.3.3
    pip install --upgrade "tensorflow==2.3.3"
  • >= 2.4.0, < 2.4.2 2.4.2
    pip install --upgrade "tensorflow==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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback