CVE-2020-26268: Write to immutable memory region in TensorFlow
Impact The tf.rawops.ImmutableConst operation returns a constant tensor created from a memory mapped file which is assumed immutable. However, if the type of the tensor is not an integral type, the operation crashes the Python interpreter as it tries to write to the memory area:
python >> import tensorflow as tf >> with open('/tmp/test.txt','w') as f: f.write('a'128) >> tf.rawops.ImmutableConst(dtype=tf.string,shape=2, memoryregionname='/tmp/test.txt')
If the file is too small, TensorFlow properly returns an error as the memory area has fewer bytes than what is needed for the tensor it creates. However, as soon as there are enough bytes, the above snippet causes a segmentation fault.
This is because the alocator used to return the buffer data is not marked as returning an opaque handle since the needed virtual method is not overriden.
Patches We have patched the issue in GitHub commit c1e1fc899ad5f8c725dcbb6470069890b5060bc7 and will release TensorFlow 2.4.0 containing the patch. TensorFlow nightly packages after this commit will also have the issue resolved.
Since this issue also impacts TF versions before 2.4, we will patch all releases between 1.15 and 2.3 inclusive.
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 by members of the Aivul Team from Qihoo 360.
Other sources
In affected versions of TensorFlow the tf.rawops.ImmutableConst operation returns a constant tensor created from a memory mapped file which is assumed immutable. However, if the type of the tensor is not an integral type, the operation crashes the Python interpreter as it tries to write to the memory area. If the file is too small, TensorFlow properly returns an error as the memory area has fewer bytes than what is needed for the tensor it creates. However, as soon as there are enough bytes, the above snippet causes a segmentation fault. This is because the allocator used to return the buffer data is not marked as returning an opaque handle since the needed virtual method is not overridden. This is fixed in versions 1.15.5, 2.0.4, 2.1.3, 2.2.2, 2.3.2, and 2.4.0.
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2020-26268?
The severity of CVE-2020-26268 is considered moderate due to its potential to crash the Python interpreter.
How do I fix CVE-2020-26268?
To fix CVE-2020-26268, upgrade TensorFlow to version 2.3.2 or later, or to version 1.15.5.
Which versions of TensorFlow are affected by CVE-2020-26268?
CVE-2020-26268 affects TensorFlow versions prior to 1.15.5 and versions between 2.0.0 and 2.3.0.
How can I check if my TensorFlow version is vulnerable to CVE-2020-26268?
You can verify your TensorFlow version by running 'pip show tensorflow' in your command line or terminal.
What is the impact of CVE-2020-26268 on applications using TensorFlow?
The impact of CVE-2020-26268 includes potential crashes of applications when using the 'tf.raw_ops.ImmutableConst' operation with non-integral tensor types.