CVE-2022-23589: Null pointer dereference in Grappler's `IsConstant` in Tensorflow
Impact Under certain scenarios, Grappler component of TensorFlow can trigger a null pointer dereference. There are 2 places where this can occur, for the same malicious alteration of a SavedModel file (fixing the first one would trigger the same dereference in the second place):
First, during constant folding, the GraphDef might not have the required nodes for the binary operation:
cc NodeDef mulleftchild = nodemap->GetNode(node->input(0)); NodeDef mulrightchild = nodemap->GetNode(node->input(1)); // One child must be constant, and the second must be Conv op. const bool leftchildisconstant = IsReallyConstant(mulleftchild); const bool rightchildisconstant = IsReallyConstant(mulrightchild);
If a node is missing, the correposning mulchild would be null, and the dereference in the subsequent line would be incorrect.
We have a similar issue during IsIdentityConsumingSwitch:
cc NodeDef inputnode = graph.GetNode(tensorid.node()); return IsSwitch(inputnode);
Patches We have patched the issue in GitHub commits 0a365c029e437be0349c31f8d4c9926b69fa3fa1 and 045deec1cbdebb27d817008ad5df94d96a08b1bf.
The fix will be included in TensorFlow 2.8.0. We will also cherrypick this commit on TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, as these are also affected and still in supported range.
For more information Please consult our security guide for more information regarding the security model and how to contact us with issues and questions.
Other sources
Tensorflow is an Open Source Machine Learning Framework. Under certain scenarios, Grappler component of TensorFlow can trigger a null pointer dereference. There are 2 places where this can occur, for the same malicious alteration of a SavedModel file (fixing the first one would trigger the same dereference in the second place). First, during constant folding, the GraphDef might not have the required nodes for the binary operation. If a node is missing, the correposning mulchild would be null, and the dereference in the subsequent line would be incorrect. We have a similar issue during IsIdentityConsumingSwitch. The fix will be included in TensorFlow 2.8.0. We will also cherrypick this commit on TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, as these are also affected and still in supported range.
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.7.1 - Upgrade
Upgrade
pip/tensorflow-gputo a version that resolves this vulnerability.Fixed in 2.6.3 - Upgrade
Upgrade
pip/tensorflow-gputo a version that resolves this vulnerability.Fixed in 2.5.3 - Upgrade
Upgrade
pip/tensorflow-cputo a version that resolves this vulnerability.Fixed in 2.7.1 - Upgrade
Upgrade
pip/tensorflow-cputo a version that resolves this vulnerability.Fixed in 2.6.3 - Upgrade
Upgrade
pip/tensorflow-cputo a version that resolves this vulnerability.Fixed in 2.5.3 - Upgrade
Upgrade
pip/tensorflowto a version that resolves this vulnerability.Fixed in 2.7.1 - Upgrade
Upgrade
pip/tensorflowto a version that resolves this vulnerability.Fixed in 2.6.3 - Upgrade
Upgrade
pip/tensorflowto a version that resolves this vulnerability.Fixed in 2.5.3 - Upgrade
Upgrade
TensorFlowto a version that resolves this vulnerability.Fixed in 2.8.0 - Upgrade
Upgrade
TensorFlowto a version that resolves this vulnerability.Patch 0a365c029e437be0349c31f8d4c9926b69fa3fa1 - Upgrade
Upgrade
TensorFlowto a version that resolves this vulnerability.Patch 045deec1cbdebb27d817008ad5df94d96a08b1bf
Event History
Frequently Asked Questions
What is the severity of CVE-2022-23589?
CVE-2022-23589 is classified as a medium severity vulnerability due to the potential for null pointer dereference.
How do I fix CVE-2022-23589?
To resolve CVE-2022-23589, upgrade TensorFlow to version 2.7.1 or version 2.6.3 depending on your installed version.
Which versions of TensorFlow are affected by CVE-2022-23589?
CVE-2022-23589 affects TensorFlow versions up to 2.5.2, from 2.6.0 to 2.6.2, and version 2.7.0.
What component of TensorFlow is impacted by CVE-2022-23589?
The Grappler component of TensorFlow is the specific area impacted by CVE-2022-23589.
Can CVE-2022-23589 be exploited by a malicious SavedModel file?
Yes, CVE-2022-23589 can be triggered by a malicious alteration of a SavedModel file leading to a null pointer dereference.