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.
Risk Assessment
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.
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 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.
Classification
Compliance Impact
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.01%.
Technical Details
NVD Description
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)
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
AI Threat Alert