Track vulnerabilities like this one.
Sign up free to get alerted when software you use is affected.
7.1
CVE-2022-21731: TensorFlow Machine Learning Framework: Denial of Service Attack
CVE-2022-21731 · published 4 years ago
Summary
TensorFlow's shape inference can be used to crash the system, causing it to become unresponsive. This issue affects users of TensorFlow versions 2.5.0 and later, including versions 2.7.1, 2.6.3, and 2.5.3. To stay secure, update to the latest version, 2.8.0, or apply the patch to the affected versions.
What to do
- Update google inc. tensorflow to version 2.5.3.
- Update google inc. tensorflow to version 2.6.3.
- Update google inc. tensorflow to version 2.7.1.
- Update google tensorflow-gpu to version 2.5.3.
- Update google tensorflow-gpu to version 2.6.3.
- Update google tensorflow-gpu to version 2.7.1.
- Update google inc. tensorflow-cpu to version 2.5.3.
- Update google inc. tensorflow-cpu to version 2.6.3.
- Update google inc. tensorflow-cpu to version 2.7.1.
Affected software
| Ecosystem | Vendor | Product | Affected versions |
|---|---|---|---|
| pip | google inc. | tensorflow |
< 2.5.3 >= 2.6.0, < 2.6.3 2.7.0 Fix: upgrade to 2.5.3
|
| pip | tensorflow-gpu |
< 2.5.3 >= 2.6.0, < 2.6.3 2.7.0 Fix: upgrade to 2.5.3
|
|
| pip | google inc. | tensorflow-cpu |
< 2.5.3 >= 2.6.0, < 2.6.3 2.7.0 Fix: upgrade to 2.5.3
|
| – | tensorflow |
<= 2.5.2 >= 2.6.0, <= 2.6.2 2.7.0 cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:* |
Original advisory text
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.
References
- https://github.com/tensorflow/tensorflow/blob/5100e359aef5c8021f2e71c7b986420b85... URL
- https://nvd.nist.gov/vuln/detail/CVE-2022-21731 Vendor Advisory
- https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2...
- https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2...
- https://github.com/advisories/GHSA-m4hf-j54p-p353
- https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/21xxx/CVE-2022-21731... Vendor Advisory
- https://github.com/tensorflow/tensorflow/blob/5100e359aef5c8021f2e71c7b986420b85... URL
- https://github.com/tensorflow/tensorflow/security/advisories/GHSA-m4hf-j54p-p353 Vendor Advisory
- https://github.com/tensorflow/tensorflow/commit/08d7b00c0a5a20926363849f611729f5... Patch
Internet-facing
60 days
Internal
At next upgrade
- Not known to be exploited
- Needs hands-on effort to exploit
- Gives an attacker partial control
Type
CWE-754Improper Check for Unusual or Exceptional Conditions
CWE-843Type Confusion
Timeline
Published3 Feb 2022
Updated3 Nov 2026
First seen6 Mar 2026
Track software like this
Free during beta