Skip to content
Heist/ feed
Back to feed
High

Security advisory

Type: advisorySources: OSVCVE: CVE-2021-29530

TensorFlow is an end-to-end open source platform for machine learning. An attacker can trigger a null pointer dereference by providing an invalid `permutation` to `tf.raw_ops.SparseMatrixSparseCholesky`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/080f1d9e257589f78b3ffb75debf584168aa6062/tensorflow/core/kernels/sparse/sparse_cholesky_op.cc#L85-L86) fails to properly validate the input arguments. Although `ValidateInputs` is called and there are checks in the body of this function, the code proceeds to the next line in `ValidateInputs` since `OP_REQUIRES`(https://github.com/tensorflow/tensorflow/blob/080f1d9e257589f78b3ffb75debf584168aa6062/tensorflow/core/framework/op_requires.h#L41-L48) is a macro that only exits the current function. Thus, the first validation condition that fails in `ValidateInputs` will cause an early return from that function. However, the caller will continue execution from the next line. The fix is to either explicitly check `context->status()` or to convert `ValidateInputs` to return a `Status`. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.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-29530
Confirmed fixed CVEs
Not specified
Updated in this feed
31 Oct 2026, 12:44 UTC · Revision 1

Source evidence

CVE-2021-29530

core-osv · Original source

Published 14 May 2021, 20:15 UTC

TensorFlow is an end-to-end open source platform for machine learning. An attacker can trigger a null pointer dereference by providing an invalid `permutation` to `tf.raw_ops.SparseMatrixSparseCholesky`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/080f1d9e257589f78b3ffb75debf584168aa6062/tensorflow/core/kernels/sparse/sparse_cholesky_op.cc#L85-L86) fails to properly validate the input arguments. Although `ValidateInputs` is called and there are checks in the body of this function, the code proceeds to the next line in `ValidateInputs` since `OP_REQUIRES`(https://github.com/tensorflow/tensorflow/blob/080f1d9e257589f78b3ffb75debf584168aa6062/tensorflow/core/framework/op_requires.h#L41-L48) is a macro that only exits the current function. Thus, the first validation condition that fails in `ValidateInputs` will cause an early return from that function. However, the caller will continue execution from the next line. The fix is to either explicitly check `context->status()` or to convert `ValidateInputs` to return a `Status`. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.

