CVE-2021-41210: TensorFlow: heap OOB read in SparseCountSparseOutput
HIGH PoC AVAILABLEA heap out-of-bounds read in TensorFlow's SparseCountSparseOutput shape inference allows local low-privilege attackers to read sensitive memory or crash the process. Shared ML training clusters, multi-tenant Jupyter environments, and containerized inference platforms face the highest real-world exposure. Patch all TensorFlow deployments to 2.7.0, 2.6.1, 2.5.2, or 2.4.4 immediately and audit base images in ML CI/CD pipelines.
What is the risk?
CVSS 7.1 High, but operational risk is moderate for most organizations due to the local attack vector. The vulnerability becomes significantly more dangerous in shared compute environments — GPU clusters, Jupyter hubs, or SageMaker Studio — where multiple users share the same TensorFlow runtime. Attack complexity is low once local access is obtained. No CISA KEV listing and no known active exploitation at time of disclosure, but the 2021 vintage means many unpatched deployments still exist in production.
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| TensorFlow | pip | — | No patch |
Do you use TensorFlow? You're affected.
How severe is it?
What is the attack surface?
What should I do?
6 steps-
Patch: Upgrade TensorFlow to 2.7.0, 2.6.1, 2.5.2, or 2.4.4 in all environments.
-
Inventory: Enumerate TF versions across training clusters, CI/CD pipelines, notebook servers, and inference containers. Use 'pip show tensorflow' or container scanning tools.
-
Container hygiene: Update Dockerfiles and requirements.txt/pyproject.toml constraints; rebuild and redeploy affected images.
-
Isolation: Until patched, enforce least-privilege access on shared ML compute — restrict who can submit arbitrary TF operations.
-
Detection: Alert on unexpected SIGSEGV/heap corruption crashes in TF training or serving processes.
-
Verify: Confirm patch application with CVE scanners (Trivy, Grype) against your ML container registry.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2021-41210?
A heap out-of-bounds read in TensorFlow's SparseCountSparseOutput shape inference allows local low-privilege attackers to read sensitive memory or crash the process. Shared ML training clusters, multi-tenant Jupyter environments, and containerized inference platforms face the highest real-world exposure. Patch all TensorFlow deployments to 2.7.0, 2.6.1, 2.5.2, or 2.4.4 immediately and audit base images in ML CI/CD pipelines.
Is CVE-2021-41210 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2021-41210, increasing the risk of exploitation.
How to fix CVE-2021-41210?
1. Patch: Upgrade TensorFlow to 2.7.0, 2.6.1, 2.5.2, or 2.4.4 in all environments. 2. Inventory: Enumerate TF versions across training clusters, CI/CD pipelines, notebook servers, and inference containers. Use 'pip show tensorflow' or container scanning tools. 3. Container hygiene: Update Dockerfiles and requirements.txt/pyproject.toml constraints; rebuild and redeploy affected images. 4. Isolation: Until patched, enforce least-privilege access on shared ML compute — restrict who can submit arbitrary TF operations. 5. Detection: Alert on unexpected SIGSEGV/heap corruption crashes in TF training or serving processes. 6. Verify: Confirm patch application with CVE scanners (Trivy, Grype) against your ML container registry.
What systems are affected by CVE-2021-41210?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, notebook environments, multi-tenant ML platforms, containerized ML workloads.
What is the CVSS score for CVE-2021-41210?
CVE-2021-41210 has a CVSS v3.1 base score of 7.1 (HIGH). The EPSS exploitation probability is 0.15%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001 AI Software AML.T0037 Data from Local System AML.T0049 Exploit Public-Facing Application Compliance Controls Affected
What are the technical details?
Original Advisory
TensorFlow is an open source platform for machine learning. In affected versions the shape inference functions for `SparseCountSparseOutput` can trigger a read outside of bounds of heap allocated array. 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 low-privilege access to a shared ML training cluster — a compromised data scientist account or malicious insider — crafts a Python script that calls tf.sets.count() with a specially malformed sparse tensor. During shape inference for SparseCountSparseOutput, TensorFlow reads beyond the bounds of a heap-allocated array. In a training environment, adjacent heap memory may contain sensitive batch data, gradient tensors, or authentication tokens (e.g., cloud provider credentials loaded into the training process). Repeated triggering can also crash the training job, disrupting production model pipelines and causing financial loss in long-running distributed training runs.
Weaknesses (CWE)
CWE-125 — Out-of-bounds Read: The product reads data past the end, or before the beginning, of the intended buffer.
- [Implementation] Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylis
- [Architecture and Design] Use a language that provides appropriate memory abstractions.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H References
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