CVE-2021-29525: TensorFlow - Division by 0 in Conv2DBackpropInput

tensorflow Updated 02 Oct 2025

Summary

06/03/2024
Yes i
High
Not published

CVE-2021-29525: Division by 0 in Conv2DBackpropInput. Affects tensorflow across 4 version ranges.

< 2.1.4 >= 2.2.0, < 2.2.3 >= 2.3.0, < 2.3.3 >= 2.4.0, < 2.4.2

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-29525 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 Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

TensorFlow is an end-to-end open source platform for machine learning. It provides a comprehensive ecosystem for building and deploying machine learning models. TensorFlow is widely used in various industries and research domains due to its flexibility and scalability. However, a vulnerability has been discovered in TensorFlow that can lead to a division by 0 in the tf.raw_ops.Conv2DBackpropInput function. This vulnerability can be exploited by an attacker to cause a denial of service or potentially execute arbitrary code.

Vulnerability Detail

The vulnerability arises from a division operation in the implementation of tf.raw_ops.Conv2DBackpropInput. The division is performed using a value controlled by the caller, allowing an attacker to provide a malicious input that triggers a division by 0. This can lead to a crash or undefined behavior in the affected TensorFlow version. The vulnerability has been assigned the CVE identifier CVE-2021-29525 and has a CVSSv3 score of 9.8 (Critical). It affects multiple versions of TensorFlow, including 2.1.4, 2.2.3, 2.3.3, and 2.4.2.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 2.1.4 2.1.4
  • >= 2.2.0, < 2.2.3 2.2.3
  • >= 2.3.0, < 2.3.3 2.3.3
  • >= 2.4.0, < 2.4.2 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, it is advised to sanitize user inputs and validate them before passing them to the vulnerable function. By ensuring that the input values are within a valid range, the risk of triggering a division by 0 can be mitigated. Here is an example of how to sanitize inputs in Python:

def sanitize_input(value):
    if value <= 0:
        value = 1
    return value

# Usage:
input_value = sanitize_input(user_input)
result = tf.raw_ops.Conv2DBackpropInput(input_value, ...)

Conclusion

In conclusion, a division by 0 vulnerability has been discovered in TensorFlow versions 2.1.4, 2.2.3, 2.3.3, and 2.4.2. This vulnerability can be exploited by an attacker to cause a denial of service or potentially execute arbitrary code. It is recommended to upgrade to TensorFlow 2.5.0 or apply the fix manually to mitigate the issue. Sanitizing user inputs can serve as a temporary workaround. For further support on vulnerability remediation, 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 ecosystem for building and deploying machine learning models. It is widely used in various industries and research domains.

This vulnerability can be exploited by an attacker to cause a denial of service or potentially execute arbitrary code. It can lead to a crash or undefined behavior in the affected TensorFlow versions.

The vulnerability affects TensorFlow versions 2.1.4, 2.2.3, 2.3.3, and 2.4.2. These versions are still within the supported range.

Yes, this vulnerability has been assigned the CVE identifier CVE-2021-29525.

The CVSSv3 score of this vulnerability is 9.8 (Critical).

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 2.1.4 2.1.4
  • >= 2.2.0, < 2.2.3 2.2.3
  • >= 2.3.0, < 2.3.3 2.3.3
  • >= 2.4.0, < 2.4.2 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