{"id":"CVE-2021-29571","published":"2021-05-14T19:16:27Z","modified":"2024-08-03T22:11:05Z","title":"Memory corruption in `DrawBoundingBoxesV2`","vendor":"tensorflow","product":"tensorflow","tier":"tail","description":{"text":"TensorFlow is an end-to-end open source platform for machine learning. The implementation of `tf.raw_ops.MaxPoolGradWithArgmax` can cause reads outside of bounds of heap allocated data if attacker supplies specially crafted inputs. The implementation(https://github.com/tensorflow/tensorflow/blob/31bd5026304677faa8a0b77602c6154171b9aec1/tensorflow/core/kernels/image/draw_bounding_box_op.cc#L116-L130) assumes that the last element of `boxes` input is 4, as required by [the op](https://www.tensorflow.org/api_docs/python/tf/raw_ops/DrawBoundingBoxesV2). Since this is not checked attackers passing values less than 4 can write outside of bounds of heap allocated objects and cause memory corruption. If the last dimension in `boxes` is less than 4, accesses similar to `tboxes(b, bb, 3)` will access data outside of bounds. Further during code execution there are also writes to these indices. 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.","provenance":"source","from":"CVE.org"},"cvss":{"score":4.5,"severity":"MEDIUM","version":"3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.0024,"percentile":0.15399,"provenance":"source"},"cwes":[{"id":"CWE-787","name":"Out-of-bounds Write"}],"references":[{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-whr9-vfh2-7hm6","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/tensorflow/tensorflow/commit/79865b542f9ffdc9caeb255631f7c56f1d4b6517","tags":["x_refsource_MISC"]}],"priority":{"score":6.2,"factors":[{"name":"EPSS percentile","points":3.08},{"name":"CVSS severity","points":3.15}]},"vendorSlug":"tensorflow","affectedVersions":[{"vendor":"tensorflow","product":"tensorflow","versions":["< 2.1.4",">= 2.2.0, < 2.2.3",">= 2.3.0, < 2.3.3",">= 2.4.0, < 2.4.2"]}],"affected":[{"ecosystem":"PyPI","package":"tensorflow","vulnerableRanges":["<2.1.4",">=2.2.0, <2.2.3",">=2.3.0, <2.3.3",">=2.4.0, <2.4.2","<2.2.0rc0",">=2.2.0, <2.3.0rc0",">=2.3.0, <2.3.4",">=2.4.0, <2.4.3"],"patched":["2.1.4","2.2.3","2.3.3","2.4.2","2.2.0rc0","2.3.0rc0","2.3.4","2.4.3"],"from":["GHSA-whr9-vfh2-7hm6","PYSEC-2021-208"],"provenance":"source"},{"ecosystem":"PyPI","package":"tensorflow-cpu","vulnerableRanges":["<2.1.4",">=2.2.0, <2.2.3",">=2.3.0, <2.3.3",">=2.4.0, <2.4.2","<2.2.0rc0",">=2.2.0, <2.3.0rc0",">=2.3.0, <2.3.4",">=2.4.0, <2.4.3"],"patched":["2.1.4","2.2.3","2.3.3","2.4.2","2.2.0rc0","2.3.0rc0","2.3.4","2.4.3"],"from":["GHSA-whr9-vfh2-7hm6","PYSEC-2021-499"],"provenance":"source"},{"ecosystem":"PyPI","package":"tensorflow-gpu","vulnerableRanges":["<2.1.4",">=2.2.0, <2.2.3",">=2.3.0, <2.3.3",">=2.4.0, <2.4.2","<2.2.0rc0",">=2.2.0, <2.3.0rc0",">=2.3.0, <2.3.4",">=2.4.0, <2.4.3"],"patched":["2.1.4","2.2.3","2.3.3","2.4.2","2.2.0rc0","2.3.0rc0","2.3.4","2.4.3"],"from":["GHSA-whr9-vfh2-7hm6","PYSEC-2021-697"],"provenance":"source"}],"summary":{"text":"The flaw is a memory corruption bug in the DrawBoundingBoxesV2 operation of TensorFlow, where the code assumes the last dimension of the boxes input is 4 without checking it. An attacker who can supply crafted inputs to that operation can cause out-of-bounds reads and writes on heap-allocated data, with local access and low privileges required and a high attack complexity.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:18:25Z"},"euvd":{"id":"EUVD-2021-0312","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-tensorflow-cve-2021-29533","parents":[{"from":"CVE-2021-29533","to":"CVE-2021-29571","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/core/kernels/image/draw_bounding_box_op.cc"],"commits":["https://github.com/tensorflow/tensorflow/commit/b432a38fe0e1b4b904a6c222cbce794c39703e87","https://github.com/tensorflow/tensorflow/commit/79865b542f9ffdc9caeb255631f7c56f1d4b6517"],"basis":"shared function","functions":["DrawBoundingBoxesOp"]}]}],"children":[{"from":"CVE-2021-29571","to":"CVE-2022-36001","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/core/kernels/image/draw_bounding_box_op.cc"],"commits":["https://github.com/tensorflow/tensorflow/commit/79865b542f9ffdc9caeb255631f7c56f1d4b6517","https://github.com/tensorflow/tensorflow/commit/da0d65cdc1270038e72157ba35bf74b85d9bda11"],"basis":"shared function","functions":["DrawBoundingBoxesOp"]}]}]}}