CVE-2021-29561: TensorFlow: DoS via malformed LoadAndRemapMatrix input
MEDIUM PoC AVAILABLEA local attacker with low privileges can crash any TensorFlow process by passing a non-scalar tensor to tf.raw_ops.LoadAndRemapMatrix, triggering an unguarded assertion. Patch to TF 2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4. Primary risk is in shared ML compute environments—Jupyter hubs, multi-tenant GPU clusters—where untrusted users can submit workloads.
Risk Assessment
Medium risk in isolation, elevated in shared-compute contexts. CVSS 5.5 reflects local-only exploitability, but in practice many ML training environments expose TensorFlow ops to semi-trusted users (data scientists, contractors) who could intentionally or accidentally trigger this. No remote vector exists; the blast radius is process termination, not data exfiltration or code execution. Not actively exploited in the wild and not in CISA KEV.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| tensorflow | pip | — | No patch |
Do you use tensorflow? You're affected.
Severity & Risk
Attack Surface
Recommended Action
4 steps-
Patch: Upgrade to TensorFlow 2.5.0, or backported fixes in 2.4.2 / 2.3.3 / 2.2.3 / 2.1.4.
-
Workaround: Validate that ckpt_path is a scalar string tensor before passing to LoadAndRemapMatrix; add tf.debugging.assert_scalar() guards in code that calls this op.
-
Detection: Monitor for unexpected TensorFlow process crashes (exit code from CHECK failure) in training/serving logs; alert on repeated restarts of ML workload pods.
-
Access control: Restrict who can submit arbitrary TF graph operations on shared infrastructure—namespace isolation in Kubernetes, user quotas on ML platforms.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2021-29561?
A local attacker with low privileges can crash any TensorFlow process by passing a non-scalar tensor to tf.raw_ops.LoadAndRemapMatrix, triggering an unguarded assertion. Patch to TF 2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4. Primary risk is in shared ML compute environments—Jupyter hubs, multi-tenant GPU clusters—where untrusted users can submit workloads.
Is CVE-2021-29561 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2021-29561, increasing the risk of exploitation.
How to fix CVE-2021-29561?
1. Patch: Upgrade to TensorFlow 2.5.0, or backported fixes in 2.4.2 / 2.3.3 / 2.2.3 / 2.1.4. 2. Workaround: Validate that ckpt_path is a scalar string tensor before passing to LoadAndRemapMatrix; add tf.debugging.assert_scalar() guards in code that calls this op. 3. Detection: Monitor for unexpected TensorFlow process crashes (exit code from CHECK failure) in training/serving logs; alert on repeated restarts of ML workload pods. 4. Access control: Restrict who can submit arbitrary TF graph operations on shared infrastructure—namespace isolation in Kubernetes, user quotas on ML platforms.
What systems are affected by CVE-2021-29561?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, MLOps orchestration platforms.
What is the CVSS score for CVE-2021-29561?
CVE-2021-29561 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. An attacker can cause a denial of service by exploiting a `CHECK`-failure coming from `tf.raw_ops.LoadAndRemapMatrix`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/d94227d43aa125ad8b54115c03cece54f6a1977b/tensorflow/core/kernels/ragged_tensor_to_tensor_op.cc#L219-L222) assumes that the `ckpt_path` is always a valid scalar. However, an attacker can send any other tensor as the first argument of `LoadAndRemapMatrix`. This would cause the rank `CHECK` in `scalar<T>()()` to trigger and terminate the process. 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 low-privilege access to a shared ML compute platform (e.g., a data analyst account on a Jupyter Hub or a compromised CI/CD pipeline) submits a training job containing a call to tf.raw_ops.LoadAndRemapMatrix with a non-scalar tensor as the first argument. The CHECK assertion fires immediately, terminating the TensorFlow process. In a distributed training scenario, this kills the chief worker, forcing the entire job to restart—potentially wiping hours of compute and triggering costly re-runs. In a model-serving context where checkpoint hot-reloading is enabled, repeated triggering can keep the inference service in a restart loop, effectively achieving sustained denial of service.
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/77dd114513d7796e1e2b8aece214a380af26fbf4 Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-gvm4-h8j3-rjrq 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