{"schemaVersion":1,"url":"https://cve.openhack.com/cve/CVE-2021-29512","id":"CVE-2021-29512","title":"Heap buffer overflow in `RaggedBinCount`","description":"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` ","descriptionLong":"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.","published":"2021-05-14T18:55:10.000Z","updated":"2026-10-20T14:20:34.088140722Z","reserved":"2021-03-30T00:00:00.000Z","status":"Modified","rejected":false,"assigner":"GitHub_M","metric":{"version":"3.1","score":2.5,"vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L","rating":"low","source":"GitHub_M"},"metrics":[{"version":"4.0","score":null,"vector":"CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:P/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N","rating":"low","source":"GitHub"},{"version":"3.1","score":2.5,"vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L","rating":"low","source":"GitHub_M"},{"version":"3.1","score":2.5,"vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L","rating":"low","source":"github.com"},{"version":"3.1","score":7.8,"vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","rating":"high","source":"NVD"},{"version":"3.1","score":7.8,"vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","rating":"high","source":"OSV"},{"version":"3.1","score":2.5,"vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L","rating":"low","source":"GitHub"},{"version":"2.0","score":4.6,"vector":"AV:L/AC:L/Au:N/C:P/I:P/A:P","rating":"medium","source":"NVD"}],"rating":"low","products":["tensorflow"],"affectedProducts":[{"vendor":"tensorflow","product":"tensorflow","defaultStatus":null,"versions":[{"status":"affected","version":">=2.3.0, < 2.3.3"},{"status":"affected","version":">= 2.4.0, < 2.4.2"}],"platforms":[]}],"packages":[{"ecosystem":"PyPI","name":"tensorflow","purl":"pkg:pypi/tensorflow","ranges":[">=2.3.0 <2.3.3",">=2.4.0 <2.4.2"],"fixed":["2.3.3","2.4.2"],"advisory":"GHSA-4278-2v5v-65r4"},{"ecosystem":"PyPI","name":"tensorflow-cpu","purl":"pkg:pypi/tensorflow-cpu","ranges":[">=2.3.0 <2.3.3",">=2.4.0 <2.4.2"],"fixed":["2.3.3","2.4.2"],"advisory":"GHSA-4278-2v5v-65r4"},{"ecosystem":"PyPI","name":"tensorflow-gpu","purl":"pkg:pypi/tensorflow-gpu","ranges":[">=2.3.0 <2.3.3",">=2.4.0 <2.4.2"],"fixed":["2.3.3","2.4.2"],"advisory":"GHSA-4278-2v5v-65r4"}],"cwes":["CWE-120","CWE-787"],"aliases":["BIT-tensorflow-2021-29512","GHSA-4278-2v5v-65r4","PYSEC-2021-149","PYSEC-2021-440","PYSEC-2021-638"],"references":[{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-4278-2v5v-65r4","tags":["x_refsource_CONFIRM","x_transferred","Exploit","Patch","Third Party Advisory","fix","web","advisory"]},{"url":"https://github.com/tensorflow/tensorflow/commit/eebb96c2830d48597d055d247c0e9aebaea94cd5","tags":["x_refsource_MISC","x_transferred","Patch","Third Party Advisory","fix","web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-29512","tags":["advisory"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2021-440.yaml","tags":["web"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2021-638.yaml","tags":["web"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow/PYSEC-2021-149.yaml","tags":["web"]}],"patchReferenced":true,"fixAvailable":true,"exploitReferenced":true,"kev":false,"kevAdded":null,"kevDue":null,"kevEntry":null,"ssvc":null,"epss":0.00211,"epssPercentile":0.1142,"sources":[{"name":"CVE List","url":"https://www.cve.org/CVERecord?id=CVE-2021-29512","ok":true},{"name":"NVD","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-29512","ok":true,"note":"Modified"},{"name":"OSV","url":"https://osv.dev/vulnerability/CVE-2021-29512","ok":true,"note":"3 packages"},{"name":"GitHub Advisory","url":"https://github.com/advisories/GHSA-4278-2v5v-65r4","ok":true,"note":"GHSA-4278-2v5v-65r4"},{"name":"CISA KEV","url":"https://www.cisa.gov/known-exploited-vulnerabilities-catalog","ok":true,"note":"not listed"},{"name":"EPSS","url":"https://api.first.org/data/v1/epss?cve=CVE-2021-29512","ok":true,"note":"scored 2026-11-19"}],"aiTitle":false,"tech":[],"critical":[],"attention":null}