CVE-2021-29519: TensorFlow - Type Confusion in SparseCross API

tensorflow Updated 02 Oct 2025

Summary

14/05/2021
Yes i
Low
2.5

CVE-2021-29519: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow across 5 version ranges.

< 2.1.4 >= 2.2.0, < 2.2.3 >= 2.3.0, < 2.3.3 >= 2.4.0, < 2.4.2 < b1cc5e5a50e7cee09f2c6eb48eb40ee9c4125025

Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓

Also tracked for

The same CVE-2021-29519 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

TensorFlow is an end-to-end open source platform for machine learning. It provides a comprehensive ecosystem of tools, libraries, and resources for developing and deploying machine learning models. TensorFlow is widely used in various domains, including research, industry, and academia. The tf.raw_ops.SparseCross API in TensorFlow allows for sparse cross operations, which are commonly used in machine learning tasks such as recommendation systems. However, a vulnerability has been discovered in this API that can lead to a denial of service (DoS) attack.

Vulnerability Detail

The vulnerability (CVE-2021-29519) in TensorFlow's tf.raw_ops.SparseCross API arises from a type confusion issue. The implementation of the API can be tricked into considering a tensor of type tstring as containing integral elements. This can result in a CHECK failure and a subsequent denial of service. An attacker could exploit this vulnerability by providing malicious input to the API, causing the TensorFlow application to crash or become unresponsive. The impact of this vulnerability can range from disruption of service to potential data loss or corruption.

How To Fix

Latest published version: 2.21.0 as of 22 Oct 2026

pip install --upgrade "tensorflow==2.21.0"

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 2.1.4 2.1.4
    pip install --upgrade "tensorflow==2.1.4"
  • >= 2.2.0, < 2.2.3 2.2.3
    pip install --upgrade "tensorflow==2.2.3"
  • >= 2.3.0, < 2.3.3 2.3.3
    pip install --upgrade "tensorflow==2.3.3"
  • >= 2.4.0, < 2.4.2 2.4.2
    pip install --upgrade "tensorflow==2.4.2"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

There is no specific workaround provided for this vulnerability. However, as a general best practice, it is recommended to ensure that input data passed to the tf.raw_ops.SparseCross API is properly validated and sanitized. This can help mitigate the risk of exploitation. Additionally, keeping TensorFlow up to date with the latest security patches is crucial to minimize the exposure to known vulnerabilities.

Conclusion

The type confusion vulnerability in TensorFlow's tf.raw_ops.SparseCross API (CVE-2021-29519) can result in a denial of service attack and potential data loss or corruption. It is crucial to update to the latest patched version of TensorFlow and follow best practices for input validation to mitigate this vulnerability. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

TensorFlow is an open source platform for machine learning, widely used for developing and deploying machine learning models.

tf.raw_ops.SparseCross is an API in TensorFlow that allows for sparse cross operations, commonly used in machine learning tasks such as recommendation systems.

A type confusion vulnerability occurs when a program mistakenly interprets data of one type as another type, leading to unexpected behavior or security issues.

The vulnerability can result in a denial of service (DoS) attack, causing the TensorFlow application to crash or become unresponsive. This can lead to disruption of service, potential data loss, or data corruption.

To mitigate this vulnerability, it is recommended to update to the latest patched version of TensorFlow (2.5.0 or later). Additionally, ensure that input data passed to the tf.raw_ops.SparseCross API is properly validated and sanitized.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow.

How To Fix

Latest published version: 2.21.0 as of 22 Oct 2026

pip install --upgrade "tensorflow==2.21.0"

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 2.1.4 2.1.4
    pip install --upgrade "tensorflow==2.1.4"
  • >= 2.2.0, < 2.2.3 2.2.3
    pip install --upgrade "tensorflow==2.2.3"
  • >= 2.3.0, < 2.3.3 2.3.3
    pip install --upgrade "tensorflow==2.3.3"
  • >= 2.4.0, < 2.4.2 2.4.2
    pip install --upgrade "tensorflow==2.4.2"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback