{"id":"CVE-2021-41219","published":"2021-11-05T20:50:17Z","modified":"2024-08-04T03:08:31Z","title":"Undefined behavior via `nullptr` reference binding in sparse matrix multiplication","vendor":"tensorflow","product":"tensorflow","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":7.8,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00211,"percentile":0.11517,"provenance":"source"},"cwes":[{"id":"CWE-824","name":"Access of Uninitialized Pointer"}],"references":[{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-4f99-p9c2-3j8x","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/tensorflow/tensorflow/commit/e6cf28c72ba2eb949ca950d834dd6d66bb01cfae","tags":["x_refsource_MISC"]}],"priority":{"score":7.8,"factors":[{"name":"EPSS percentile","points":2.3},{"name":"CVSS severity","points":5.46}]},"vendorSlug":"tensorflow","affectedVersions":[{"vendor":"tensorflow","product":"tensorflow","versions":[">= 2.6.0, < 2.6.1",">= 2.5.0, < 2.5.2","< 2.4.4"]}],"affected":[{"ecosystem":"PyPI","package":"tensorflow","vulnerableRanges":[">=2.6.0, <2.6.1",">=2.5.0, <2.5.2","<2.4.4",">=2.7.0rc0, <2.7.0"],"patched":["2.6.1","2.5.2","2.4.4","2.7.0"],"from":["GHSA-4f99-p9c2-3j8x","PYSEC-2021-411"],"provenance":"source"},{"ecosystem":"PyPI","package":"tensorflow-cpu","vulnerableRanges":[">=2.6.0, <2.6.1",">=2.5.0, <2.5.2","<2.4.4",">=2.7.0rc0, <2.7.0"],"patched":["2.6.1","2.5.2","2.4.4","2.7.0"],"from":["GHSA-4f99-p9c2-3j8x","PYSEC-2021-628"],"provenance":"source"},{"ecosystem":"PyPI","package":"tensorflow-gpu","vulnerableRanges":[">=2.6.0, <2.6.1",">=2.5.0, <2.5.2","<2.4.4",">=2.7.0rc0, <2.7.0"],"patched":["2.6.1","2.5.2","2.4.4","2.7.0"],"from":["GHSA-4f99-p9c2-3j8x","PYSEC-2021-826"],"provenance":"source"}],"summary":{"text":"The TensorFlow sparse matrix multiplication kernel binds a reference to a null pointer when the dimensions of input a or b are zero or less, which is undefined behavior. An attacker with local access and low privileges who can run a TensorFlow sparse matrix multiplication operation with such inputs, without any user interaction, can trigger this condition to cause memory corruption.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:11:19Z"},"euvd":{"id":"EUVD-2021-0441","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-tensorflow-cve-2021-29557","parents":[{"from":"CVE-2021-29557","to":"CVE-2021-41219","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/core/kernels/sparse_matmul_op.cc"],"commits":["https://github.com/tensorflow/tensorflow/commit/7f283ff806b2031f407db64c4d3edcda8fb9f9f5","https://github.com/tensorflow/tensorflow/commit/e6cf28c72ba2eb949ca950d834dd6d66bb01cfae"],"basis":"shared function","functions":["SparseMatMulOp"]}]}]}}