{"id":"CVE-2021-37658","published":"2021-08-12T20:50:11Z","modified":"2024-08-04T01:23:01Z","title":"Reference binding to nullptr in `MatrixSetDiagV*` ops in TensorFlow","vendor":"tensorflow","product":"tensorflow","tier":"tail","description":{"text":"TensorFlow is an end-to-end open source platform for machine learning. In affected versions an attacker can cause undefined behavior via binding a reference to null pointer in all operations of type `tf.raw_ops.MatrixSetDiagV*`. The [implementation](https://github.com/tensorflow/tensorflow/blob/84d053187cb80d975ef2b9684d4b61981bca0c41/tensorflow/core/kernels/linalg/matrix_diag_op.cc) has incomplete validation that the value of `k` is a valid tensor. We have check that this value is either a scalar or a vector, but there is no check for the number of elements. If this is an empty tensor, then code that accesses the first element of the tensor is wrong. We have patched the issue in GitHub commit ff8894044dfae5568ecbf2ed514c1a37dc394f1b. 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.1,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00167,"percentile":0.06128,"provenance":"source"},"cwes":[{"id":"CWE-824","name":"Access of Uninitialized Pointer"}],"references":[{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-6p5r-g9mq-ggh2","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/tensorflow/tensorflow/commit/ff8894044dfae5568ecbf2ed514c1a37dc394f1b","tags":["x_refsource_MISC"]}],"priority":{"score":6.2,"factors":[{"name":"EPSS percentile","points":1.23},{"name":"CVSS severity","points":4.97}]},"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-6p5r-g9mq-ggh2","PYSEC-2021-280"],"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-6p5r-g9mq-ggh2","PYSEC-2021-571"],"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-6p5r-g9mq-ggh2","PYSEC-2021-769"],"provenance":"source"}],"summary":{"text":"The flaw is an incomplete input validation in the MatrixSetDiagV* operations (tf.raw_ops.MatrixSetDiagV*) of TensorFlow's matrix diagonal kernel, where the code accepts an empty tensor for the argument k and then accesses its first element, binding a reference to a null pointer. An attacker with local access and low privileges can trigger undefined behavior by supplying such an input, with no user interaction required, and the flaw can corrupt memory and affect availability.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:16:31Z"},"euvd":{"id":"EUVD-2021-0384","exploited":false,"provenance":"source"}}