Skip to main content

CVE-2022-41885: CWE-131: Incorrect Calculation of Buffer Size in tensorflow tensorflow

Medium
Published: Fri Nov 18 2022 (11/18/2022, 00:00:00 UTC)
Source: CVE
Vendor/Project: tensorflow
Product: tensorflow

Description

TensorFlow is an open source platform for machine learning. When `tf.raw_ops.FusedResizeAndPadConv2D` is given a large tensor shape, it overflows. We have patched the issue in GitHub commit d66e1d568275e6a2947de97dca7a102a211e01ce. 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.

AI-Powered Analysis

AILast updated: 06/21/2025, 21:22:35 UTC

Technical Analysis

CVE-2022-41885 is a medium-severity vulnerability in TensorFlow, an open-source machine learning platform widely used for developing and deploying machine learning models. The vulnerability arises from an incorrect calculation of buffer size (CWE-131) in the function tf.raw_ops.FusedResizeAndPadConv2D. Specifically, when this function is provided with a large tensor shape, an integer overflow occurs during buffer size computation. This overflow can lead to buffer overflows, which may cause memory corruption, crashes, or potentially arbitrary code execution depending on how the corrupted memory is leveraged. The issue affects TensorFlow versions prior to 2.7.4, versions 2.8.0 up to but not including 2.8.1, and versions 2.9.0 up to but not including 2.9.1. The vulnerability was patched in a GitHub commit (d66e1d568275e6a2947de97dca7a102a211e01ce) and the fix is included in TensorFlow 2.11 and backported to 2.10.1, 2.9.3, and 2.8.4. No known exploits have been reported in the wild to date. Exploitation requires feeding specially crafted large tensor shapes to the vulnerable function, which is typically invoked in machine learning workflows. This vulnerability does not require authentication or user interaction beyond supplying malicious input to the TensorFlow API or application using it. The flaw impacts confidentiality, integrity, and availability by potentially allowing memory corruption and denial of service, and possibly code execution in environments running vulnerable TensorFlow versions.

Potential Impact

For European organizations, the impact of this vulnerability depends on their use of TensorFlow in production or research environments. Organizations leveraging TensorFlow for AI/ML workloads—such as financial institutions using AI for fraud detection, healthcare providers using ML for diagnostics, or manufacturing firms employing AI for predictive maintenance—may be at risk. Exploitation could lead to denial of service by crashing ML services or, in worst cases, arbitrary code execution enabling attackers to compromise systems running TensorFlow. This could result in data breaches, disruption of critical AI-driven services, and loss of trust. Since TensorFlow is often integrated into larger systems, the vulnerability could be a vector for lateral movement or persistence within networks. The lack of known exploits reduces immediate risk, but the widespread use of TensorFlow and the ease of triggering the vulnerability by supplying crafted inputs mean that organizations should prioritize patching. Additionally, AI research institutions and cloud service providers hosting TensorFlow workloads in Europe could be targeted to disrupt AI services or steal intellectual property.

Mitigation Recommendations

1. Immediate upgrade to patched TensorFlow versions: update to TensorFlow 2.11 or later, or apply backported patches in 2.10.1, 2.9.3, or 2.8.4 as applicable. 2. Audit all machine learning pipelines and applications that use TensorFlow to identify vulnerable versions. 3. Implement input validation and sanitization on tensor shapes and sizes before passing them to TensorFlow APIs to prevent oversized or malicious inputs. 4. Employ runtime protections such as memory safety tools (e.g., AddressSanitizer) during development and testing to detect buffer overflows. 5. Monitor logs and application behavior for crashes or anomalies indicative of exploitation attempts. 6. For cloud deployments, restrict access to TensorFlow services and APIs to trusted users and networks to reduce exposure. 7. Engage with vendors and cloud providers to ensure TensorFlow instances are updated and hardened. 8. Incorporate vulnerability scanning for TensorFlow versions in asset management and vulnerability management programs. These steps go beyond generic advice by emphasizing input validation, runtime protections, and supply chain vigilance specific to TensorFlow ML workloads.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
GitHub_M
Date Reserved
2022-09-30T00:00:00.000Z
Cisa Enriched
true

Threat ID: 682d9849c4522896dcbf6caf

Added to database: 5/21/2025, 9:09:29 AM

Last enriched: 6/21/2025, 9:22:35 PM

Last updated: 8/1/2025, 10:55:06 AM

Views: 18

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats