CVE-2021-41206: TensorFlow: missing shape validation allows heap R/W
HIGH PoC AVAILABLEMultiple TensorFlow operations lack tensor shape validation, enabling heap memory reads/writes or crashes by any user who can submit workloads. Patch immediately to TF 2.7.0, 2.6.1, 2.5.2, or 2.4.4—especially in multi-tenant training environments or public-facing model serving. Local access requirement limits internet exposure, but shared ML platforms (Jupyter, Kubeflow, SageMaker) elevate this to a lateral movement risk within your AI infrastructure.
Risk Assessment
CVSS 7.8 (High) with local attack vector reduces internet-facing exposure, but in ML platform contexts—multi-user Jupyter environments, cloud ML workspaces, or shared training clusters—'local' translates to any authenticated user. Low attack complexity and low privilege requirements mean any data scientist or developer with notebook access could trigger heap corruption. The vulnerability spans multiple undisclosed ops, implying a broad attack surface. No active exploitation reported and not in CISA KEV, but the potential for heap R/W makes this more than a stability issue.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| tensorflow | pip | — | No patch |
Do you use tensorflow? You're affected.
Severity & Risk
Attack Surface
Recommended Action
5 steps-
Patch: Upgrade to TF 2.7.0, or apply cherry-picked commits to 2.6.1, 2.5.2, or 2.4.4 per the GitHub advisory.
-
Inventory: Enumerate all systems running TensorFlow across training infra, serving endpoints, notebooks, and CI/CD pipelines.
-
Isolation: Restrict job submission access to TF endpoints until patched; enforce least-privilege on who can run TF workloads.
-
Detection: Monitor TF process logs for unexpected segfaults or CHECK-fail messages as potential exploitation indicators.
-
Rebuild: Update all Docker/container images containing TF to patched versions and redeploy.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2021-41206?
Multiple TensorFlow operations lack tensor shape validation, enabling heap memory reads/writes or crashes by any user who can submit workloads. Patch immediately to TF 2.7.0, 2.6.1, 2.5.2, or 2.4.4—especially in multi-tenant training environments or public-facing model serving. Local access requirement limits internet exposure, but shared ML platforms (Jupyter, Kubeflow, SageMaker) elevate this to a lateral movement risk within your AI infrastructure.
Is CVE-2021-41206 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2021-41206, increasing the risk of exploitation.
How to fix CVE-2021-41206?
1. Patch: Upgrade to TF 2.7.0, or apply cherry-picked commits to 2.6.1, 2.5.2, or 2.4.4 per the GitHub advisory. 2. Inventory: Enumerate all systems running TensorFlow across training infra, serving endpoints, notebooks, and CI/CD pipelines. 3. Isolation: Restrict job submission access to TF endpoints until patched; enforce least-privilege on who can run TF workloads. 4. Detection: Monitor TF process logs for unexpected segfaults or CHECK-fail messages as potential exploitation indicators. 5. Rebuild: Update all Docker/container images containing TF to patched versions and redeploy.
What systems are affected by CVE-2021-41206?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, shared ML platforms, ML workstations, containerized ML workloads.
What is the CVSS score for CVE-2021-41206?
CVE-2021-41206 has a CVSS v3.1 base score of 7.8 (HIGH). The EPSS exploitation probability is 0.01%.
Technical Details
NVD Description
TensorFlow is an open source platform for machine learning. In affected versions several TensorFlow operations are missing validation for the shapes of the tensor arguments involved in the call. Depending on the API, this can result in undefined behavior and segfault or `CHECK`-fail related crashes but in some scenarios writes and reads from heap populated arrays are also possible. We have discovered these issues internally via tooling while working on improving/testing GPU op determinism. As such, we don't have reproducers and there will be multiple fixes for these issues. These fixes will be included in TensorFlow 2.7.0. We will also cherrypick these commits 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
A malicious insider or attacker with compromised data scientist credentials on a shared ML platform submits a training job or inference request containing tensors with deliberately malformed shapes targeting one of the vulnerable ops. The absent shape validation triggers a heap write primitive that the attacker can exploit for memory disclosure—leaking model weights, API keys, or credentials stored in the process heap—or to achieve arbitrary code execution within the TF worker process. In a Kubernetes-based ML pipeline, this becomes a container escape vector with potential cluster-wide lateral movement.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H References
- github.com/tensorflow/tensorflow/commit/4d74d8a00b07441cba090a02e0dd9ed385145bf4 Patch 3rd Party
- github.com/tensorflow/tensorflow/commit/4dddb2fd0b01cdd196101afbba6518658a2c9e07 Patch 3rd Party
- github.com/tensorflow/tensorflow/commit/579261dcd446385831fe4f7457d802a59685121d Patch 3rd Party
- github.com/tensorflow/tensorflow/commit/68422b215e618df5ad375bcdc6d2052e9fd3080a Patch 3rd Party
- github.com/tensorflow/tensorflow/commit/da4aad5946be30e5f049920fa076e1f7ef021261 Patch 3rd Party
- github.com/tensorflow/tensorflow/commit/e7f497570abb6b4ae5af4970620cd880e4c0c904 Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-pgcq-h79j-2f69 3rd Party
- github.com/ARPSyndicate/cvemon Exploit
- github.com/ChamalBandara/CVEs Exploit
Timeline
Related Vulnerabilities
CVE-2020-15196 9.9 TensorFlow: heap OOB read in sparse/ragged count ops
Same package: tensorflow CVE-2020-15205 9.8 TensorFlow: heap overflow in StringNGrams, ASLR bypass
Same package: tensorflow CVE-2020-15208 9.8 TFLite: OOB read/write via tensor dimension mismatch
Same package: tensorflow CVE-2019-16778 9.8 TensorFlow: heap overflow in UnsortedSegmentSum op
Same package: tensorflow CVE-2022-23587 9.8 TensorFlow: integer overflow in Grappler enables RCE
Same package: tensorflow
AI Threat Alert