{"id":"CVE-2021-37692","aliases":["CVE-2021-37692","GHSA-cmgw-8vpc-rc59","BIT-TENSORFLOW-2021-37692","PYSEC-2021-314","PYSEC-2021-605","PYSEC-2021-803"],"related":[],"kind":"vulnerability","state":"published","title":"Segfault on strings tensors with mistmatched dimensions in TensorFlow","summary":"TensorFlow is an end-to-end open source platform for machine learning. In affected versions under certain conditions, Go code can trigger a segfault in string deallocation. For string tensors, `C.TF_TString_Dealloc` is called during garbage collection within a finalizer function. However, tensor structure isn't checked until encoding to avoid a performance penalty. The current method for dealloc assumes that encoding succeeded, but segfaults when a string tensor is garbage collected whose encoding failed (e.g., due to mismatched dimensions). To fix this, the call to set the finalizer function is deferred until `NewTensor` returns and, if encoding failed for a string tensor, deallocs are determined based on bytes written. We have patched the issue in GitHub commit 8721ba96e5760c229217b594f6d2ba332beedf22. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, which is the other affected version.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"TensorFlow is an end-to-end open source platform for machine learning. In affected versions under certain conditions, Go code can trigger a segfault in string deallocation. For string tensors, `C.TF_TString_Dealloc` is called during garbage collection within a finalizer function. However, tensor structure isn't checked until encoding to avoid a performance penalty. The current method for dealloc assumes that encoding succeeded, but segfaults when a string tensor is garbage collected whose encoding failed (e.g., due to mismatched dimensions). To fix this, the call to set the finalizer function is deferred until `NewTensor` returns and, if encoding failed for a string tensor, deallocs are determined based on bytes written. We have patched the issue in GitHub commit 8721ba96e5760c229217b594f6d2ba332beedf22. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, which is the other affected version.","source":"cvelist"},{"lang":"en","text":"### Impact\nUnder certain conditions, Go code can trigger a segfault in string deallocation.\n\n\nFor string tensors, `C.TF_TString_Dealloc` is called during garbage collection within a finalizer function.  However, tensor structure isn't checked until encoding to avoid a performance penalty.  The current method for dealloc assumes that encoding succeeded, but segfaults when a string tensor is garbage collected whose encoding failed (e.g., due to mismatched dimensions).\n\nTo fix this, the call to set the finalizer function is deferred until `NewTensor` returns and, if encoding failed for a string tensor, deallocs are determined based on bytes written.\n\n### Patches\nWe have patched the issue in GitHub commit [8721ba96e5760c229217b594f6d2ba332beedf22](https://github.com/tensorflow/tensorflow/commit/8721ba96e5760c229217b594f6d2ba332beedf22) (merging [#50508](https://github.com/tensorflow/tensorflow/pull/50508)).\n\nThe fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, which is the other affected version.                                                                                                                                               \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 externally via a [fixing PR](https://github.com/tensorflow/tensorflow/pull/50508).","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 bajo determinadas condiciones, el código Go puede desencadenar un error de segmentación en la desasignación de cadenas.&#xa0;Para tensores de cadena, se llama a \"C.TF_TString_Dealloc\" durante la recolección de basura dentro de una función finalizer.&#xa0;Sin embargo, la estructura del tensor no es comprobada hasta la codificación para impedir que se lleve a cabo una penalización del rendimiento.&#xa0;El método actual para dealloc asume que la codificación tuvo éxito, pero segfaults cuando se recolecta basura un tensor de cadena cuya codificación falló (por ejemplo, debido a dimensiones no coincidentes).&#xa0;Para solucionar este problema, la llamada para establecer la función finalizer se aplaza hasta que regrese \"NewTensor\" y, si la codificación presenta un fallo para un tensor de cadena, las deslocalizaciones se determinan en función de los bytes escritos.&#xa0;Hemos solucionado el problema en GitHub commit 8721ba96e5760c229217b594f6d2ba332beedf22.&#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, que es la otra versión afectada.","source":"nvd"}],"published":"2021-08-12T23:00:14.000Z","modified":"2026-09-08T08:48:16.738Z","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:N/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-20"],"affected":[{"ranges":[{"version":">= 2.5.0, < 2.5.1","status":"affected"}],"vendor":"tensorflow","product":"tensorflow","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"2.5.0rc0","status":"affected","fixed":"2.5.1"}],"ecosystem":"PyPI","package":"tensorflow","purl":"pkg:pypi/tensorflow","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.5.0rc0","status":"affected","fixed":"2.5.1"}],"ecosystem":"PyPI","package":"tensorflow-cpu","purl":"pkg:pypi/tensorflow-cpu","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.5.0rc0","status":"affected","fixed":"2.5.1"}],"ecosystem":"PyPI","package":"tensorflow-gpu","purl":"pkg:pypi/tensorflow-gpu","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"2.5.0","fixed":"2.6.0"}],"vendor":"google","product":"tensorflow","cpe":"cpe:2.3:a:google:tensorflow:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"git","introduced":"0","status":"affected","fixed":"8721ba96e5760c229217b594f6d2ba332beedf22"},{"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":"8721ba96e5760c229217b594f6d2ba332beedf22"},{"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":"8721ba96e5760c229217b594f6d2ba332beedf22"},{"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.5.0","status":"affected","fixed":"2.6.0"}],"ecosystem":"Bitnami","package":"tensorflow","purl":"pkg:bitnami/tensorflow","source":"bitnami"}],"references":[{"url":"https://github.com/tensorflow/tensorflow/security/advisories/GHSA-cmgw-8vpc-rc59","tags":["advisory","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://github.com/tensorflow/tensorflow/pull/50508","tags":["advisory","patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec","bitnami"]},{"url":"https://github.com/tensorflow/tensorflow/commit/8721ba96e5760c229217b594f6d2ba332beedf22","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-37692","tags":["advisory","web"],"sources":["ghsa","bitnami"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-cpu/PYSEC-2021-605.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow-gpu/PYSEC-2021-803.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/tensorflow/PYSEC-2021-314.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-37692","url":"https://www.cve.org/CVERecord?id=CVE-2021-37692","licence":"CVE Terms of Use","modified":"2024-08-04T01:23:01.419Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-cmgw-8vpc-rc59","url":"https://github.com/advisories/GHSA-cmgw-8vpc-rc59","licence":"CC-BY-4.0","modified":"2026-07-08T06:28:58.551Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-37692","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-37692","licence":"Public domain","modified":"2026-06-17T04:00:59.760Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-314","url":"https://osv.dev/vulnerability/PYSEC-2021-314","licence":"CC-BY-4.0","modified":"2023-12-06T01:01:24.717Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-605","url":"https://osv.dev/vulnerability/PYSEC-2021-605","licence":"CC-BY-4.0","modified":"2023-12-06T01:01:24.717Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-803","url":"https://osv.dev/vulnerability/PYSEC-2021-803","licence":"CC-BY-4.0","modified":"2023-12-06T01:01:24.717Z"},{"source":"bitnami","name":"Bitnami Vulnerability Database","id":"BIT-TENSORFLOW-2021-37692","url":"https://osv.dev/vulnerability/BIT-TENSORFLOW-2021-37692","licence":"Apache-2.0","modified":"2026-09-08T08:48:16.738Z"}],"updatedAt":"2026-11-25T22:58:03.214Z","epss":{"score":0.00172,"percentile":0.03881,"date":"2026-11-30T12:00:22.000Z"}}