CVE-2021-37692: Segfault on strings tensors with mistmatched dimensions in TensorFlow
Impact Under certain conditions, Go code can trigger a segfault in string deallocation.
For string tensors, C.TFTStringDealloc 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.
Patches We have patched the issue in GitHub commit 8721ba96e5760c229217b594f6d2ba332beedf22 (merging #50508).
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.
For more information Please consult our security guide for more information regarding the security model and how to contact us with issues and questions.
Attribution This vulnerability has been reported externally via a fixing PR.
Other sources
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.TFTStringDealloc 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.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/tensorflow-gputo a version that resolves this vulnerability.Fixed in 2.5.1 - Upgrade
Upgrade
pip/tensorflow-cputo a version that resolves this vulnerability.Fixed in 2.5.1 - Upgrade
Upgrade
pip/tensorflowto a version that resolves this vulnerability.Fixed in 2.5.1 - Upgrade
Upgrade
tensorflowto a version that resolves this vulnerability.Fixed in 2.6.0 - Upgrade
Upgrade
tensorflowto a version that resolves this vulnerability.Fixed in 2.5.1Patch 8721ba96e5760c229217b594f6d2ba332beedf22 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Patch 8721ba96e5760c229217b594f6d2ba332beedf22
Event History
Frequently Asked Questions
What is the severity of CVE-2021-37692?
CVE-2021-37692 has a severity rating that requires attention, as it can lead to segmentation faults in Go code during string deallocation.
How do I fix CVE-2021-37692?
To fix CVE-2021-37692, upgrade to TensorFlow version 2.5.1 or later.
Which versions of TensorFlow are affected by CVE-2021-37692?
CVE-2021-37692 affects TensorFlow versions between 2.5.0 and 2.6.0.
What kind of issues does CVE-2021-37692 cause in TensorFlow?
CVE-2021-37692 can cause segmentation faults during garbage collection processes involving string tensors.
Is CVE-2021-37692 applicable to all TensorFlow installations?
No, CVE-2021-37692 specifically impacts installations using affected versions of TensorFlow, TensorFlow-GPU, and TensorFlow-CPU.