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.

What is the risk?

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.

What systems are affected?

Package Ecosystem Vulnerable Range Patched
TensorFlow pip No patch
195.8K OpenSSF 7.1 3.7K dependents Pushed 2d ago 4% patched ~1372d to patch Full package profile →

Do you use TensorFlow? You're affected.

How severe is it?

CVSS 3.1
9.1 / 10
EPSS
0.4%
chance of exploitation in 30 days
Higher than 30% 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, VulnCheck KEV, CISA SSVC, EPSS, Metasploit, Exploit-DB, trickest/cve, Nuclei templates, and inthewild.io exploitation reports.

What is the 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

What should I do?

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.

What does CISA's SSVC say?

Decision Track*
Exploitation poc
Automatable No
Technical Impact partial

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

How is it classified?

Which compliance frameworks are affected?

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.38%.

What is the AI security impact?

Affected AI Architectures

model servingtraining pipelinesNLP model deploymentsrecommendation system pipelines

MITRE ATLAS Techniques

AML.T0010.001 AI Software
AML.T0043 Craft Adversarial Data
AML.T0049 Exploit Public-Facing Application

Compliance Controls Affected

EU AI Act: Art.9
ISO 42001: A.6.2
NIST AI RMF: MANAGE-2.2
OWASP LLM Top 10: LLM05

What are the technical details?

Original Advisory

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)

CWE-125 — Out-of-bounds Read: The product reads data past the end, or before the beginning, of the intended buffer.

  • [Implementation] Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylis
  • [Architecture and Design] Use a language that provides appropriate memory abstractions.

Source: MITRE CWE corpus.

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