CVE-2021-29513: TensorFlow - Null Pointer Dereference Vulnerability

tensorflow Updated 02 Oct 2025

Summary

06/03/2024
Yes i
High
Not published

CVE-2021-29513: Type confusion during tensor casts lead to dereferencing null pointers. Affects tensorflow across 4 version ranges.

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

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-29513 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 Penetration testing for web, API and mobile 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 building and deploying machine learning models. TensorFlow allows users to perform various operations on tensors, which are multi-dimensional arrays. These operations are typically performed on numeric tensors. However, calling TensorFlow operations with tensors of non-numeric types can lead to null pointer dereferences.

Vulnerability Detail

The vulnerability in TensorFlow arises from a type confusion during the conversion from Python array to C++ array. This vulnerability can be exploited when TensorFlow operations that expect numeric tensors are called with non-numeric tensors. As a result, null pointer dereferences occur, leading to crashes or potentially allowing attackers to execute arbitrary code. The issue has been identified and fixed in TensorFlow 2.5.0. To mitigate the risk, it is recommended to update to the fixed versions of TensorFlow.

How To Fix

Fixed versions by release line

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

  • < 2.1.4 2.1.4
  • >= 2.2.0, < 2.2.3 2.2.3
  • >= 2.3.0, < 2.3.3 2.3.3
  • >= 2.4.0, < 2.4.2 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. The recommended approach is to update TensorFlow to the fixed versions mentioned above.

Conclusion

The vulnerability in TensorFlow (CVE-2021-29513) exposes users to null pointer dereferences when non-numeric tensors are used in TensorFlow operations. To address this issue, it is crucial to update TensorFlow to the fixed versions (2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4). For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

TensorFlow is an open source platform for machine learning that provides tools and resources for building and deploying machine learning models.

A null pointer dereference occurs when a program attempts to access or manipulate memory using a null pointer, resulting in a crash or potentially allowing attackers to execute arbitrary code.

The vulnerability in TensorFlow arises from a type confusion during the conversion from Python array to C++ array, which can be exploited when non-numeric tensors are passed to TensorFlow operations that expect numeric tensors.

The vulnerability can lead to null pointer dereferences, resulting in crashes or potentially allowing attackers to execute arbitrary code.

To mitigate the risk, it is recommended to update TensorFlow to the fixed versions (2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4) that address the type confusion vulnerability.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow.

How To Fix

Fixed versions by release line

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

  • < 2.1.4 2.1.4
  • >= 2.2.0, < 2.2.3 2.2.3
  • >= 2.3.0, < 2.3.3 2.3.3
  • >= 2.4.0, < 2.4.2 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