{"id":"CVE-2021-37643","published":"2021-08-12T18:10:21Z","modified":"2024-08-04T01:23:01Z","title":"Null pointer dereference in `MatrixDiagPartOp` in TensorFlow","vendor":"tensorflow","product":"tensorflow","tier":"tail","description":{"text":"TensorFlow is an end-to-end open source platform for machine learning. If a user does not provide a valid padding value to `tf.raw_ops.MatrixDiagPartOp`, then the code triggers a null pointer dereference (if input is empty) or produces invalid behavior, ignoring all values after the first. The [implementation](https://github.com/tensorflow/tensorflow/blob/8d72537c6abf5a44103b57b9c2e22c14f5f49698/tensorflow/core/kernels/linalg/matrix_diag_op.cc#L89) reads the first value from a tensor buffer without first checking that the tensor has values to read from. We have patched the issue in GitHub commit 482da92095c4d48f8784b1f00dda4f81c28d2988. 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.","provenance":"source","from":"CVE.org"},"cvss":{"score":7.7,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.0016,"percentile":0.05238,"provenance":"source"},"cwes":[{"id":"CWE-476","name":"NULL Pointer Dereference"}],"references":[{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-fcwc-p4fc-c5cc","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/tensorflow/tensorflow/commit/482da92095c4d48f8784b1f00dda4f81c28d2988","tags":["x_refsource_MISC"]}],"priority":{"score":6.4,"factors":[{"name":"EPSS percentile","points":1.05},{"name":"CVSS severity","points":5.39}]},"vendorSlug":"tensorflow","affectedVersions":[{"vendor":"tensorflow","product":"tensorflow","versions":[">= 2.5.0, < 2.5.1",">= 2.4.0, < 2.4.3","< 2.3.4"]}],"affected":[{"ecosystem":"PyPI","package":"tensorflow","vulnerableRanges":["<2.3.4",">=2.4.0, <2.4.3",">=2.5.0, <2.5.1",">=2.3.0, <2.3.4"],"patched":["2.3.4","2.4.3","2.5.1"],"from":["GHSA-fcwc-p4fc-c5cc","PYSEC-2021-265"],"provenance":"source"},{"ecosystem":"PyPI","package":"tensorflow-cpu","vulnerableRanges":["<2.3.4",">=2.4.0, <2.4.3",">=2.5.0, <2.5.1",">=2.3.0, <2.3.4"],"patched":["2.3.4","2.4.3","2.5.1"],"from":["GHSA-fcwc-p4fc-c5cc","PYSEC-2021-556"],"provenance":"source"},{"ecosystem":"PyPI","package":"tensorflow-gpu","vulnerableRanges":["<2.3.4",">=2.4.0, <2.4.3",">=2.5.0, <2.5.1",">=2.3.0, <2.3.4"],"patched":["2.3.4","2.4.3","2.5.1"],"from":["GHSA-fcwc-p4fc-c5cc","PYSEC-2021-754"],"provenance":"source"}],"summary":{"text":"The flaw is a null pointer dereference in the MatrixDiagPartOp kernel of TensorFlow's linear algebra operations, which mishandles a missing or invalid padding value and reads from an empty tensor buffer without checking it. An attacker with local access who can supply input to tf.raw_ops.MatrixDiagPartOp without authentication or user interaction can crash the process or cause invalid computation results, with no special configuration required.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:15:20Z"},"euvd":{"id":"EUVD-2021-0369","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-tensorflow-cve-2021-29515","parents":[{"from":"CVE-2021-29515","to":"CVE-2021-37643","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/core/kernels/linalg/matrix_diag_op.cc"],"commits":["https://github.com/tensorflow/tensorflow/commit/a7116dd3913c4a4afd2a3a938573aa7c785fdfc6","https://github.com/tensorflow/tensorflow/commit/482da92095c4d48f8784b1f00dda4f81c28d2988"],"basis":"rarely changed file"},{"kind":"similar","provenance":"machine","score":0.36,"basis":"same product + CWE + description similarity"}]}],"children":[{"from":"CVE-2021-37643","to":"CVE-2021-37657","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/core/kernels/linalg/matrix_diag_op.cc"],"commits":["https://github.com/tensorflow/tensorflow/commit/482da92095c4d48f8784b1f00dda4f81c28d2988","https://github.com/tensorflow/tensorflow/commit/f2a673bd34f0d64b8e40a551ac78989d16daad09"],"basis":"shared function","functions":["MatrixDiagPartOp"]}]}]}}