CVE-2021-41195: TensorFlow: integer overflow in segment ops causes DoS

MEDIUM PoC AVAILABLE
Published November 5, 2021
CISO Take

A local attacker with low privileges can crash TensorFlow processes by passing oversized segment IDs to tf.math.segment_* operations, triggering an integer overflow and process abort. Impact is limited to availability — no data exfiltration or code execution. Patch to TF 2.7.0 / 2.6.1 / 2.5.2 / 2.4.4; prioritize shared multi-tenant ML environments such as Jupyter hubs, Kubeflow, or MLflow servers where untrusted users can execute TensorFlow code.

What is the risk?

Low-to-medium operational risk. CVSS 5.5 reflects a local attack vector requiring only low privileges, with impact confined to availability (A:H, C:N, I:N). Not in CISA KEV and no known active exploitation. Risk escalates significantly in multi-tenant ML training infrastructure where a single malicious or misconfigured job can terminate co-located workloads.

What systems are affected?

Package Ecosystem Vulnerable Range Patched
TensorFlow pip No patch
195.8K OpenSSF 7.1 3.7K dependents Pushed 2d ago 4% patched ~1372d to patch Full 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 10% 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?

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

What should I do?

5 steps
  1. Upgrade TensorFlow to 2.7.0, 2.6.1, 2.5.2, or 2.4.4 (cherry-picked patches available for older supported branches).

  2. Audit workloads using tf.math.segment_* operations, especially those accepting user-controlled or external tensor inputs.

  3. In multi-tenant environments, enforce process isolation between users and validate tensor shapes before passing to segment ops.

  4. Monitor for repeated unexpected TensorFlow process crashes — patterns may indicate active probing.

  5. Review container/namespace isolation in Kubeflow and similar platforms to limit blast radius of a crash.

How is it classified?

Which compliance frameworks are affected?

This CVE is relevant to:

EU AI Act
Art. 9 - Risk Management System
ISO 42001
Clause 8.4 - AI system operation and monitoring
NIST AI RMF
GOVERN 1.2 - Policies, processes, procedures, and practices across the AI risk management lifecycle MANAGE 2.2 - Mechanisms are in place to sustain the value of deployed AI systems

Frequently Asked Questions

What is CVE-2021-41195?

A local attacker with low privileges can crash TensorFlow processes by passing oversized segment IDs to tf.math.segment_* operations, triggering an integer overflow and process abort. Impact is limited to availability — no data exfiltration or code execution. Patch to TF 2.7.0 / 2.6.1 / 2.5.2 / 2.4.4; prioritize shared multi-tenant ML environments such as Jupyter hubs, Kubeflow, or MLflow servers where untrusted users can execute TensorFlow code.

Is CVE-2021-41195 actively exploited?

Proof-of-concept exploit code is publicly available for CVE-2021-41195, increasing the risk of exploitation.

How to fix CVE-2021-41195?

1. Upgrade TensorFlow to 2.7.0, 2.6.1, 2.5.2, or 2.4.4 (cherry-picked patches available for older supported branches). 2. Audit workloads using tf.math.segment_* operations, especially those accepting user-controlled or external tensor inputs. 3. In multi-tenant environments, enforce process isolation between users and validate tensor shapes before passing to segment ops. 4. Monitor for repeated unexpected TensorFlow process crashes — patterns may indicate active probing. 5. Review container/namespace isolation in Kubeflow and similar platforms to limit blast radius of a crash.

What systems are affected by CVE-2021-41195?

This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, notebook environments, batch inference pipelines.

What is the CVSS score for CVE-2021-41195?

CVE-2021-41195 has a CVSS v3.1 base score of 5.5 (MEDIUM). The EPSS exploitation probability is 0.21%.

What is the AI security impact?

Affected AI Architectures

training pipelinesmodel servingnotebook environmentsbatch inference pipelines

MITRE ATLAS Techniques

AML.T0010.001 AI Software
AML.T0029 Denial of AI Service
AML.T0043 Craft Adversarial Data

Compliance Controls Affected

EU AI Act: Art. 9
ISO 42001: Clause 8.4
NIST AI RMF: GOVERN 1.2, MANAGE 2.2

What are the technical details?

Original Advisory

TensorFlow is an open source platform for machine learning. In affected versions the implementation of `tf.math.segment_*` operations results in a `CHECK`-fail related abort (and denial of service) if a segment id in `segment_ids` is large. This is similar to CVE-2021-29584 (and similar other reported vulnerabilities in TensorFlow, localized to specific APIs): the implementation (both on CPU and GPU) computes the output shape using `AddDim`. However, if the number of elements in the tensor overflows an `int64_t` value, `AddDim` results in a `CHECK` failure which provokes a `std::abort`. Instead, code should use `AddDimWithStatus`. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.

Exploitation Scenario

An adversary with access to a shared Jupyter notebook server or MLflow training environment writes a minimal Python snippet calling tf.math.segment_sum() with a segment_ids tensor containing a value large enough to overflow int64 during output shape computation. When executed, AddDim triggers a CHECK failure and std::abort, immediately killing the TensorFlow process. In a shared cluster, this terminates any co-located training jobs or inference servers sharing the process, achieving targeted disruption of AI pipeline availability with a single line of user code.

Weaknesses (CWE)

CWE-190 — Integer Overflow or Wraparound: The product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. This occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may become a very small or negative number.

  • [Requirements] Ensure that all protocols are strictly defined, such that all out-of-bounds behavior can be identified simply, and require strict conformance to the protocol.
  • [Requirements] Use a language that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. If possible, choose a language or compiler that performs automatic bounds checking.

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
November 5, 2021
Last Modified
November 21, 2024
First Seen
November 5, 2021

Related Vulnerabilities