{"id":"CVE-2021-41211","aliases":["CVE-2021-41211","GHSA-cvgx-3v3q-m36c","BIT-TENSORFLOW-2021-41211","PYSEC-2021-403","PYSEC-2021-620","PYSEC-2021-818"],"related":[],"kind":"vulnerability","state":"published","title":"Heap OOB read in shape inference for `QuantizeV2`","summary":"TensorFlow is an open source platform for machine learning. In affected versions the shape inference code for `QuantizeV2` can trigger a read outside of bounds of heap allocated array. This occurs whenever `axis` is a negative value less than `-1`. In this case, we are accessing data before the start of a heap buffer. The code allows `axis` to be an optional argument (`s` would contain an `error::NOT_FOUND` error code). Otherwise, it assumes that `axis` is a valid index into the dimensions of the `input` tensor. If `axis` is less than `-1` then this results in a heap OOB read. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, as this version is the only one that is also affected.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"TensorFlow is an open source platform for machine learning. In affected versions the shape inference code for `QuantizeV2` can trigger a read outside of bounds of heap allocated array. This occurs whenever `axis` is a negative value less than `-1`. In this case, we are accessing data before the start of a heap buffer. The code allows `axis` to be an optional argument (`s` would contain an `error::NOT_FOUND` error code). Otherwise, it assumes that `axis` is a valid index into the dimensions of the `input` tensor. If `axis` is less than `-1` then this results in a heap OOB read. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, as this version is the only one that is also affected.","source":"cvelist"},{"lang":"en","text":"### Impact\nThe [shape inference code for `QuantizeV2`](https://github.com/tensorflow/tensorflow/blob/8d72537c6abf5a44103b57b9c2e22c14f5f49698/tensorflow/core/framework/common_shape_fns.cc#L2509-L2530) can trigger a read outside of bounds of heap allocated array:\n\n```python\nimport tensorflow as tf\n\n@tf.function\ndef test():\n  data=tf.raw_ops.QuantizeV2(\n    input=[1.0,1.0],\n    min_range=[1.0,10.0],\n    max_range=[1.0,10.0],\n    T=tf.qint32,\n    mode='MIN_COMBINED',\n    round_mode='HALF_TO_EVEN',\n    narrow_range=False,\n    axis=-100,\n    ensure_minimum_range=10)\n  return data\n\ntest()\n```\n\nThis occurs whenever `axis` is a negative value less than `-1`. In this case, we are accessing data before the start of a heap buffer:\n    \n```cc\nint axis = -1;\nStatus s = c->GetAttr(\"axis\", &axis);\nif (!s.ok() && s.code() != error::NOT_FOUND) {\n  return s;\n}   \n... \nif (axis != -1) {\n  ...\n  TF_RETURN_IF_ERROR(\n      c->Merge(c->Dim(minmax, 0), c->Dim(input, axis), &depth));\n}\n```\n\nThe code allows `axis` to be an optional argument (`s` would contain an `error::NOT_FOUND` error code). Otherwise, it assumes that `axis` is a valid index into the dimensions of the `input` tensor. If `axis` is less than `-1` then this results in a heap OOB read.\n    \n### Patches\nWe have patched the issue in GitHub commit [a0d64445116c43cf46a5666bd4eee28e7a82f244](https://github.com/tensorflow/tensorflow/commit/a0d64445116c43cf46a5666bd4eee28e7a82f244).\n    \nThe fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, as this version is the only one that is also affected.\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 para el aprendizaje automático. En las versiones afectadas, el código de inferencia de forma para \"QuantizeV2\" puede desencadenar una lectura fuera de límites de la matriz asignada a la pila. Esto ocurre siempre que el \"eje\" es un valor negativo menor que \"1\". En este caso, estamos accediendo a los datos antes del inicio de un buffer de heap. El código permite que \"axis\" sea un argumento opcional (\"s\" contendría un código de error \"error::NOT_FOUND\"). En caso contrario, asume que \"axis\" es un índice válido en las dimensiones del tensor \"input\". Si \"axis\" es menor que \"-1\", se produce una lectura OOB de la pila. La corrección será incluida en TensorFlow versión 2.7.0. También vamos a incluir este commit en TensorFlow versión 2.6.1, ya que esta versión es la única que también está afectada","source":"nvd"}],"published":"2021-11-05T20:15:11.000Z","modified":"2026-09-08T08:48:25.205Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H","score":7.1,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H","score":7.1,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H","score":7.1,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H","score":7.1,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:L/AC:L/Au:N/C:P/I:N/A:P","score":3.6,"rating":"LOW"},{"scorer":"Bitnami Vulnerability Database","scheme":"rating","rating":"HIGH"}],"cwes":["CWE-125"],"affected":[{"ranges":[{"version":">= 2.6.0, < 2.6.1","status":"affected"}],"vendor":"tensorflow","product":"tensorflow","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"2.6.0","status":"affected","fixed":"2.6.1"}],"ecosystem":"PyPI","package":"tensorflow","purl":"pkg:pypi/tensorflow","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.6.0","status":"affected","fixed":"2.6.1"}],"ecosystem":"PyPI","package":"tensorflow-cpu","purl":"pkg:pypi/tensorflow-cpu","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.6.0","status":"affected","fixed":"2.6.1"}],"ecosystem":"PyPI","package":"tensorflow-gpu","purl":"pkg:pypi/tensorflow-gpu","source":"ghsa"},{"ranges":[{"status":"affected","version":"2.6.0"}],"vendor":"google","product":"tensorflow","cpe":"cpe:2.3:a:google:tensorflow:2.6.0:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"git","introduced":"0","status":"affected","fixed":"a0d64445116c43cf46a5666bd4eee28e7a82f244"},{"type":"ecosystem","introduced":"2.6.0","status":"affected","fixed":"2.6.1"},{"type":"ecosystem","introduced":"2.7.0rc0","status":"affected","fixed":"2.7.0"}],"ecosystem":"PyPI","package":"tensorflow","purl":"pkg:pypi/tensorflow","repo":"https://github.com/tensorflow/tensorflow","source":"pysec"},{"ranges":[{"type":"git","introduced":"0","status":"affected","fixed":"a0d64445116c43cf46a5666bd4eee28e7a82f244"},{"type":"ecosystem","introduced":"2.6.0","status":"affected","fixed":"2.6.1"},{"type":"ecosystem","introduced":"2.7.0rc0","status":"affected","fixed":"2.7.0"}],"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":"a0d64445116c43cf46a5666bd4eee28e7a82f244"},{"type":"ecosystem","introduced":"2.6.0","status":"affected","fixed":"2.6.1"},{"type":"ecosystem","introduced":"2.7.0rc0","status":"affected","fixed":"2.7.0"}],"ecosystem":"PyPI","package":"tensorflow-gpu","purl":"pkg:pypi/tensorflow-gpu","repo":"https://github.com/tensorflow/tensorflow","source":"pysec"},{"ranges":[{"type":"semver","introduced":"2.6.0","status":"affected","fixed":"2.6.1"}],"ecosystem":"Bitnami","package":"tensorflow","purl":"pkg:bitnami/tensorflow","source":"bitnami"}],"references":[{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-cvgx-3v3q-m36c","tags":["advisory","exploit","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://github.com/tensorflow/tensorflow/commit/a0d64445116c43cf46a5666bd4eee28e7a82f244","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-41211","tags":["advisory","web"],"sources":["ghsa","bitnami"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2021-620.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2021-818.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow/PYSEC-2021-403.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-41211","url":"https://www.cve.org/CVERecord?id=CVE-2021-41211","licence":"CVE Terms of Use","modified":"2024-08-04T03:08:31.458Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-cvgx-3v3q-m36c","url":"https://github.com/advisories/GHSA-cvgx-3v3q-m36c","licence":"CC-BY-4.0","modified":"2026-07-08T06:29:09.995Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-41211","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-41211","licence":"Public domain","modified":"2026-06-17T04:08:06.273Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-403","url":"https://osv.dev/vulnerability/PYSEC-2021-403","licence":"CC-BY-4.0","modified":"2023-12-06T01:01:34.407Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-620","url":"https://osv.dev/vulnerability/PYSEC-2021-620","licence":"CC-BY-4.0","modified":"2023-12-06T01:01:34.407Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-818","url":"https://osv.dev/vulnerability/PYSEC-2021-818","licence":"CC-BY-4.0","modified":"2023-12-06T01:01:34.407Z"},{"source":"bitnami","name":"Bitnami Vulnerability Database","id":"BIT-TENSORFLOW-2021-41211","url":"https://osv.dev/vulnerability/BIT-TENSORFLOW-2021-41211","licence":"Apache-2.0","modified":"2026-09-08T08:48:25.205Z"}],"updatedAt":"2026-11-25T22:58:05.388Z","epss":{"score":0.00208,"percentile":0.06165,"date":"2026-11-30T12:00:22.000Z"}}