{"id":"CVE-2021-37687","published":"2021-08-12T22:15:17Z","modified":"2024-08-04T01:23:01Z","title":"Heap OOB in TensorFlow Lite's `Gather*` implementations","vendor":"tensorflow","product":"tensorflow","tier":"tail","description":{"text":"TensorFlow is an end-to-end open source platform for machine learning. In affected versions TFLite's [`GatherNd` implementation](https://github.com/tensorflow/tensorflow/blob/149562d49faa709ea80df1d99fc41d005b81082a/tensorflow/lite/kernels/gather_nd.cc#L124) does not support negative indices but there are no checks for this situation. Hence, an attacker can read arbitrary data from the heap by carefully crafting a model with negative values in `indices`. Similar issue exists in [`Gather` implementation](https://github.com/tensorflow/tensorflow/blob/149562d49faa709ea80df1d99fc41d005b81082a/tensorflow/lite/kernels/gather.cc). We have patched the issue in GitHub commits bb6a0383ed553c286f87ca88c207f6774d5c4a8f and eb921122119a6b6e470ee98b89e65d721663179d. 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":5.5,"severity":"MEDIUM","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00188,"percentile":0.04879,"provenance":"source"},"cwes":[{"id":"CWE-125","name":"Out-of-bounds Read"}],"references":[{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-jwf9-w5xm-f437","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/tensorflow/tensorflow/commit/bb6a0383ed553c286f87ca88c207f6774d5c4a8f","tags":["x_refsource_MISC"]},{"url":"https://github.com/tensorflow/tensorflow/commit/eb921122119a6b6e470ee98b89e65d721663179d","tags":["x_refsource_MISC"]}],"priority":{"score":4.8,"factors":[{"name":"EPSS percentile","points":0.98},{"name":"CVSS severity","points":3.85}]},"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-jwf9-w5xm-f437","PYSEC-2021-309"],"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-jwf9-w5xm-f437","PYSEC-2021-600"],"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-jwf9-w5xm-f437","PYSEC-2021-798"],"provenance":"source"}],"summary":{"text":"The flaw is an out-of-bounds read in TensorFlow Lite's Gather-family kernels, specifically the GatherNd and Gather implementations, which fail to reject negative values in the indices input. An attacker with local access and low privileges can read arbitrary heap memory by supplying a crafted model containing negative indices, without requiring user interaction.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:19:03Z"},"euvd":{"id":"EUVD-2021-0413","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-tensorflow-cve-2021-29589","parents":[{"from":"CVE-2021-29589","to":"CVE-2021-37687","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/lite/kernels/gather_nd.cc"],"commits":["https://github.com/tensorflow/tensorflow/commit/8e45822aa0b9f5df4b4c64f221e64dc930a70a9d","https://github.com/tensorflow/tensorflow/commit/bb6a0383ed553c286f87ca88c207f6774d5c4a8f","https://github.com/tensorflow/tensorflow/commit/eb921122119a6b6e470ee98b89e65d721663179d"],"basis":"rarely changed file"}]}],"children":[{"from":"CVE-2021-37687","to":"CVE-2022-35937","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/lite/kernels/gather_nd.cc"],"commits":["https://github.com/tensorflow/tensorflow/commit/bb6a0383ed553c286f87ca88c207f6774d5c4a8f","https://github.com/tensorflow/tensorflow/commit/eb921122119a6b6e470ee98b89e65d721663179d","https://github.com/tensorflow/tensorflow/commit/595a65a3e224a0362d7e68c2213acfc2b499a196"],"basis":"rarely changed file"}]}]}}