CVE-2021-29568: TensorFlow - Null Pointer Dereference in tf.raw_ops.ParameterizedTruncatedNormal

tensorflow Updated 02 Oct 2025

Summary

06/03/2024
Yes i
High
Not published

CVE-2021-29568: Reference binding to null in ParameterizedTruncatedNormal. 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-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 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 developing and deploying machine learning models. TensorFlow is widely used in various domains, including research, industry, and academia. It offers a range of functionalities for building and training neural networks, as well as tools for data preprocessing, visualization, and evaluation. However, a vulnerability has been discovered in TensorFlow that can lead to undefined behavior and potential security risks.

Vulnerability Detail

The vulnerability, identified as CVE-2021-29568, resides in the tf.raw_ops.ParameterizedTruncatedNormal function of TensorFlow. This function is responsible for generating random numbers from a parameterized truncated normal distribution. The vulnerability arises from a lack of input validation in the implementation of this function. Specifically, the code does not check the validity of the shape argument before accessing its first element. If the shape argument is empty, the code attempts to access an empty array, resulting in a null pointer dereference. An attacker can exploit this vulnerability by providing a crafted input that triggers the null pointer dereference, potentially leading to a denial of service (DoS) or arbitrary code execution.

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

As a temporary workaround, users can manually validate the shape argument before calling the tf.raw_ops.ParameterizedTruncatedNormal function. By ensuring that the shape argument is not empty, the null pointer dereference can be avoided. Here is an example of how to perform this validation in Python:

import tensorflow as tf

def safe_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)

Conclusion

The vulnerability in TensorFlow's tf.raw_ops.ParameterizedTruncatedNormal function can result in undefined behavior and potential security risks. It is crucial for users to update their TensorFlow installations to the latest patched version as soon as it becomes available. Regularly checking for updates and promptly applying them is essential to ensure the security and stability of TensorFlow deployments. 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 set of tools and resources for developing and deploying machine learning models. It is widely used in various domains, including research, industry, and academia.

This vulnerability can lead to undefined behavior and potential security risks. An attacker can exploit the null pointer dereference to cause a denial of service (DoS) or execute arbitrary code.

The vulnerability affects TensorFlow versions 0 and above. Specifically, versions 2.1.4, 2.2.3, 2.3.3, and 2.4.2 are confirmed to be vulnerable.

Yes, the TensorFlow development team has addressed this vulnerability in the upcoming release of TensorFlow 2.5.0. They have also backported the fix to earlier versions, including TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3, and TensorFlow 2.1.4.

To fix this vulnerability, it is recommended to update your TensorFlow installation to the latest patched version as soon as it becomes available. Follow the official TensorFlow documentation for updating the package.

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