CVE-2021-37647: TensorFlow - Null Pointer Dereference
- Cve: CVE-2021-37647
- Name: TensorFlow - Null Pointer Dereference
- Description: TensorFlow is an end-to-end open source platform for machine learning. When a user does not supply arguments that determine a valid sparse tensor, `tf.raw_ops.SparseTensorSliceDataset` implementation can be made to dereference a null pointer. The [implementation](https://github.com/tensorflow/tensorflow/blob/8d72537c6abf5a44103b57b9c2e22c14f5f49698/tensorflow/core/kernels/data/sparse_tensor_slice_dataset_op.cc#L240-L251) has some argument validation but fails to consider the case when either `indices` or `values` are provided for an empty sparse tensor when the other is not. If `indices` is empty, then [code that performs validation](https://github.com/tensorflow/tensorflow/blob/8d72537c6abf5a44103b57b9c2e22c14f5f49698/tensorflow/core/kernels/data/sparse_tensor_slice_dataset_op.cc#L260-L261) (i.e., checking that the indices are monotonically increasing) results in a null pointer dereference. If `indices` as provided by the user is empty, then `indices` in the C++ code above is backed by an empty `std::vector`, hence calling `indices->dim_size(0)` results in null pointer dereferencing (same as calling `std::vector::at()` on an empty vector). We have patched the issue in GitHub commit 02cc160e29d20631de3859c6653184e3f876b9d7. 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.
- Impact: Attackers can cause application crashes or undefined behavior, potentially leading to denial of service or stability issues.
- Remediation: Update to TensorFlow 2.6.0 or later, or apply the patch from commit 02cc160e29d20631de3859c6653184e3f876b9d7 to affected versions.
- Vulnerability type: null_pointer_dereference
- Vulnerability impact: denial_of_service
- Requirement type: none
- Labels source: projectdiscovery
- Severity: medium
- Cvss score: 5.5
- Cvss vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
- Epss score: 0.0016
- Epss percentile: 0.05065
- Assignee: [email protected]
- Published at: 2021-08-12T19:15:08Z
- Age in days: 1930
- Modified at: 2026-06-17T04:00:54Z
- Patch available: yes
- References total: 2
- Products total: 1
- Oss: yes
- Projects total: 1
- Advisory url: https://nvd.nist.gov/vuln/detail/CVE-2021-37647
- Nvd status: modified
- Checked, none or zero: known exploited entries, nuclei templates, public exploits total, public exploits capped, public exploits, rejected by nvd
- Not known: requirements, hackerone
Cwe
| Id | Name |
|---|---|
| CWE-476 | NULL Pointer Dereference |
References
| Url | Source | Tags |
|---|---|---|
| https://github.com/tensorflow/tensorflow/commit/02cc160e29d20631de3859c6653184e3f876b9d7 | nvd | Patch, Third Party Advisory |
| https://github.com/tensorflow/tensorflow/security/advisories/GHSA-c5x2-p679-95wc | nvd | Third Party Advisory |
Products
| Product | Affected | Platform bound | Sources | Url |
|---|---|---|---|---|
| google:tensorflow | = 2.6.0 rc0; = 2.6.0 rc1; = 2.6.0 rc2; = 2.5.0; >= 2.4.0, < 2.4.3; >= 2.3.0, < 2.3.4 | no | nvd | /v1/products/google/tensorflow |
Projects
| Repository | Link kinds | Indexed | Url |
|---|---|---|---|
| tensorflow/tensorflow | commit, fix, package, security_advisory | yes | /v1/repositories/tensorflow/tensorflow |
Index
- Repositories: 340
- Repositories high signal: 133
- Packages: 3
Exploitation
- Authentication required: yes
- Checked, none or zero: known exploited, known exploited by, exploitation seen, public exploit, public exploit count, initial access, remote
- Not known: known exploited since, vulncheck known exploited since, public exploit first date, nuclei template, initial access since, hackerone reports, exposed hosts