Junglewise Threat Intelligence

CVE-2021-37654: PYSEC-2021-765 - TensorFlow is an end-to-end open source platform for machine learning. In affected versions an attacker can trigger a crash via a `CHECK`-fa

CVE-2021-37654 · Severity: low · CVSS 3.1 · Published 2021-08-12

Technologies: tensorflow-cpu (PyPI), tensorflow-gpu (PyPI), Google TensorFlow, tensorflow (PyPI). Vendors: Google, PyPI.

Executive brief

TensorFlow is a machine learning framework used for building and training AI models. A flaw in the ResourceGather operation allows an attacker to read data outside allocated memory boundaries or trigger a crash, potentially leading to information disclosure or service disruption in applications using affected TensorFlow versions.

Technical details

The vulnerability is a heap out-of-bounds (OOB) read in the ResourceGather operation caused by missing validation of the batch_dims parameter against the input tensor rank. The vulnerable code uses batch_dims to iterate over tensor dimensions without checking that batch_dims ≤ tensor.dims(), causing reads beyond valid heap memory. In debug builds, a DCHECK catches the out-of-bounds access; in release builds, the DCHECK becomes a no-op, allowing the OOB read to proceed. The attack requires calling tf.raw_ops.ResourceGather with a batch_dims value exceeding the input tensor's rank. Patches are available in TensorFlow 2.3.4, 2.4.3, 2.5.1, and 2.6.0.

Affected products

  • Google TensorFlow before 2.3.4; 2.4.0-2.4.2; 2.5.0
  • Google TensorFlow CPU before 2.3.4; 2.4.0-2.4.2; 2.5.0
  • Google TensorFlow GPU before 2.3.4; 2.4.0-2.4.2; 2.5.0

Timeline

  • 2021-08-11: disclosed
  • 2021-08-25: patched: TensorFlow 2.3.4, 2.4.3, 2.5.1, and 2.6.0 released with fix

References

Related threats