🛡️ CVE-2021-37670 — tensorflow
Description
Heap OOB in UpperBound and LowerBound
Impact
An attacker can read from outside of bounds of heap allocated data by sending specially crafted illegal arguments to tf.raw_ops.UpperBound:
```python
import tensorflow as tf
tf.raw_ops.UpperBound(
sorted_input=[1,2,3],
values=tf.constant(value=[[0,0,0],[1,1,1],[2,2,2]],dtype=tf.int64),
out_type=tf.int64)
```
The [implementation](https://github.com/tensorflow/tensorflow/blob/460e000de3a83278fb00b61a16d161b1964f15f4/tensorflow/core/kernels/searchsorted_op.cc#L85-L104) does not validate the rank of sorted_input argument:
```cc
void Compute(OpKernelContext* ctx) override {
const Tensor& sorted_inputs_t = ctx->input(0);
// ...
OP_REQUIRES(ctx, sorted_inputs_t.dim_size(0) == values_t.dim_size(0),
Status(error::INVALID_ARGUMENT,
"Leading dim_size of both tensors must match."));
// ...
if (output_t->dtype() == DT_INT32) {
OP_REQUIRES(ctx,
FastBoundsCheck(sorted_inputs_t.dim_size(1), ...));
// ...
}
```
As we access the first two dimensions of sorted_inputs_t tensor, it must have rank at least 2.
A similar issue occurs in tf.raw_ops.LowerBound.
Patches
We have patched the issue in GitHub commit [42459e4273c2e47a3232cc16c4f4fff3b3a35c38](https://github.com/tensorflow/tensorflow/commit/42459e4273c2e47a3232cc16c4f4fff3b3a35c38).
The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1, TensorFlow 2.4.3, and TensorFlow 2.3.4, as these are also affected and still in supported range.
For more information
Please consult [our security guide](https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md) for more information regarding the security model and how to contact us with issues and questions.
Attribution
This vulnerability has been reported by members of the Aivul Team from Qihoo 360.
How this vulnerability can be exploited
This issue can be reached with local access to the system, attack complexity is low, an attacker needs low-level privileges on the target. No user interaction is required. Rated impact: confidentiality high, integrity none, availability none.
Weakness class
CVE-2021-37670 is classified as CWE-125: Out-of-bounds Read. The code reads past the limits of a buffer, exposing adjacent memory contents or crashing the process.
Affected software
CVE-2021-37670 is recorded against 3 packages.
- tensorflow
- tensorflow-cpu (from 2.5.0 up to 2.5.1)
- tensorflow-gpu (from 2.5.0 up to 2.5.1)
Timeline and source
Published on 6 March 2024 and last revised on 8 July 2026. No public exploit is currently recorded for this entry. A vendor advisory or fix has been published. Record sourced from OSV.
References
Details
CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
Affected Packages
| Software | From version | Fixed in |
|---|---|---|
| tensorflow | — | — |
| tensorflow-cpu | 2.5.0 | 2.5.1 |
| tensorflow-gpu | 2.5.0 | 2.5.1 |
References
Similar Threats
More CVE 2021 advisories
Browse all of CVE 2021 in the advisory index.
Vulnerability Monitoring
Track new vulnerabilities in tensorflow
CVE-2021-37670 is rated CVSS 5.0 Medium. BotEraser monitors your WordPress installation and notifies you when software you use appears in our vulnerability database.
Set Up Free Alerts →No credit card required · Results in minutes
ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.