{"id":"CVE-2021-37645","aliases":["CVE-2021-37645","GHSA-9w2p-5mgw-p94c","BIT-TENSORFLOW-2021-37645","PYSEC-2021-267","PYSEC-2021-558","PYSEC-2021-756"],"related":[],"kind":"vulnerability","state":"published","title":"Integer overflow due to conversion to unsigned in TensorFlow","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","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.","source":"cvelist"},{"lang":"en","text":"### 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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"TensorFlow es una plataforma de código abierto de extremo a extremo para el aprendizaje automático. En las versiones afectadas, la implementación \"tf.raw_ops.QuantizeAndDequantizeV4Grad\" es vulnerable a un problema de desbordamiento de enteros causado al convertir un valor entero con signo a uno sin signo y la posterior asignación de memoria basada en este valor. La [implementación](https://github.com/tensorflow/tensorflow/blob/8d72537c6abf5a44103b57b9c2e22c14f5f49698/tensorflow/core/kernels/quantize_and_dequantize_op.cc#L126) usa el valor de \"axis\" como argumento del tamaño del constructor de \"absl::InlinedVector\". Pero, el constructor usa un tipo sin signo para el argumento, por lo que la conversión implícita transforma el valor negativo en un entero grande. Hemos parcheado el problema en el commit 96f364a1ca3009f98980021c4b32be5fdcca33a1 de GitHub. La corrección será incluida en TensorFlow versión 2.6.0. También seleccionaremos este commit en TensorFlow 2.5.1, y TensorFlow 2.4.3, ya que estos también están afectados y todavía en el rango de soporte.","source":"nvd"}],"published":"2021-08-12T21:05:11.000Z","modified":"2026-09-08T08:48:22.974Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:L/AC:L/Au:N/C:N/I:N/A:P","score":2.1,"rating":"LOW"},{"scorer":"Bitnami Vulnerability Database","scheme":"rating","rating":"MEDIUM"}],"cwes":["CWE-681"],"affected":[{"ranges":[{"version":">= 2.5.0, < 2.5.1","status":"affected"},{"version":"< 2.4.3","status":"affected"}],"vendor":"tensorflow","product":"tensorflow","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.4.3"}],"ecosystem":"PyPI","package":"tensorflow","purl":"pkg:pypi/tensorflow","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.5.0","status":"affected","fixed":"2.5.1"}],"ecosystem":"PyPI","package":"tensorflow","purl":"pkg:pypi/tensorflow","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.4.3"}],"ecosystem":"PyPI","package":"tensorflow-cpu","purl":"pkg:pypi/tensorflow-cpu","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.5.0","status":"affected","fixed":"2.5.1"}],"ecosystem":"PyPI","package":"tensorflow-cpu","purl":"pkg:pypi/tensorflow-cpu","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.4.3"}],"ecosystem":"PyPI","package":"tensorflow-gpu","purl":"pkg:pypi/tensorflow-gpu","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.5.0","status":"affected","fixed":"2.5.1"}],"ecosystem":"PyPI","package":"tensorflow-gpu","purl":"pkg:pypi/tensorflow-gpu","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"2.3.0","fixed":"2.3.4"},{"status":"affected","introduced":"2.4.0","fixed":"2.4.3"},{"status":"affected","version":"2.5.0"},{"status":"affected","version":"2.6.0"},{"status":"affected","version":"2.6.0"},{"status":"affected","version":"2.6.0"}],"vendor":"google","product":"tensorflow","cpe":"cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"git","introduced":"0","status":"affected","fixed":"96f364a1ca3009f98980021c4b32be5fdcca33a1"},{"type":"ecosystem","introduced":"2.3.0","status":"affected","fixed":"2.3.4"},{"type":"ecosystem","introduced":"2.4.0","status":"affected","fixed":"2.4.3"}],"ecosystem":"PyPI","package":"tensorflow","purl":"pkg:pypi/tensorflow","repo":"https://github.com/tensorflow/tensorflow","source":"pysec"},{"ranges":[{"type":"git","introduced":"0","status":"affected","fixed":"96f364a1ca3009f98980021c4b32be5fdcca33a1"},{"type":"ecosystem","introduced":"2.3.0","status":"affected","fixed":"2.3.4"},{"type":"ecosystem","introduced":"2.4.0","status":"affected","fixed":"2.4.3"}],"ecosystem":"PyPI","package":"tensorflow-cpu","purl":"pkg:pypi/tensorflow-cpu","repo":"https://github.com/tensorflow/tensorflow","source":"pysec"},{"ranges":[{"type":"git","introduced":"0","status":"affected","fixed":"96f364a1ca3009f98980021c4b32be5fdcca33a1"},{"type":"ecosystem","introduced":"2.3.0","status":"affected","fixed":"2.3.4"},{"type":"ecosystem","introduced":"2.4.0","status":"affected","fixed":"2.4.3"}],"ecosystem":"PyPI","package":"tensorflow-gpu","purl":"pkg:pypi/tensorflow-gpu","repo":"https://github.com/tensorflow/tensorflow","source":"pysec"},{"ranges":[{"type":"semver","introduced":"2.3.0","status":"affected","fixed":"2.3.4"},{"type":"semver","introduced":"2.4.0","status":"affected","fixed":"2.4.3"},{"type":"semver","introduced":"2.5.0","status":"affected","fixed":"2.5.1"}],"ecosystem":"Bitnami","package":"tensorflow","purl":"pkg:bitnami/tensorflow","source":"bitnami"}],"references":[{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-9w2p-5mgw-p94c","tags":["advisory","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://github.com/tensorflow/tensorflow/commit/96f364a1ca3009f98980021c4b32be5fdcca33a1","tags":["advisory","fix","patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-37645","tags":["advisory","web"],"sources":["ghsa","bitnami"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2021-558.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2021-756.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow/PYSEC-2021-267.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/tensorflow/tensorflow","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-37645","url":"https://www.cve.org/CVERecord?id=CVE-2021-37645","licence":"CVE Terms of Use","modified":"2024-08-04T01:23:01.313Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-9w2p-5mgw-p94c","url":"https://github.com/advisories/GHSA-9w2p-5mgw-p94c","licence":"CC-BY-4.0","modified":"2026-07-08T06:28:45.534Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-37645","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-37645","licence":"Public domain","modified":"2026-06-17T04:00:53.767Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-267","url":"https://osv.dev/vulnerability/PYSEC-2021-267","licence":"CC-BY-4.0","modified":"2023-12-06T01:01:21.849Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-558","url":"https://osv.dev/vulnerability/PYSEC-2021-558","licence":"CC-BY-4.0","modified":"2023-12-06T01:01:21.849Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-756","url":"https://osv.dev/vulnerability/PYSEC-2021-756","licence":"CC-BY-4.0","modified":"2023-12-06T01:01:21.849Z"},{"source":"bitnami","name":"Bitnami Vulnerability Database","id":"BIT-TENSORFLOW-2021-37645","url":"https://osv.dev/vulnerability/BIT-TENSORFLOW-2021-37645","licence":"Apache-2.0","modified":"2026-09-08T08:48:22.974Z"}],"updatedAt":"2026-11-25T22:58:03.182Z","epss":{"score":0.00152,"percentile":0.02287,"date":"2026-11-30T12:00:22.000Z"}}