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.

What is the risk?

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.

What systems are affected?

Package Ecosystem Vulnerable Range Patched
TensorFlow pip No patch
195.8K OpenSSF 7.1 3.7K dependents Pushed 3d 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 8% 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, 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. 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.

How is it classified?

Which compliance frameworks are affected?

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

What is the AI security impact?

Affected AI Architectures

training pipelinesmodel servingmodel registriesMLOps pipelinesbatch inference

MITRE ATLAS Techniques

AML.T0010.001 AI Software
AML.T0011.000 Unsafe AI Artifacts
AML.T0018.001 Modify AI Model Architecture
AML.T0029 Denial of AI Service

Compliance Controls Affected

EU AI Act: Article 9
ISO 42001: 6.1.2, 8.4
NIST AI RMF: GOVERN-1.1, MS-2.5

What are the technical details?

Original Advisory

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.

Weaknesses (CWE)

CWE-476 — NULL Pointer Dereference: The product dereferences a pointer that it expects to be valid but is NULL.

  • [Implementation] For any pointers that could have been modified or provided from a function that can return NULL, check the pointer for NULL before use. When working with a multithreaded or otherwise asynchronous environment, ensure that proper locking APIs are used to lock before the check, and unlock when it has finished [REF-1484].
  • [Requirements] Select a programming language that is not susceptible to these issues.

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