CVE-2021-29525: TensorFlow - Division by 0 in Conv2DBackpropInput
Summary
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
- tensorflow · PyPI
- tensorflow · PyPI
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
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.
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 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.42.1.4 -
>= 2.2.0, < 2.2.32.2.3 -
>= 2.3.0, < 2.3.32.3.3 -
>= 2.4.0, < 2.4.22.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 →
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).
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.