CVE-2021-29561: TensorFlow: DoS via malformed LoadAndRemapMatrix input

MEDIUM PoC AVAILABLE
Published May 14, 2021
CISO Take

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.

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
195.0K OpenSSF 7.2 3.7K dependents Pushed today 4% patched ~1372d to patch Full package profile →

Do you use tensorflow? You're affected.

Severity & Risk

CVSS 3.1
5.5 / 10
EPSS
0.0%
chance of exploitation in 30 days
Higher than 1% 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, CISA SSVC, EPSS, trickest/cve, and Nuclei templates.

Attack Surface

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

Recommended Action

4 steps
  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.

Classification

Compliance Impact

This CVE is relevant to:

EU AI Act
Article 15 - Accuracy, robustness and cybersecurity
ISO 42001
A.6.2.6 - AI system availability and resilience
NIST AI RMF
MANAGE 2.2 - Mechanisms are in place to start, stop, and monitor AI system operation
OWASP LLM Top 10
LLM04 - Model Denial of Service

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

Timeline

Published
May 14, 2021
Last Modified
November 21, 2024
First Seen
May 14, 2021

Related Vulnerabilities