CVE-2022-23576: CWE-190: Integer Overflow or Wraparound in tensorflow tensorflow
Tensorflow is an Open Source Machine Learning Framework. The implementation of `OpLevelCostEstimator::CalculateOutputSize` is vulnerable to an integer overflow if an attacker can create an operation which would involve tensors with large enough number of elements. We can have a large enough number of dimensions in `output_shape.dim()` or just a small number of dimensions being large enough to cause an overflow in the multiplication. 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.
AI Analysis
Technical Summary
CVE-2022-23576 is a medium-severity vulnerability affecting the TensorFlow open-source machine learning framework. The flaw resides in the implementation of the function OpLevelCostEstimator::CalculateOutputSize, which calculates the output tensor size based on the dimensions of the output shape. Specifically, the vulnerability is an integer overflow or wraparound (CWE-190) that occurs when the multiplication of the dimensions in output_shape.dim() results in a value exceeding the maximum representable integer size. This can happen either by having a large number of dimensions or by having one or more dimensions with very large sizes. When this overflow occurs, the calculated output size becomes incorrect, potentially leading to memory allocation errors, buffer overflows, or other undefined behaviors during tensor operations. The vulnerability affects TensorFlow versions prior to 2.5.3, versions between 2.6.0 and before 2.6.3, and versions between 2.7.0 and before 2.7.1. The issue was addressed in TensorFlow 2.8.0 and backported to supported versions 2.7.1, 2.6.3, and 2.5.3. No known exploits have been reported in the wild. Exploitation requires the attacker to craft operations involving tensors with maliciously large dimensions to trigger the overflow during output size calculation. This vulnerability could be leveraged in scenarios where untrusted or user-supplied tensor shapes are processed without adequate validation, potentially leading to denial of service or memory corruption. However, exploitation complexity is moderate as it requires detailed knowledge of the TensorFlow internals and the ability to influence tensor shapes processed by the system.
Potential Impact
For European organizations, the impact of this vulnerability depends largely on their use of TensorFlow in production or research environments. Organizations deploying TensorFlow for machine learning workloads that process untrusted input data or expose model training or inference services to external users could be at risk. Successful exploitation could lead to denial of service conditions by causing crashes or memory exhaustion, disrupting critical AI-driven services such as automated decision-making, predictive analytics, or computer vision applications. In worst cases, memory corruption might be leveraged to execute arbitrary code, though this is less likely without additional vulnerabilities. Given the increasing reliance on AI and machine learning in sectors such as finance, healthcare, manufacturing, and autonomous systems across Europe, this vulnerability could affect the availability and integrity of AI services. Additionally, organizations involved in AI research or cloud service providers offering TensorFlow-based services might face operational disruptions or reputational damage if exploited. However, since no known exploits exist and exploitation requires specific conditions, the immediate risk is moderate but should not be underestimated.
Mitigation Recommendations
European organizations should prioritize upgrading TensorFlow installations to version 2.8.0 or later, or to the patched versions 2.7.1, 2.6.3, or 2.5.3 as applicable. Where immediate upgrades are not feasible, organizations should implement strict input validation and sanitization for tensor shapes, ensuring that dimensions do not exceed safe thresholds to prevent integer overflow during output size calculations. Deploy runtime monitoring to detect abnormal tensor sizes or resource usage spikes that could indicate exploitation attempts. For environments exposing TensorFlow services externally, apply network segmentation and access controls to limit exposure to untrusted inputs. Additionally, conduct code reviews and security testing focused on tensor operations to identify potential misuse or unsafe handling of tensor dimensions. Incorporate fuzz testing targeting tensor shape inputs to proactively discover similar vulnerabilities. Finally, maintain awareness of TensorFlow security advisories and apply patches promptly to reduce exposure.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Italy, Spain, Poland, Belgium
CVE-2022-23576: CWE-190: Integer Overflow or Wraparound in tensorflow tensorflow
Description
Tensorflow is an Open Source Machine Learning Framework. The implementation of `OpLevelCostEstimator::CalculateOutputSize` is vulnerable to an integer overflow if an attacker can create an operation which would involve tensors with large enough number of elements. We can have a large enough number of dimensions in `output_shape.dim()` or just a small number of dimensions being large enough to cause an overflow in the multiplication. 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.
AI-Powered Analysis
Technical Analysis
CVE-2022-23576 is a medium-severity vulnerability affecting the TensorFlow open-source machine learning framework. The flaw resides in the implementation of the function OpLevelCostEstimator::CalculateOutputSize, which calculates the output tensor size based on the dimensions of the output shape. Specifically, the vulnerability is an integer overflow or wraparound (CWE-190) that occurs when the multiplication of the dimensions in output_shape.dim() results in a value exceeding the maximum representable integer size. This can happen either by having a large number of dimensions or by having one or more dimensions with very large sizes. When this overflow occurs, the calculated output size becomes incorrect, potentially leading to memory allocation errors, buffer overflows, or other undefined behaviors during tensor operations. The vulnerability affects TensorFlow versions prior to 2.5.3, versions between 2.6.0 and before 2.6.3, and versions between 2.7.0 and before 2.7.1. The issue was addressed in TensorFlow 2.8.0 and backported to supported versions 2.7.1, 2.6.3, and 2.5.3. No known exploits have been reported in the wild. Exploitation requires the attacker to craft operations involving tensors with maliciously large dimensions to trigger the overflow during output size calculation. This vulnerability could be leveraged in scenarios where untrusted or user-supplied tensor shapes are processed without adequate validation, potentially leading to denial of service or memory corruption. However, exploitation complexity is moderate as it requires detailed knowledge of the TensorFlow internals and the ability to influence tensor shapes processed by the system.
Potential Impact
For European organizations, the impact of this vulnerability depends largely on their use of TensorFlow in production or research environments. Organizations deploying TensorFlow for machine learning workloads that process untrusted input data or expose model training or inference services to external users could be at risk. Successful exploitation could lead to denial of service conditions by causing crashes or memory exhaustion, disrupting critical AI-driven services such as automated decision-making, predictive analytics, or computer vision applications. In worst cases, memory corruption might be leveraged to execute arbitrary code, though this is less likely without additional vulnerabilities. Given the increasing reliance on AI and machine learning in sectors such as finance, healthcare, manufacturing, and autonomous systems across Europe, this vulnerability could affect the availability and integrity of AI services. Additionally, organizations involved in AI research or cloud service providers offering TensorFlow-based services might face operational disruptions or reputational damage if exploited. However, since no known exploits exist and exploitation requires specific conditions, the immediate risk is moderate but should not be underestimated.
Mitigation Recommendations
European organizations should prioritize upgrading TensorFlow installations to version 2.8.0 or later, or to the patched versions 2.7.1, 2.6.3, or 2.5.3 as applicable. Where immediate upgrades are not feasible, organizations should implement strict input validation and sanitization for tensor shapes, ensuring that dimensions do not exceed safe thresholds to prevent integer overflow during output size calculations. Deploy runtime monitoring to detect abnormal tensor sizes or resource usage spikes that could indicate exploitation attempts. For environments exposing TensorFlow services externally, apply network segmentation and access controls to limit exposure to untrusted inputs. Additionally, conduct code reviews and security testing focused on tensor operations to identify potential misuse or unsafe handling of tensor dimensions. Incorporate fuzz testing targeting tensor shape inputs to proactively discover similar vulnerabilities. Finally, maintain awareness of TensorFlow security advisories and apply patches promptly to reduce exposure.
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2022-01-19T00:00:00.000Z
- Cisa Enriched
- true
Threat ID: 682d9848c4522896dcbf618b
Added to database: 5/21/2025, 9:09:28 AM
Last enriched: 6/22/2025, 4:06:01 AM
Last updated: 8/14/2025, 8:09:40 AM
Views: 19
Related Threats
CVE-2025-8878: CWE-94 Improper Control of Generation of Code ('Code Injection') in properfraction Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress
MediumCVE-2025-8143: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in pencidesign Soledad
MediumCVE-2025-8142: CWE-98 Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion') in pencidesign Soledad
HighCVE-2025-8105: CWE-94 Improper Control of Generation of Code ('Code Injection') in pencidesign Soledad
HighCVE-2025-8719: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in reubenthiessen Translate This gTranslate Shortcode
MediumActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
External Links
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.