CVE-2021-29573: TensorFlow: div-by-zero in MaxPoolGrad op causes DoS
MEDIUMPoC AVAILABLEThis medium-severity vulnerability allows a local, low-privileged attacker to crash TensorFlow processes by passing a zero-batch tensor to MaxPoolGradWithArgmax — no remote vector, no data exfiltration. Primary risk is availability disruption in shared or multi-tenant ML training environments. Patch immediately to TF 2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4; the fix is available and straightforward.
What is the risk?
Risk is LOW to MEDIUM depending on deployment context. CVSS 5.5 (local) reflects limited exploitability: attacker needs local access and low privileges. In isolated single-tenant training environments the blast radius is minimal. Risk escalates in multi-tenant ML platforms (shared Jupyter, Kubeflow, SageMaker Studio) where untrusted users can submit training jobs — a malicious insider or compromised notebook could repeatedly crash shared training workers. Not in CISA KEV and no evidence of active exploitation as of disclosure date.
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| TensorFlow | pip | — | No patch |
Do you use TensorFlow? You're affected.
How severe is it?
What is the attack surface?
What should I do?
5 stepsPATCH
Upgrade to TensorFlow 2.5.0 or cherrypicked fixes: 2.4.2, 2.3.3, 2.2.3, 2.1.4. Commit 376c352a is the authoritative fix.
WORKAROUND
Add upstream batch dimension validation before any call to MaxPoolGradWithArgmax — assert or tf.debugging.assert_greater(tf.shape(tensor)[0], 0).
MULTI-TENANT PLATFORMS: Restrict user-submitted training jobs to sandboxed environments; treat TF process crashes as potential abuse signals.
DETECTION
Alert on abnormal TF process termination in training clusters; log SIGFPE/division-by-zero signals from ML worker processes.
INVENTORY
Run 'pip show tensorflow' across all ML nodes; flag any version below the patched releases.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2021-29573?
This medium-severity vulnerability allows a local, low-privileged attacker to crash TensorFlow processes by passing a zero-batch tensor to MaxPoolGradWithArgmax — no remote vector, no data exfiltration. Primary risk is availability disruption in shared or multi-tenant ML training environments. Patch immediately to TF 2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4; the fix is available and straightforward.
Is CVE-2021-29573 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2021-29573, increasing the risk of exploitation.
How to fix CVE-2021-29573?
1. PATCH: Upgrade to TensorFlow 2.5.0 or cherrypicked fixes: 2.4.2, 2.3.3, 2.2.3, 2.1.4. Commit 376c352a is the authoritative fix. 2. WORKAROUND: Add upstream batch dimension validation before any call to MaxPoolGradWithArgmax — assert or tf.debugging.assert_greater(tf.shape(tensor)[0], 0). 3. MULTI-TENANT PLATFORMS: Restrict user-submitted training jobs to sandboxed environments; treat TF process crashes as potential abuse signals. 4. DETECTION: Alert on abnormal TF process termination in training clusters; log SIGFPE/division-by-zero signals from ML worker processes. 5. INVENTORY: Run 'pip show tensorflow' across all ML nodes; flag any version below the patched releases.
What systems are affected by CVE-2021-29573?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving with gradient-based inference, multi-tenant ML platforms, MLOps CI/CD pipelines.
What is the CVSS score for CVE-2021-29573?
CVE-2021-29573 has a CVSS v3.1 base score of 5.5 (MEDIUM). The EPSS exploitation probability is 0.19%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001AI SoftwareAML.T0029Denial of AI ServiceAML.T0049Exploit Public-Facing ApplicationCompliance Controls Affected
What are the technical details?
Original Advisory
TensorFlow is an end-to-end open source platform for machine learning. The implementation of `tf.raw_ops.MaxPoolGradWithArgmax` is vulnerable to a division by 0. The implementation(https://github.com/tensorflow/tensorflow/blob/279bab6efa22752a2827621b7edb56a730233bd8/tensorflow/core/kernels/maxpooling_op.cc#L1033-L1034) fails to validate that the batch dimension of the tensor is non-zero, before dividing by this quantity. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.
Exploitation Scenario
An insider threat or attacker with access to a shared Kubeflow or MLflow training cluster submits a crafted training script that passes a tensor with batch_size=0 to a model containing a max-pooling layer with gradient computation (e.g., during a backward pass). TensorFlow attempts to divide by the batch dimension, triggers a division-by-zero (CWE-369), and the training worker process crashes. The attacker repeats this in a loop to create sustained denial of service against the shared training infrastructure, delaying production model deployments. In a CI/CD MLOps pipeline, this could block automated retraining jobs indefinitely.
Weaknesses (CWE)
CWE-369 — Divide By Zero: The product divides a value by zero.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:HReferences
Timeline
Related Vulnerabilities
CVE-2026-189489.9Feast: insecure UDF deserialization enables RCE
Same package: tensorflowCVE-2020-151969.9TensorFlow: heap OOB read in sparse/ragged count ops
Same package: tensorflowCVE-2020-152059.8TensorFlow: heap overflow in StringNGrams, ASLR bypass
Same package: tensorflowCVE-2019-167789.8TensorFlow: heap overflow in UnsortedSegmentSum op
Same package: tensorflowCVE-2020-152089.8TFLite: OOB read/write via tensor dimension mismatch
Same package: tensorflow