{"id":"CVE-2022-21731","published":"2022-02-03T11:37:56Z","modified":"2025-05-05T16:32:12Z","title":"Type confusion leading to segfault in Tensorflow","vendor":null,"product":null,"tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":6.5,"severity":"MEDIUM","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00852,"percentile":0.59118,"provenance":"source"},"cwes":[{"id":"CWE-843","name":"Access of Resource Using Incompatible Type"}],"references":[{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-m4hf-j54p-p353","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/tensorflow/tensorflow/commit/08d7b00c0a5a20926363849f611729f53f3ec022","tags":["x_refsource_MISC"]},{"url":"https://github.com/tensorflow/tensorflow/blob/5100e359aef5c8021f2e71c7b986420b85ce7b3d/tensorflow/core/framework/common_shape_fns.cc#L1961-L2059","tags":["x_refsource_MISC"]},{"url":"https://github.com/tensorflow/tensorflow/blob/5100e359aef5c8021f2e71c7b986420b85ce7b3d/tensorflow/core/framework/shape_inference.cc#L345-L358","tags":["x_refsource_MISC"]}],"priority":{"score":16.4,"factors":[{"name":"EPSS percentile","points":11.82},{"name":"CVSS severity","points":4.55}]},"ssvc":{"exploitation":"poc","automatable":"no","technicalImpact":"partial","timestamp":"2025-04-25T15:47:26.571505Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"PyPI","package":"tensorflow","vulnerableRanges":["<2.5.3",">=2.6.0, <2.6.3",">=2.7.0, <2.7.1"],"patched":["2.5.3","2.6.3","2.7.1"],"from":["GHSA-m4hf-j54p-p353","PYSEC-2026-3211"],"provenance":"source"},{"ecosystem":"PyPI","package":"tensorflow-cpu","vulnerableRanges":["<2.5.3",">=2.6.0, <2.6.3",">=2.7.0, <2.7.1"],"patched":["2.5.3","2.6.3","2.7.1"],"from":["GHSA-m4hf-j54p-p353","PYSEC-2022-55"],"provenance":"source"},{"ecosystem":"PyPI","package":"tensorflow-gpu","vulnerableRanges":["<2.5.3",">=2.6.0, <2.6.3",">=2.7.0, <2.7.1"],"patched":["2.5.3","2.6.3","2.7.1"],"from":["GHSA-m4hf-j54p-p353","PYSEC-2022-110"],"provenance":"source"}],"summary":{"text":"The flaw is a type confusion in TensorFlow's shape inference for the ConcatV2 operation, where the axis value is converted into a 32-bit min_rank that the WithRankAtLeast check then compares against a 64-bit bound, allowing the rank validation to be bypassed. An attacker who can supply a crafted input to a ConcatV2 operation can trigger a segfault that denies service to the process, with the attack vector being network-reachable and requiring low privileges and no user interaction.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T21:24:09Z"},"euvd":{"id":"EUVD-2022-0294","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-tensorflow-cve-2021-37675","parents":[{"from":"CVE-2021-37675","to":"CVE-2022-21731","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/core/framework/common_shape_fns.cc"],"commits":["https://github.com/tensorflow/tensorflow/commit/8a793b5d7f59e37ac7f3cd0954a750a2fe76bad4","https://github.com/tensorflow/tensorflow/commit/08d7b00c0a5a20926363849f611729f53f3ec022"],"basis":"rarely changed file"}]},{"from":"CVE-2021-41211","to":"CVE-2022-21731","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/core/framework/common_shape_fns.cc"],"commits":["https://github.com/tensorflow/tensorflow/commit/a0d64445116c43cf46a5666bd4eee28e7a82f244","https://github.com/tensorflow/tensorflow/commit/08d7b00c0a5a20926363849f611729f53f3ec022"],"basis":"rarely changed file"}]}]}}