# CVE-2021-29523: TensorFlow CHECK-fail in AddManySparseToTensorsMap

Source: https://junglewise.ai/threats/cve-2021-29523-tensorflow-check-fail-in-addmanysparsetotensorsmap  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2021-05-14. Updated: 2026-09-26  
License: CC BY 4.0 with a link back

CVE-2021-29523 · Severity: low · CVSS 3.1 · Published 2021-05-14

TensorFlow's AddManySparseToTensorsMap operation processes sparse tensor data. An attacker can crash a TensorFlow application by providing specially crafted tensor dimension values that cause an integer overflow, triggering a denial-of-service condition without authentication required.

Technologies: [Google TensorFlow](https://junglewise.ai/threats/technologies/tensorflow), [tensorflow (PyPI)](https://junglewise.ai/threats/technologies/pypi-tensorflow), [tensorflow-cpu (PyPI)](https://junglewise.ai/threats/technologies/tensorflow-cpu), [tensorflow-gpu (PyPI)](https://junglewise.ai/threats/technologies/tensorflow-gpu). Vendors: [Google](https://junglewise.ai/threats/vendors/google), [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2021-29523 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2021-29523 being exploited in the wild.

**How severe is CVE-2021-29523?** Low severity, with a CVSS score of 3.1, published 14 May 2021.

**Which products and versions are affected?** Google TensorFlow 0.x, 1.x, 2.0.0–2.1.3, 2.2.0–2.2.2, 2.3.0–2.3.2, 2.4.0–2.4.1; tensorflow (PyPI) GIT:introduced=0,fixed=69c68ecbb24dff3fa0e46da0d16c821a2dd22d7c|ECOSYSTEM:introduced=0,fixed=2.1.4,introduced=2.2.0,fixed=2.2.3,introduced=2.3.0,fixed=2.3.3,introduced=2.4.0,fixed=2.4.2; tensorflow-cpu (PyPI) GIT:introduced=0,fixed=69c68ecbb24dff3fa0e46da0d16c821a2dd22d7c|ECOSYSTEM:introduced=0,fixed=2.1.4,introduced=2.2.0,fixed=2.2.3,introduced=2.3.0,fixed=2.3.3,introduced=2.4.0,fixed=2.4.2; tensorflow-gpu (PyPI) GIT:introduced=0,fixed=69c68ecbb24dff3fa0e46da0d16c821a2dd22d7c|ECOSYSTEM:introduced=0,fixed=2.1.4,introduced=2.2.0,fixed=2.2.3,introduced=2.3.0,fixed=2.3.3,introduced=2.4.0,fixed=2.4.2.

**Is there a fix for CVE-2021-29523?** Yes. tensorflow (PyPI): upgrade to 2.4.2 or later; tensorflow-cpu (PyPI): upgrade to 2.4.2 or later; tensorflow-gpu (PyPI): upgrade to 2.4.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2021-29523 attacked?** It is attacked with local access, in a software library.

**Am I affected by CVE-2021-29523?** Check whether you run Google TensorFlow, tensorflow (PyPI), tensorflow-cpu (PyPI) or one of the others listed at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- tensorflow (PyPI): upgrade to 2.4.2 or later

  ```sh
  pip install "tensorflow>=2.4.2"
  ```

- tensorflow-cpu (PyPI): upgrade to 2.4.2 or later

  ```sh
  pip install "tensorflow-cpu>=2.4.2"
  ```

- tensorflow-gpu (PyPI): upgrade to 2.4.2 or later

  ```sh
  pip install "tensorflow-gpu>=2.4.2"
  ```


## Technical details

The vulnerability is an integer overflow (CWE-190) in the AddManySparseToTensorsMap operation's TensorShape constructor. The vulnerable code uses a legacy TensorShape constructor that invokes a CHECK operation on the InitDims method without proper overflow validation. When an attacker provides dimension values in the sparse_shape parameter that cause multiplication overflow during tensor shape initialization, the CHECK fails and terminates the process. The vulnerability requires local access (or network access if the application exposes this operation) and no authentication. A fix using BuildTensorShapeBase or AddDimWithStatus to handle overflow gracefully was committed and included in TensorFlow 2.5.0, with backports to 2.4.2, 2.3.3, 2.2.3, and 2.1.4.

## Affected products

- Google TensorFlow 0.x, 1.x, 2.0.0–2.1.3, 2.2.0–2.2.2, 2.3.0–2.3.2, 2.4.0–2.4.1

## Identifiers

- CVE-2021-29523
- GHSA-2cpx-427x-q2c6
- PYSEC-2021-160
- PYSEC-2021-451
- PYSEC-2021-649

## Timeline

- 2021-05-13: disclosed
- 2021-05-21: patched: Fix included in TensorFlow 2.5.0 and backported to 2.4.2, 2.3.3, 2.2.3, 2.1.4

## References

- [https://github.com/tensorflow/tensorflow/security/advisories/GHSA-2cpx-427x-q2c6](https://github.com/tensorflow/tensorflow/security/advisories/GHSA-2cpx-427x-q2c6)

## Related threats

- [PYSEC-2026-3331 - TensorFlow has segfault in array_ops.upper_bound](https://junglewise.ai/threats/cve-2023-33976-tensorflow-has-segfault-in-array-ops-upper-bound)
- [PYSEC-2026-3182 - TensorFlow Denial of Service vulnerability](https://junglewise.ai/threats/cve-2023-25661-tensorflow-denial-of-service-vulnerability)
- [PYSEC-2026-3300 - TensorFlow vulnerable to Out-of-Bounds Read in DynamicStitch](https://junglewise.ai/threats/cve-2023-25659-tensorflow-vulnerable-to-out-of-bounds-read-in-dynamicstitch)
- [PYSEC-2026-3362 - TensorFlow vulnerable to seg fault in `tf.raw_ops.Print`](https://junglewise.ai/threats/cve-2023-25660-tensorflow-vulnerable-to-seg-fault-in-tf-raw-ops-print)
- [PYSEC-2026-3293 - TensorFlow vulnerable to integer overflow in EditDistance](https://junglewise.ai/threats/cve-2023-25662-tensorflow-vulnerable-to-integer-overflow-in-editdistance)
