CVE-2021-37653: Division by 0 in `ResourceGather` in TensorFlow
Impact An attacker can trigger a crash via a floating point exception in tf.rawops.ResourceGather:
python import tensorflow as tf
tensor = tf.constant(value=[[]],shape=(0,1),dtype=tf.uint32) v = tf.Variable(tensor) tf.rawops.ResourceGather( resource=v.handle, indices=[0], dtype=tf.uint32, batchdims=1, validateindices=False)
The implementation computes the value of a value, batchsize, and then divides by it without checking that this value is not 0.
Patches We have patched the issue in GitHub commit ac117ee8a8ea57b73d34665cdf00ef3303bc0b11.
The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4, as these are also affected and still in supported range.
For more information Please consult our security guide for more information regarding the security model and how to contact us with issues and questions.
Attribution This vulnerability has been reported by members of the Aivul Team from Qihoo 360.
Other sources
TensorFlow is an end-to-end open source platform for machine learning. In affected versions an attacker can trigger a crash via a floating point exception in tf.rawops.ResourceGather. The implementation computes the value of a value, batchsize, and then divides by it without checking that this value is not 0. We have patched the issue in GitHub commit ac117ee8a8ea57b73d34665cdf00ef3303bc0b11. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4, as these are also affected and still in supported range.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/tensorflow-gputo a version that resolves this vulnerability.Fixed in 2.5.1 - Upgrade
Upgrade
pip/tensorflow-gputo a version that resolves this vulnerability.Fixed in 2.4.3 - Upgrade
Upgrade
pip/tensorflow-gputo a version that resolves this vulnerability.Fixed in 2.3.4 - Upgrade
Upgrade
pip/tensorflow-cputo a version that resolves this vulnerability.Fixed in 2.5.1 - Upgrade
Upgrade
pip/tensorflow-cputo a version that resolves this vulnerability.Fixed in 2.4.3 - Upgrade
Upgrade
pip/tensorflow-cputo a version that resolves this vulnerability.Fixed in 2.3.4 - Upgrade
Upgrade
pip/tensorflowto a version that resolves this vulnerability.Fixed in 2.5.1 - Upgrade
Upgrade
pip/tensorflowto a version that resolves this vulnerability.Fixed in 2.4.3 - Upgrade
Upgrade
pip/tensorflowto a version that resolves this vulnerability.Fixed in 2.3.4 - Upgrade
Upgrade
tensorflowto a version that resolves this vulnerability.Fixed in 2.6.0Patch ac117ee8a8ea57b73d34665cdf00ef3303bc0b11 - Upgrade
Upgrade
tensorflowto a version that resolves this vulnerability.Fixed in 2.5.1Patch ac117ee8a8ea57b73d34665cdf00ef3303bc0b11 - Upgrade
Upgrade
tensorflowto a version that resolves this vulnerability.Fixed in 2.4.3Patch ac117ee8a8ea57b73d34665cdf00ef3303bc0b11 - Upgrade
Upgrade
tensorflowto a version that resolves this vulnerability.Fixed in 2.3.4Patch ac117ee8a8ea57b73d34665cdf00ef3303bc0b11
Event History
Frequently Asked Questions
What is the severity of CVE-2021-37653?
CVE-2021-37653 has a moderate severity rating due to the potential for an attacker to trigger a crash in TensorFlow applications.
How do I fix CVE-2021-37653?
To fix CVE-2021-37653, update your TensorFlow installation to version 2.5.1 or higher.
Which versions of TensorFlow are affected by CVE-2021-37653?
CVE-2021-37653 affects TensorFlow versions from 2.3.0 up to 2.6.0-rc2.
What specific function is vulnerable in CVE-2021-37653?
The vulnerable function in CVE-2021-37653 is tf.raw_ops.ResourceGather.
Can CVE-2021-37653 lead to data loss?
While CVE-2021-37653 can cause application crashes, it does not directly lead to data loss.