CVE-2022-29210 Heap buffer overflow due to incorrect hash function in TensorFlow

Medium 5.5 Published Updated

A heap buffer overflow in TensorFlow's TensorKey hash function allows attackers to cause crashes or potentially execute arbitrary code via crafted tensors.

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

What is CVE-2022-29210?

CVE-2022-29210 is a medium-severity memory corruption vulnerability in Google Tensorflow, published on 20 May 2022. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

TensorFlow is an open source platform for machine learning. In version 2.8.0, the `TensorKey` hash function used total estimated `AllocatedBytes()`, which (a) is an estimate per tensor, and (b) is a very poor hash function for constants (e.g. `int32_t`). It also tried to access individual tensor bytes through `tensor.data()` of size `AllocatedBytes()`. This led to ASAN failures because the `AllocatedBytes()` is an estimate of total bytes allocated by a tensor, including any pointed-to constructs (e.g. strings), and does not refer to contiguous bytes in the `.data()` buffer. The discoverers could not use this byte vector anyway because types such as `tstring` include pointers, whereas they needed to hash the string values themselves. This issue is patched in Tensorflow versions 2.9.0 and 2.8.1.

Weakness: CWE-787, CWE-122, CWE-120

Which versions are affected by CVE-2022-29210?

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

PackageAffectedFixed in
tensorflow BitnamiFrom 2.8.02.8.1
tensorflow PyPIFrom 2.8.02.8.1
tensorflow PyPIFrom 2.8.02.8.1
tensorflow PyPIFrom 2.8.02.8.1
tensorflow-cpu PyPIFrom 2.8.02.8.1
tensorflow-cpu PyPIFrom 2.8.02.8.1
4 more packages
tensorflow-cpu PyPIFrom 2.8.02.8.1
tensorflow-gpu PyPIFrom 2.8.02.8.1
tensorflow-gpu PyPIFrom 2.8.02.8.1
tensorflow-gpu PyPIFrom 2.8.02.8.1

Products include Google Tensorflow.

How do I fix CVE-2022-29210?

Upgrade tensorflow to 2.8.1 or later.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is CVE-2022-29210 being exploited?

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

All Google Tensorflow vulnerabilities

Sources

Also known as BIT-tensorflow-2022-29210, GHSA-hc2f-7r5r-r2hg, PYSEC-2026-1007, PYSEC-2026-3200, PYSEC-2026-3339.

Is CVE-2022-29210 in your software?

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

Check your SBOMs for free