osv:CVE-2021-29530
Complete source record
{
  "id": "e33334641a5a1b1623ac93baac1e4282bf25b955a4f74a3f22f88a13bc00dac2",
  "url": "https://osv.dev/vulnerability/CVE-2021-29530",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "CVE-2021-29530",
    "summary": "TensorFlow is an end-to-end open source platform for machine learning. An attacker can trigger a null pointer dereference by providing an invalid `permutation` to `tf.raw_ops.SparseMatrixSparseCholesky`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/080f1d9e257589f78b3ffb75debf584168aa6062/tensorflow/core/kernels/sparse/sparse_cholesky_op.cc#L85-L86) fails to properly validate the input arguments. Although `ValidateInputs` is called and there are checks in the body of this function, the code proceeds to the next line in `ValidateInputs` since `OP_REQUIRES`(https://github.com/tensorflow/tensorflow/blob/080f1d9e257589f78b3ffb75debf584168aa6062/tensorflow/core/framework/op_requires.h#L41-L48) is a macro that only exits the current function. Thus, the first validation condition that fails in `ValidateInputs` will cause an early return from that function. However, the caller will continue execution from the next line. The fix is to either explicitly check `context->status()` or to convert `ValidateInputs` to return a `Status`. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.",
    "evidence": "osv:CVE-2021-29530",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2021-29530",
      "aliases": [
        "BIT-tensorflow-2021-29530",
        "CVE-2021-29530",
        "GHSA-xcwj-wfcm-m23c",
        "PYSEC-2021-167",
        "PYSEC-2021-458",
        "PYSEC-2021-656"
      ],
      "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": "0931ea3d985bb9c8fdd054a5e29c4129623c849b"
                },
                {
                  "introduced": "2b96f3662bd776e277f86997659e61046b56c315"
                },
                {
                  "fixed": "cfe0c80169ae984bcdc99ff6de7444164aaa8e07"
                },
                {
                  "introduced": "b36436b087bd8e8701ef51718179037cccdfc26e"
                },
                {
                  "fixed": "3929ffacfbef7c431e8397920d040aaf47acff19"
                },
                {
                  "introduced": "582c8d236cb079023657287c318ff26adb239002"
                },
                {
                  "fixed": "1923123d32ea41d92b70a27a3f6ecf0763b56f6c"
                },
                {
                  "fixed": "e6a7c7cc18c3aaad1ae0872cb0a959f5c923d2bd"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "2.1.4"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.2.0"
                      },
                      {
                        "fixed": "2.2.3"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.3.0"
                      },
                      {
                        "fixed": "2.3.3"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "cpe": "cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.4.0"
                      },
                      {
                        "fixed": "2.4.2"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "range": [
                      {
                        "fixed": "e6a7c7cc18c3aaad1ae0872cb0a959f5c923d2bd"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v2.1.3",
            "v2.2.2",
            "v2.3.2",
            "v2.4.1",
            "v2.1.2",
            "v2.2.1",
            "v2.4.0",
            "v2.3.1",
            "v2.2.0",
            "v2.1.1",
            "v2.3.0",
            "v2.1.0",
            "v2.1.0-rc0",
            "v2.1.0-rc2",
            "v2.1.0-rc1",
            "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-29530.json",
            "vanir_signatures": [
              {
                "id": "CVE-2021-29530-bd98f96b",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "253781478397541056602689406463014838958",
                    "239560922857308828919157851601272280929",
                    "280711993339257124038781815470371329037",
                    "205090741053361526681941472168103285574",
                    "121946168169142239614567311044557000014",
                    "89783717097941851157565793427942842478",
                    "28972579787471686773729522611243035204",
                    "311823163073068944011776732932071184318",
                    "296878916593624319768100602367596172954",
                    "255967630873613548701264099863185083856",
                    "260870806742725755014545069736338714846",
                    "214985371609828385320743754504512928578",
                    "194470700351065301689674946308411906892",
                    "21325521787577701379505581389811486509",
                    "175750355588109615123289094420149349357",
                    "96936261567771253156925096846107220815",
                    "14014010318667349279570987137102121057",
                    "45959256262558526328153025040865236802",
                    "304199593083152093320124538432500244808",
                    "274706543680024705398874828629765198453",
                    "80470081812361228662722619050302491090",
                    "15630166823741107531637766925156438067",
                    "168307337367787846154540922106810935219",
                    "275135145937553463084677149015795725311",
                    "127671899323606939144055113861206734623",
                    "306861041691438897677301544136695638205",
                    "307669638991137709776520653745912930877",
                    "5687570855211274080550150991624986348",
                    "127050220195203212942599071205006030273",
                    "288457066491466488746535658527327104655",
                    "146129390556571693719022638557521853446",
                    "183363277977567025938066774229162175409",
                    "43581517195697618132229909117580499422",
                    "171365111257850579948939170529609886377",
                    "140809007161098837781433933020177554659",
                    "142588258317183017402260634446745893566",
                    "130106211139833448463966603537732320358",
                    "326977632074968974300616639522420919582",
                    "262314191185911328371145091567193517656",
                    "261598356254991826953734235852749118995",
                    "44124725594456650662205956441308050567",
                    "14478431743598174032197323092021278185",
                    "9108933313667840532796487540082086815",
                    "284058706955699957258638976439423242433",
                    "88760001953405681975565764395957190954",
                    "12431736038571622175522060094770234020",
                    "287127589613663426338055858168067774780",
                    "325966101634517283622955065444791650130",
                    "14309112608701686400098650250032605995",
                    "283225996118914251767355321496948224279",
                    "288080263079928045858847493184662451430",
                    "234247219865892728865002434907009707769"
                  ]
                },
                "source": "https://github.com/tensorflow/tensorflow/commit/e6a7c7cc18c3aaad1ae0872cb0a959f5c923d2bd",
                "target": {
                  "file": "tensorflow/core/kernels/sparse/sparse_cholesky_op.cc"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              }
            ],
            "vanir_signatures_modified": "2026-10-20T14:24:22Z"
          }
        }
      ],
      "modified": "2026-10-20T14:24:22.091966900Z",
      "provider": "osv",
      "references": [
        "https://github.com/tensorflow/tensorflow/commit/e6a7c7cc18c3aaad1ae0872cb0a959f5c923d2bd",
        "https://github.com/tensorflow/tensorflow/security/advisories/GHSA-xcwj-wfcm-m23c"
      ],
      "provider_metadata": {}
    },
    "related_cves": [
      {
        "value": "CVE-2021-29530",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 388899,
  "published_at": "2021-05-14T20:15:11.983+00:00"
}