TensorFlow can crash or run attacker code when given out-of-bounds axis

CriticalSE Fix-First Score 51/100CVE-2023-25668SE-AIV-00453Remote code executionModel serving and inferenceMade public 25 Mar 2023

Download as PDF

What this means

An attacker with the ability to pass data to TensorFlow can crash the application or run code with the privileges of the TensorFlow process. This can lead to data theft, system compromise, or service downtime. Any application that accepts untrusted input to quantization operations is at risk.

SecurityElites Manager Brief: the decision in one minute

TensorFlow has a critical flaw that lets attackers crash your system or run their code by sending specially crafted data to quantization functions. You must upgrade TensorFlow immediately to version 2.11.1 or later.

SecurityElites Fix-First Score51 of 100
Our own ranking of what to fix first. Real attacks count most, then the chance of attack, then severity.
SecurityElites fix windowWithin 7 days
Critical severity. This is our suggestion from common practice; your own policy comes first.
Who should own the fixMachine learning or data engineering team, with coordination from security and operations.
Likely effortAbout 30 minutes per environment: check which version is installed, upgrade the package, restart services, and verify the new version runs. Effort may increase if you have many isolated environments or if your application needs testing after the upgrade.

Questions to ask your team or supplier

  • Which of our TensorFlow deployments use quantization operations, and have they been tested with the new version?
  • Do we have input validation on the axis parameter for quantization functions, as a defense-in-depth measure?
  • Have our logs been checked for signs that this flaw was exploited before we applied the fix?

Message you can forward to the owning team

Security notice: TensorFlow can crash or run attacker code when given out-of-bounds axis (CVE-2023-25668)

Severity: Critical
SecurityElites Fix-First Score: 51 of 100
SecurityElites fix window: Within 7 days
Action: upgrade to tensorflow 2.11.1, tensorflow-cpu 2.11.1, tensorflow-gpu 2.11.1 or later.
What we need from you: confirm whether we run this software, who owns it, and the date it will be fixed.
Full guide: https://securityelites.com/ai-vulnerabilities/cve-2023-25668-tensorflow-can-crash-or-run-attacker-code-when-given/
Source: SecurityElites AI Vulnerabilities Database, record SE-AIV-00453

What is at stake in your AI setup

  • Model files: could be corrupted or replaced if an attacker gains code execution through this flaw.
  • Compute resources: a crash triggered by this flaw could waste GPU or CPU compute time and increase your cloud bill.
  • Training or retrieval data: if the TensorFlow process can read arbitrary memory, sensitive training data could be extracted.
  • Keys for inference APIs: if the TensorFlow process holds keys for external AI services, those keys could be stolen through memory access.

Map where your company uses AI

Who is exposed

  • Teams running TensorFlow versions before 2.11.1 for any quantization or dequantization tasks.
  • Applications that accept user input or external data fed into QuantizeAndDequantizeV2, V3, V4, or V4Grad operations.
  • Microservices or APIs that wrap TensorFlow quantization functions.
  • Development and testing environments running affected versions, even if production is patched.

Upgrades you need

SoftwareAffected versionsMove to
tensorflow
PyPI
Every version before 2.11.12.11.1 or later
tensorflow-cpu
PyPI
Every version before 2.11.12.11.1 or later
tensorflow-gpu
PyPI
Every version before 2.11.12.11.1 or later

Am I affected?

Enter the version you run. Nothing you type is stored.

SecurityElites Developer Brief: the technical picture

Is it being attackedNo known attacks and no public attack code when CISA last reviewed it
Where the attacker must beAnywhere that can reach it over a network, including the internet if it is exposed
Account neededNone. No login is needed
Does a person have to do somethingNo. It works without anyone clicking or opening anything
How hard it is to doEasy. It works reliably once the attacker can reach it
Risk of: data being readHigh
Risk of: data or settings being changedHigh
Risk of: the service being taken downHigh
Can attackers automate it at scaleYes, according to CISA
How much control an attacker gainsTotal control of the affected software, according to CISA

Read from the official severity rating: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Kind of coding mistake

  • CWE-122
  • CWE-125: memory is read out of bounds

If you cannot upgrade today

  • If you cannot upgrade immediately, add validation to block quantization operations or check that the axis parameter does not exceed the input tensor's dimensions before passing it to any QuantizeAndDequantizeV* operation.

Signs it may already have been used against you

  • Search application error logs for crashes in quantization operations, especially with messages about memory access, bounds, or segmentation faults that occurred before the upgrade.
  • Check TensorFlow debug or info-level logs for QuantizeAndDequantizeV2, V3, V4, or V4Grad operations with unusual or very large axis values.
  • Look for patterns of repeated failures or crashes in the same quantization function over a short time window, which could indicate repeated attack attempts.
  • Review access logs if your TensorFlow service is exposed via API; look for requests with very large numeric parameters to quantization endpoints.

