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

MEDIUMPoC 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.

What is the risk?

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.

What systems are affected?

PackageEcosystemVulnerable RangePatched
TensorFlowpip—No patch
201.6KOpenSSF 7.73.4K dependentsPushed 3d ago4% patched~1372d to patchFull package profile →

Do you use TensorFlow? You're affected.

How severe is it?

CVSS 3.1
5.5 / 10
EPSS
0.2%
chance of exploitation in 30 days
Higher than 9% 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, VulnCheck KEV, CISA SSVC, EPSS, Metasploit, Exploit-DB, trickest/cve, Nuclei templates, and inthewild.io exploitation reports.

What is the attack surface?

AVACPRUISCIA
AVLocal
ACLow
PRLow
UINone
SUnchanged
CNone
INone
AHigh

What should I do?

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.

How is it classified?

Which compliance frameworks are affected?

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.19%.

What is the AI security impact?

Affected AI Architectures

training pipelinesmodel servingMLOps orchestration platforms

MITRE ATLAS Techniques

AML.T0010.001AI Software
AML.T0029Denial of AI Service
AML.T0049Exploit Public-Facing Application

Compliance Controls Affected

EU AI Act: Article 15
ISO 42001: A.6.2.6
NIST AI RMF: MANAGE 2.2
OWASP LLM Top 10: LLM04

What are the technical details?

Original Advisory

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)

CWE-617 — Reachable Assertion: The product contains an assert() or similar statement that can be triggered by an attacker, which leads to an application exit or other behavior that is more severe than necessary.

  • [Implementation] If the assertion statement is required (e.g., for security or reliability), change the invoking code to avoid the conditions that trigger the assertion.
  • [Implementation] Consider changing the assertion to some other less "fatal" error. This might not be easy to implement, since other code may be needed to handle the error.

Source: MITRE CWE corpus.

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