CVE-2021-41217: TensorFlow: null pointer crash in control flow graph

MEDIUM PoC AVAILABLE
Published November 5, 2021
CISO Take

A crafted TensorFlow model with unpaired control flow nodes (Exit without Enter) crashes the TF runtime via null pointer dereference, causing denial of service. Any pipeline that loads externally-supplied or user-submitted TF models is at risk. Patch immediately to TF 2.7.0, 2.6.1, 2.5.2, or 2.4.4 — and validate model provenance before loading.

Risk Assessment

Medium risk in isolated environments, elevated in shared ML platforms. The local attack vector (AV:L) limits direct remote exploitation, but in multi-tenant training platforms, model-sharing hubs, or CI/CD pipelines that auto-load submitted models, an attacker with model upload capability can reliably crash the TF worker process. No confidentiality or integrity impact — pure availability loss. CVSS 5.5 underestimates operational impact in production inference fleets.

Affected Systems

Package Ecosystem Vulnerable Range Patched
tensorflow pip No patch
195.0K OpenSSF 7.2 3.7K dependents Pushed 6d ago 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 4% of all CVEs
Exploitation Status
Exploit Available
Exploitation: MEDIUM
Sophistication
Moderate
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

5 steps
  1. Patch: Upgrade TensorFlow to 2.7.0 (preferred), or cherrypick patches for 2.6.1, 2.5.2, 2.4.4.

  2. Validate model provenance: Restrict model loading to trusted, hash-verified sources; reject models from untrusted submitters.

  3. Sandbox model loading: Run model parsing in isolated subprocesses with resource limits so a crash does not cascade.

  4. Detect: Alert on unexpected TF process terminations (SIGSEGV/crash signals) — repeated crashes may indicate active exploitation attempts.

  5. Audit: Check ML pipeline dependencies; CI/CD jobs that auto-test submitted models are particularly exposed.

Classification

Compliance Impact

This CVE is relevant to:

EU AI Act
Article 9 - Risk management system for high-risk AI
ISO 42001
6.1.2 - AI risk assessment 8.4 - AI system operation and monitoring
NIST AI RMF
GOVERN-1.1 - Risk identification and classification MS-2.5 - Testing, Evaluation, Validation and Verification (TEVV)

Frequently Asked Questions

What is CVE-2021-41217?

A crafted TensorFlow model with unpaired control flow nodes (Exit without Enter) crashes the TF runtime via null pointer dereference, causing denial of service. Any pipeline that loads externally-supplied or user-submitted TF models is at risk. Patch immediately to TF 2.7.0, 2.6.1, 2.5.2, or 2.4.4 — and validate model provenance before loading.

Is CVE-2021-41217 actively exploited?

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

How to fix CVE-2021-41217?

1. Patch: Upgrade TensorFlow to 2.7.0 (preferred), or cherrypick patches for 2.6.1, 2.5.2, 2.4.4. 2. Validate model provenance: Restrict model loading to trusted, hash-verified sources; reject models from untrusted submitters. 3. Sandbox model loading: Run model parsing in isolated subprocesses with resource limits so a crash does not cascade. 4. Detect: Alert on unexpected TF process terminations (SIGSEGV/crash signals) — repeated crashes may indicate active exploitation attempts. 5. Audit: Check ML pipeline dependencies; CI/CD jobs that auto-test submitted models are particularly exposed.

What systems are affected by CVE-2021-41217?

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

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

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

Technical Details

NVD Description

TensorFlow is an open source platform for machine learning. In affected versions the process of building the control flow graph for a TensorFlow model is vulnerable to a null pointer exception when nodes that should be paired are not. This occurs because the code assumes that the first node in the pairing (e.g., an `Enter` node) always exists when encountering the second node (e.g., an `Exit` node). When this is not the case, `parent` is `nullptr` so dereferencing it causes a crash. 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 model-sharing platform (e.g., internal MLflow registry, shared training cluster, or public model hub) uploads a crafted SavedModel containing an Exit node in a control flow subgraph without the required paired Enter node. When any user or automated pipeline loads this model — during training, fine-tuning, or serving — TensorFlow's graph builder hits a null pointer dereference and crashes the worker. In a training cluster, this can disrupt long-running jobs. In a model serving fleet, it crashes the inference process, triggering restarts that degrade availability. Exploitation requires only the ability to craft and submit a TF model file — no exploit code beyond a few lines of TF graph manipulation API.

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