CVE-2022-23560

8.8 HIGH

📋 TL;DR

This vulnerability in TensorFlow allows attackers to craft malicious TFLite models that can read and write memory outside of allocated arrays during sparse-to-dense tensor conversion. This affects all users running vulnerable TensorFlow versions who process untrusted TFLite models, potentially leading to memory corruption and arbitrary code execution.

💻 Affected Systems

Products:
  • TensorFlow
  • TensorFlow Lite
Versions: TensorFlow 2.5.0 to 2.7.0, and potentially earlier versions
Operating Systems: All operating systems running TensorFlow
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects processing of TFLite models with sparse tensors. All TensorFlow deployments using TFLite are vulnerable by default.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise, data theft, or ransomware deployment.

🟠

Likely Case

Memory corruption causing application crashes, denial of service, or limited information disclosure.

🟢

If Mitigated

No impact if proper input validation and model sanitization are implemented alongside patching.

🌐 Internet-Facing: HIGH - If TensorFlow services process user-uploaded models, attackers can exploit remotely without authentication.
🏢 Internal Only: MEDIUM - Internal users could exploit via malicious models in ML pipelines or shared repositories.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

Exploitation requires crafting malicious TFLite models. The vulnerability is in the core conversion logic, making reliable exploitation feasible for skilled attackers.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: TensorFlow 2.8.0, 2.7.1, 2.6.3, 2.5.3

Vendor Advisory: https://github.com/tensorflow/tensorflow/security/advisories/GHSA-4hvf-hxvg-f67v

Restart Required: Yes

Instructions:

1. Identify TensorFlow version: pip show tensorflow 2. Upgrade to patched version: pip install --upgrade tensorflow==2.8.0 (or appropriate version) 3. Restart all TensorFlow services and applications 4. Verify upgrade: python -c 'import tensorflow as tf; print(tf.__version__)'

🔧 Temporary Workarounds

Disable TFLite Model Processing

all

Temporarily disable processing of TFLite models until patching is complete.

# Modify application code to reject .tflite files
# Implement input validation to block sparse tensor models

Sandbox Model Execution

linux

Run TensorFlow in isolated containers with minimal privileges.

docker run --read-only --cap-drop=ALL -v /safe/models:/models tensorflow/tensorflow:latest

🧯 If You Can't Patch

  • Implement strict input validation: only allow trusted, verified TFLite models from known sources
  • Deploy runtime protection: Use memory-safe languages for model preprocessing or employ ASLR/CFG hardening

🔍 How to Verify

Check if Vulnerable:

Check TensorFlow version: python -c 'import tensorflow as tf; print(tf.__version__)'. Versions 2.5.0-2.7.0 are vulnerable.

Check Version:

python -c 'import tensorflow as tf; print(tf.__version__)'

Verify Fix Applied:

Confirm version is 2.8.0, 2.7.1, 2.6.3, or 2.5.3. Test with known safe TFLite models to ensure functionality.

📡 Detection & Monitoring

Log Indicators:

  • TensorFlow segmentation faults or memory errors
  • Unexpected model processing failures
  • Large number of .tflite file uploads

Network Indicators:

  • Unusual uploads of TFLite models to ML endpoints
  • Spikes in model processing requests

SIEM Query:

source="tensorflow" AND (error="segmentation" OR error="memory" OR "tflite" AND status="failed")

🔗 References

📤 Share & Export