CVE-2021-37690
MEDIUM 6.6CVSS 3.1Use after free and segfault in shape inference functions
TensorFlow is an end-to-end open source platform for machine learning. In affected versions when running shape functions, some functions (such as MutableHashTableShape) produce extra output information in the form of a ShapeAndType struct. The shapes embedded in this struct are owned by an inference context that is cleaned up almost immediately; if the upstream code attempts to access this shape information, it can trigger a segfault. ShapeRefiner is mitigating this for normal output shapes by cloning them (and thus putting the newly created shape under ownership of an inference context that will not die), but we were not doing the same for shapes and types. This commit fixes that by doing similar logic on output shapes and types. We have patched the issue in GitHub commit ee119d4a498979525046fba1c3dd3f13a039fbb1. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4, as these are also affected and still in supported range.
- Published
- 13 Aug 2021
- Last modified
- 8 Jul 2026
- Assigned by
- security-advisories@github.com
- NVD status
- Modified
- Weakness
- CWE-416
- Also known as
- BIT-tensorflow-2021-37690GHSA-3hxh-8cp2-g4hgPYSEC-2021-312PYSEC-2021-603PYSEC-2021-801
- Sources
- NVDJSONOSV GHSA-3hxh-8cp2-g4hgJSONOSV PYSEC-2021-312JSONOSV PYSEC-2021-603JSONOSV PYSEC-2021-801JSON
Scores
| Source | Scored by | Version | Score | Vector / decision |
|---|---|---|---|---|
| OSV | GitHub | CVSS 4.0 | CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:H/SC:N/SI:N/SA:N | |
| NVD | security-advisories@github.com (Secondary) | CVSS 3.1 | MEDIUM 6.6 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:H |
| NVD | nvd@nist.gov (Primary) | CVSS 3.1 | MEDIUM 6.6 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:H |
| OSV | GitHub | CVSS 3.1 | MEDIUM 6.6 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:H |
| NVD | nvd@nist.gov (Primary) | CVSS 2.0 | MEDIUM 4.6 | AV:L/AC:L/Au:N/C:P/I:P/A:P |
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| NVD | tensorflowcpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:* |
>= 2.3.0, < 2.3.4 | 2.3.4 | |
| NVD | tensorflowcpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:* |
>= 2.4.0, < 2.4.3 | 2.4.3 | |
| NVD | tensorflowcpe:2.3:a:google:tensorflow:2.5.0:*:*:*:*:*:*:* |
= 2.5.0 | ||
| NVD | tensorflowcpe:2.3:a:google:tensorflow:2.6.0:rc0:*:*:*:*:*:* |
= 2.6.0 | ||
| NVD | tensorflowcpe:2.3:a:google:tensorflow:2.6.0:rc1:*:*:*:*:*:* |
= 2.6.0 | ||
| NVD | tensorflowcpe:2.3:a:google:tensorflow:2.6.0:rc2:*:*:*:*:*:* |
= 2.6.0 | ||
| OSV | PyPI | tensorflow | < 2.3.4 | 2.3.4 |
| OSV | PyPI | tensorflow | >= 2.4.0, < 2.4.3 | 2.4.3 |
| OSV | PyPI | tensorflow | >= 2.5.0, < 2.5.1 | 2.5.1 |
| OSV | PyPI | tensorflow-cpu | < 2.3.4 | 2.3.4 |
| OSV | PyPI | tensorflow-cpu | >= 2.4.0, < 2.4.3 | 2.4.3 |
| OSV | PyPI | tensorflow-cpu | >= 2.5.0, < 2.5.1 | 2.5.1 |
| OSV | PyPI | tensorflow-gpu | < 2.3.4 | 2.3.4 |
| OSV | PyPI | tensorflow-gpu | >= 2.4.0, < 2.4.3 | 2.4.3 |
| OSV | PyPI | tensorflow-gpu | >= 2.5.0, < 2.5.1 | 2.5.1 |
| OSV | PyPI | tensorflow | >= 2.3.0, < 2.3.4; >= 2.4.0, < 2.4.3 | 2.3.4, 2.4.3 |
| OSV | PyPI | tensorflow-cpu | >= 2.3.0, < 2.3.4; >= 2.4.0, < 2.4.3 | 2.3.4, 2.4.3 |
| OSV | PyPI | tensorflow-gpu | >= 2.3.0, < 2.3.4; >= 2.4.0, < 2.4.3 | 2.3.4, 2.4.3 |
References
- https://github.com/tensorflow/tensorflow/commit/ee119d4a498979525046fba1c3dd3f13a039fbb1 · Patch, Third Party Advisory, WEB, FIX
- https://github.com/tensorflow/tensorflow/security/advisories/GHSA-3hxh-8cp2-g4hg · Third Party Advisory, WEB, ADVISORY
- https://nvd.nist.gov/vuln/detail/CVE-2021-37690 · ADVISORY
- https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2021-603.yaml · WEB
- https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2021-801.yaml · WEB
- https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow/PYSEC-2021-312.yaml · WEB
- https://github.com/tensorflow/tensorflow · PACKAGE
History
- 25 Nov 2026 20:33 UTC · NVD: first stored (published 13 Aug 2021)
- 25 Nov 2026 20:12 UTC · OSV: first stored (published 13 Aug 2021)
- 25 Nov 2026 20:12 UTC · OSV: first stored (published 13 Aug 2021)
- 25 Nov 2026 20:12 UTC · OSV: first stored (published 13 Aug 2021)
- 25 Nov 2026 20:11 UTC · OSV: first stored (published 25 Aug 2021)