CVE-2022-21725: TensorFlow: DoS via div-by-zero in conv cost estimator
MEDIUM PoC AVAILABLE CISA: TRACK*A low-privileged remote attacker can crash TensorFlow processes by submitting a convolution operation with stride=0, triggering a division by zero in the Grappler cost estimator. Patch immediately to TensorFlow 2.8.0, 2.7.1, 2.6.3, or 2.5.3. Risk is elevated in any deployment where untrusted users can submit computation graphs or model definitions.
Risk Assessment
Medium risk overall, but context-dependent. CVSS 6.5 reflects network reachability with low privilege requirements and no user interaction needed, with full availability impact. In isolated training environments with no external access, practical risk is low. In model serving APIs or platforms that accept user-defined ops or graph definitions, this becomes a meaningful availability threat. No confidentiality or integrity impact, and no evidence of in-the-wild exploitation.
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-
Upgrade to TensorFlow 2.8.0, 2.7.1, 2.6.3, or 2.5.3 which include the fix (commit 3218043d6d3a).
-
If immediate patching is not possible, enforce input validation to reject stride values ≤ 0 at the API boundary before passing to TensorFlow ops.
-
Restrict access to model definition or graph submission endpoints to authenticated, trusted users only.
-
Monitor TensorFlow process crashes and restarts as a detection signal.
-
Run TF serving processes under process supervisors with automatic restart and alerting to limit availability impact.
CISA SSVC Assessment
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2022-21725?
A low-privileged remote attacker can crash TensorFlow processes by submitting a convolution operation with stride=0, triggering a division by zero in the Grappler cost estimator. Patch immediately to TensorFlow 2.8.0, 2.7.1, 2.6.3, or 2.5.3. Risk is elevated in any deployment where untrusted users can submit computation graphs or model definitions.
Is CVE-2022-21725 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2022-21725, increasing the risk of exploitation.
How to fix CVE-2022-21725?
1. Upgrade to TensorFlow 2.8.0, 2.7.1, 2.6.3, or 2.5.3 which include the fix (commit 3218043d6d3a). 2. If immediate patching is not possible, enforce input validation to reject stride values ≤ 0 at the API boundary before passing to TensorFlow ops. 3. Restrict access to model definition or graph submission endpoints to authenticated, trusted users only. 4. Monitor TensorFlow process crashes and restarts as a detection signal. 5. Run TF serving processes under process supervisors with automatic restart and alerting to limit availability impact.
What systems are affected by CVE-2022-21725?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, inference, ML platforms (multi-tenant), AutoML / NAS pipelines.
What is the CVSS score for CVE-2022-21725?
CVE-2022-21725 has a CVSS v3.1 base score of 6.5 (MEDIUM). The EPSS exploitation probability is 0.22%.
Technical Details
NVD Description
Tensorflow is an Open Source Machine Learning Framework. The estimator for the cost of some convolution operations can be made to execute a division by 0. The function fails to check that the stride argument is strictly positive. Hence, the fix is to add a check for the stride argument to ensure it is valid. The fix will be included in TensorFlow 2.8.0. We will also cherrypick this commit on TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, as these are also affected and still in supported range.
Exploitation Scenario
An adversary with API access to a TensorFlow-backed model serving endpoint or MLaaS platform that accepts custom model architectures submits a convolutional neural network definition with a stride parameter set to 0. When TensorFlow's Grappler optimizer evaluates the computational cost of this operation during graph compilation, it executes the unguarded division, crashes the process, and causes a denial of service. In a multi-tenant ML platform, a single malicious user can disrupt service for all other tenants. The exploit requires only basic TensorFlow API knowledge and is trivially reproducible from the public GitHub proof-of-concept.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H References
- github.com/tensorflow/tensorflow/blob/ffa202a17ab7a4a10182b746d230ea66f021fe16/tensorflow/core/grappler/costs/op_level_cost_estimator.cc Exploit 3rd Party
- github.com/tensorflow/tensorflow/commit/3218043d6d3a019756607643cf65574fbfef5d7a Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-v3f7-j968-4h5f 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