CVE-2021-41221
Access to invalid memory during shape inference in `Cudnn*` ops
TensorFlow is an open source platform for machine learning. In affected versions the shape inference code for the Cudnn* operations in TensorFlow can be tricked into accessing invalid memory, via a heap buffer overflow. This occurs because the ranks of the input, input_h and input_c parameters are not validated, but code assumes they have certain values. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.
Attack profile
How easy it is to exploit
- Attack vector
- Local
- Complexity
- Low
- Privileges needed
- Low
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Exploit likelihood
What each source reports
CVE List Score used 7.8
Access to invalid memory during shape inference in `Cudnn*` ops
TensorFlow is an open source platform for machine learning. In affected versions the shape inference code for the Cudnn* operations in TensorFlow can be tricked into accessing invalid memory, via a heap buffer overflow. This occurs because the ranks of the input, input_h and input_c parameters are not validated, but code assumes they have certain values. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.
- Record
CVE-2021-41221- CVSS 3.1
- 7.8 High
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-120
- Updated
- 2026-11-02
EUVDEUVD-2021-0443 7.8
TensorFlow is an open source platform for machine learning. In affected versions the shape inference code for the Cudnn* operations in TensorFlow can be tricked into accessing invalid memory, via a heap buffer overflow. This occurs because the ranks of the input, input_h and input_c parameters are not validated, but code assumes they have certain values. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.
- Record
EUVD-2021-0443- CVSS 3.1
- 7.8 High
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-03
GitHub AdvisoriesGHSA-cqv6-3phm-hcwx 7.8
Access to invalid memory during shape inference in `Cudnn*` ops
Impact
The shape inference code for the Cudnn* operations in TensorFlow can be tricked into accessing invalid memory, via a heap buffer overflow:
import tensorflow as tf
@tf.function
def func():
return tf.raw_ops.CudnnRNNV3(
input=[0.1, 0.1],
input_h=[0.5],
input_c=[0.1, 0.1, 0.1],
params=[0.5, 0.5],
sequence_lengths=[-1, 0, 1])
func()
This occurs because the ranks of the input, input_h and input_c parameters are not validated, but code assumes they have certain values:
auto input_shape = c->input(0);
auto input_h_shape = c->input(1);
auto seq_length = c->Dim(input_shape, 0);
auto batch_size = c->Dim(input_shape, 1); // assumes rank >= 2
auto num_units = c->Dim(input_h_shape, 2); // assumes rank >= 3
Patches
We have patched the issue in GitHub commit af5fcebb37c8b5d71c237f4e59c6477015c78ce6.
The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.
For more information
Please consult our security guide for more information regarding the security model and how to contact us with issues and questions.
Attribution
This vulnerability has been reported by members of the Aivul Team from Qihoo 360.
- Record
GHSA-cqv6-3phm-hcwx- CVSS 3.1
- 7.8 High
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-120, CWE-787
- Updated
- 2026-11-02
NVD 7.8
TensorFlow is an open source platform for machine learning. In affected versions the shape inference code for the Cudnn* operations in TensorFlow can be tricked into accessing invalid memory, via a heap buffer overflow. This occurs because the ranks of the input, input_h and input_c parameters are not validated, but code assumes they have certain values. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.
- Record
CVE-2021-41221- CVSS 3.1
- 7.8 High
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - CVSS 2.0
- 4.6 Medium
AV:L/AC:L/Au:N/C:P/I:P/A:P - Weakness
- CWE-120, CWE-787
- Updated
- 2026-11-02
OSV 7.8
TensorFlow is an open source platform for machine learning. In affected versions the shape inference code for the Cudnn* operations in TensorFlow can be tricked into accessing invalid memory, via a heap buffer overflow. This occurs because the ranks of the input, input_h and input_c parameters are not validated, but code assumes they have certain values. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.
- Record
CVE-2021-41221- CVSS 3.1
- 7.8 High
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
OSVGHSA-cqv6-3phm-hcwx 7.8
Access to invalid memory during shape inference in `Cudnn*` ops
Impact
The shape inference code for the Cudnn* operations in TensorFlow can be tricked into accessing invalid memory, via a heap buffer overflow:
import tensorflow as tf
@tf.function
def func():
return tf.raw_ops.CudnnRNNV3(
input=[0.1, 0.1],
input_h=[0.5],
input_c=[0.1, 0.1, 0.1],
params=[0.5, 0.5],
sequence_lengths=[-1, 0, 1])
func()
This occurs because the ranks of the input, input_h and input_c parameters are not validated, but code assumes they have certain values:
auto input_shape = c->input(0);
auto input_h_shape = c->input(1);
auto seq_length = c->Dim(input_shape, 0);
auto batch_size = c->Dim(input_shape, 1); // assumes rank >= 2
auto num_units = c->Dim(input_h_shape, 2); // assumes rank >= 3
Patches
We have patched the issue in GitHub commit af5fcebb37c8b5d71c237f4e59c6477015c78ce6.
The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.
For more information
Please consult our security guide for more information regarding the security model and how to contact us with issues and questions.
Attribution
This vulnerability has been reported by members of the Aivul Team from Qihoo 360.
- Record
GHSA-cqv6-3phm-hcwx- CVSS 3.1
- 7.8 High
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-120, CWE-787
- Updated
- 2026-11-02
Show 5 moreShow less
OSVBIT-tensorflow-2021-41221No score
Access to invalid memory during shape inference in `Cudnn*` ops
TensorFlow is an open source platform for machine learning. In affected versions the shape inference code for the Cudnn* operations in TensorFlow can be tricked into accessing invalid memory, via a heap buffer overflow. This occurs because the ranks of the input, input_h and input_c parameters are not validated, but code assumes they have certain values. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.
- Record
BIT-tensorflow-2021-41221- Updated
- 2026-11-02
OSVopenSUSE-SU-2024:12116-1No score
tensorflow-lite-2.9.1-1.1 on GA media
These are all security issues fixed in the tensorflow-lite-2.9.1-1.1 package on the GA media of openSUSE Tumbleweed.
- Record
openSUSE-SU-2024:12116-1- Updated
- 2026-11-02
OSVPYSEC-2021-413No score
TensorFlow is an open source platform for machine learning. In affected versions the shape inference code for the Cudnn* operations in TensorFlow can be tricked into accessing invalid memory, via a heap buffer overflow. This occurs because the ranks of the input, input_h and input_c parameters are not validated, but code assumes they have certain values. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.
- Record
PYSEC-2021-413- Updated
- 2026-11-02
OSVPYSEC-2021-630No score
TensorFlow is an open source platform for machine learning. In affected versions the shape inference code for the Cudnn* operations in TensorFlow can be tricked into accessing invalid memory, via a heap buffer overflow. This occurs because the ranks of the input, input_h and input_c parameters are not validated, but code assumes they have certain values. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.
- Record
PYSEC-2021-630- Updated
- 2026-11-02
OSVPYSEC-2021-828No score
TensorFlow is an open source platform for machine learning. In affected versions the shape inference code for the Cudnn* operations in TensorFlow can be tricked into accessing invalid memory, via a heap buffer overflow. This occurs because the ranks of the input, input_h and input_c parameters are not validated, but code assumes they have certain values. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.
- Record
PYSEC-2021-828- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
tensorflowPyPI | 2.6.0 up to 2.6.1 | 2.6.1 |
tensorflowPyPI | 2.5.0 up to 2.5.2 | 2.5.2 |
tensorflowPyPI | before 2.4.4 | 2.4.4 |
tensorflow-cpuPyPI | 2.6.0 up to 2.6.1 | 2.6.1 |
tensorflow-cpuPyPI | 2.5.0 up to 2.5.2 | 2.5.2 |
tensorflow-cpuPyPI | before 2.4.4 | 2.4.4 |
tensorflow-gpuPyPI | 2.6.0 up to 2.6.1 | 2.6.1 |
tensorflow-gpuPyPI | 2.5.0 up to 2.5.2 | 2.5.2 |
tensorflow-gpuPyPI | before 2.4.4 | 2.4.4 |
tensorflowBitnami | 2.4.0 up to 2.4.4, 2.5.0 up to 2.5.2, 2.6.0 up to 2.6.1 | 2.4.42.5.22.6.1 |
Show 9 moreShow less
| Package | Affected | Fixed |
|---|---|---|
tensorflowPyPI | 2.5.0 up to 2.5.2, plus listed versions 2.5.1 | 2.5.2 |
tensorflowPyPI | before 2.4.4, plus listed versions 0.12.00.12.11.0.01.0.11.1.0 Show 45 moreShow less1.10.01.10.11.11.01.12.01.12.21.12.31.13.11.13.21.14.01.15.01.15.21.15.31.15.41.15.51.2.01.2.11.3.01.4.01.4.11.5.01.5.11.6.01.7.01.7.11.8.01.9.02.0.02.0.12.0.22.0.32.0.42.1.02.1.12.1.22.1.32.1.42.2.02.2.12.2.22.2.32.3.02.3.12.3.22.3.32.3.4 | 2.4.4 |
tensorflow-cpuPyPI | 2.5.0 up to 2.5.2, plus listed versions 2.5.1 | 2.5.2 |
tensorflow-cpuPyPI | before 2.4.4, plus listed versions 1.15.02.1.02.1.12.1.22.1.3 Show 14 moreShow less2.1.42.2.02.2.12.2.22.2.32.3.02.3.12.3.22.3.32.3.42.4.02.4.12.4.22.4.3 | 2.4.4 |
tensorflow-gpuPyPI | 2.5.0 up to 2.5.2, plus listed versions 2.5.1 | 2.5.2 |
tensorflow-gpuPyPI | before 2.4.4, plus listed versions 0.12.00.12.11.0.01.0.11.1.0 Show 45 moreShow less1.10.01.10.11.11.01.12.01.12.21.12.31.13.11.13.21.14.01.15.01.15.21.15.31.15.41.15.51.2.01.2.11.3.01.4.01.4.11.5.01.5.11.6.01.7.01.7.11.8.01.9.02.0.02.0.12.0.22.0.32.0.42.1.02.1.12.1.22.1.32.1.42.2.02.2.12.2.22.2.32.3.02.3.12.3.22.3.32.3.4 | 2.4.4 |
tensorflowPyPI | before 2.4.4, 2.5.0 up to 2.5.2, 2.6.0 up to 2.6.1, 2.7.0rc0 up to 2.7.0, plus listed versions 0.12.00.12.11.0.01.0.11.1.0 Show 45 moreShow less1.10.01.10.11.11.01.12.01.12.21.12.31.13.11.13.21.14.01.15.01.15.21.15.31.15.41.15.51.2.01.2.11.3.01.4.01.4.11.5.01.5.11.6.01.7.01.7.11.8.01.9.02.0.02.0.12.0.22.0.32.0.42.1.02.1.12.1.22.1.32.1.42.2.02.2.0rc02.2.0rc12.2.0rc22.2.0rc32.2.0rc42.2.12.2.22.2.3 | 2.4.42.5.22.6.12.7.0 |
tensorflow-cpuPyPI | before 2.4.4, 2.5.0 up to 2.5.2, 2.6.0 up to 2.6.1, 2.7.0rc0 up to 2.7.0, plus listed versions 1.15.02.1.02.1.12.1.22.1.3 Show 16 moreShow less2.1.42.2.02.2.12.2.22.2.32.3.02.3.12.3.22.3.32.3.42.4.02.4.12.4.22.4.32.5.12.7.0rc1 | 2.4.42.5.22.6.12.7.0 |
tensorflow-gpuPyPI | before 2.4.4, 2.5.0 up to 2.5.2, 2.6.0 up to 2.6.1, 2.7.0rc0 up to 2.7.0, plus listed versions 0.12.00.12.11.0.01.0.11.1.0 Show 45 moreShow less1.10.01.10.11.11.01.12.01.12.21.12.31.13.11.13.21.14.01.15.01.15.21.15.31.15.41.15.51.2.01.2.11.3.01.4.01.4.11.5.01.5.11.6.01.7.01.7.11.8.01.9.02.0.02.0.12.0.22.0.32.0.42.1.02.1.12.1.22.1.32.1.42.2.02.2.12.2.22.2.32.3.02.3.12.3.22.3.32.3.4 | 2.4.42.5.22.6.12.7.0 |
History
| Recorded | Changed | Sources |
|---|---|---|
| facts | ||
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2021-41221 is a high vulnerability (CVSS 7.8) in Google Tensorflow, published November 5, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.22%, the 12th percentile. Fixed in tensorflow 2.6.1.
References
github.com/tensorflow/tensorflow/security/advisories/GHSA-cqv6-3phm-hcwx
github.com/tensorflow/tensorflow/commit/af5fcebb37c8b5d71c237f4e59c6477015c78ce6
nvd.nist.gov/vuln/detail/CVE-2021-41221
github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2021-630.yaml
github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2021-828.yaml
github.com/pypa/advisory-database/tree/main/vulns/tensorflow/PYSEC-2021-413.yaml
Show 165 moreShow less
github.com/advisories/GHSA-cqv6-3phm-hcwx
github.com/tensorflow/tensorflow
suse.com/security/cve/CVE-2020-10531
suse.com/security/cve/CVE-2020-15190
suse.com/security/cve/CVE-2020-15191
suse.com/security/cve/CVE-2020-15194
suse.com/security/cve/CVE-2020-15202
suse.com/security/cve/CVE-2020-15203
suse.com/security/cve/CVE-2020-15204
suse.com/security/cve/CVE-2020-15205
suse.com/security/cve/CVE-2020-15206
suse.com/security/cve/CVE-2020-15207
suse.com/security/cve/CVE-2020-15208
suse.com/security/cve/CVE-2020-15209
suse.com/security/cve/CVE-2020-26266
suse.com/security/cve/CVE-2020-26270
suse.com/security/cve/CVE-2021-22922
suse.com/security/cve/CVE-2021-22923
suse.com/security/cve/CVE-2021-22926
suse.com/security/cve/CVE-2021-37635
suse.com/security/cve/CVE-2021-37636
suse.com/security/cve/CVE-2021-37637
suse.com/security/cve/CVE-2021-37638
suse.com/security/cve/CVE-2021-37639
suse.com/security/cve/CVE-2021-37640
suse.com/security/cve/CVE-2021-37641
suse.com/security/cve/CVE-2021-37642
suse.com/security/cve/CVE-2021-37643
suse.com/security/cve/CVE-2021-37644
suse.com/security/cve/CVE-2021-37645
suse.com/security/cve/CVE-2021-37646
suse.com/security/cve/CVE-2021-37647
suse.com/security/cve/CVE-2021-37648
suse.com/security/cve/CVE-2021-37649
suse.com/security/cve/CVE-2021-37650
suse.com/security/cve/CVE-2021-37651
suse.com/security/cve/CVE-2021-37652
suse.com/security/cve/CVE-2021-37653
suse.com/security/cve/CVE-2021-37654
suse.com/security/cve/CVE-2021-37655
suse.com/security/cve/CVE-2021-37656
suse.com/security/cve/CVE-2021-37657
suse.com/security/cve/CVE-2021-37658
suse.com/security/cve/CVE-2021-37659
suse.com/security/cve/CVE-2021-37660
suse.com/security/cve/CVE-2021-37661
suse.com/security/cve/CVE-2021-37662
suse.com/security/cve/CVE-2021-37663
suse.com/security/cve/CVE-2021-37664
suse.com/security/cve/CVE-2021-37665
suse.com/security/cve/CVE-2021-37666
suse.com/security/cve/CVE-2021-37667
suse.com/security/cve/CVE-2021-37668
suse.com/security/cve/CVE-2021-37669
suse.com/security/cve/CVE-2021-37670
suse.com/security/cve/CVE-2021-37671
suse.com/security/cve/CVE-2021-37672
suse.com/security/cve/CVE-2021-37673
suse.com/security/cve/CVE-2021-37674
suse.com/security/cve/CVE-2021-37675
suse.com/security/cve/CVE-2021-37676
suse.com/security/cve/CVE-2021-37677
suse.com/security/cve/CVE-2021-37678
suse.com/security/cve/CVE-2021-37679
suse.com/security/cve/CVE-2021-37680
suse.com/security/cve/CVE-2021-37681
suse.com/security/cve/CVE-2021-37682
suse.com/security/cve/CVE-2021-37683
suse.com/security/cve/CVE-2021-37684
suse.com/security/cve/CVE-2021-37685
suse.com/security/cve/CVE-2021-37686
suse.com/security/cve/CVE-2021-37687
suse.com/security/cve/CVE-2021-37688
suse.com/security/cve/CVE-2021-37689
suse.com/security/cve/CVE-2021-37690
suse.com/security/cve/CVE-2021-37691
suse.com/security/cve/CVE-2021-37692
suse.com/security/cve/CVE-2021-41195
suse.com/security/cve/CVE-2021-41196
suse.com/security/cve/CVE-2021-41197
suse.com/security/cve/CVE-2021-41198
suse.com/security/cve/CVE-2021-41199
suse.com/security/cve/CVE-2021-41200
suse.com/security/cve/CVE-2021-41201
suse.com/security/cve/CVE-2021-41202
suse.com/security/cve/CVE-2021-41203
suse.com/security/cve/CVE-2021-41204
suse.com/security/cve/CVE-2021-41205
suse.com/security/cve/CVE-2021-41206
suse.com/security/cve/CVE-2021-41207
suse.com/security/cve/CVE-2021-41208
suse.com/security/cve/CVE-2021-41209
suse.com/security/cve/CVE-2021-41210
suse.com/security/cve/CVE-2021-41211
suse.com/security/cve/CVE-2021-41212
suse.com/security/cve/CVE-2021-41213
suse.com/security/cve/CVE-2021-41214
suse.com/security/cve/CVE-2021-41215
suse.com/security/cve/CVE-2021-41216
suse.com/security/cve/CVE-2021-41217
suse.com/security/cve/CVE-2021-41218
suse.com/security/cve/CVE-2021-41219
suse.com/security/cve/CVE-2021-41220
suse.com/security/cve/CVE-2021-41221
suse.com/security/cve/CVE-2021-41222
suse.com/security/cve/CVE-2021-41223
suse.com/security/cve/CVE-2021-41224
suse.com/security/cve/CVE-2021-41225
suse.com/security/cve/CVE-2021-41226
suse.com/security/cve/CVE-2021-41227
suse.com/security/cve/CVE-2021-41228
suse.com/security/cve/CVE-2022-21725
suse.com/security/cve/CVE-2022-21726
suse.com/security/cve/CVE-2022-21727
suse.com/security/cve/CVE-2022-21728
suse.com/security/cve/CVE-2022-21729
suse.com/security/cve/CVE-2022-21730
suse.com/security/cve/CVE-2022-21731
suse.com/security/cve/CVE-2022-21732
suse.com/security/cve/CVE-2022-21733
suse.com/security/cve/CVE-2022-21734
suse.com/security/cve/CVE-2022-21735
suse.com/security/cve/CVE-2022-21736
suse.com/security/cve/CVE-2022-21737
suse.com/security/cve/CVE-2022-21738
suse.com/security/cve/CVE-2022-21739
suse.com/security/cve/CVE-2022-21740
suse.com/security/cve/CVE-2022-21741
suse.com/security/cve/CVE-2022-23557
suse.com/security/cve/CVE-2022-23558
suse.com/security/cve/CVE-2022-23559
suse.com/security/cve/CVE-2022-23560
suse.com/security/cve/CVE-2022-23561
suse.com/security/cve/CVE-2022-23562
suse.com/security/cve/CVE-2022-23563
suse.com/security/cve/CVE-2022-23564
suse.com/security/cve/CVE-2022-23565
suse.com/security/cve/CVE-2022-23566
suse.com/security/cve/CVE-2022-23567
suse.com/security/cve/CVE-2022-23568
suse.com/security/cve/CVE-2022-23569
suse.com/security/cve/CVE-2022-23570
suse.com/security/cve/CVE-2022-23571
suse.com/security/cve/CVE-2022-23572
suse.com/security/cve/CVE-2022-23573
suse.com/security/cve/CVE-2022-23574
suse.com/security/cve/CVE-2022-23575
suse.com/security/cve/CVE-2022-23576
suse.com/security/cve/CVE-2022-23577
suse.com/security/cve/CVE-2022-23578
suse.com/security/cve/CVE-2022-23579
suse.com/security/cve/CVE-2022-23580
suse.com/security/cve/CVE-2022-23581
suse.com/security/cve/CVE-2022-23582
suse.com/security/cve/CVE-2022-23583
suse.com/security/cve/CVE-2022-23584
suse.com/security/cve/CVE-2022-23585
suse.com/security/cve/CVE-2022-23586
suse.com/security/cve/CVE-2022-23587
suse.com/security/cve/CVE-2022-23588
suse.com/security/cve/CVE-2022-23589
suse.com/security/cve/CVE-2022-23590
suse.com/security/cve/CVE-2022-23591
suse.com/security/cve/CVE-2022-23594
suse.com/security/cve/CVE-2022-23595
Left out here: 33 versions. The JSON record has them.