CVE-2021-29568: TensorFlow ParameterizedTruncatedNormal Null Pointer Dereference

tensorflow-cpu Updated 02 Oct 2025

Summary

14/05/2021
Yes i
Unrated
Not published

CVE-2021-29568: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-cpu 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 Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

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 industries and research domains for tasks such as image recognition, natural language processing, and recommendation systems. However, a vulnerability has been discovered in TensorFlow that can lead to undefined behavior when binding to a null pointer in the tf.raw_ops.ParameterizedTruncatedNormal function.

Vulnerability Detail

The vulnerability arises due to a lack of input argument validation in the implementation of tf.raw_ops.ParameterizedTruncatedNormal. Specifically, the vulnerability occurs when the shape argument is empty, resulting in shape_tensor.flat<T>() being an empty array. This leads to undefined behavior when the implementation attempts to access the first element of shape. An attacker can exploit this vulnerability to trigger unexpected behavior or potentially cause a denial-of-service condition. The vulnerability affects versions of TensorFlow up to 2.4.3.

How To Fix

Latest published version: 2.21.0 as of 22 Oct 2026

pip install --upgrade "tensorflow-cpu==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-cpu==2.2.0rc0"
  • >= 2.2.0, < 2.3.0rc0 2.3.0rc0
    pip install --upgrade "tensorflow-cpu==2.3.0rc0"
  • >= 2.3.0, < 2.3.4 2.3.4
    pip install --upgrade "tensorflow-cpu==2.3.4"
  • >= 2.4.0, < 2.4.3 2.4.3
    pip install --upgrade "tensorflow-cpu==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 temporary workaround, users can manually validate the shape argument before calling the tf.raw_ops.ParameterizedTruncatedNormal function. This can be done by checking if the shape array is empty and taking appropriate action, such as providing a default shape or raising an error. Here is an example of how to perform this validation in Python:

import tensorflow as tf

def parameterized_truncated_normal(shape, mean, stddev):
    if not shape:
        raise ValueError('Shape argument cannot be empty.')
    return tf.raw_ops.ParameterizedTruncatedNormal(shape=shape, mean=mean, stddev=stddev)

By implementing this workaround, users can prevent the null pointer dereference vulnerability.

Conclusion

The discovered vulnerability in TensorFlow's tf.raw_ops.ParameterizedTruncatedNormal function can lead to undefined behavior and potential security risks. Users are strongly advised to update their TensorFlow installations to the fixed versions mentioned above or apply the provided workaround. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tensorflow-cpu →

Share this vulnerability

FAQ

TensorFlow is an open source platform for machine learning that provides a comprehensive set of tools and resources for developing and deploying machine learning models.

This vulnerability can lead to undefined behavior and potentially allow attackers to trigger unexpected behavior or cause a denial-of-service condition in TensorFlow applications.

The vulnerability affects versions of TensorFlow up to 2.4.3.

To fix this vulnerability, users should update their TensorFlow installations to one of the fixed versions: TensorFlow 2.5.0, TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3, or TensorFlow 2.1.4.

Yes, users can manually validate the shape argument before calling the tf.raw_ops.ParameterizedTruncatedNormal function to mitigate the vulnerability. See the 'workaround' section for more details.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow-cpu.

How To Fix

Latest published version: 2.21.0 as of 22 Oct 2026

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