CVE-2022-36004: TensorFlow: DoS via tf.random.gamma CHECK assertion

HIGH PoC AVAILABLE
Published September 16, 2022
CISO Take

Any TensorFlow deployment invoking tf.random.gamma with externally-controlled input is remotely crashable — no credentials required, no workaround exists. Patch is mandatory: upgrade to TF 2.10.0, 2.9.1, 2.8.1, or 2.7.2. Prioritize internet-facing inference services and training APIs that accept user-defined tensor shapes.

What is the risk?

High exploitability: network-reachable, zero privileges, low complexity — an attacker just needs to send oversized shape or rate values. Blast radius is availability-only (C:N/I:N/A:H); no data exfiltration or code execution path. Elevated risk for organizations exposing TensorFlow inference endpoints to untrusted input. Not in CISA KEV and no confirmed active exploitation reduces urgency slightly, but the trivial trigger mechanism means any unpatched public endpoint is permanently exposed.

What systems are affected?

Package Ecosystem Vulnerable Range Patched
TensorFlow pip No patch
195.8K OpenSSF 7.1 3.7K dependents Pushed 3d ago 4% patched ~1372d to patch Full package profile →

Do you use TensorFlow? You're affected.

How severe is it?

CVSS 3.1
7.5 / 10
EPSS
0.4%
chance of exploitation in 30 days
Higher than 30% of all CVEs
Exploitation Status
Exploit Available
Exploitation: MEDIUM
Sophistication
Trivial
Exploitation Confidence
medium
Public PoC indexed (trickest/cve)
Composite signal derived from CISA KEV, VulnCheck KEV, CISA SSVC, EPSS, Metasploit, Exploit-DB, trickest/cve, Nuclei templates, and inthewild.io exploitation reports.

What is the attack surface?

AV AC PR UI S C I A
AV Network
AC Low
PR None
UI None
S Unchanged
C None
I None
A High

What should I do?

5 steps
  1. Patch: Upgrade to TensorFlow 2.10.0, 2.9.1, 2.8.1, or 2.7.2 (fix cherry-picked to all supported branches via commit 552bfced).

  2. Input validation: Enforce hard upper bounds on shape dimensions and rate parameter values at API boundaries before they reach tf.random.gamma.

  3. Rate limiting: Apply per-client request rate limits on inference endpoints to reduce sustained DoS impact.

  4. Detection: Alert on repeated TensorFlow process crashes or container restarts — a pattern of CHECK failures in logs is a direct indicator of exploitation attempts.

  5. Isolation: Run inference workers in isolated containers with auto-restart policies to minimize service downtime if triggered.

How is it classified?

Which compliance frameworks are affected?

This CVE is relevant to:

EU AI Act
Article 15 - Accuracy, Robustness and Cybersecurity
ISO 42001
A.6.2.3 - AI System Operation
NIST AI RMF
MANAGE 2.2 - Risk Response and Remediation
OWASP LLM Top 10
LLM04 - Model Denial of Service

Frequently Asked Questions

What is CVE-2022-36004?

Any TensorFlow deployment invoking tf.random.gamma with externally-controlled input is remotely crashable — no credentials required, no workaround exists. Patch is mandatory: upgrade to TF 2.10.0, 2.9.1, 2.8.1, or 2.7.2. Prioritize internet-facing inference services and training APIs that accept user-defined tensor shapes.

Is CVE-2022-36004 actively exploited?

Proof-of-concept exploit code is publicly available for CVE-2022-36004, increasing the risk of exploitation.

How to fix CVE-2022-36004?

1. Patch: Upgrade to TensorFlow 2.10.0, 2.9.1, 2.8.1, or 2.7.2 (fix cherry-picked to all supported branches via commit 552bfced). 2. Input validation: Enforce hard upper bounds on shape dimensions and rate parameter values at API boundaries before they reach tf.random.gamma. 3. Rate limiting: Apply per-client request rate limits on inference endpoints to reduce sustained DoS impact. 4. Detection: Alert on repeated TensorFlow process crashes or container restarts — a pattern of CHECK failures in logs is a direct indicator of exploitation attempts. 5. Isolation: Run inference workers in isolated containers with auto-restart policies to minimize service downtime if triggered.

What systems are affected by CVE-2022-36004?

This vulnerability affects the following AI/ML architecture patterns: model serving, training pipelines, inference APIs.

What is the CVSS score for CVE-2022-36004?

CVE-2022-36004 has a CVSS v3.1 base score of 7.5 (HIGH). The EPSS exploitation probability is 0.39%.

What is the AI security impact?

Affected AI Architectures

model servingtraining pipelinesinference APIs

MITRE ATLAS Techniques

AML.T0029 Denial of AI Service
AML.T0043 Craft Adversarial Data
AML.T0049 Exploit Public-Facing Application

Compliance Controls Affected

EU AI Act: Article 15
ISO 42001: A.6.2.3
NIST AI RMF: MANAGE 2.2
OWASP LLM Top 10: LLM04

What are the technical details?

Original Advisory

TensorFlow is an open source platform for machine learning. When `tf.random.gamma` receives large input shape and rates, it gives a `CHECK` fail that can trigger a denial of service attack. We have patched the issue in GitHub commit 552bfced6ce4809db5f3ca305f60ff80dd40c5a3. The fix will be included in TensorFlow 2.10.0. We will also cherrypick this commit on TensorFlow 2.9.1, TensorFlow 2.8.1, and TensorFlow 2.7.2, as these are also affected and still in supported range. There are no known workarounds for this issue.

Exploitation Scenario

An adversary identifies a public ML inference API backed by TensorFlow — for example, a Bayesian recommendation engine or VAE-based anomaly detection service. By sending POST requests with crafted tensors containing extremely large shape values or rate parameters that are passed internally to tf.random.gamma, the adversary triggers a CHECK assertion failure, crashing the TensorFlow serving process. With no workaround available, repeated requests sustain a persistent DoS. The attacker needs no authentication, no ML expertise, and no prior reconnaissance beyond identifying the endpoint — a single malformed request is sufficient to crash the worker.

Weaknesses (CWE)

CWE-617 — Reachable Assertion: The product contains an assert() or similar statement that can be triggered by an attacker, which leads to an application exit or other behavior that is more severe than necessary.

  • [Implementation] Make sensitive open/close operation non reachable by directly user-controlled data (e.g. open/close resources)
  • [Implementation] Perform input validation on user data.

Source: MITRE CWE corpus.

CVSS Vector

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Timeline

Published
September 16, 2022
Last Modified
November 21, 2024
First Seen
September 16, 2022

Related Vulnerabilities