{"id":"CVE-2021-37645","aliases":["BIT-tensorflow-2021-37645","GHSA-9w2p-5mgw-p94c","PYSEC-2021-267","PYSEC-2021-558","PYSEC-2021-756"],"url":"https://o3.security/vulnerability/CVE-2021-37645","summary":"Integer overflow due to conversion to unsigned","details":"### Impact\nThe 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.\n\n```python\nimport tensorflow as tf\n\ntf.raw_ops.QuantizeAndDequantizeV4Grad(\n  gradients=[1.0,2.0],\n  input=[1.0,1.0],\n  input_min=[0.0],\n  input_max=[10.0],\n  axis=-100)\n```\n\nThe [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.\n\n### Patches\nWe have patched the issue in GitHub commit [96f364a1ca3009f98980021c4b32be5fdcca33a1](https://github.com/tensorflow/tensorflow/commit/96f364a1ca3009f98980021c4b32be5fdcca33a1).\n\nThe 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.\n\n### For more information\nPlease consult [our security guide](https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md) for more information regarding the security model and how to contact us with issues and questions.\n\n### Attribution\nThis vulnerability has been reported by members of the Aivul Team from Qihoo 360.","published":"2021-08-12T21:15:07.887Z","modified":"2026-08-07T17:28:13.394019Z","cvss":{"score":5.5,"severity":"MEDIUM","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"},"epss":null,"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"PyPI","name":"tensorflow","fixedVersion":"2.4.3"},{"ecosystem":"PyPI","name":"tensorflow","fixedVersion":"2.5.1"},{"ecosystem":"PyPI","name":"tensorflow-cpu","fixedVersion":"2.4.3"},{"ecosystem":"PyPI","name":"tensorflow-cpu","fixedVersion":"2.5.1"},{"ecosystem":"PyPI","name":"tensorflow-gpu","fixedVersion":"2.4.3"},{"ecosystem":"PyPI","name":"tensorflow-gpu","fixedVersion":"2.5.1"}],"fix":{"url":"https://github.com/tensorflow/tensorflow/commit/96f364a1ca3009f98980021c4b32be5fdcca33a1","label":"tensorflow/tensorflow@96f364a"},"references":[{"type":"ADVISORY","url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-9w2p-5mgw-p94c"},{"type":"FIX","url":"https://github.com/tensorflow/tensorflow/commit/96f364a1ca3009f98980021c4b32be5fdcca33a1"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-37645"},{"type":"WEB","url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2021-558.yaml"},{"type":"WEB","url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2021-756.yaml"},{"type":"WEB","url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow/PYSEC-2021-267.yaml"},{"type":"PACKAGE","url":"https://github.com/tensorflow/tensorflow"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-07T17:28:13.394019Z"}}