CVE-2021-29548: TensorFlow: DoS via division by zero in QuantizedBatchNorm
MEDIUM PoC AVAILABLEMedium-severity DoS in TensorFlow's quantized batch normalization op — exploitable locally with low privileges by passing inputs that violate the op contract. Patch to TF 2.5.0 or the cherrypick backports (2.1.4/2.2.3/2.3.3/2.4.2); no workaround exists short of input validation. Elevated concern in shared ML clusters or Jupyter environments where co-tenants can trigger model ops.
Risk Assessment
Medium risk overall, but contextually higher in multi-tenant ML platforms. CVSS 5.5 (local, low-privilege, availability-only) understates the blast radius in shared inference serving infrastructure where a single crashed TF process can disrupt all co-hosted workloads. No confidentiality or integrity exposure. Not actively exploited (not in KEV). Patching is straightforward — risk window is short for teams with disciplined dependency management.
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 cherrypick backports: 2.1.4, 2.2.3, 2.3.3, 2.4.2. Verify via
pip show tensorflow. -
Input validation: if upgrade is not immediately feasible, validate that the variance tensor passed to QuantizedBatchNormWithGlobalNormalization contains no zero values before op invocation.
-
Isolation: in shared environments, run each tenant's TF workload in a separate process/container to contain crash impact.
-
Detection: alert on unexpected TF runtime segfaults or OOM-killer events in ML workload logs — repeated crashes from the same op are an indicator.
-
Audit: scan requirements.txt / conda envs across the ML platform for affected TF versions.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2021-29548?
Medium-severity DoS in TensorFlow's quantized batch normalization op — exploitable locally with low privileges by passing inputs that violate the op contract. Patch to TF 2.5.0 or the cherrypick backports (2.1.4/2.2.3/2.3.3/2.4.2); no workaround exists short of input validation. Elevated concern in shared ML clusters or Jupyter environments where co-tenants can trigger model ops.
Is CVE-2021-29548 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2021-29548, increasing the risk of exploitation.
How to fix CVE-2021-29548?
1. Patch: upgrade to TensorFlow ≥2.5.0 or apply cherrypick backports: 2.1.4, 2.2.3, 2.3.3, 2.4.2. Verify via `pip show tensorflow`. 2. Input validation: if upgrade is not immediately feasible, validate that the variance tensor passed to QuantizedBatchNormWithGlobalNormalization contains no zero values before op invocation. 3. Isolation: in shared environments, run each tenant's TF workload in a separate process/container to contain crash impact. 4. Detection: alert on unexpected TF runtime segfaults or OOM-killer events in ML workload logs — repeated crashes from the same op are an indicator. 5. Audit: scan requirements.txt / conda envs across the ML platform for affected TF versions.
What systems are affected by CVE-2021-29548?
This vulnerability affects the following AI/ML architecture patterns: model serving, training pipelines, edge inference.
What is the CVSS score for CVE-2021-29548?
CVE-2021-29548 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. An attacker can cause a runtime division by zero error and denial of service in `tf.raw_ops.QuantizedBatchNormWithGlobalNormalization`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/55a97caa9e99c7f37a0bbbeb414dc55553d3ae7f/tensorflow/core/kernels/quantized_batch_norm_op.cc) does not validate all constraints specified in the op's contract(https://www.tensorflow.org/api_docs/python/tf/raw_ops/QuantizedBatchNormWithGlobalNormalization). 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 access to a shared ML training cluster (e.g., a rogue data scientist, compromised notebook, or malicious ML job submitted to a shared queue) crafts a TF computation graph that calls `tf.raw_ops.QuantizedBatchNormWithGlobalNormalization` with a zero-value variance tensor. When executed, the TF runtime performs an unchecked division by zero, throws a runtime error, and crashes the entire TF process. On a shared TF Serving deployment, this kills inference for all models hosted in the same process. The attacker can repeat the request to maintain the DoS, preventing recovery. No elevated privileges or ML expertise required — the op is directly accessible via the raw_ops API.
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/d6ed5bcfe1dcab9e85a4d39931bd18d99018e75b Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-p45v-v4pw-77jr 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