CWE-680: Integer Overflow to Buffer Overflow
The product performs a calculation to determine how much memory to allocate, but an integer overflow can occur that causes less memory to be allocated than expected, leading to a buffer overflow.
View on MITRETechnical Details
- Structure
- Chain
Applicable To
Security Consequences
Scope
Impact
Mitigation Strategies
No mitigation information available for this CWE.
Detection Methods
No detection method information available for this CWE.
Code Examples & CVEs
Demonstrative Examples
The following image processing code allocates a table for images.
This code intends to allocate a table of size num_imgs, however as num_imgs grows large, the calculation determining the size of the list will eventually overflow (CWE-190). This will result in a very small list to be allocated instead. If the subsequent code operates on the list as if it were num_imgs long, it may result in many types of out-of-bounds problems (CWE-119).
Observed CVE Examples (2)
Chain: in a web browser, an unsigned 64-bit integer is forcibly cast to a 32-bit integer (CWE-681) and potentially leading to an integer overflow (CWE-190). If an integer overflow occurs, this can cause heap memory corruption (CWE-122)
View Detailschain: unchecked message size metadata allows integer overflow (CWE-190) leading to buffer overflow (CWE-119).
View DetailsCWE Relationships
No relationship information available for this CWE.
Frequently Asked Questions
What is CWE-680: Integer Overflow to Buffer Overflow?+
CWE-680: Integer Overflow to Buffer Overflow is a Common Weakness Enumeration (CWE) entry maintained by MITRE. The product performs a calculation to determine how much memory to allocate, but an integer overflow can occur that causes less memory to be allocated than expected, leading to a buffer overflow.
What are the security consequences of Integer Overflow to Buffer Overflow?+
If exploited, CWE-680 (Integer Overflow to Buffer Overflow) it can compromise Integrity, Availability and Confidentiality, leading to outcomes such as Modify Memory, DoS: Crash, Exit, or Restart and Execute Unauthorized Code or Commands.
Which programming languages are affected by Integer Overflow to Buffer Overflow?+
CWE-680 commonly affects Not Language-Specific. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.
What are real-world examples of Integer Overflow to Buffer Overflow?+
MITRE documents real CVEs mapped to CWE-680, including CVE-2021-43537 and CVE-2017-1000121. You can look up the full details of each CVE, including CVSS scores and remediation guidance, on our CVE Lookup tool.
What is the difference between a CWE and a CVE?+
A CWE (Common Weakness Enumeration) like CWE-680 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.