CVE-2021-29568: TensorFlow - ParameterizedTruncatedNormal Null Pointer Dereference

tensorflow Updated 02 Oct 2025

Summary

14/05/2021
Yes i
Low
2.5

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

>= 2.2.0, < 2.3.0rc0 < 2.2.0rc0 >= 2.3.0, < 2.3.4 >= 2.4.0, < 2.4.3 < 5e52ef5a461570cfb68f3bdbbebfe972cb4e0fd8

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-29568 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 Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

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. It offers support for both CPU and GPU computations, making it suitable for a wide range of applications. However, a vulnerability has been discovered in TensorFlow that can lead to undefined behavior and potential security risks.

Vulnerability Detail

The vulnerability (CVE-2021-29568) exists in the tf.raw_ops.ParameterizedTruncatedNormal function of TensorFlow. An attacker can trigger undefined behavior by binding to a null pointer. The issue arises due to the lack of input argument validation in the implementation of the function. Specifically, the shape argument is not checked for emptiness before accessing its first element. If the shape argument is empty, the shape_tensor.flat<T>() array will also be empty, leading to undefined behavior. This vulnerability can be exploited by an attacker to cause a denial-of-service (DoS) condition or potentially execute arbitrary code.

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.2.0rc0 2.2.0rc0
    pip install --upgrade "tensorflow==2.2.0rc0"
  • >= 2.2.0, < 2.3.0rc0 2.3.0rc0
    pip install --upgrade "tensorflow==2.3.0rc0"
  • >= 2.3.0, < 2.3.4 2.3.4
    pip install --upgrade "tensorflow==2.3.4"
  • >= 2.4.0, < 2.4.3 2.4.3
    pip install --upgrade "tensorflow==2.4.3"

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

Workaround

As a workaround, you can manually validate the shape argument before calling the tf.raw_ops.ParameterizedTruncatedNormal function. Ensure that the shape argument is not empty before passing it to the function. Here is an example of how to perform the validation in Python:

import tensorflow as tf

def parameterized_truncated_normal(shape, dtype=tf.float32, seed=None):
    if not shape:
        raise ValueError('Shape argument cannot be empty.')
    return tf.raw_ops.ParameterizedTruncatedNormal(shape=shape, dtype=dtype, seed=seed)

Conclusion

The vulnerability (CVE-2021-29568) in TensorFlow's tf.raw_ops.ParameterizedTruncatedNormal function can lead to undefined behavior and potential security risks. It is crucial to upgrade to TensorFlow 2.5.0 or apply the backported fixes to ensure the security and stability of your machine learning applications. For further support and assistance in 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 a comprehensive ecosystem of tools, libraries, and resources.

This vulnerability can lead to undefined behavior, potentially causing a denial-of-service (DoS) condition or arbitrary code execution.

The vulnerability affects TensorFlow versions 2.1.4 and later, including 2.5.0. Versions 2.2.0 to 2.4.3 are also affected.

Yes, the vulnerability has been fixed in TensorFlow 2.5.0. Backported fixes are also available for versions 2.4.2, 2.3.3, 2.2.3, and 2.1.4.

To protect your application, it is recommended to upgrade to the fixed version of TensorFlow or apply the backported fixes if you are using an older version.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

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.2.0rc0 2.2.0rc0
    pip install --upgrade "tensorflow==2.2.0rc0"
  • >= 2.2.0, < 2.3.0rc0 2.3.0rc0
    pip install --upgrade "tensorflow==2.3.0rc0"
  • >= 2.3.0, < 2.3.4 2.3.4
    pip install --upgrade "tensorflow==2.3.4"
  • >= 2.4.0, < 2.4.3 2.4.3
    pip install --upgrade "tensorflow==2.4.3"

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