CVE-2021-29572: TensorFlow: null ptr deref crashes SdcaOptimizer op
MEDIUM PoC AVAILABLEA local attacker with low privileges can crash any TensorFlow process by invoking SdcaOptimizer with malformed arguments, exploiting a missing input validation that triggers a null pointer dereference. Availability-only impact (no data leakage, no code execution), but in shared ML training clusters this becomes a multi-tenant denial-of-service vector. Patch immediately to TF 2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4; no workaround exists short of blocking access to raw ops.
What is the risk?
MEDIUM overall, elevated in multi-tenant contexts. CVSS 5.5 reflects local-only reach (AV:L), but in practice ML training infrastructure often runs user-submitted notebooks or jobs with shared TF runtimes — effectively lowering the exploitation barrier to near-zero. No confidentiality or integrity impact; pure availability. EPSS data unavailable but exploitation is trivial: a single malformed op call suffices. Not in CISA KEV, not actively exploited in the wild as of patching date.
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?
5 steps-
PATCH
Upgrade to TensorFlow 2.5.0 or apply cherry-picks to 2.4.2 / 2.3.3 / 2.2.3 / 2.1.4. Commit f7cc875 is the authoritative fix.
-
RESTRICT RAW OPS
Audit whether tf.raw_ops is accessible to untrusted callers; gate it behind authorization in serving endpoints.
-
SANDBOX
Run user-submitted TF jobs in isolated processes (containers/VMs) — prevents lateral crash impact in shared clusters.
-
DETECT
Alert on TensorFlow process crashes / OOM-kill events in training nodes; unexpected restarts of TFServing pods are the primary signal.
-
VERIFY
Confirm installed TF version via
python -c "import tensorflow as tf; print(tf.__version__)"across all ML nodes.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2021-29572?
A local attacker with low privileges can crash any TensorFlow process by invoking SdcaOptimizer with malformed arguments, exploiting a missing input validation that triggers a null pointer dereference. Availability-only impact (no data leakage, no code execution), but in shared ML training clusters this becomes a multi-tenant denial-of-service vector. Patch immediately to TF 2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4; no workaround exists short of blocking access to raw ops.
Is CVE-2021-29572 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2021-29572, increasing the risk of exploitation.
How to fix CVE-2021-29572?
1. PATCH: Upgrade to TensorFlow 2.5.0 or apply cherry-picks to 2.4.2 / 2.3.3 / 2.2.3 / 2.1.4. Commit f7cc875 is the authoritative fix. 2. RESTRICT RAW OPS: Audit whether tf.raw_ops is accessible to untrusted callers; gate it behind authorization in serving endpoints. 3. SANDBOX: Run user-submitted TF jobs in isolated processes (containers/VMs) — prevents lateral crash impact in shared clusters. 4. DETECT: Alert on TensorFlow process crashes / OOM-kill events in training nodes; unexpected restarts of TFServing pods are the primary signal. 5. VERIFY: Confirm installed TF version via `python -c "import tensorflow as tf; print(tf.__version__)"` across all ML nodes.
What systems are affected by CVE-2021-29572?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, shared ML platforms.
What is the CVSS score for CVE-2021-29572?
CVE-2021-29572 has a CVSS v3.1 base score of 5.5 (MEDIUM). The EPSS exploitation probability is 0.19%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001 AI Software AML.T0029 Denial of AI Service AML.T0049 Exploit Public-Facing Application Compliance Controls Affected
What are the technical details?
Original Advisory
TensorFlow is an end-to-end open source platform for machine learning. The implementation of `tf.raw_ops.SdcaOptimizer` triggers undefined behavior due to dereferencing a null pointer. The implementation(https://github.com/tensorflow/tensorflow/blob/60a45c8b6192a4699f2e2709a2645a751d435cc3/tensorflow/core/kernels/sdca_internal.cc) does not validate that the user supplied arguments satisfy all constraints expected by the op(https://www.tensorflow.org/api_docs/python/tf/raw_ops/SdcaOptimizer). The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.
Exploitation Scenario
An adversary with a low-privilege account on a shared ML training platform (e.g., a data scientist in a multi-tenant Jupyter environment or a malicious insider) submits a TF training job that calls tf.raw_ops.SdcaOptimizer with intentionally invalid or null arguments. The missing input validation dereferences a null pointer, crashing the TF runtime process. In a shared cluster, this terminates co-located training jobs from other tenants and potentially corrupts shared checkpointing storage. An attacker could loop this across node restarts to sustain a denial-of-service against the ML platform, delaying production model releases or degrading online serving.
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 References
- github.com/tensorflow/tensorflow/commit/f7cc8755ac6683131fdfa7a8a121f9d7a9dec6fb Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-5gqf-456p-4836 Exploit Patch 3rd Party
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