Log searches to start from

Find quantization operation errors (adapt field names to your logs)Splunk

index=main (QuantizeAndDequantizeV2 OR QuantizeAndDequantizeV3 OR QuantizeAndDequantizeV4 OR QuantizeAndDequantizeV4Grad) (error OR crash OR segmentation OR fault OR bounds) | stats count by host, component

Find quantization operation errors (adapt field names to your logs)Elastic

message:(QuantizeAndDequantizeV2 OR QuantizeAndDequantizeV3 OR QuantizeAndDequantizeV4 OR QuantizeAndDequantizeV4Grad) AND (error OR crash OR segmentation OR fault OR bounds) | stats count by host, component

Written with AI as a starting point. Review them and change the index and field names to match your own logs before you rely on the result.

SecurityElites Fix Guide: step by step

  1. Find where TensorFlow is installedCheck all Python environments and containers where TensorFlow is used. Run pip list or pip show to find the installed version of tensorflow, tensorflow-cpu, and tensorflow-gpu packages in each environment.
  2. Check the current TensorFlow versionNote the version number of each TensorFlow installation. If any version is before 2.11.1, it must be upgraded. Use the snippet below to automate this check.
  3. Back up your application and dataCreate a snapshot or backup of your application configuration, trained models, and any persistent data before making changes. This lets you roll back quickly if the upgrade causes issues.
  4. Upgrade TensorFlow to version 2.11.1 or laterUse pip to upgrade: upgrade tensorflow to 2.11.1, tensorflow-cpu to 2.11.1, or tensorflow-gpu to 2.11.1, depending on which package your environment uses. If you have pinned versions in requirements files, update those files too.
  5. Restart services and applicationsStop and start all services, containers, or notebooks that use TensorFlow. This ensures the new version is loaded into memory.
  6. Verify the upgrade succeededRun pip show on the upgraded package and confirm the version is 2.11.1 or later. Use the snippet below to verify this programmatically in your application code.
  7. Test quantization operationsIf your application uses QuantizeAndDequantizeV2, V3, V4, or V4Grad, run your normal tests to ensure they still work correctly with the new version.
  8. Check logs for signs of exploitation before the fixSearch your application and system logs for unexpected crashes, memory errors, or errors from quantization operations that occurred before you applied the fix.

How to confirm it is fixed: Run the version check snippet in your Python environment and confirm that tensorflow, tensorflow-cpu, or tensorflow-gpu reports version 2.11.1 or later.

SecurityElites Quick Fixes: copy and paste

Upgrade tensorflow with pipupgrade

pip install --upgrade "tensorflow>=2.11.1"
pip show tensorflow | grep Version

Pin it in requirements.txtupgrade

tensorflow>=2.11.1

Upgrade tensorflow-cpu with pipupgrade

pip install --upgrade "tensorflow-cpu>=2.11.1"
pip show tensorflow-cpu | grep Version

Pin it in requirements.txtupgrade

tensorflow-cpu>=2.11.1

Upgrade tensorflow-gpu with pipupgrade

pip install --upgrade "tensorflow-gpu>=2.11.1"
pip show tensorflow-gpu | grep Version

Pin it in requirements.txtupgrade

tensorflow-gpu>=2.11.1

Check TensorFlow version in Pythonfor this issue

import tensorflow as tf
print(f'TensorFlow version: {tf.__version__}')
version_parts = tf.__version__.split('.')
major, minor, patch = int(version_parts[0]), int(version_parts[1]), int(version_parts[2].split('-')[0])
if (major < 2) or (major == 2 and minor < 11) or (major == 2 and minor == 11 and patch < 1):
    print('VULNERABLE: Please upgrade to 2.11.1 or later')
else:
    print('SAFE: Version is 2.11.1 or later')

Check installed version with pipfor this issue

pip show tensorflow | grep Version

Run the service in a locked-down containergeneral hardening

docker run --read-only --cap-drop ALL \
  --security-opt no-new-privileges --user 1000:1000 \
  -p 127.0.0.1:8080:8080 YOUR_IMAGE

Test in a non-production environment first. General hardening examples use placeholder names and ports; change them to match your setup.

Let your AI coding assistant do the upgrade

Paste this into the coding assistant you already use, inside the project. It checks first and asks before it changes anything.

Instruction for your coding assistant

You are helping me fix a security vulnerability (CVE-2023-25668) in this project.\n\n1. Search the whole repository, including lock files, container files and CI configuration, for these packages and list every place they are pinned or installed:\n   - tensorflow (PyPI): must be 2.11.1 or later
   - tensorflow-cpu (PyPI): must be 2.11.1 or later
   - tensorflow-gpu (PyPI): must be 2.11.1 or later
