Skip to content
Heist/ feed
Back to feed
High

Security advisory

Type: advisorySources: OSVCVE: CVE-2021-41219

TensorFlow is an open source platform for machine learning. In affected versions the code for sparse matrix multiplication is vulnerable to undefined behavior via binding a reference to `nullptr`. This occurs whenever the dimensions of `a` or `b` are 0 or less. In the case on one of these is 0, an empty output tensor should be allocated (to conserve the invariant that output tensors are always allocated when the operation is successful) but nothing should be written to it (that is, we should return early from the kernel implementation). Otherwise, attempts to write to this empty tensor would result in heap OOB access. 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-41219
Confirmed fixed CVEs
Not specified
Updated in this feed
31 Oct 2026, 12:40 UTC · Revision 1

Source evidence

CVE-2021-41219

core-osv · Original source

Published 5 Nov 2021, 21:15 UTC

TensorFlow is an open source platform for machine learning. In affected versions the code for sparse matrix multiplication is vulnerable to undefined behavior via binding a reference to `nullptr`. This occurs whenever the dimensions of `a` or `b` are 0 or less. In the case on one of these is 0, an empty output tensor should be allocated (to conserve the invariant that output tensors are always allocated when the operation is successful) but nothing should be written to it (that is, we should return early from the kernel implementation). Otherwise, attempts to write to this empty tensor would result in heap OOB access. 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-41219
Complete source record
{
  "id": "5d0a0c23a9301734a5f5f9950c729b5db52f9d3bb0bad4eae70546e454b744d3",
  "url": "https://osv.dev/vulnerability/CVE-2021-41219",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "CVE-2021-41219",
    "summary": "TensorFlow is an open source platform for machine learning. In affected versions the code for sparse matrix multiplication is vulnerable to undefined behavior via binding a reference to `nullptr`. This occurs whenever the dimensions of `a` or `b` are 0 or less. In the case on one of these is 0, an empty output tensor should be allocated (to conserve the invariant that output tensors are always allocated when the operation is successful) but nothing should be written to it (that is, we should return early from the kernel implementation). Otherwise, attempts to write to this empty tensor would result in heap OOB access. 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-41219",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2021-41219",
      "aliases": [
        "BIT-tensorflow-2021-41219",
        "CVE-2021-41219",
        "GHSA-4f99-p9c2-3j8x",
        "PYSEC-2021-411",
        "PYSEC-2021-628",
        "PYSEC-2021-826"
      ],
      "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": "0"
                },
                {
                  "fixed": "64918868e2154b06c7479347a59a4230f785e9fa"
                },
                {
                  "introduced": "a4dfb8d1a71385bd6d122e4f27f86dcebb96712d"
                },
                {
                  "fixed": "957590ea15cc03ee2e00fc61934647d54836676f"
                },
                {
                  "introduced": "919f693420e35d00c8d0a42100837ae3718f7927"
                },
                {
                  "last_affected": "919f693420e35d00c8d0a42100837ae3718f7927"
                },
                {
                  "fixed": "e6cf28c72ba2eb949ca950d834dd6d66bb01cfae"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "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:2.6.0:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.6.0"
                      },
                      {
                        "last_affected": "2.6.0"
                      }
                    ],
                    "source": "CPE_STRING"
                  },
                  {
                    "range": [
                      {
                        "fixed": "e6cf28c72ba2eb949ca950d834dd6d66bb01cfae"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "versions": [
            "2.6.0",
            "v2.4.3",
            "v2.6.0",
            "v2.5.1",
            "v2.4.2",
            "v2.5.0",
            "v2.4.1",
            "v2.4.0",
            "v2.4.0-rc4",
            "v2.4.0-rc3",
            "v2.4.0-rc2",
            "v2.4.0-rc1",
            "v2.4.0-rc0",
            "v1.12.1",
            "v1.9.0-rc2",
            "v1.6.0-rc1",
            "v1.1.0-rc2",
            "v1.1.0-rc1",
            "0.6.0",
            "0.5.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-41219.json",
            "vanir_signatures": [
              {
                "id": "CVE-2021-41219-e35f9595",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "131646583307348361265931725869254135041",
                    "236248303188475814624048363304330174318",
                    "67275911203612993402886492126659149118",
                    "59521701472467330831020808875113786034",
                    "242339139671710414677888199441791063256",
                    "211266445585701223755014517195296847324",
                    "144109193804040640274424178480882424740",
                    "176125258620033537698204007379317373207",
                    "187118476959131580674242229808742155962",
                    "221949162690031847391221150021094558589"
                  ]
                },
                "source": "https://github.com/tensorflow/tensorflow/commit/e6cf28c72ba2eb949ca950d834dd6d66bb01cfae",
                "target": {
                  "file": "tensorflow/core/kernels/sparse_matmul_op.cc"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              }
            ],
            "vanir_signatures_modified": "2026-10-20T14:11:01Z"
          }
        }
      ],
      "modified": "2026-10-20T14:11:01.535717036Z",
      "provider": "osv",
      "references": [
        "https://github.com/tensorflow/tensorflow/commit/e6cf28c72ba2eb949ca950d834dd6d66bb01cfae",
        "https://github.com/tensorflow/tensorflow/security/advisories/GHSA-4f99-p9c2-3j8x"
      ],
      "provider_metadata": {}
    },
    "related_cves": [
      {
        "value": "CVE-2021-41219",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 388698,
  "published_at": "2021-11-05T21:15:09.137+00:00"
}