Skip to content
Heist/ feed
Back to feed
High

Security advisory

Type: advisorySources: OSVCVE: CVE-2021-41221

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.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2021-41221
Confirmed fixed CVEs
Not specified
Updated in this feed
31 Oct 2026, 12:52 UTC · Revision 1

Source evidence

CVE-2021-41221

core-osv · Original source

Published 5 Nov 2021, 23:15 UTC

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.

osv:CVE-2021-41221
Complete source record
{
  "id": "0de08e0b252d11b544924a9ffa04083c2e2458bc50cb434f199c906cc949cd3a",
  "url": "https://osv.dev/vulnerability/CVE-2021-41221",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "CVE-2021-41221",
    "summary": "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.",
    "evidence": "osv:CVE-2021-41221",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2021-41221",
      "aliases": [
        "BIT-tensorflow-2021-41221",
        "CVE-2021-41221",
        "GHSA-cqv6-3phm-hcwx",
        "PYSEC-2021-413",
        "PYSEC-2021-630",
        "PYSEC-2021-828"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/tensorflow/tensorflow",
              "type": "GIT",
              "events": [
                {
                  "introduced": "582c8d236cb079023657287c318ff26adb239002"
                },
                {
                  "fixed": "64918868e2154b06c7479347a59a4230f785e9fa"
                },
                {
                  "introduced": "a4dfb8d1a71385bd6d122e4f27f86dcebb96712d"
                },
                {
                  "fixed": "957590ea15cc03ee2e00fc61934647d54836676f"
                },
                {
                  "introduced": "919f693420e35d00c8d0a42100837ae3718f7927"
                },
                {
                  "fixed": "3aa40c3ce9d16eae296f086bc4ac4d62deb2affc"
                },
                {
                  "introduced": "ce35e5c3a8efdb8161c6a85c8fb9ffb5bbdc9ffd"
                },
                {
                  "last_affected": "ff68385595088304cf772086b9a259a65b007622"
                },
                {
                  "fixed": "af5fcebb37c8b5d71c237f4e59c6477015c78ce6"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.4.0"
                      },
                      {
                        "fixed": "2.4.4"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.5.0"
                      },
                      {
                        "fixed": "2.5.2"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.6.0"
                      },
                      {
                        "fixed": "2.6.1"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:google:tensorflow:2.7.0:rc0:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.7.0-rc0"
                      },
                      {
                        "last_affected": "2.7.0-rc0"
                      }
                    ],
                    "source": "CPE_STRING"
                  },
                  {
                    "cpe": "cpe:2.3:a:google:tensorflow:2.7.0:rc1:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.7.0-rc1"
                      },
                      {
                        "last_affected": "2.7.0-rc1"
                      }
                    ],
                    "source": "CPE_STRING"
                  },
                  {
                    "range": [
                      {
                        "fixed": "af5fcebb37c8b5d71c237f4e59c6477015c78ce6"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "versions": [
            "2.7.0-rc0",
            "2.7.0-rc1",
            "v2.7.0-rc1",
            "v2.4.3",
            "v2.6.0",
            "v2.5.1",
            "v2.7.0-rc0",
            "v2.4.2",
            "v2.5.0",
            "v2.4.1",
            "v2.4.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-41221.json",
            "vanir_signatures": [
              {
                "id": "CVE-2021-41221-0d55eb0b",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "118694546093519178402817787757898241473",
                    "258846801479330369354051197833199152723",
                    "283437646914638091728887841506823151821",
                    "239652795635704487224366929297095596058",
                    "118694546093519178402817787757898241473",
                    "258846801479330369354051197833199152723",
                    "315250839980954442794389400229965781291",
                    "281273899779120340251234867540017516981",
                    "118694546093519178402817787757898241473",
                    "258846801479330369354051197833199152723",
                    "253541768477098468456454063446009678706"
                  ]
                },
                "source": "https://github.com/tensorflow/tensorflow/commit/af5fcebb37c8b5d71c237f4e59c6477015c78ce6",
                "target": {
                  "file": "tensorflow/core/ops/cudnn_rnn_ops_test.cc"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              },
              {
                "id": "CVE-2021-41221-6b13451d",
                "digest": {
                  "length": 923,
                  "function_hash": "202902201092835611437034021854511617419"
                },
                "source": "https://github.com/tensorflow/tensorflow/commit/af5fcebb37c8b5d71c237f4e59c6477015c78ce6",
                "target": {
                  "file": "tensorflow/core/ops/cudnn_rnn_ops_test.cc",
                  "function": "TEST"
                },
                "deprecated": false,
                "signature_type": "Function",
                "signature_version": "v1"
              },
              {
                "id": "CVE-2021-41221-97fa497c",
                "digest": {
                  "length": 929,
                  "function_hash": "304136540262746988534198931519059772696"
                },
                "source": "https://github.com/tensorflow/tensorflow/commit/af5fcebb37c8b5d71c237f4e59c6477015c78ce6",
                "target": {
                  "file": "tensorflow/core/ops/cudnn_rnn_ops_test.cc",
                  "function": "TEST"
                },
                "deprecated": false,
                "signature_type": "Function",
                "signature_version": "v1"
              },
              {
                "id": "CVE-2021-41221-bf482407",
                "digest": {
                  "length": 1066,
                  "function_hash": "66182289958864132325895794462936143042"
                },
                "source": "https://github.com/tensorflow/tensorflow/commit/af5fcebb37c8b5d71c237f4e59c6477015c78ce6",
                "target": {
                  "file": "tensorflow/core/ops/cudnn_rnn_ops_test.cc",
                  "function": "TEST"
                },
                "deprecated": false,
                "signature_type": "Function",
                "signature_version": "v1"
              },
              {
                "id": "CVE-2021-41221-fc1d693d",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "123875540620579454762848304763070508768",
                    "145987571041281447065708213934056822852",
                    "255765073408836349722371678193814315449",
                    "71606848174238972166582519510640422008",
                    "319802517651899723163523400941898362128",
                    "50437515902350039548985297195807307137",
                    "48039668474374917909536629248595790238",
                    "160635530201276953824480718569855529512",
                    "196389132899340221627507251824533212295",
                    "123875540620579454762848304763070508768",
                    "145987571041281447065708213934056822852",
                    "255765073408836349722371678193814315449",
                    "71606848174238972166582519510640422008",
                    "319802517651899723163523400941898362128",
                    "50437515902350039548985297195807307137",
                    "251289243987824787917355713817453569710",
                    "145451793578567446919497572074278921923",
                    "201804582758592530163778121090951495598",
                    "37581804411958549139825504814327340783",
                    "251675699549679527107647937379157442183",
                    "57996396148105329571288912809518158194",
                    "304769490380883915301941841283663411189",
                    "334370031726148448186845603596904053509",
                    "160635530201276953824480718569855529512",
                    "196389132899340221627507251824533212295",
                    "183568529671463780385030105081443204417",
                    "203809736805669869767923346918929742954",
                    "156036236433352584483844332244518604211",
                    "291239982531107127469776900706612765285"
                  ]
                },
                "source": "https://github.com/tensorflow/tensorflow/commit/af5fcebb37c8b5d71c237f4e59c6477015c78ce6",
                "target": {
                  "file": "tensorflow/core/ops/cudnn_rnn_ops.cc"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              }
            ],
            "vanir_signatures_modified": "2026-10-20T14:28:21Z"
          }
        }
      ],
      "modified": "2026-10-20T14:28:21.963551108Z",
      "provider": "osv",
      "references": [
        "https://github.com/tensorflow/tensorflow/commit/af5fcebb37c8b5d71c237f4e59c6477015c78ce6",
        "https://github.com/tensorflow/tensorflow/security/advisories/GHSA-cqv6-3phm-hcwx"
      ],
      "provider_metadata": {}
    },
    "related_cves": [
      {
        "value": "CVE-2021-41221",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 389047,
  "published_at": "2021-11-05T23:15:08.413+00:00"
}