Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🐍
🐍 PyPI
Not in CISA KEV
HIGH severity

CVE-2021-29614 — tensorflow

HIGHFix: tensorflow/tensorflow@698e015

CVE-2021-29614 is a high-severity (CVSS 7.8) CWE-665 vulnerability in tensorflow. 1 public exploit reference exists, so weaponization risk is real. A fix is available for tensorflow — see the affected versions and patch details below.

Interpreter crash from `tf.io.decode_raw`

Also known asBIT-tensorflow-2021-29614GHSA-8pmx-p244-g88hPYSEC-2021-251PYSEC-2021-542PYSEC-2021-740
Published
Updated
Affected
12 pkgs
Patched
12 / 12
Exploits
1 known
Exploitation data as of Oct 9, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

EPSS Exploitation Probability

via FIRST.org ↗
0.2%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs12th percentile — riskier than 12% of all scored CVEsHighest risk
0.00%0.24%0.48%0.72%0.0%0.2%Apr 26Aug 26Oct 26

Probability of exploitation in the next 30 days, from FIRST.org EPSS.

How urgent is this, really

CVE-2021-29614 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.

Where this sits among everything scored

Of 385,386 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.

Real-World Exposure

12 pkgs affected
🐍tensorflow🐍tensorflow🐍tensorflow🐍tensorflow🐍tensorflow-cpu🐍tensorflow-cpu🐍tensorflow-cpu🐍tensorflow-cpu+4 more

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.

Description

Impact

The implementation of tf.io.decode_raw produces incorrect results and crashes the Python interpreter when combining fixed_length and wider datatypes.

import tensorflow as tf

tf.io.decode_raw(tf.constant(["1","2","3","4"]), tf.uint16, fixed_length=4)

The implementation of the padded version is buggy due to a confusion about pointer arithmetic rules.

First, the code computes the width of each output element by dividing the fixed_length value to the size of the type argument:

int width = fixed_length / sizeof(T);

The fixed_length argument is also used to determine the size needed for the output tensor:

TensorShape out_shape = input.shape();
out_shape.AddDim(width);
Tensor* output_tensor = nullptr;
OP_REQUIRES_OK(context, context->allocate_output("output", out_shape, &output_tensor));

auto out = output_tensor->flat_inner_dims<T>();
T* out_data = out.data();
memset(out_data, 0, fixed_length * flat_in.size());

This is followed by reencoding code:

for (int64 i = 0; i < flat_in.size(); ++i) {
  const T* in_data = reinterpret_cast<const T*>(flat_in(i).data());

  if (flat_in(i).size() > fixed_length) {
    memcpy(out_data, in_data, fixed_length);
  } else {
    memcpy(out_data, in_data, flat_in(i).size());
  }
  out_data += fixed_length;
}

The erroneous code is the last line above: it is moving the out_data pointer by fixed_length * sizeof(T) bytes whereas it only copied at most fixed_length bytes from the input. This results in parts of the input not being decoded into the output.

Furthermore, because the pointer advance is far wider than desired, this quickly leads to writing to outside the bounds of the backing data. This OOB write leads to interpreter crash in the reproducer mentioned here, but more severe attacks can be mounted too, given that this gadget allows writing to periodically placed locations in memory.

Patches

We have patched the issue in GitHub commit 698e01511f62a3c185754db78ebce0eee1f0184d.

The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, 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.

Affected Packages

12 total 12 fixed
EcosystemPackageVulnerable rangeFix
🐍PyPItensorflowall versions2.1.4pip install --upgrade 'tensorflow==2.1.4'
🐍PyPItensorflow≥ 2.2.0&&< 2.2.32.2.3pip install --upgrade 'tensorflow==2.2.3'
🐍PyPItensorflow≥ 2.3.0&&< 2.3.32.3.3pip install --upgrade 'tensorflow==2.3.3'
🐍PyPItensorflow≥ 2.4.0&&< 2.4.22.4.2pip install --upgrade 'tensorflow==2.4.2'
🐍PyPItensorflow-cpuall versions2.1.4pip install --upgrade 'tensorflow-cpu==2.1.4'
🐍PyPItensorflow-cpu≥ 2.2.0&&< 2.2.32.2.3pip install --upgrade 'tensorflow-cpu==2.2.3'

Affected Products

1 product · 4 configurations
Application
tensorflowgoogle
≥ 2.4.0 && < 2.4.2
range
Exploits & PoCs
1

Research use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for tensorflow, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update tensorflow to 2.1.4 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2021-29614 is resolved across your whole dependency graph.

  3. Workarounds

    Stop feeding it untrusted input: reject or quarantine files and payloads from unverified sources until you can upgrade, restrict accepted formats to the ones you actually need, and run the parsing or decoding step in a least-privileged sandbox or short-lived worker so a crash or corrupted read cannot reach the rest of the process.

Frequently Asked Questions

### Impact The implementation of `tf.io.decode_raw` produces incorrect results and crashes the Python interpreter when combining `fixed_length` and wider datatypes. ```python import tensorflow as tf tf.io.decode_raw(tf.constant(["1","2","3","4"]), tf.uint16, fixed_length=4) ``` The [implementation of the padded version](https://github.com/tensorflow/tensorflow/blob/1d8903e5b167ed0432077a3db6e462daf781d1fe/tensorflow/core/kernels/decode_padded_raw_op.cc) is buggy due to a confusion about pointer arithmetic rules. First, the code [computes](https://github.c
O3 Security · Impact-Aware SCA

Is CVE-2021-29614 in your dependencies?

Find it across PyPI, including transitive dependencies.

CVE-2021-29614: tensorflow — Fixed in 2.1.4