# CVE-2022-21731: Type confusion leading to segfault in Tensorflow

- Severity: Medium 6.5 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.88%, higher than 60% of CVEs (2026-12-01)
- Public exploit code or proof of concept: 2 links below, marked "exploit"
- Published: 2022-02-03T11:37:56.000Z
- Modified: 2026-09-10T03:49:12.357Z
- Also known as: GHSA-m4hf-j54p-p353, BIT-TENSORFLOW-2022-21731, PYSEC-2022-110, PYSEC-2022-55, PYSEC-2026-3211
- Weaknesses: CWE-754, CWE-843
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial
- Assigned by: GitHub_M

## Description

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.

(As written by CVE List.)

## Affected

- Unspecified product: n/a
- tensorflow (PyPI): before 2.5.3; from 2.6.0 before 2.6.3; from 2.7.0 before 2.7.1
- tensorflow-cpu (PyPI): before 2.5.3; from 2.6.0 before 2.6.3; from 2.7.0 before 2.7.1; before 08d7b00c0a5a20926363849f611729f53f3ec022
- tensorflow-gpu (PyPI): before 2.5.3; from 2.6.0 before 2.6.3; from 2.7.0 before 2.7.1; before 08d7b00c0a5a20926363849f611729f53f3ec022
- google tensorflow: up to 2.5.2; from 2.6.0 up to 2.6.2; 2.7.0
- tensorflow (Bitnami): before 2.5.3; from 2.6.0 before 2.6.3; from 2.7.0 before 2.7.1

## Every score

- GitHub_M: CVSS:3.1 6.5 Medium `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- GitHub: CVSS:3.1 6.5 High `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- GitHub: CVSS:4.0 High `CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N`
- NVD: CVSS:3.1 6.5 Medium `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- NVD: CVSS:2.0 4.0 Medium `AV:N/AC:L/Au:S/C:N/I:N/A:P`
- PyPA Advisory Database: CVSS:3.1 6.5 Medium `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- PyPA Advisory Database: CVSS:4.0 `CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N`
- Bitnami Vulnerability Database: rating Medium

## References

- <https://github.com/tensorflow/tensorflow/blob/5100e359aef5c8021f2e71c7b986420b85ce7b3d/tensorflow/core/framework/common_shape_fns.cc#L1961-L2059> (exploit, advisory, third-party-advisory, web)
- <https://github.com/tensorflow/tensorflow/blob/5100e359aef5c8021f2e71c7b986420b85ce7b3d/tensorflow/core/framework/shape_inference.cc#L345-L358> (exploit, advisory, third-party-advisory, web)
- <https://github.com/tensorflow/tensorflow/security/advisories/GHSA-m4hf-j54p-p353> (advisory, patch, third-party-advisory, web)
- <https://github.com/tensorflow/tensorflow/commit/08d7b00c0a5a20926363849f611729f53f3ec022> (advisory, fix, patch, third-party-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2022-21731> (advisory, web)
- <https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2022-55.yaml> (web)
- <https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2022-110.yaml> (web)
- <https://github.com/tensorflow/tensorflow> (web)
- <https://pypi.org/project/tensorflow> (package)
- <https://github.com/advisories/GHSA-m4hf-j54p-p353> (advisory)

## Sources

- CVE List: [CVE-2022-21731](https://www.cve.org/CVERecord?id=CVE-2022-21731), CVE Terms of Use, modified 2025-05-05
- GitHub Advisory Database: [GHSA-m4hf-j54p-p353](https://github.com/advisories/GHSA-m4hf-j54p-p353), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2022-21731](https://nvd.nist.gov/vuln/detail/CVE-2022-21731), Public domain, modified 2026-06-17
- PyPA Advisory Database: [PYSEC-2022-110](https://osv.dev/vulnerability/PYSEC-2022-110), CC-BY-4.0, modified 2026-07-13
- PyPA Advisory Database: [PYSEC-2022-55](https://osv.dev/vulnerability/PYSEC-2022-55), CC-BY-4.0, modified 2026-07-13
- PyPA Advisory Database: [PYSEC-2026-3211](https://osv.dev/vulnerability/PYSEC-2026-3211), CC-BY-4.0, modified 2026-07-13
- Bitnami Vulnerability Database: [BIT-TENSORFLOW-2022-21731](https://osv.dev/vulnerability/BIT-TENSORFLOW-2022-21731), Apache-2.0, modified 2026-09-08

---

Page: https://cve.day/CVE-2022-21731 · Whole record: https://cve.day/CVE-2022-21731.json · Rebuilt by cve.day 2026-11-25T22:58:09.473Z
