{"id":"CVE-2021-29610","published":"2021-05-14T19:20:47Z","modified":"2024-08-03T22:11:06Z","title":"Invalid validation in `QuantizeAndDequantizeV2`","vendor":"tensorflow","product":"tensorflow","tier":"tail","description":{"text":"TensorFlow is an end-to-end open source platform for machine learning. The validation in `tf.raw_ops.QuantizeAndDequantizeV2` allows invalid values for `axis` argument:. The validation(https://github.com/tensorflow/tensorflow/blob/eccb7ec454e6617738554a255d77f08e60ee0808/tensorflow/core/kernels/quantize_and_dequantize_op.cc#L74-L77) uses `||` to mix two different conditions. If `axis_ < -1` the condition in `OP_REQUIRES` will still be true, but this value of `axis_` results in heap underflow. This allows attackers to read/write to other data on the heap. 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":3.6,"severity":"LOW","version":"3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:L","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00201,"percentile":0.10185,"provenance":"source"},"cwes":[{"id":"CWE-665","name":"Improper Initialization"}],"references":[{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-mq5c-prh3-3f3h","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/tensorflow/tensorflow/commit/c5b0d5f8ac19888e46ca14b0e27562e7fbbee9a9","tags":["x_refsource_MISC"]}],"priority":{"score":4.6,"factors":[{"name":"EPSS percentile","points":2.04},{"name":"CVSS severity","points":2.52}]},"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-mq5c-prh3-3f3h","PYSEC-2021-247"],"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-mq5c-prh3-3f3h","PYSEC-2021-538"],"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-mq5c-prh3-3f3h","PYSEC-2021-736"],"provenance":"source"}],"summary":{"text":"The flaw is improper validation of the axis argument in the QuantizeAndDequantizeV2 operation (exposed as tf.raw_ops.QuantizeAndDequantizeV2) within TensorFlow, where a mixed || condition lets an out-of-range axis value below -1 pass the check and cause a heap underflow. An attacker with local access and low privileges, who can get a victim to run a crafted TensorFlow computation with that input (requiring high attack complexity), could read or write other data on the heap.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:21:48Z"},"euvd":{"id":"EUVD-2021-0351","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-tensorflow-cve-2020-15265","parents":[{"from":"CVE-2020-15265","to":"CVE-2021-29610","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/core/kernels/quantize_and_dequantize_op.cc"],"commits":["https://github.com/tensorflow/tensorflow/commit/eccb7ec454e6617738554a255d77f08e60ee0808","https://github.com/tensorflow/tensorflow/commit/c5b0d5f8ac19888e46ca14b0e27562e7fbbee9a9"],"basis":"shared function","functions":["QuantizeAndDequantizeV2Op"]}]}],"children":[{"from":"CVE-2021-29610","to":"CVE-2022-36026","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["tensorflow/core/kernels/quantize_and_dequantize_op.cc"],"commits":["https://github.com/tensorflow/tensorflow/commit/c5b0d5f8ac19888e46ca14b0e27562e7fbbee9a9","https://github.com/tensorflow/tensorflow/commit/f3f9cb38ecfe5a8a703f2c4a8fead434ef291713"],"basis":"shared function","functions":["QuantizeAndDequantizeV2Op"]}]}]}}