CVE-2021-29517: TensorFlow: Conv3D div-by-zero crashes ML processes
MEDIUM PoC AVAILABLEA malicious user with local access can crash any TensorFlow process using Conv3D by passing a crafted filter tensor with a zero fifth element. Patch immediately to TF 2.5.0 or the cherrypicked fixes for 2.1.x–2.4.x; if running untrusted tensor inputs through 3D CNN inference endpoints, add input validation as a defense-in-depth layer. No active exploitation reported and not in CISA KEV, but unpatched training or serving infrastructure accepting external input is directly at risk.
Risk Assessment
Medium severity (CVSS 5.5) with high availability impact locally. The low attack complexity and low privileges required make exploitation trivial for anyone with access to a TF-backed service or shared training environment. Blast radius is limited to process availability — no confidentiality or integrity impact. Organizations running TF inference APIs accessible to multiple internal users or tenants face the highest exposure; production model serving with strict input validation has lower practical risk.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| tensorflow | pip | — | No patch |
Do you use tensorflow? You're affected.
Severity & Risk
Attack Surface
Recommended Action
5 steps-
Patch: Upgrade to TensorFlow 2.5.0, or cherrypick commit 799f835 onto 2.4.2, 2.3.3, 2.2.3, or 2.1.4.
-
Validate inputs server-side before passing to Conv3D: assert filter.shape[4] > 0 and verify tensor shape compatibility before op execution.
-
Run inference workers as unprivileged, isolated processes (containers/VMs) so a crash doesn't cascade to the host.
-
Implement request rate limiting and input size/shape bounds on any public or internal TF Serving endpoints.
-
Detection: monitor for abrupt TF process exits (SIGABRT from Eigen assertion) or crash loops in serving pods — alert on repeated abnormal terminations.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2021-29517?
A malicious user with local access can crash any TensorFlow process using Conv3D by passing a crafted filter tensor with a zero fifth element. Patch immediately to TF 2.5.0 or the cherrypicked fixes for 2.1.x–2.4.x; if running untrusted tensor inputs through 3D CNN inference endpoints, add input validation as a defense-in-depth layer. No active exploitation reported and not in CISA KEV, but unpatched training or serving infrastructure accepting external input is directly at risk.
Is CVE-2021-29517 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2021-29517, increasing the risk of exploitation.
How to fix CVE-2021-29517?
1. Patch: Upgrade to TensorFlow 2.5.0, or cherrypick commit 799f835 onto 2.4.2, 2.3.3, 2.2.3, or 2.1.4. 2. Validate inputs server-side before passing to Conv3D: assert filter.shape[4] > 0 and verify tensor shape compatibility before op execution. 3. Run inference workers as unprivileged, isolated processes (containers/VMs) so a crash doesn't cascade to the host. 4. Implement request rate limiting and input size/shape bounds on any public or internal TF Serving endpoints. 5. Detection: monitor for abrupt TF process exits (SIGABRT from Eigen assertion) or crash loops in serving pods — alert on repeated abnormal terminations.
What systems are affected by CVE-2021-29517?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, inference, shared ML compute environments.
What is the CVSS score for CVE-2021-29517?
CVE-2021-29517 has a CVSS v3.1 base score of 5.5 (MEDIUM). The EPSS exploitation probability is 0.01%.
Technical Details
NVD Description
TensorFlow is an end-to-end open source platform for machine learning. A malicious user could trigger a division by 0 in `Conv3D` implementation. The implementation(https://github.com/tensorflow/tensorflow/blob/42033603003965bffac51ae171b51801565e002d/tensorflow/core/kernels/conv_ops_3d.cc#L143-L145) does a modulo operation based on user controlled input. Thus, when `filter` has a 0 as the fifth element, this results in a division by 0. Additionally, if the shape of the two tensors is not valid, an Eigen assertion can be triggered, resulting in a program crash. 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 adversary with access to an internal model serving API (e.g., TensorFlow Serving or a custom Flask/FastAPI wrapper) submits a Conv3D inference request with a filter tensor whose fifth dimension is 0. The Conv3D kernel at conv_ops_3d.cc performs a modulo on this user-controlled value, triggering an integer division by zero and crashing the worker process. In a Kubernetes deployment without proper pod restart backoff, the adversary repeats the request to keep the replica in a crash loop, effectively taking the inference endpoint offline. In a shared GPU cluster, the same technique kills a co-tenant's training job, causing data loss for that run.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H References
- github.com/tensorflow/tensorflow/commit/799f835a3dfa00a4d852defa29b15841eea9d64f Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-772p-x54p-hjrv Exploit Patch 3rd Party
Timeline
Related Vulnerabilities
CVE-2020-15196 9.9 TensorFlow: heap OOB read in sparse/ragged count ops
Same package: tensorflow CVE-2020-15205 9.8 TensorFlow: heap overflow in StringNGrams, ASLR bypass
Same package: tensorflow CVE-2020-15208 9.8 TFLite: OOB read/write via tensor dimension mismatch
Same package: tensorflow CVE-2019-16778 9.8 TensorFlow: heap overflow in UnsortedSegmentSum op
Same package: tensorflow CVE-2022-23587 9.8 TensorFlow: integer overflow in Grappler enables RCE
Same package: tensorflow
AI Threat Alert