Executive brief
TensorFlow is an open-source machine learning framework used to build and train neural network models. The Dequantize operation, which converts quantized tensors to floating-point values, fails to properly validate the axis parameter, allowing attackers to read memory beyond array bounds. An attacker with the ability to invoke TensorFlow operations could extract sensitive data from memory or crash the application.
Technical details
The vulnerability is an out-of-bounds (OOB) heap read in TensorFlow's Dequantize kernel (CWE-125). The root cause is insufficient validation of the axis parameter—while the code checks that axis is greater than -1, it does not verify that axis does not exceed the number of input tensor dimensions. This allows an attacker to pass an arbitrarily large axis value (e.g., 2^31-1) that causes the code to read past the end of the dimension array when accessing input.dim_size(axis_). The attack requires the ability to call tf.raw_ops.Dequantize with a crafted input, which is feasible in environments where users can execute arbitrary TensorFlow code (network-accessible inference servers, collaborative notebooks). Patches are available in TensorFlow 2.8.0, 2.7.1, 2.6.3, and 2.5.3.
Affected products
- Google TensorFlow < 2.5.3, 2.6.0-2.6.2, 2.7.0
- Google TensorFlow CPU < 2.5.3, 2.6.0-2.6.2, 2.7.0
- Google TensorFlow GPU < 2.5.3, 2.6.0-2.6.2, 2.7.0
Timeline
- 2022-02-09: disclosed
- 2022-02: patched: Fixed in TensorFlow 2.8.0; backports to 2.7.1, 2.6.3, 2.5.3