{"id":"CVE-2021-29512","published":"2021-05-14T18:55:10Z","modified":"2024-08-03T22:11:05Z","title":"Heap buffer overflow in `RaggedBinCount`","vendor":"tensorflow","product":"tensorflow","tier":"tail","description":{"text":"TensorFlow is an end-to-end open source platform for machine learning. If the `splits` argument of `RaggedBincount` does not specify a valid `SparseTensor`(https://www.tensorflow.org/api_docs/python/tf/sparse/SparseTensor), then an attacker can trigger a heap buffer overflow. This will cause a read from outside the bounds of the `splits` tensor buffer in the implementation of the `RaggedBincount` op(https://github.com/tensorflow/tensorflow/blob/8b677d79167799f71c42fd3fa074476e0295413a/tensorflow/core/kernels/bincount_op.cc#L430-L433). Before the `for` loop, `batch_idx` is set to 0. The user controls the `splits` array, making it contain only one element, 0. Thus, the code in the `while` loop would increment `batch_idx` and then try to read `splits(1)`, which is outside of bounds. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2 and TensorFlow 2.3.3, as these are also affected.","provenance":"source","from":"CVE.org"},"cvss":{"score":2.5,"severity":"LOW","version":"3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00211,"percentile":0.0648,"provenance":"source"},"cwes":[{"id":"CWE-120","name":"Buffer Copy without Checking Size of Input"}],"references":[{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-4278-2v5v-65r4","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/tensorflow/tensorflow/commit/eebb96c2830d48597d055d247c0e9aebaea94cd5","tags":["x_refsource_MISC"]}],"priority":{"score":3.0,"factors":[{"name":"EPSS percentile","points":1.3},{"name":"CVSS severity","points":1.75}]},"vendorSlug":"tensorflow","affectedVersions":[{"vendor":"tensorflow","product":"tensorflow","versions":[">=2.3.0, < 2.3.3",">= 2.4.0, < 2.4.2"]}],"affected":[{"ecosystem":"PyPI","package":"tensorflow","vulnerableRanges":[">=2.3.0, <2.3.3",">=2.4.0, <2.4.2"],"patched":["2.3.3","2.4.2"],"from":["GHSA-4278-2v5v-65r4","PYSEC-2021-149"],"provenance":"source"},{"ecosystem":"PyPI","package":"tensorflow-cpu","vulnerableRanges":[">=2.3.0, <2.3.3",">=2.4.0, <2.4.2"],"patched":["2.3.3","2.4.2"],"from":["GHSA-4278-2v5v-65r4","PYSEC-2021-440"],"provenance":"source"},{"ecosystem":"PyPI","package":"tensorflow-gpu","vulnerableRanges":[">=2.3.0, <2.3.3",">=2.4.0, <2.4.2"],"patched":["2.3.3","2.4.2"],"from":["GHSA-4278-2v5v-65r4","PYSEC-2021-638"],"provenance":"source"}],"summary":{"text":"A heap buffer overflow in TensorFlow's RaggedBincount operation is triggered when the splits argument does not form a valid SparseTensor, causing the implementation to read past the end of the splits buffer. An attacker who can supply a crafted splits input, such as a single-element array containing only 0, can exploit this to read out of bounds, requiring local access with low privileges and high attack complexity.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:22:39Z"},"euvd":{"id":"EUVD-2021-0253","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-tensorflow-cve-2020-15203","children":[{"from":"CVE-2021-29512","to":"CVE-2022-21737","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/core/kernels/bincount_op.cc"],"commits":["https://github.com/tensorflow/tensorflow/commit/eebb96c2830d48597d055d247c0e9aebaea94cd5","https://github.com/tensorflow/tensorflow/commit/7019ce4f68925fd01cdafde26f8d8c938f47e6f9"],"basis":"shared function","functions":["RaggedBincountOp"]}]},{"from":"CVE-2021-29512","to":"CVE-2022-35986","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/core/kernels/bincount_op.cc"],"commits":["https://github.com/tensorflow/tensorflow/commit/eebb96c2830d48597d055d247c0e9aebaea94cd5","https://github.com/tensorflow/tensorflow/commit/7a4591fd4f065f4fa903593bc39b2f79530a74b8"],"basis":"shared function","functions":["RaggedBincountOp"]}]}]}}