CVE-2022-21733: TensorFlow: StringNGrams integer overflow enables OOM DoS

MEDIUM PoC AVAILABLE CISA: TRACK*
Published February 3, 2022
CISO Take

Any TensorFlow deployment exposing the StringNGrams operation via an inference API is vulnerable to remote DoS by any authenticated user — the exploitation bar is low. Patch immediately to TF 2.8.0, 2.7.1, 2.6.3, or 2.5.3. If patching is delayed, add strict server-side input validation on pad_width parameters and enforce memory limits on inference containers.

What is the risk?

Medium severity (CVSS 6.5) but operationally significant for NLP inference services. AV:N/AC:L/PR:L means any authenticated API consumer can crash the server with a single crafted request. No code execution or data exposure, but uncontrolled OOM can cascade to container or node failures in shared infrastructure. Not in CISA KEV and no observed in-the-wild exploitation, but the vulnerability is trivially reproducible from the public patch diff.

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
6.5 / 10
EPSS
0.8%
chance of exploitation in 30 days
Higher than 52% of all CVEs
Exploitation Status
Exploit Available
Exploitation: MEDIUM
Sophistication
Trivial
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 Low
UI None
S Unchanged
C None
I None
A High

What should I do?

5 steps
  1. Patch: upgrade to TensorFlow 2.8.0, 2.7.1, 2.6.3, or 2.5.3 — commit f68fdab93fb7f4ddb4eb438c8fe052753c9413e8 contains the fix.

  2. Workaround: validate and bound pad_width inputs at the API gateway layer before invoking StringNGrams operations.

  3. Defense-in-depth: enforce memory limits on TF inference containers (e.g., Kubernetes resource limits) to contain blast radius of OOM events.

  4. Detection: alert on sudden memory spikes followed by OOM kills in TF serving processes; monitor for abnormal request patterns targeting string processing endpoints.

  5. API hardening: restrict inference API access to the minimum required set of authenticated callers.

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
Article 15 - Accuracy, robustness and cybersecurity
ISO 42001
A.6.2 - AI system operational and monitoring controls
NIST AI RMF
MANAGE 2.2 - Mechanisms to sustain AI system operation in adverse conditions
OWASP LLM Top 10
LLM04 - Model Denial of Service

Frequently Asked Questions

What is CVE-2022-21733?

Any TensorFlow deployment exposing the StringNGrams operation via an inference API is vulnerable to remote DoS by any authenticated user — the exploitation bar is low. Patch immediately to TF 2.8.0, 2.7.1, 2.6.3, or 2.5.3. If patching is delayed, add strict server-side input validation on pad_width parameters and enforce memory limits on inference containers.

Is CVE-2022-21733 actively exploited?

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

How to fix CVE-2022-21733?

1. Patch: upgrade to TensorFlow 2.8.0, 2.7.1, 2.6.3, or 2.5.3 — commit f68fdab93fb7f4ddb4eb438c8fe052753c9413e8 contains the fix. 2. Workaround: validate and bound pad_width inputs at the API gateway layer before invoking StringNGrams operations. 3. Defense-in-depth: enforce memory limits on TF inference containers (e.g., Kubernetes resource limits) to contain blast radius of OOM events. 4. Detection: alert on sudden memory spikes followed by OOM kills in TF serving processes; monitor for abnormal request patterns targeting string processing endpoints. 5. API hardening: restrict inference API access to the minimum required set of authenticated callers.

What systems are affected by CVE-2022-21733?

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

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

CVE-2022-21733 has a CVSS v3.1 base score of 6.5 (MEDIUM). The EPSS exploitation probability is 0.81%.

What is the AI security impact?

Affected AI Architectures

model servingNLP preprocessing pipelinestraining pipelines

MITRE ATLAS Techniques

AML.T0029 Denial of AI Service
AML.T0034 Cost Harvesting
AML.T0049 Exploit Public-Facing Application

Compliance Controls Affected

EU AI Act: Article 15
ISO 42001: A.6.2
NIST AI RMF: MANAGE 2.2
OWASP LLM Top 10: LLM04

What are the technical details?

Original Advisory

Tensorflow is an Open Source Machine Learning Framework. The implementation of `StringNGrams` can be used to trigger a denial of service attack by causing an out of memory condition after an integer overflow. We are missing a validation on `pad_witdh` and that result in computing a negative value for `ngram_width` which is later used to allocate parts of the output. The fix will be included in TensorFlow 2.8.0. We will also cherrypick this commit on TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, as these are also affected and still in supported range.

Exploitation Scenario

An adversary with a valid API account — a trial user, compromised credential, or malicious insider — submits a text inference request to a TensorFlow Serving endpoint that processes n-gram features. The request includes a crafted pad_width value designed to trigger integer overflow in the StringNGrams kernel. TF computes a negative ngram_width and attempts to allocate an impossibly large output buffer, exhausting server memory and crashing the inference process. In Kubernetes environments, this triggers pod restart loops, producing a sustained service outage for all users sharing that endpoint with no forensic indicators beyond OOM logs.

Weaknesses (CWE)

CWE-190 — Integer Overflow or Wraparound: The product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. This occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may become a very small or negative number.

  • [Requirements] Ensure that all protocols are strictly defined, such that all out-of-bounds behavior can be identified simply, and require strict conformance to the protocol.
  • [Requirements] Use a language that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. If possible, choose a language or compiler that performs automatic bounds checking.

Source: MITRE CWE corpus.

CVSS Vector

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

Timeline

Published
February 3, 2022
Last Modified
May 5, 2025
First Seen
February 3, 2022

Related Vulnerabilities