Google · Tensorflow · CVE-2021-29513
Name of the Vulnerable Software and Affected Versions:
TensorFlow versions prior to 2.5.0
TensorFlow version 2.4.2
TensorFlow version 2.3.3
TensorFlow version 2.2.3
TensorFlow version 2.1.4
Description:
The issue arises when calling TF operations with tensors of non-numeric types, resulting in null pointer dereferences. This occurs due to a type confusion in the conversion from Python array to C++ array. The estimated number of potentially affected devices is not provided. There is no information about real-world incidents where this issue was exploited.
Technical details about exploitation include:
- The conversion from Python array to C++ array is vulnerable to a type confusion.
- The `pyarray type` is `NPY VOID` but the `descr` field is such that `descr->field = NULL`, triggering a null dereference in `PyArrayDescr to TF DataType`.
- API endpoints and variables are not explicitly mentioned, but the issue involves the use of `tf.random.truncated normal`, `tf.random.stateless truncated normal`, `tf.one hot`, `tf.range`, and `tf.raw ops.ResourceCountUpTo` functions.
Recommendations:
- For TensorFlow version 2.1.4, update to a newer version that includes the fix.
- For TensorFlow version 2.2.3, update to a newer version that includes the fix.
- For TensorFlow version 2.3.3, update to a newer version that includes the fix.
- For TensorFlow version 2.4.2, update to a newer version that includes the fix.
- For versions prior to 2.5.0, update to version 2.5.0 or later to resolve the issue.
As a temporary workaround, consider avoiding the use of non-numeric tensors with TF operations until a patch is available. Restrict access to the vulnerable conversion function to minimize the risk of exploitation.