Home / Google / Tensorflow / CVE-2022-21731
CVE-2022-21731: is it exploited, and which versions of Google Tensorflow are affected and fixed?
CVE-2022-21731 is a type confusion vulnerability in Google Tensorflow. It is not known to be exploited: it is not in CISA's Known Exploited Vulnerabilities catalog (catalog 2026.11.30, read December 3, 2026, 13:38 UTC). Affected: tensorflow before 2.5.3, tensorflow from 2.6.0 before 2.6.3, tensorflow from 2.7.0 before 2.7.1 and 6 more (GitHub advisory GHSA-m4hf-j54p-p353). Fixed in 2.5.3, 2.6.3 and 2.7.1 (GitHub advisory GHSA-m4hf-j54p-p353). Severity: Medium (6.5, CVSS 3.1, from GitHub_M).
Data checked December 3, 2026: last read CISA KEV December 3, 2026, 13:38 UTC, CVE record November 19, 2026, 07:14 UTC and NVD November 19, 2026, 07:51 UTC.
What is CVE-2022-21731?
Type confusion leading to segfault in Tensorflow
Tensorflow is an Open Source Machine Learning Framework. The implementation of shape inference for `ConcatV2` can be used to trigger a denial of service attack via a segfault caused by a type confusion. The `axis` argument is translated into `concat_dim` in the `ConcatShapeHelper` helper function. Then, a value for `min_rank` is computed based on `concat_dim`. This is then used to validate that the `values` tensor has at least the required rank. However, `WithRankAtLeast` receives the lower bound as a 64-bits value and then compares it against the maximum 32-bits integer value that could be represented. Due to the fact that `min_rank` is a 32-bits value and the value of `axis`, the `rank` argument is a negative value, so the error check is bypassed. 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.
From the CVE record by GitHub_M, last updated May 5, 2025, 16:32 UTC.
Which packages are affected, and in which version is each fixed?
| Ecosystem | Package | Affected | Fixed in | Advisory |
|---|---|---|---|---|
| PyPI | tensorflow | < 2.5.3 | 2.5.3 | GHSA-m4hf-j54p-p353 |
| PyPI | tensorflow | >= 2.6.0, < 2.6.3 | 2.6.3 | GHSA-m4hf-j54p-p353 |
| PyPI | tensorflow | >= 2.7.0, < 2.7.1 | 2.7.1 | GHSA-m4hf-j54p-p353 |
| PyPI | tensorflow-cpu | < 2.5.3 | 2.5.3 | GHSA-m4hf-j54p-p353 |
| PyPI | tensorflow-cpu | >= 2.6.0, < 2.6.3 | 2.6.3 | GHSA-m4hf-j54p-p353 |
| PyPI | tensorflow-cpu | >= 2.7.0, < 2.7.1 | 2.7.1 | GHSA-m4hf-j54p-p353 |
| PyPI | tensorflow-gpu | < 2.5.3 | 2.5.3 | GHSA-m4hf-j54p-p353 |
| PyPI | tensorflow-gpu | >= 2.6.0, < 2.6.3 | 2.6.3 | GHSA-m4hf-j54p-p353 |
| PyPI | tensorflow-gpu | >= 2.7.0, < 2.7.1 | 2.7.1 | GHSA-m4hf-j54p-p353 |
GitHub Advisory Database, reviewed advisories (CC BY 4.0); advisory updated November 13, 2024. Summary: Type confusion leading to segfault in Tensorflow.
Which products and versions does the NVD list as affected?
| Vendor | Product | Versions | Type |
|---|---|---|---|
| tensorflow | through 2.5.2 | application | |
| tensorflow | from 2.6.0 through 2.6.2 | application | |
| tensorflow | 2.7.0 | application |
NVD analysis (status Modified), last modified June 17, 2026, 04:26 UTC.
How severe is CVE-2022-21731?
| Score | Version | Vector | Source |
|---|---|---|---|
| Medium 6.5 | CVSS 3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H | GitHub_M |
| Medium 6.5 | CVSS 3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H | NVD |
| Medium 4.0 | CVSS 2.0 | AV:N/AC:L/Au:S/C:N/I:N/A:P | NVD |
Each score is shown as its source gave it: the CNA that wrote the record, CISA's ADP (vulnrichment) and the NVD. They can differ.
What the ratings mean: in CVSS 3 and 4, scores run from 0 to 10, with Low 0.1 to 3.9, Medium 4.0 to 6.9, High 7.0 to 8.9 and Critical 9.0 to 10.0. CVSS 2 has no Critical band: its High runs from 7.0 to 10.0. The vector lists how the flaw is reached (network, local), what an attacker needs (privileges, a user's click) and what it can harm.
Is CVE-2022-21731 exploited in the wild?
- CISA KEV
- Not listed (catalog 2026.11.30)
- CISA SSVC
- Exploitation: poc; automatable: no; technical impact: partial (CISA ADP, April 25, 2025)
- EPSS
- 0.88% probability of exploitation activity in the next 30 days, percentile 60.2 (FIRST EPSS, scores of December 2, 2026)
What kind of flaw is it?
- CWE-843 Access of Resource Using Incompatible Type
- CWE-754 Improper Check for Unusual or Exceptional Conditions
Where are the vendor advisories and references?
- https://github.com/tensorflow/tensorflow/security/advisories/GHSA-m4hf-j54p-p353 x_refsource_CONFIRM
- https://github.com/tensorflow/tensorflow/commit/08d7b00c0a5a20926363849f611729f53f3ec022 x_refsource_MISC
- https://github.com/tensorflow/tensorflow/blob/5100e359aef5c8021f2e71c7b986420b85ce7b3d/tensorflow/core/framework/common_shape_fns.cc#L1961-L2059 x_refsource_MISC
- https://github.com/tensorflow/tensorflow/blob/5100e359aef5c8021f2e71c7b986420b85ce7b3d/tensorflow/core/framework/shape_inference.cc#L345-L358 x_refsource_MISC
When was it published, and where is the official record?
- Reserved
- November 16, 2021
- Published
- February 3, 2022, 11:37 UTC
- CVE record updated
- May 5, 2025, 16:32 UTC by GitHub_M
- NVD
- Modified, last modified June 17, 2026, 04:26 UTC
- Last checked
- CVE list November 19, 2026, 07:14 UTC; NVD November 19, 2026, 07:51 UTC; KEV December 3, 2026, 13:38 UTC; EPSS December 2, 2026
- Official record
- cve.org · NVD
What other CVEs affect Tensorflow?
- Sep 25, 2025CVE-2025-55559 Google Tensorflow: denial of service (uncontrolled resource consumption)
- Sep 25, 2025CVE-2025-55556 Google Tensorflow: embedded Malicious Code
- May 6, 2025CVE-2025-0649 Google Tensorflow: stack buffer overflow
- Feb 3, 2022CVE-2022-21740 Google Tensorflow: out-of-bounds write (memory corruption)
- Feb 3, 2022CVE-2022-21741 Google Tensorflow: divide by zero
- Feb 3, 2022CVE-2022-21737 Google Tensorflow: unusual condition not checked
- Feb 3, 2022CVE-2022-21738 Google Tensorflow: integer overflow
- Feb 3, 2022CVE-2022-21739 Google Tensorflow: NULL pointer dereference (crash)
Questions about CVE-2022-21731
Is CVE-2022-21731 exploited in the wild?
Not as far as CISA knows: it is not in the Known Exploited Vulnerabilities catalog, read December 3, 2026, 13:38 UTC. FIRST's EPSS gives it a 0.88% chance of exploitation activity in the next 30 days (scores of December 2, 2026).
Which versions of Google Tensorflow are affected by CVE-2022-21731?
tensorflow before 2.5.3, tensorflow from 2.6.0 before 2.6.3, tensorflow from 2.7.0 before 2.7.1, tensorflow-cpu before 2.5.3, tensorflow-cpu from 2.6.0 before 2.6.3, tensorflow-cpu from 2.7.0 before 2.7.1 and 3 more, per the GitHub advisory GHSA-m4hf-j54p-p353. The tables above give every range the sources list.
Which version fixes CVE-2022-21731?
2.5.3, 2.6.3 and 2.7.1, per the GitHub advisory GHSA-m4hf-j54p-p353. Check the vendor's advisory before you rely on it.
How severe is CVE-2022-21731?
Medium (6.5, CVSS 3.1, from GitHub_M). The severity table above shows each score with its source.
Where is the official record of CVE-2022-21731?
The CVE Program's record is at cve.org and the NVD's at nvd.nist.gov. For a fix, the vendor's own advisory is the one to follow.