5.5medium
Crashes due to overflow and `CHECK`-fail in ops with large tensor shapes
- Severity
- 5.5medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.32% (higher than 26% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-prcg-wp5q-rv7pBIT-TENSORFLOW-2021-41197PYSEC-2021-390PYSEC-2021-607PYSEC-2021-805
Description
TensorFlow is an open source platform for machine learning. In affected versions TensorFlow allows tensor to have a large number of dimensions and each dimension can be as large as desired. However, the total number of elements in a tensor must fit within an `int64_t`. If an overflow occurs, `MultiplyWithoutOverflow` would return a negative result. In the majority of TensorFlow codebase this then results in a `CHECK`-failure. Newer constructs exist which return a `Status` instead of crashing the binary. This is similar to CVE-2021-29584. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| tensorflow tensorflow | >= 2.6.0, < 2.6.1, >= 2.5.0, < 2.5.2, < 2.4.4 | CVE List |
| tensorflow (PyPI) | from 2.6.0 before 2.6.1, from 2.5.0 before 2.5.2, before 2.4.4, before a871989d7b6c18cdebf2fb4f0e5c5b62fbc19edf, before d81b1351da3e8c884ff836b64458d94e4a157c15, before 7c1692bd417eb4f9b33ead749a41166d6080af85, from 2.7.0rc0 before 2.7.0 | GitHub Advisory Database, PyPA Advisory Database |
| tensorflow-cpu (PyPI) | from 2.6.0 before 2.6.1, from 2.5.0 before 2.5.2, before 2.4.4, before a871989d7b6c18cdebf2fb4f0e5c5b62fbc19edf, before d81b1351da3e8c884ff836b64458d94e4a157c15, before 7c1692bd417eb4f9b33ead749a41166d6080af85, from 2.7.0rc0 before 2.7.0 | GitHub Advisory Database, PyPA Advisory Database |
| tensorflow-gpu (PyPI) | from 2.6.0 before 2.6.1, from 2.5.0 before 2.5.2, before 2.4.4, before a871989d7b6c18cdebf2fb4f0e5c5b62fbc19edf, before d81b1351da3e8c884ff836b64458d94e4a157c15, before 7c1692bd417eb4f9b33ead749a41166d6080af85, from 2.7.0rc0 before 2.7.0 | GitHub Advisory Database, PyPA Advisory Database |
| google tensorflow | before 2.4.4, from 2.5.0 before 2.5.2, from 2.6.0 before 2.6.1 | NVD |
| tensorflow (Bitnami) | before 2.4.4, from 2.5.0 before 2.5.2, from 2.6.0 before 2.6.1 | Bitnami Vulnerability Database |
All scores
| GitHub_M | 5.5medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
| GitHub | 5.5medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
| GitHub | medium CVSS:4.0 | CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N |
| NVD | 5.5medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
| NVD | 2.1low CVSS:2.0 | AV:L/AC:L/Au:N/C:N/I:N/A:P |
| Bitnami Vulnerability Database | medium rating |
Classification
What each source says
CVE List
TensorFlow is an open source platform for machine learning. In affected versions TensorFlow allows tensor to have a large number of dimensions and each dimension can be as large as desired. However, the total number of elements in a tensor must fit within an `int64_t`. If an overflow occurs, `MultiplyWithoutOverflow` would return a negative result. In the majority of TensorFlow codebase this then results in a `CHECK`-failure. Newer constructs exist which return a `Status` instead of crashing the binary. This is similar to CVE-2021-29584. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.
GitHub Advisory Database
Impact
TensorFlow allows tensor to have a large number of dimensions and each dimension can be as large as desired. However, the total number of elements in a tensor must fit within an int64_t. If an overflow occurs, MultiplyWithoutOverflow would return a negative result. In the majority of TensorFlow codebase this then results in a CHECK-failure. Newer constructs exist which return a Status instead of crashing the binary.
For example AddDim calls should be replaced by AddDimWithStatus.
This is similar to CVE-2021-29584 (and similar other reported vulnerabilities in TensorFlow, localized to specific APIs).
Patches
We have patched the issue in GitHub commits 7c1692bd417eb4f9b33ead749a41166d6080af85 (merging #51732), d81b1351da3e8c884ff836b64458d94e4a157c15 (merging #51717), a871989d7b6c18cdebf2fb4f0e5c5b62fbc19edf (merging #51658), and d81b1351da3e8c884ff836b64458d94e4a157c15 (merging #51973). It is possible that other similar instances exist in TensorFlow, we will issue fixes as these are discovered.
The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.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 externally via GitHub issue, GitHub issue and GitHub issue.
NVD (es)
TensorFlow es una plataforma de código abierto para el aprendizaje automático. En las versiones afectadas TensorFlow permite que el tensor tenga un gran número de dimensiones y cada dimensión puede ser tan grande como se desee. Sin embargo, el número total de elementos en un tensor debe caber dentro de un "int64_t". Si se produce un desbordamiento, "MultiplyWithoutOverflow" devolverá un resultado negativo. En la mayoría de los códigos de TensorFlow esto resulta en un fallo de "CHECK". Se presentan nuevas construcciones que devuelven un "Status" en lugar de bloquear el binario. Esto es similar a CVE-2021-29584. La corrección será incluida en TensorFlow versión 2.7.0. También será incluida este commit en TensorFlow versión 2.6.1, TensorFlow versión 2.5.2, y TensorFlow versión 2.4.4, ya que estos también están afectados y todavía están en el rango admitido
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-41197 changed 2024-08-04 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-prcg-wp5q-rv7p changed 2026-07-08 | CC-BY-4.0 |
| NVD | CVE-2021-41197 changed 2026-06-17 | Public domain |
| PyPA Advisory Database | PYSEC-2021-390 changed 2023-12-06 | CC-BY-4.0 |
| PyPA Advisory Database | PYSEC-2021-607 changed 2023-12-06 | CC-BY-4.0 |
| PyPA Advisory Database | PYSEC-2021-805 changed 2023-12-06 | CC-BY-4.0 |
| Bitnami Vulnerability Database | BIT-TENSORFLOW-2021-41197 changed 2026-09-08 | Apache-2.0 |