CVE-2021-37643 Null pointer dereference in `MatrixDiagPartOp` in TensorFlow

High 7.7 Published Updated

An attacker can cause a denial of service or invalid behavior in TensorFlow by providing an empty tensor to MatrixDiagPartOp without a valid padding value.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2021-37643?

CVE-2021-37643 is a high-severity vulnerability in Google Tensorflow, published on 12 Aug 2021. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

TensorFlow is an end-to-end open source platform for machine learning. If a user does not provide a valid padding value to `tf.raw_ops.MatrixDiagPartOp`, then the code triggers a null pointer dereference (if input is empty) or produces invalid behavior, ignoring all values after the first. The [implementation](https://github.com/tensorflow/tensorflow/blob/8d72537c6abf5a44103b57b9c2e22c14f5f49698/tensorflow/core/kernels/linalg/matrix_diag_op.cc#L89) reads the first value from a tensor buffer without first checking that the tensor has values to read from. We have patched the issue in GitHub commit 482da92095c4d48f8784b1f00dda4f81c28d2988. 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.

Weakness: CWE-476

Which versions are affected by CVE-2021-37643?

22 open source packages ship an affected version, including tensorflow, tensorflow-cpu and tensorflow-gpu. It affects 1 product.

PackageAffectedFixed in
tensorflow BitnamiFrom 2.3.02.3.4, 2.4.3, 2.5.1
tensorflow PyPIAll versions2.3.4
tensorflow PyPIAll versions2.3.4
tensorflow PyPIFrom 2.3.02.3.4, 2.4.3
tensorflow PyPIFrom 2.4.02.4.3
tensorflow PyPIFrom 2.4.02.4.3
16 more packages
tensorflow PyPIFrom 2.5.02.5.1
tensorflow PyPIFrom 2.5.02.5.1
tensorflow-cpu PyPIAll versions2.3.4
tensorflow-cpu PyPIAll versions2.3.4
tensorflow-cpu PyPIFrom 2.3.02.3.4, 2.4.3
tensorflow-cpu PyPIFrom 2.4.02.4.3
tensorflow-cpu PyPIFrom 2.4.02.4.3
tensorflow-cpu PyPIFrom 2.5.02.5.1
tensorflow-cpu PyPIFrom 2.5.02.5.1
tensorflow-gpu PyPIAll versions2.3.4
tensorflow-gpu PyPIAll versions2.3.4
tensorflow-gpu PyPIFrom 2.3.02.3.4, 2.4.3
tensorflow-gpu PyPIFrom 2.4.02.4.3
tensorflow-gpu PyPIFrom 2.4.02.4.3
tensorflow-gpu PyPIFrom 2.5.02.5.1
tensorflow-gpu PyPIFrom 2.5.02.5.1

Products include Google Tensorflow.

How do I fix CVE-2021-37643?

Upgrade tensorflow to a fixed version for your release line: 2.3.4, 2.4.3 or 2.5.1.

Is CVE-2021-37643 being exploited?

There is no known exploitation of CVE-2021-37643 in the wild and no public exploit code.

All Google Tensorflow vulnerabilities

Sources

Also known as BIT-tensorflow-2021-37643, GHSA-fcwc-p4fc-c5cc, PYSEC-2021-265, PYSEC-2021-556, PYSEC-2021-754.

Is CVE-2021-37643 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free