CVE-2021-29518: TensorFlow - Null Pointer Dereference in Eager Mode
Summary
CVE-2021-29518: Session operations in eager mode lead to null pointer dereferences. Affects tensorflow across 4 version ranges.
< 2.1.4
>= 2.2.0, < 2.2.3
>= 2.3.0, < 2.3.3
>= 2.4.0, < 2.4.2
Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓
Also tracked for
- tensorflow · PyPI
- tensorflow · PyPI
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
The same CVE-2021-29518 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
TensorFlow is an end-to-end open source platform for machine learning. It provides a comprehensive ecosystem of tools, libraries, and resources for developing and deploying machine learning models. TensorFlow supports eager mode, which allows for immediate execution of operations, and session mode, which provides a more traditional graph-based execution model. In eager mode, session operations are invalid, but users can still call the raw ops associated with them. This vulnerability arises from a null pointer dereference in the implementation of session operations in eager mode.
Vulnerability Detail
In TensorFlow's eager mode, the session state pointer is dereferenced without checking if it is valid. This can lead to a null pointer dereference, causing undefined behavior. An attacker could exploit this vulnerability by triggering the execution of session operations in eager mode, resulting in a crash or potential code execution. The vulnerability has been assigned the identifier CVE-2021-29518 and has a severity rating of High.
How To Fix
Fixed versions by release line
The minimum fixed version depends on the release line you run.
-
< 2.1.42.1.4 -
>= 2.2.0, < 2.2.32.2.3 -
>= 2.3.0, < 2.3.32.3.3 -
>= 2.4.0, < 2.4.22.4.2
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
As a workaround, users can avoid using eager mode and switch to session mode for executing operations. By using session mode, the vulnerability can be bypassed. Here is an example of how to switch from eager mode to session mode:
import tensorflow as tf
# Disable eager execution
tf.compat.v1.disable_eager_execution()
# Rest of the code using session mode
...
By disabling eager execution, the vulnerable session operations will not be triggered, eliminating the risk of null pointer dereference.
Conclusion
In conclusion, TensorFlow is affected by a high-severity vulnerability that allows for a null pointer dereference in eager mode. This can be exploited to cause crashes or potentially execute arbitrary code. Users should update their TensorFlow installations to the latest patched version and consider switching from eager mode to session mode as a workaround. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open source platform for machine learning, providing tools and resources for developing and deploying machine learning models.
Eager mode in TensorFlow allows for immediate execution of operations, providing a more interactive and intuitive programming experience.
This vulnerability affects TensorFlow when used in eager mode. It allows for a null pointer dereference, which can lead to crashes or potential code execution.
This vulnerability has a severity rating of High.
To mitigate the risk, it is recommended to update TensorFlow to the latest patched version, which includes a fix for this vulnerability.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.