CVE-2022-21725: TensorFlow: DoS via div-by-zero in conv cost estimator

MEDIUM PoC AVAILABLE CISA: TRACK*
Published February 3, 2022
CISO Take

A low-privileged remote attacker can crash TensorFlow processes by submitting a convolution operation with stride=0, triggering a division by zero in the Grappler cost estimator. Patch immediately to TensorFlow 2.8.0, 2.7.1, 2.6.3, or 2.5.3. Risk is elevated in any deployment where untrusted users can submit computation graphs or model definitions.

Risk Assessment

Medium risk overall, but context-dependent. CVSS 6.5 reflects network reachability with low privilege requirements and no user interaction needed, with full availability impact. In isolated training environments with no external access, practical risk is low. In model serving APIs or platforms that accept user-defined ops or graph definitions, this becomes a meaningful availability threat. No confidentiality or integrity impact, and no evidence of in-the-wild exploitation.

Affected Systems

Package Ecosystem Vulnerable Range Patched
tensorflow pip No patch
195.0K OpenSSF 7.2 3.7K dependents Pushed 6d ago 4% patched ~1372d to patch Full package profile →

Do you use tensorflow? You're affected.

Severity & Risk

CVSS 3.1
6.5 / 10
EPSS
0.2%
chance of exploitation in 30 days
Higher than 44% of all CVEs
Exploitation Status
Exploit Available
Exploitation: MEDIUM
Sophistication
Trivial
Exploitation Confidence
medium
CISA SSVC: Public PoC
Public PoC indexed (trickest/cve)
Composite signal derived from CISA KEV, CISA SSVC, EPSS, trickest/cve, and Nuclei templates.

Attack Surface

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

Recommended Action

5 steps
  1. Upgrade to TensorFlow 2.8.0, 2.7.1, 2.6.3, or 2.5.3 which include the fix (commit 3218043d6d3a).

  2. If immediate patching is not possible, enforce input validation to reject stride values ≤ 0 at the API boundary before passing to TensorFlow ops.

  3. Restrict access to model definition or graph submission endpoints to authenticated, trusted users only.

  4. Monitor TensorFlow process crashes and restarts as a detection signal.

  5. Run TF serving processes under process supervisors with automatic restart and alerting to limit availability impact.

CISA SSVC Assessment

Decision Track*
Exploitation poc
Automatable No
Technical Impact partial

Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.

Classification

Compliance Impact

This CVE is relevant to:

EU AI Act
Article 15 - Accuracy, robustness and cybersecurity
ISO 42001
6.1.2 - AI risk assessment 8.4 - AI system operation and monitoring
NIST AI RMF
GOVERN 6.2 - Policies for AI risk and impact MANAGE 2.2 - Residual risks and treatment
OWASP LLM Top 10
LLM04 - Model Denial of Service

Frequently Asked Questions

What is CVE-2022-21725?

A low-privileged remote attacker can crash TensorFlow processes by submitting a convolution operation with stride=0, triggering a division by zero in the Grappler cost estimator. Patch immediately to TensorFlow 2.8.0, 2.7.1, 2.6.3, or 2.5.3. Risk is elevated in any deployment where untrusted users can submit computation graphs or model definitions.

Is CVE-2022-21725 actively exploited?

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

How to fix CVE-2022-21725?

1. Upgrade to TensorFlow 2.8.0, 2.7.1, 2.6.3, or 2.5.3 which include the fix (commit 3218043d6d3a). 2. If immediate patching is not possible, enforce input validation to reject stride values ≤ 0 at the API boundary before passing to TensorFlow ops. 3. Restrict access to model definition or graph submission endpoints to authenticated, trusted users only. 4. Monitor TensorFlow process crashes and restarts as a detection signal. 5. Run TF serving processes under process supervisors with automatic restart and alerting to limit availability impact.

What systems are affected by CVE-2022-21725?

This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, inference, ML platforms (multi-tenant), AutoML / NAS pipelines.

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

CVE-2022-21725 has a CVSS v3.1 base score of 6.5 (MEDIUM). The EPSS exploitation probability is 0.22%.

Technical Details

NVD Description

Tensorflow is an Open Source Machine Learning Framework. The estimator for the cost of some convolution operations can be made to execute a division by 0. The function fails to check that the stride argument is strictly positive. Hence, the fix is to add a check for the stride argument to ensure it is valid. The fix will be included in TensorFlow 2.8.0. We will also cherrypick this commit on TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, as these are also affected and still in supported range.

Exploitation Scenario

An adversary with API access to a TensorFlow-backed model serving endpoint or MLaaS platform that accepts custom model architectures submits a convolutional neural network definition with a stride parameter set to 0. When TensorFlow's Grappler optimizer evaluates the computational cost of this operation during graph compilation, it executes the unguarded division, crashes the process, and causes a denial of service. In a multi-tenant ML platform, a single malicious user can disrupt service for all other tenants. The exploit requires only basic TensorFlow API knowledge and is trivially reproducible from the public GitHub proof-of-concept.

CVSS Vector

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

Timeline

Published
February 3, 2022
Last Modified
May 5, 2025
First Seen
February 3, 2022

Related Vulnerabilities