CVE-2022-36004: TensorFlow Denial of Service Vulnerability in tf.random.gamma

tensorflow Updated 18 Jul 2026

Summary

13/07/2026
Yes i
Moderate
5.9

CVE-2022-36004: TensorFlow vulnerable to CHECK fail in tf.random.gamma. Affects tensorflow across 3 version ranges.

< 2.7.2 >= 2.8.0, < 2.8.1 >= 2.9.0, < 2.9.1

Fixed in 2.7.2, 2.8.1 or 2.9.1, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2022-36004 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 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 machine learning library developed by Google, widely used for building and training machine learning models. It provides a flexible ecosystem for deploying machine learning applications across various platforms. However, TensorFlow is susceptible to certain vulnerabilities, including a critical issue in the tf.random.gamma function that can lead to denial of service under specific conditions.

Vulnerability Detail

The vulnerability arises when the tf.random.gamma function is called with large input shapes and rates, leading to a CHECK fail. This failure can be exploited to trigger a denial of service attack, causing the application to become unresponsive. The issue is particularly concerning for applications that rely on TensorFlow for generating random numbers in a production environment, as it can disrupt service availability and affect user experience.

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.7.2 2.7.2
    pip install --upgrade "tensorflow==2.7.2"
  • >= 2.8.0, < 2.8.1 2.8.1
    pip install --upgrade "tensorflow==2.8.1"
  • >= 2.9.0, < 2.9.1 2.9.1
    pip install --upgrade "tensorflow==2.9.1"

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, avoid using tf.random.gamma with large input shapes and rates until the package is updated. Here is an example of how to limit the input size:

import tensorflow as tf arg_0 = tf.random.uniform(shape=(2,), dtype=tf.int32, maxval=65536) arg_1 = tf.random.uniform(shape=(2, 2), dtype=tf.float64, maxval=None) arg_2 = tf.random.uniform(shape=(2, 2, 2), dtype=tf.float64, maxval=None) arg_3 = tf.float64 arg_4 = 48 arg_5 = 'None' tf.random.gamma(shape=arg_0, alpha=arg_1, beta=arg_2, dtype=arg_3, seed=arg_4, name=arg_5)

Conclusion

The CVE-2022-36004 vulnerability in TensorFlow's tf.random.gamma function poses a significant risk of denial of service. It is crucial to update to the latest patched version of TensorFlow to mitigate this risk. Additionally, using Vulert can help monitor your applications for vulnerabilities effectively.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

CVE-2022-36004 is a vulnerability in TensorFlow's tf.random.gamma function that can lead to a denial of service when large input shapes and rates are used.

Exploiting this vulnerability can cause your application to become unresponsive, affecting service availability and user experience.

TensorFlow versions prior to 2.10.0, including 2.9.0, 2.8.0, and 2.7.0, are affected by this vulnerability.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in real-time. Visit Vulert Scanner to check if your application is affected without any signup.

As a temporary measure, avoid using tf.random.gamma with large input shapes and rates until you can update to a patched version.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow.

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.7.2 2.7.2
    pip install --upgrade "tensorflow==2.7.2"
  • >= 2.8.0, < 2.8.1 2.8.1
    pip install --upgrade "tensorflow==2.8.1"
  • >= 2.9.0, < 2.9.1 2.9.1
    pip install --upgrade "tensorflow==2.9.1"

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