Executive brief
TensorFlow is an open-source machine learning library widely used to build and deploy AI models. A stack overflow vulnerability exists in how TensorFlow processes GraphDef files (the format used to represent computational graphs). An attacker who can provide a malicious SavedModel file with self-recursive function definitions can trigger a crash during model loading, causing denial of service to applications that load untrusted models.
Technical details
The vulnerability is a stack overflow (CWE-400, CWE-674) in TensorFlow's GraphDef parser. The issue occurs because TensorFlow's runtime assumes that GraphDef format does not contain self-recursive functions, but the parser does not enforce this invariant. An attacker can craft a SavedModel containing a self-referential function definition where a node references the containing function, causing unbounded recursion during NodeDef resolution. This can be triggered when loading a SavedModel file. The fix was released in commit 448a16182065bd08a202d9057dd8ca541e67996c and is available in TensorFlow 2.8.0 and backported to 2.7.1, 2.6.3, and 2.5.3.
Affected products
- Google TensorFlow before 2.5.3, 2.6.0 before 2.6.3, 2.7.0 before 2.7.1
- Google TensorFlow CPU before 2.5.3, 2.6.0 before 2.6.3, 2.7.0 before 2.7.1
- Google TensorFlow GPU before 2.5.3, 2.6.0 before 2.6.3, 2.7.0 before 2.7.1
Timeline
- 2022-02-04: disclosed: GitHub advisory published
- 2022-02-04: patched: Fix committed in GitHub commit 448a16182065bd08a202d9057dd8ca541e67996c