Learn about CVE-2021-37652, a high-severity vulnerability in TensorFlow's boosted trees creation, allowing use after free errors. Find out the impact, affected versions, and mitigation steps.
TensorFlow is an end-to-end open-source platform for machine learning. In certain versions, a vulnerability exists in the implementation of
tf.raw_ops.BoostedTreesCreateEnsemble
, allowing for a use after free error with specially crafted arguments.
Understanding CVE-2021-37652
This CVE describes a use after free vulnerability in boosted trees creation within TensorFlow.
What is CVE-2021-37652?
CVE-2021-37652 is a vulnerability in TensorFlow versions that allows an attacker to trigger a use after free error by supplying specially crafted arguments to
tf.raw_ops.BoostedTreesCreateEnsemble
function. This can lead to a double-free process and access of invalid memory, impacting system integrity, confidentiality, and availability.
The Impact of CVE-2021-37652
The impact of this CVE is rated as high, with a CVSS base score of 7.8. It requires low privileges to exploit locally, but can result in high confidentiality, integrity, and availability impacts. The vulnerability is classified as CWE-416: Use After Free.
Technical Details of CVE-2021-37652
In the affected versions, TensorFlow incorrectly handles the lifecycle of a resource object used in
tf.raw_ops.BoostedTreesCreateEnsemble
, leading to a double-free scenario. This issue arises due to a change in resource representation from a naked pointer to a smart pointer during code refactoring.
Vulnerability Description
The vulnerability stems from improper resource handling, resulting in a situation where a resource is freed multiple times, leading to memory corruption and potential exploitation by attackers.
Affected Systems and Versions
The vulnerability affects TensorFlow versions >= 2.5.0 and < 2.5.1, >= 2.4.0 and < 2.4.3, and < 2.3.4.
Exploitation Mechanism
Attackers can exploit this vulnerability by providing specially crafted arguments to the vulnerable function, triggering the use after free error and double-free process.
Mitigation and Prevention
To mitigate the impact of CVE-2021-37652, immediate steps should be taken to address the vulnerability and prevent exploitation.
Immediate Steps to Take
Users are advised to apply the patches provided by TensorFlow to address the vulnerability. It is crucial to update to TensorFlow 2.6.0 or the patched versions (2.5.1, 2.4.3, 2.3.4) to prevent exploitation.
Long-Term Security Practices
In the long term, developers should follow secure coding practices, conduct regular security audits, and stay informed about security updates for third-party libraries like TensorFlow.
Patching and Updates
TensorFlow has released patches addressing the CVE in GitHub commit 5ecec9c6fbdbc6be03295685190a45e7eee726ab. These fixes are included in TensorFlow 2.6.0 and will be backported to versions 2.5.1, 2.4.3, and 2.3.4 to cover all affected and supported releases.