CVE-2022-21738
JSON

6.5medium

Integer overflow leading to crash in Tensorflow

Severity
6.5medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.72% (higher than 50% of CVEs)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-x4qx-4fjv-hmw6BIT-TENSORFLOW-2022-21738PYSEC-2022-117PYSEC-2022-62PYSEC-2026-3258

Description

Tensorflow is an Open Source Machine Learning Framework. The implementation of `SparseCountSparseOutput` can be made to crash a TensorFlow process by an integer overflow whose result is then used in a memory allocation. The fix will be included in TensorFlow 2.8.0. We will also cherrypick this commit on TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, as these are also affected and still in supported range.

Affected

Product or packageVersionsReported by
Unspecified productn/aCVE List
tensorflow (PyPI)before 2.5.3, from 2.6.0 before 2.6.3, from 2.7.0 before 2.7.1GitHub Advisory Database, PyPA Advisory Database
tensorflow-cpu (PyPI)before 2.5.3, from 2.6.0 before 2.6.3, from 2.7.0 before 2.7.1, before 6f4d3e8139ec724dbbcb40505891c81dd1052c4aGitHub Advisory Database, PyPA Advisory Database
tensorflow-gpu (PyPI)before 2.5.3, from 2.6.0 before 2.6.3, from 2.7.0 before 2.7.1, before 6f4d3e8139ec724dbbcb40505891c81dd1052c4aGitHub Advisory Database, PyPA Advisory Database
google tensorflowup to 2.5.2, from 2.6.0 up to 2.6.2, 2.7.0NVD
tensorflow (Bitnami)before 2.5.3, from 2.6.0 before 2.6.3, from 2.7.0 before 2.7.1Bitnami Vulnerability Database

All scores

GitHub_M6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
GitHub6.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
NVD6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
NVD4.0medium CVSS:2.0AV:N/AC:L/Au:S/C:N/I:N/A:P
PyPA Advisory Database6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
PyPA Advisory DatabaseNot scored CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
Bitnami Vulnerability Databasemedium rating

Classification

CWE-190

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.

What each source says

CVE List

Tensorflow is an Open Source Machine Learning Framework. The implementation of `SparseCountSparseOutput` can be made to crash a TensorFlow process by an integer overflow whose result is then used in a memory allocation. The fix will be included in TensorFlow 2.8.0. We will also cherrypick this commit on TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, as these are also affected and still in supported range.

GitHub Advisory Database
Impact

The implementation of SparseCountSparseOutput can be made to crash a TensorFlow process by an integer overflow whose result is then used in a memory allocation:

import tensorflow as tf
import numpy as np
    
tf.raw_ops.SparseCountSparseOutput(
  indices=[[1,1]],
  values=[2],
  dense_shape=[2 ** 31, 2 ** 32],
  weights=[1],
  binary_output=True,
  minlength=-1,
  maxlength=-1,
  name=None)
Patches

We have patched the issue in GitHub commit 6f4d3e8139ec724dbbcb40505891c81dd1052c4a.

The fix will be included in TensorFlow 2.8.0. We will also cherrypick this commit on TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, 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 Faysal Hossain Shezan from University of Virginia.

NVD (es)

Tensorflow es un marco de aprendizaje automático de código abierto. La implementación de "SparseCountSparseOutput" puede hacer que un proceso de TensorFlow se bloquee por un desbordamiento de enteros cuyo resultado es usado en una asignación de memoria. La corrección será incluida en TensorFlow versión 2.8.0. También seleccionaremos este commit en TensorFlow versión 2.7.1, TensorFlow versión 2.6.3, y TensorFlow versión 2.5.3, ya que estos también están afectados y aún están en el rango admitido

References

https://github.com/tensorflow/tensorflow/blob/5100e359aef5c8021f2e71c7b986420b85ce7b3d/tensorflow/core/kernels/count_ops.cc#L168-L273advisory, exploit, third-party-advisory, web
https://github.com/tensorflow/tensorflow/security/advisories/GHSA-x4qx-4fjv-hmw6advisory, patch, third-party-advisory, web
https://github.com/tensorflow/tensorflow/commit/6f4d3e8139ec724dbbcb40505891c81dd1052c4aadvisory, fix, patch, third-party-advisory, web
https://nvd.nist.gov/vuln/detail/CVE-2022-21738advisory, web
https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2022-62.yamlweb
https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2022-117.yamlweb
https://github.com/tensorflow/tensorflowpackage
https://pypi.org/project/tensorflowpackage
https://github.com/advisories/GHSA-x4qx-4fjv-hmw6advisory

Sources

SourceRecordLicence
CVE ListCVE-2022-21738 changed 2025-05-05CVE Terms of Use
GitHub Advisory DatabaseGHSA-x4qx-4fjv-hmw6 changed 2026-09-10CC-BY-4.0
NVDCVE-2022-21738 changed 2026-06-17Public domain
PyPA Advisory DatabasePYSEC-2022-117 changed 2026-07-13CC-BY-4.0
PyPA Advisory DatabasePYSEC-2022-62 changed 2026-07-13CC-BY-4.0
PyPA Advisory DatabasePYSEC-2026-3258 changed 2026-07-13CC-BY-4.0
Bitnami Vulnerability DatabaseBIT-TENSORFLOW-2022-21738 changed 2026-09-08Apache-2.0