{"id":"CVE-2021-37670","aliases":["CVE-2021-37670","GHSA-9697-98pf-4rw7","BIT-TENSORFLOW-2021-37670","PYSEC-2021-292","PYSEC-2021-583","PYSEC-2021-781"],"related":[],"kind":"vulnerability","state":"published","title":"Heap OOB in `UpperBound` and `LowerBound` in TensorFlow","summary":"TensorFlow is an end-to-end open source platform for machine learning. In affected versions an attacker can read from outside of bounds of heap allocated data by sending specially crafted illegal arguments to `tf.raw_ops.UpperBound`. The [implementation](https://github.com/tensorflow/tensorflow/blob/460e000de3a83278fb00b61a16d161b1964f15f4/tensorflow/core/kernels/searchsorted_op.cc#L85-L104) does not validate the rank of `sorted_input` argument. A similar issue occurs in `tf.raw_ops.LowerBound`. We have patched the issue in GitHub commit 42459e4273c2e47a3232cc16c4f4fff3b3a35c38. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4, 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 an attacker can read from outside of bounds of heap allocated data by sending specially crafted illegal arguments to `tf.raw_ops.UpperBound`. The [implementation](https://github.com/tensorflow/tensorflow/blob/460e000de3a83278fb00b61a16d161b1964f15f4/tensorflow/core/kernels/searchsorted_op.cc#L85-L104) does not validate the rank of `sorted_input` argument. A similar issue occurs in `tf.raw_ops.LowerBound`. We have patched the issue in GitHub commit 42459e4273c2e47a3232cc16c4f4fff3b3a35c38. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4, as these are also affected and still in supported range.","source":"cvelist"},{"lang":"en","text":"### Impact\nAn attacker can read from outside of bounds of heap allocated data by sending specially crafted illegal arguments to `tf.raw_ops.UpperBound`:\n\n```python\nimport tensorflow as tf\n  \ntf.raw_ops.UpperBound(\n  sorted_input=[1,2,3],\n  values=tf.constant(value=[[0,0,0],[1,1,1],[2,2,2]],dtype=tf.int64),\n  out_type=tf.int64)\n```\n  \nThe [implementation](https://github.com/tensorflow/tensorflow/blob/460e000de3a83278fb00b61a16d161b1964f15f4/tensorflow/core/kernels/searchsorted_op.cc#L85-L104) does not validate the rank of `sorted_input` argument:\n\n```cc\n  void Compute(OpKernelContext* ctx) override {\n    const Tensor& sorted_inputs_t = ctx->input(0);\n    // ...\n    OP_REQUIRES(ctx, sorted_inputs_t.dim_size(0) == values_t.dim_size(0),\n                Status(error::INVALID_ARGUMENT,\n                       \"Leading dim_size of both tensors must match.\"));\n    // ...\n    if (output_t->dtype() == DT_INT32) {\n      OP_REQUIRES(ctx,\n                  FastBoundsCheck(sorted_inputs_t.dim_size(1), ...));\n      // ...\n    }\n```\n\nAs we access the first two dimensions of `sorted_inputs_t` tensor, it must have rank at least 2.\n\nA similar issue occurs in `tf.raw_ops.LowerBound`.\n\n### Patches\nWe have patched the issue in GitHub commit [42459e4273c2e47a3232cc16c4f4fff3b3a35c38](https://github.com/tensorflow/tensorflow/commit/42459e4273c2e47a3232cc16c4f4fff3b3a35c38).\n  \nThe fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4, 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.&#xa0;En las versiones afectadas, un atacante puede leer desde fuera de límites de los datos asignados a la pila mediante el envío de argumentos ilegales especialmente diseñados a \"tf.raw_ops.UpperBound\".&#xa0;La [implementación] (https://github.com/tensorflow/tensorflow/blob/460e000de3a83278fb00b61a16d161b1964f15f4/tensorflow/core/kernels/searchsorted_op.cc#L85-L104) no comprueba el rango del argumento \"sorted_input\".&#xa0;Un problema similar ocurre en \"tf.raw_ops.LowerBound\".&#xa0;Hemos solucionado el problema en GitHub commit 42459e4273c2e47a3232cc16c4f4fff3b3a35c38.&#xa0;La corrección será incluida en TensorFlow versión 2.6.0.&#xa0;También seleccionaremos este commit en TensorFlow versión 2.5.1, TensorFlow versión 2.4.3 y TensorFlow versión 2.3.4, ya que estos también están afectados y aún se encuentran en el rango admitido.","source":"nvd"}],"published":"2021-08-12T22:25:16.000Z","modified":"2026-09-08T08:46:41.130Z","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:N","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:H/I:N/A:N","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:H/I:N/A:N","score":5.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/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:H/I:N/A:N","score":5.5,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:L/AC:L/Au:N/C:P/I:N/A:N","score":2.1,"rating":"LOW"},{"scorer":"Bitnami Vulnerability Database","scheme":"rating","rating":"MEDIUM"}],"cwes":["CWE-125"],"affected":[{"ranges":[{"version":">= 2.5.0, < 2.5.1","status":"affected"},{"version":">= 2.4.0, < 2.4.3","status":"affected"},{"version":"< 2.3.4","status":"affected"}],"vendor":"tensorflow","product":"tensorflow","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.3.4"}],"ecosystem":"PyPI","package":"tensorflow","purl":"pkg:pypi/tensorflow","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.4.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.3.4"}],"ecosystem":"PyPI","package":"tensorflow-cpu","purl":"pkg:pypi/tensorflow-cpu","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.4.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.3.4"}],"ecosystem":"PyPI","package":"tensorflow-gpu","purl":"pkg:pypi/tensorflow-gpu","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.4.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":"42459e4273c2e47a3232cc16c4f4fff3b3a35c38"},{"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":"42459e4273c2e47a3232cc16c4f4fff3b3a35c38"},{"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":"42459e4273c2e47a3232cc16c4f4fff3b3a35c38"},{"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-9697-98pf-4rw7","tags":["advisory","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://github.com/tensorflow/tensorflow/commit/42459e4273c2e47a3232cc16c4f4fff3b3a35c38","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-37670","tags":["advisory","web"],"sources":["ghsa","bitnami"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2021-583.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2021-781.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow/PYSEC-2021-292.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-37670","url":"https://www.cve.org/CVERecord?id=CVE-2021-37670","licence":"CVE Terms of Use","modified":"2024-08-04T01:23:01.507Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-9697-98pf-4rw7","url":"https://github.com/advisories/GHSA-9697-98pf-4rw7","licence":"CC-BY-4.0","modified":"2026-07-08T06:29:57.921Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-37670","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-37670","licence":"Public domain","modified":"2026-06-17T04:00:56.950Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-292","url":"https://osv.dev/vulnerability/PYSEC-2021-292","licence":"CC-BY-4.0","modified":"2023-12-06T01:01:23.361Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-583","url":"https://osv.dev/vulnerability/PYSEC-2021-583","licence":"CC-BY-4.0","modified":"2023-12-06T01:01:23.361Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-781","url":"https://osv.dev/vulnerability/PYSEC-2021-781","licence":"CC-BY-4.0","modified":"2023-12-06T01:01:23.361Z"},{"source":"bitnami","name":"Bitnami Vulnerability Database","id":"BIT-TENSORFLOW-2021-37670","url":"https://osv.dev/vulnerability/BIT-TENSORFLOW-2021-37670","licence":"Apache-2.0","modified":"2026-09-08T08:46:41.130Z"}],"updatedAt":"2026-11-25T22:58:03.205Z","epss":{"score":0.00173,"percentile":0.0702,"date":"2026-12-01T12:00:22.000Z"}}