CVE-2021-29527: TensorFlow - Division by 0 in QuantizedConv2D

tensorflow Updated 02 Oct 2025

Summary

06/03/2024
Yes i
Medium
Not published

CVE-2021-29527: Division by 0 in QuantizedConv2D. 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-29527 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 Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

TensorFlow is an end-to-end open source platform for machine learning. It provides a comprehensive set of tools, libraries, and resources for developing and deploying machine learning models. TensorFlow is widely used in various industries and has a large community of developers and users. However, a vulnerability has been discovered in the tf.raw_ops.QuantizedConv2D function, which can be exploited to trigger a division by 0.

Vulnerability Detail

The vulnerability exists in the implementation of the tf.raw_ops.QuantizedConv2D function in TensorFlow. The function performs a division by a quantity that is controlled by the caller, allowing an attacker to provide a value of 0 and trigger a division by 0 error. This can lead to unexpected behavior, crashes, or even potential security vulnerabilities in applications that rely on TensorFlow for machine learning tasks.

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, developers can manually modify the affected code to ensure that the division operation is not performed with a value of 0. This can be achieved by adding appropriate checks and handling cases where the divisor is 0. Here is an example of how the code can be modified:

# Original code
result = tf.raw_ops.QuantizedConv2D(inputs, filters, strides, padding)

# Modified code
if divisor != 0:
    result = tf.raw_ops.QuantizedConv2D(inputs, filters, strides, padding)
else:
    # Handle the case where divisor is 0
    result = tf.zeros_like(inputs)

Conclusion

In conclusion, a vulnerability has been discovered in TensorFlow that allows an attacker to trigger a division by 0 error in the tf.raw_ops.QuantizedConv2D function. This vulnerability can have various impacts, including crashes and potential security vulnerabilities. It is recommended to update to the latest patched versions of TensorFlow or apply the provided workaround to mitigate the risk. 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 set of tools and resources for developing and deploying machine learning models.

This vulnerability allows an attacker to trigger a division by 0 error in the tf.raw_ops.QuantizedConv2D function, potentially leading to crashes or security vulnerabilities in applications that use TensorFlow for machine learning tasks.

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 and will receive the fix.

To fix this vulnerability, it is recommended to update to the latest patched versions of TensorFlow, which include the fix. The fix will be included in TensorFlow 2.5.0, and for affected versions, it will be cherrypicked and included in TensorFlow 2.4.2, 2.3.3, 2.2.3, and 2.1.4.

Yes, as a temporary workaround, developers can manually modify the affected code to ensure that the division operation is not performed with a value of 0. This involves adding appropriate checks and handling cases where the divisor is 0.

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