CVE-2021-41206: TensorFlow Missing Validation of Tensor Shapes

tensorflow Updated 02 Oct 2025

Summary

05/11/2021
Yes i
High
7.0

CVE-2021-41206: TensorFlow is an open source platform for machine learning. Affects tensorflow across 9 version ranges.

< 2.4.4 >= 2.5.0, < 2.5.2 >= 2.6.0, < 2.6.1 < 4d74d8a00b07441cba090a02e0dd9ed385145bf4 < 4dddb2fd0b01cdd196101afbba6518658a2c9e07 < 68422b215e618df5ad375bcdc6d2052e9fd3080a < 579261dcd446385831fe4f7457d802a59685121d < da4aad5946be30e5f049920fa076e1f7ef021261 < e7f497570abb6b4ae5af4970620cd880e4c0c904

Fixed in 2.4.4, 2.5.2 or 2.6.1, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2021-41206 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 open source platform for machine learning. It provides a comprehensive ecosystem of tools, libraries, and resources for building and deploying machine learning models. TensorFlow is widely used in various domains, including research, industry, and academia. It supports both CPU and GPU computations, enabling efficient training and inference on large-scale datasets. However, in certain versions of TensorFlow, there is a vulnerability related to missing validation of tensor shapes in certain operations.

Vulnerability Detail

The vulnerability in TensorFlow arises from the absence of shape validation for tensor arguments in specific function calls. This lack of validation can lead to undefined behavior, crashes, and potential security issues. Depending on the API being used, the consequences of this vulnerability can vary. In some scenarios, it may result in segfaults or CHECK-fail related crashes. Additionally, it is possible for heap populated arrays to be read from or written to, potentially leading to memory corruption. The vulnerability was discovered internally during efforts to improve and test GPU op determinism. While there are no specific reproducers available, multiple fixes for these issues will be included in TensorFlow 2.7.0. The fixes will also be backported to TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these versions are also affected and within the supported range.

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.4.4 2.4.4
    pip install --upgrade "tensorflow==2.4.4"
  • >= 2.5.0, < 2.5.2 2.5.2
    pip install --upgrade "tensorflow==2.5.2"
  • >= 2.6.0, < 2.6.1 2.6.1
    pip install --upgrade "tensorflow==2.6.1"

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

Workaround

As there are no specific reproducers available for this vulnerability, there is no known workaround at this time. It is recommended to follow the steps mentioned in the 'how_to_fix' section and update to the latest fixed version of TensorFlow.

Conclusion

In conclusion, the vulnerability in TensorFlow related to missing validation of tensor shapes can lead to crashes, undefined behavior, and potential memory corruption. It is crucial to update to the fixed versions of TensorFlow (2.7.0, 2.6.1, 2.5.2, or 2.4.4) to mitigate these risks. Regularly updating TensorFlow and other dependencies is essential to ensure protection against known vulnerabilities. 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 that provides tools and resources for building and deploying machine learning models.

The vulnerability can result in crashes, undefined behavior, and potential memory corruption. It is important to update to the fixed versions of TensorFlow to mitigate these risks.

The vulnerability was discovered internally during efforts to improve and test GPU op determinism.

There are no known exploits for this vulnerability at this time. However, it is still important to update to the fixed versions to prevent potential security issues.

Yes, you can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities without requiring access to the code or installation.

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.4.4 2.4.4
    pip install --upgrade "tensorflow==2.4.4"
  • >= 2.5.0, < 2.5.2 2.5.2
    pip install --upgrade "tensorflow==2.5.2"
  • >= 2.6.0, < 2.6.1 2.6.1
    pip install --upgrade "tensorflow==2.6.1"

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