CVE-2022-41880: TensorFlow: heap OOB read in candidate sampler op

CRITICAL PoC AVAILABLE CISA: TRACK*
Published November 18, 2022
CISO Take

TensorFlow's BaseCandidateSamplerOp is exploitable without authentication over the network — any TF deployment accepting untrusted tensor inputs is at risk of memory disclosure or crash. Patch immediately to TF 2.11+ or the backport releases (2.10.1, 2.9.3, 2.8.4). If serving endpoints accept external input and cannot be patched immediately, add input validation to enforce true_classes ≤ range_max at the API layer.

Risk Assessment

CVSS 9.1 Critical with network/no-auth/no-interaction vector represents maximum exposure for any internet-facing TF serving endpoint. The heap OOB read (CWE-125) can expose adjacent process memory — in ML serving contexts this may include model weights, training data fragments, or in-memory credentials, making the effective impact higher than a standard process crash. Low attack complexity means exploitation requires minimal adversary skill once the endpoint is identified.

Affected Systems

Package Ecosystem Vulnerable Range Patched
tensorflow pip No patch
195.0K OpenSSF 7.2 3.7K dependents Pushed 6d ago 4% patched ~1372d to patch Full package profile →

Do you use tensorflow? You're affected.

Severity & Risk

CVSS 3.1
9.1 / 10
EPSS
0.2%
chance of exploitation in 30 days
Higher than 35% of all CVEs
Exploitation Status
Exploit Available
Exploitation: MEDIUM
Sophistication
Moderate
Exploitation Confidence
medium
CISA SSVC: Public PoC
Public PoC indexed (trickest/cve)
Composite signal derived from CISA KEV, CISA SSVC, EPSS, trickest/cve, and Nuclei templates.

Attack Surface

AV AC PR UI S C I A
AV Network
AC Low
PR None
UI None
S Unchanged
C High
I None
A High

Recommended Action

5 steps
  1. Upgrade to TensorFlow 2.11+. Backports available for 2.10.1, 2.9.3, and 2.8.4 — apply the cherry-pick commit b389f5c944cadfdfe599b3f1e4026e036f30d2d4 if upgrading major version is not immediately feasible.

  2. Add input validation at API ingestion to reject any true_classes tensor containing values exceeding configured range_max.

  3. Audit all public-facing TF Serving deployments for untrusted tensor input exposure.

  4. Apply process-level sandboxing (seccomp/AppArmor/gVisor) to TF serving containers to contain crash blast radius.

  5. Monitor serving logs for anomalous OOM or SIGABRT events as potential exploitation indicators.

CISA SSVC Assessment

Decision Track*
Exploitation poc
Automatable No
Technical Impact partial

Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.

Classification

Compliance Impact

This CVE is relevant to:

EU AI Act
Art.9 - Risk Management System
ISO 42001
A.6.2 - Security of AI System
NIST AI RMF
MANAGE-2.2 - Mechanisms to Respond to AI Risks
OWASP LLM Top 10
LLM05 - Supply Chain Vulnerabilities

Frequently Asked Questions

What is CVE-2022-41880?

TensorFlow's BaseCandidateSamplerOp is exploitable without authentication over the network — any TF deployment accepting untrusted tensor inputs is at risk of memory disclosure or crash. Patch immediately to TF 2.11+ or the backport releases (2.10.1, 2.9.3, 2.8.4). If serving endpoints accept external input and cannot be patched immediately, add input validation to enforce true_classes ≤ range_max at the API layer.

Is CVE-2022-41880 actively exploited?

Proof-of-concept exploit code is publicly available for CVE-2022-41880, increasing the risk of exploitation.

How to fix CVE-2022-41880?

1. Upgrade to TensorFlow 2.11+. Backports available for 2.10.1, 2.9.3, and 2.8.4 — apply the cherry-pick commit b389f5c944cadfdfe599b3f1e4026e036f30d2d4 if upgrading major version is not immediately feasible. 2. Add input validation at API ingestion to reject any true_classes tensor containing values exceeding configured range_max. 3. Audit all public-facing TF Serving deployments for untrusted tensor input exposure. 4. Apply process-level sandboxing (seccomp/AppArmor/gVisor) to TF serving containers to contain crash blast radius. 5. Monitor serving logs for anomalous OOM or SIGABRT events as potential exploitation indicators.

What systems are affected by CVE-2022-41880?

This vulnerability affects the following AI/ML architecture patterns: model serving, training pipelines, NLP model deployments, recommendation system pipelines.

What is the CVSS score for CVE-2022-41880?

CVE-2022-41880 has a CVSS v3.1 base score of 9.1 (CRITICAL). The EPSS exploitation probability is 0.15%.

Technical Details

NVD Description

TensorFlow is an open source platform for machine learning. When the `BaseCandidateSamplerOp` function receives a value in `true_classes` larger than `range_max`, a heap oob read occurs. We have patched the issue in GitHub commit b389f5c944cadfdfe599b3f1e4026e036f30d2d4. The fix will be included in TensorFlow 2.11. We will also cherrypick this commit on TensorFlow 2.10.1, 2.9.3, and TensorFlow 2.8.4, as these are also affected and still in supported range.

Exploitation Scenario

An adversary targets an organization's TF Serving endpoint powering a recommendation API that uses sampled softmax training. By reviewing TensorFlow source code and the GHSA advisory, they identify that BaseCandidateSamplerOp performs no bounds check on true_classes against range_max. They craft a prediction request with a true_classes tensor value exceeding range_max, triggering a heap OOB read. Repeated controlled reads allow the adversary to probe adjacent heap memory, potentially leaking cached model weights, API keys loaded into the serving process, or fragments of other users' inference inputs. No credentials or prior access are required if the endpoint is publicly reachable.

Weaknesses (CWE)

CVSS Vector

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H

Timeline

Published
November 18, 2022
Last Modified
November 21, 2024
First Seen
November 18, 2022

Related Vulnerabilities