CVE-2021-29572: TensorFlow SdcaOptimizer Null Pointer Dereference

tensorflow-cpu Updated 02 Oct 2025

Summary

14/05/2021
Yes i
Unrated
Not published

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

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

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-29572 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 Your last release was probably never penetration tested 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. The SdcaOptimizer is a component in TensorFlow that implements the Stochastic Dual Coordinate Ascent (SDCA) optimization algorithm. This algorithm is used for solving linear classification and regression problems. The vulnerability in the SdcaOptimizer implementation allows for a null pointer dereference, leading to undefined behavior and potential crashes or other unexpected outcomes.

Vulnerability Detail

The vulnerability in TensorFlow's SdcaOptimizer arises from the lack of validation of user-supplied arguments. The implementation does not check if the arguments satisfy all the constraints expected by the operation. This oversight can result in a null pointer dereference, where a null pointer is accessed, leading to undefined behavior. An attacker could potentially exploit this vulnerability to cause a denial-of-service (DoS) condition or execute arbitrary code. The vulnerability affects versions of TensorFlow up to and including 2.4.2.

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.1.4 2.1.4
    pip install --upgrade "tensorflow-cpu==2.1.4"
  • >= 2.2.0, < 2.2.3 2.2.3
    pip install --upgrade "tensorflow-cpu==2.2.3"
  • >= 2.3.0, < 2.3.3 2.3.3
    pip install --upgrade "tensorflow-cpu==2.3.3"
  • >= 2.4.0, < 2.4.2 2.4.2
    pip install --upgrade "tensorflow-cpu==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 workaround, users can avoid using the SdcaOptimizer component in TensorFlow until the package is updated to a fixed version. Alternatively, users can implement their own validation checks on the user-supplied arguments before passing them to the SdcaOptimizer. Here is an example of how to perform the validation manually:

import tensorflow as tf

def validate_sdca_optimizer_args(args):
    # Perform validation checks on args
    if not args:
        raise ValueError('Invalid arguments for SdcaOptimizer')
    # Additional validation checks...

    return args

# Usage example
args = validate_sdca_optimizer_args(user_supplied_args)
optimizer = tf.raw_ops.SdcaOptimizer(args=args)

Note that this workaround is not a substitute for upgrading to a fixed version of TensorFlow.

Conclusion

The vulnerability in TensorFlow's SdcaOptimizer can lead to a null pointer dereference and undefined behavior. It is crucial for users to upgrade to a fixed version of TensorFlow (2.5.0 or later) to mitigate the risks associated with this vulnerability. In the meantime, users can implement manual validation checks on the user-supplied arguments or avoid using the SdcaOptimizer component. For further support and assistance in 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.

The SdcaOptimizer is a component in TensorFlow that implements the Stochastic Dual Coordinate Ascent (SDCA) optimization algorithm. It is used for solving linear classification and regression problems.

A null pointer dereference occurs when a null pointer is accessed, leading to undefined behavior. In the case of this vulnerability, it can result in crashes or other unexpected outcomes.

The vulnerability can be exploited by an attacker to cause a denial-of-service (DoS) condition or execute arbitrary code. It is important to upgrade to a fixed version of TensorFlow to mitigate these risks.

To fix this vulnerability, users should upgrade their TensorFlow installation to version 2.5.0 or later. Follow the official TensorFlow documentation for instructions on how to upgrade the package.

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.1.4 2.1.4
    pip install --upgrade "tensorflow-cpu==2.1.4"
  • >= 2.2.0, < 2.2.3 2.2.3
    pip install --upgrade "tensorflow-cpu==2.2.3"
  • >= 2.3.0, < 2.3.3 2.3.3
    pip install --upgrade "tensorflow-cpu==2.3.3"
  • >= 2.4.0, < 2.4.2 2.4.2
    pip install --upgrade "tensorflow-cpu==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