2. Tell me which version we use now and whether it is affected. Stop and ask me before changing anything.
3. After I agree, raise each one to the safe version, update the lock files, and keep every other dependency as it is.
4. Run the tests and tell me what failed.
5. Give me a short summary of the files you changed that I can put in the pull request.

SecurityElites Incident Drill: could your team handle this?

Four questions to ask in your next team meeting. If any has no clear answer, that is the gap to close.

What is the vulnerable parameter in the QuantizeAndDequantizeV2 operation?A good answer: The axis parameter: when it is larger than the number of dimensions in the input, it reads memory outside the bounds of the input tensor.
What versions of TensorFlow are affected?A good answer: All versions before 2.11.1 of tensorflow, tensorflow-cpu, and tensorflow-gpu packages on PyPI.
What is the fixed version and what should we upgrade to?A good answer: Upgrade to version 2.11.1 or later of the affected package.
What outcome could this vulnerability enable?A good answer: An attacker could cause the application to crash or run arbitrary code with the privileges of the TensorFlow process.

Run a full timed drill with your team

Ticket for your backlog

Paste into Jira, GitHub Issues or any tracker that reads Markdown.

Ready-made ticket

## TensorFlow can crash or run attacker code when given out-of-bounds axis (CVE-2023-25668)

**Severity:** Critical  |  **SE Fix-First Score:** 51/100  |  **Fix window:** Within 7 days
**Record:** SE-AIV-00453 https://securityelites.com/ai-vulnerabilities/cve-2023-25668-tensorflow-can-crash-or-run-attacker-code-when-given/

### Why this matters
An attacker with the ability to pass data to TensorFlow can crash the application or run code with the privileges of the TensorFlow process. This can lead to data theft, system compromise, or service downtime. Any application that accepts untrusted input to quantization operations is at risk.

### What to do
1. Find where TensorFlow is installed
2. Check the current TensorFlow version
3. Back up your application and data
4. Upgrade TensorFlow to version 2.11.1 or later
5. Restart services and applications
6. Verify the upgrade succeeded
7. Test quantization operations
8. Check logs for signs of exploitation before the fix

Full steps: https://securityelites.com/ai-vulnerabilities/cve-2023-25668-tensorflow-can-crash-or-run-attacker-code-when-given/

### Done when
- [ ] tensorflow is at 2.11.1 or later everywhere it is installed
- [ ] tensorflow-cpu is at 2.11.1 or later everywhere it is installed
- [ ] tensorflow-gpu is at 2.11.1 or later everywhere it is installed
- [ ] Lock files, container images and CI configuration are updated
- [ ] Run the version check snippet in your Python environment and confirm that tensorflow, tensorflow-cpu, or tensorflow-gpu reports version 2.11.1 or later.
- [ ] Logs were checked for signs of earlier use

SecurityElites Fix Tracker

Record who owns this fix, the date it is due and when it is done, and see everything still open in one list. Free with a SecurityElites account.

Sign in to track this fix

Change history

  • 24 Mar 2023: Made public
  • 2 Dec 2026: Published

Official record

### Impact Attackers using Tensorflow can exploit the vulnerability. They can access heap memory which is not in the control of user, leading to a crash or RCE. When axis is larger than the dim of input, c->Dim(input,axis) goes out of bound. Same problem occurs in the QuantizeAndDequantizeV2/V3/V4/V4Grad operations too. ```python import tensorflow as tf @tf.function def test(): tf.raw_ops.QuantizeAndDequantizeV2(input=[2.5], input_min=[1.0], input_max=[10.0], signed_input=True, num_bits=1, range_given=True, round_mode='HALF_TO_EVEN', narrow_range=True, axis=0x7fffffff) test() ```### Patches We have patched the issue in GitHub commit [7b174a0f2e40ff3f3aa957aecddfd5aaae35eccb](https://github.com/tensorflow/tensorflow/commit/7b174a0f2e40ff3f3aa957aecddfd5aaae35eccb).The fix will be included in TensorFlow 2.12.0. We will also cherrypick this commit on TensorFlow 2.11.1### 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.

Weakness type: CWE-122, CWE-125

Use this record in your own tools

Get this record as JSON

curl https://securityelites.com/wp-json/se-aivd/v1/vulns/CVE-2023-25668

For scanners and pipelines: OSV format · CycloneDX format · API guide · Email alerts · Fix tracker

The plain-language sections were written with AI from the official record, and the upgrade versions come directly from the official data. Last updated 2 Dec 2026. Read the vendor advisory before changing a production system.