{"id":"CVE-2021-29535","published":"2021-05-14T19:11:52Z","modified":"2024-08-03T22:11:05Z","title":"Heap buffer overflow in `QuantizedMul`","vendor":"tensorflow","product":"tensorflow","tier":"tail","description":{"text":"TensorFlow is an end-to-end open source platform for machine learning. An attacker can cause a heap buffer overflow in `QuantizedMul` by passing in invalid thresholds for the quantization. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/87cf4d3ea9949051e50ca3f071fc909538a51cd0/tensorflow/core/kernels/quantized_mul_op.cc#L287-L290) assumes that the 4 arguments are always valid scalars and tries to access the numeric value directly. However, if any of these tensors is empty, then `.flat<T>()` is an empty buffer and accessing the element at position 0 results in overflow. 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":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.11518,"provenance":"source"},"cwes":[{"id":"CWE-131","name":"Incorrect Calculation of Buffer Size"}],"references":[{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-m3f9-w3p3-p669","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/tensorflow/tensorflow/commit/efea03b38fb8d3b81762237dc85e579cc5fc6e87","tags":["x_refsource_MISC"]}],"priority":{"score":4.1,"factors":[{"name":"EPSS percentile","points":2.3},{"name":"CVSS severity","points":1.75}]},"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-m3f9-w3p3-p669","PYSEC-2021-172"],"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-m3f9-w3p3-p669","PYSEC-2021-463"],"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-m3f9-w3p3-p669","PYSEC-2021-661"],"provenance":"source"}],"summary":{"text":"A heap buffer overflow in the QuantizedMul operation of TensorFlow, located in its quantized multiplication kernel, arises because the implementation assumes its four quantization threshold arguments are always valid scalars and reads them directly without checking for empty tensors. An attacker with local access and low privileges who can supply an empty threshold tensor (requiring high attack complexity) can trigger an out-of-bounds write on the heap, which may crash the process or disrupt availability, with no user interaction required.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:22:39Z"},"euvd":{"id":"EUVD-2021-0276","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-tensorflow-cve-2021-29528","parents":[{"from":"CVE-2021-29528","to":"CVE-2021-29535","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/core/kernels/quantized_mul_op.cc"],"commits":["https://github.com/tensorflow/tensorflow/commit/a1b11d2fdd1e51bfe18bb1ede804f60abfa92da6","https://github.com/tensorflow/tensorflow/commit/efea03b38fb8d3b81762237dc85e579cc5fc6e87"],"basis":"shared function","functions":["QuantizedMulOp"]}]}]}}