{"id":"CVE-2021-37645","published":"2021-08-12T21:05:11Z","modified":"2024-08-04T01:23:01Z","title":"Integer overflow due to conversion to unsigned in TensorFlow","vendor":"tensorflow","product":"tensorflow","tier":"tail","description":{"text":"TensorFlow is an end-to-end open source platform for machine learning. In affected versions the implementation of `tf.raw_ops.QuantizeAndDequantizeV4Grad` is vulnerable to an integer overflow issue caused by converting a signed integer value to an unsigned one and then allocating memory based on this value. The [implementation](https://github.com/tensorflow/tensorflow/blob/8d72537c6abf5a44103b57b9c2e22c14f5f49698/tensorflow/core/kernels/quantize_and_dequantize_op.cc#L126) uses the `axis` value as the size argument to `absl::InlinedVector` constructor. But, the constructor uses an unsigned type for the argument, so the implicit conversion transforms the negative value to a large integer. We have patched the issue in GitHub commit 96f364a1ca3009f98980021c4b32be5fdcca33a1. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, and TensorFlow 2.4.3, as these are also affected and still in supported range.","provenance":"source","from":"CVE.org"},"cvss":{"score":5.5,"severity":"MEDIUM","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00152,"percentile":0.04439,"provenance":"source"},"cwes":[{"id":"CWE-681","name":"Incorrect Conversion between Numeric Types"}],"references":[{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-9w2p-5mgw-p94c","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/tensorflow/tensorflow/commit/96f364a1ca3009f98980021c4b32be5fdcca33a1","tags":["x_refsource_MISC"]}],"priority":{"score":4.7,"factors":[{"name":"EPSS percentile","points":0.89},{"name":"CVSS severity","points":3.85}]},"vendorSlug":"tensorflow","affectedVersions":[{"vendor":"tensorflow","product":"tensorflow","versions":[">= 2.5.0, < 2.5.1","< 2.4.3"]}],"affected":[{"ecosystem":"PyPI","package":"tensorflow","vulnerableRanges":["<2.4.3",">=2.5.0, <2.5.1",">=2.3.0, <2.3.4",">=2.4.0, <2.4.3"],"patched":["2.4.3","2.5.1","2.3.4"],"from":["GHSA-9w2p-5mgw-p94c","PYSEC-2021-267"],"provenance":"source"},{"ecosystem":"PyPI","package":"tensorflow-cpu","vulnerableRanges":["<2.4.3",">=2.5.0, <2.5.1",">=2.3.0, <2.3.4",">=2.4.0, <2.4.3"],"patched":["2.4.3","2.5.1","2.3.4"],"from":["GHSA-9w2p-5mgw-p94c","PYSEC-2021-558"],"provenance":"source"},{"ecosystem":"PyPI","package":"tensorflow-gpu","vulnerableRanges":["<2.4.3",">=2.5.0, <2.5.1",">=2.3.0, <2.3.4",">=2.4.0, <2.4.3"],"patched":["2.4.3","2.5.1","2.3.4"],"from":["GHSA-9w2p-5mgw-p94c","PYSEC-2021-756"],"provenance":"source"}],"summary":{"text":"The flaw is an integer overflow in TensorFlow's implementation of tf.raw_ops.QuantizeAndDequantizeV4Grad, where a negative signed axis value is implicitly converted to an unsigned size and used for memory allocation via the absl::InlinedVector constructor. An attacker with local access and low privileges can trigger this by invoking the affected operation with a crafted axis value, which causes a resource-exhaustion denial of service, with no user interaction required.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:20:38Z"},"euvd":{"id":"EUVD-2021-0371","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-tensorflow-cve-2020-15265","parents":[{"from":"CVE-2021-29544","to":"CVE-2021-37645","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/20431e9044cf2ad3c0323c34888b192f3289af6b","https://github.com/tensorflow/tensorflow/commit/96f364a1ca3009f98980021c4b32be5fdcca33a1"],"basis":"shared function","functions":["QuantizeAndDequantizeV4GradientOp"]}]}],"children":[{"from":"CVE-2021-37645","to":"CVE-2022-29192","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/96f364a1ca3009f98980021c4b32be5fdcca33a1","https://github.com/tensorflow/tensorflow/commit/098e7762d909bac47ce1dbabe6dfd06294cb9d58"],"basis":"shared function","functions":["QuantizeAndDequantizeV4GradientOp"]}]},{"from":"CVE-2021-37645","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/96f364a1ca3009f98980021c4b32be5fdcca33a1","https://github.com/tensorflow/tensorflow/commit/f3f9cb38ecfe5a8a703f2c4a8fead434ef291713"],"basis":"shared function","functions":["QuantizeAndDequantizeV4GradientOp"]}]}]}}