CVE-2021-41196: TensorFlow GPU - Keras Pooling Layers Segfault

tensorflow-gpu Updated 02 Oct 2025

Summary

05/11/2021
Yes i
Unrated
Not published

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

< 2.4.4 >= 2.5.0, < 2.5.2 >= 2.6.0, < 2.6.1 >= 2.7.0rc0, < 2.7.0 < 12b1ff82b3f26ff8de17e58703231d5a02ef1b8b

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-41196 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

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

TensorFlow is an open source platform for machine learning. It provides a comprehensive ecosystem of tools, libraries, and resources for developing and deploying machine learning models. TensorFlow GPU is a variant of TensorFlow that leverages the power of GPUs for accelerated computation. It allows users to train and run machine learning models on GPU hardware, resulting in faster performance and improved efficiency. However, TensorFlow GPU is susceptible to a vulnerability in the Keras pooling layers.

Vulnerability Detail

The vulnerability in TensorFlow GPU arises from the implementation of pooling operations in the Keras pooling layers. When the size of the pool is set to 0 or when a dimension is negative, it can trigger a segmentation fault (segfault). This occurs because TensorFlow does not check the values in the sliding window to ensure they are strictly positive. As a result, an attacker could potentially exploit this vulnerability to cause a denial of service (DoS) or execute arbitrary code on a system running TensorFlow GPU. The impact of this vulnerability can range from crashing the application to potentially gaining unauthorized access to sensitive information.

How To Fix

Latest published version: 2.12.0 as of 22 Oct 2026

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

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 avoid setting the pool size to 0 or using negative dimensions in the Keras pooling layers. By ensuring that the pool size is greater than 0 and all dimensions are positive, the vulnerability can be mitigated. Here is an example of how to define a valid pooling layer in TensorFlow GPU:

from tensorflow.keras.layers import MaxPooling2D

pooling_layer = MaxPooling2D(pool_size=(2, 2))

By specifying a pool size greater than 0 and positive dimensions, the vulnerability will not be triggered.

Conclusion

The vulnerability in TensorFlow GPU's Keras pooling layers can lead to a segfault when the pool size is 0 or a dimension is negative. This can potentially result in a denial of service or arbitrary code execution. Users are advised to update their TensorFlow GPU installations to the latest patched versions to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tensorflow-gpu →

Share this vulnerability

FAQ

TensorFlow GPU is a variant of TensorFlow that utilizes GPU hardware for accelerated machine learning computations. It provides faster performance and improved efficiency compared to running TensorFlow on CPU.

Keras pooling layers are a set of layers in TensorFlow that perform downsampling operations on input data. They are commonly used in convolutional neural networks (CNNs) to reduce the spatial dimensions of feature maps.

The vulnerability arises from the lack of strict positivity checks in the TensorFlow implementation of pooling operations. When the pool size is set to 0 or a dimension is negative, it can trigger a segfault.

The consequences of this vulnerability can range from crashing the application to potentially enabling an attacker to execute arbitrary code on a system running TensorFlow GPU. It could also lead to a denial of service (DoS) situation.

To mitigate the risk of exploitation, it is recommended to update TensorFlow GPU to one of the patched versions: TensorFlow 2.7.0, TensorFlow 2.6.1, TensorFlow 2.5.2, or TensorFlow 2.4.4. These versions include a fix for the vulnerability.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow-gpu.

How To Fix

Latest published version: 2.12.0 as of 22 Oct 2026

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

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