{"@ID": "190", "@Name": "Integer Overflow or Wraparound", "@Abstraction": "Base", "@Structure": "Simple", "@Status": "Stable", "@Diagram": "/data/images/CWE-190-Diagram.png", "Description": "The product performs a calculation that can\n         produce an integer overflow or wraparound when the logic\n         assumes that the resulting value will always be larger than\n         the original value. This occurs when an integer value is\n         incremented to a value that is too large to store in the\n         associated representation. When this occurs, the value may\n         become a very small or negative number.", "Related_Weaknesses": {"Related_Weakness": [{"@Nature": "ChildOf", "@CWE_ID": "682", "@View_ID": "1000", "@Ordinal": "Primary"}, {"@Nature": "ChildOf", "@CWE_ID": "682", "@View_ID": "1003", "@Ordinal": "Primary"}, {"@Nature": "ChildOf", "@CWE_ID": "20", "@View_ID": "700", "@Ordinal": "Primary"}, {"@Nature": "CanPrecede", "@CWE_ID": "119", "@View_ID": "1000", "@Chain_ID": "680"}]}, "Weakness_Ordinalities": {"Weakness_Ordinality": [{"Ordinality": "Primary"}, {"Ordinality": "Resultant"}]}, "Applicable_Platforms": {"Language": [{"@Class": "Not Language-Specific", "@Prevalence": "Undetermined"}, {"@Name": "C", "@Prevalence": "Often"}], "Technology": {"@Class": "Not Technology-Specific", "@Prevalence": "Undetermined"}}, "Alternate_Terms": {"Alternate_Term": [{"Term": "Overflow", "Description": "The terms \"overflow\" and \"wraparound\" are\n               used interchangeably by some people, but they can have\n               more precise distinctions by others. See Terminology\n               Notes."}, {"Term": "Wraparound", "Description": "The terms \"overflow\" and \"wraparound\" are\n               used interchangeably by some people, but they can have\n               more precise distinctions by others. See Terminology\n               Notes."}, {"Term": "wrap, wrap-around, wrap around", "Description": "Alternate spellings of \"wraparound\""}]}, "Modes_Of_Introduction": {"Introduction": {"Phase": "Implementation", "Note": "This weakness may become security critical when determining the offset or size in behaviors such as memory allocation, copying, and concatenation."}}, "Likelihood_Of_Exploit": "Medium", "Common_Consequences": {"Consequence": [{"Scope": "Availability", "Impact": ["DoS: Crash, Exit, or Restart", "DoS: Resource Consumption (Memory)", "DoS: Instability"], "Note": "This weakness can generally lead to undefined behavior and therefore crashes. When the calculated result is used for resource allocation, this weakness can cause too many (or too few) resources to be allocated, possibly enabling crashes if the product requests more resources than can be provided."}, {"Scope": "Integrity", "Impact": "Modify Memory", "Note": "If the value in question is important to data (as opposed to flow), simple data corruption has occurred. Also, if the overflow/wraparound results in other conditions such as buffer overflows, further memory corruption may occur."}, {"Scope": ["Confidentiality", "Availability", "Access Control"], "Impact": ["Execute Unauthorized Code or Commands", "Bypass Protection Mechanism"], "Note": "This weakness can sometimes trigger buffer overflows, which can be used to execute arbitrary code. This is usually outside the scope of the product's implicit security policy."}, {"Scope": ["Availability", "Other"], "Impact": ["Alter Execution Logic", "DoS: Crash, Exit, or Restart", "DoS: Resource Consumption (CPU)"], "Note": "If the overflow/wraparound occurs in a loop index variable, this could cause the loop to terminate at the wrong time - too early, too late, or not at all (i.e., infinite loops). With too many iterations, some loops could consume too many resources such as memory, file handles, etc., possibly leading to a crash or other DoS."}, {"Scope": "Access Control", "Impact": "Bypass Protection Mechanism", "Note": "If integer values are used in security-critical decisions, such as calculating quotas or allocation limits, integer overflows can be used to cause an incorrect security decision."}]}, "Detection_Methods": {"Detection_Method": [{"@Detection_Method_ID": "DM-1", "Method": "Automated Static Analysis", "Description": "This weakness can often be detected using automated static analysis tools. Many modern tools use data flow analysis or constraint-based techniques to minimize the number of false positives.", "Effectiveness": "High"}, {"@Detection_Method_ID": "DM-2", "Method": "Black Box", "Description": "Sometimes, evidence of this weakness can be detected using dynamic tools and techniques that interact with the product using large test suites with many diverse inputs, such as fuzz testing (fuzzing), robustness testing, and fault injection. The product's operation may slow down, but it should not become unstable, crash, or generate incorrect results.", "Effectiveness": "Moderate", "Effectiveness_Notes": "Without visibility into the code, black box methods may not be able to sufficiently distinguish this weakness from others, requiring follow-up manual methods to diagnose the underlying problem."}, {"@Detection_Method_ID": "DM-7", "Method": "Manual Analysis", "Description": {"xhtml:p": ["This weakness can be detected using tools and techniques that require manual (human) analysis, such as penetration testing, threat modeling, and interactive tools that allow the tester to record and modify an active session.", "Specifically, manual static analysis is useful for evaluating the correctness of allocation calculations. This can be useful for detecting overflow conditions (CWE-190) or similar weaknesses that might have serious security impacts on the program."]}, "Effectiveness": "High", "Effectiveness_Notes": "These may be more effective than strictly automated techniques. This is especially the case with weaknesses that are related to design and business rules."}, {"Method": "Automated Static Analysis - Binary or Bytecode", "Description": {"xhtml:p": "According to SOAR [REF-1479], the following detection techniques may be useful:", "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": "Highly cost effective:", "xhtml:ul": {"xhtml:li": ["Bytecode Weakness Analysis - including disassembler + source code weakness analysis", "Binary Weakness Analysis - including disassembler + source code weakness analysis"]}}}, "Effectiveness": "High"}, {"Method": "Dynamic Analysis with Manual Results Interpretation", "Description": {"xhtml:p": "According to SOAR [REF-1479], the following detection techniques may be useful:", "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": "Cost effective for partial coverage:", "xhtml:ul": {"xhtml:li": ["Fuzz Tester", "Framework-based Fuzzer"]}}}, "Effectiveness": "SOAR Partial"}, {"Method": "Manual Static Analysis - Source Code", "Description": {"xhtml:p": "According to SOAR [REF-1479], the following detection techniques may be useful:", "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": "Cost effective for partial coverage:", "xhtml:ul": {"xhtml:li": "Manual Source Code Review (not inspections)"}}}, "Effectiveness": "SOAR Partial"}, {"Method": "Automated Static Analysis - Source Code", "Description": {"xhtml:p": "According to SOAR [REF-1479], the following detection techniques may be useful:", "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": "Highly cost effective:", "xhtml:ul": {"xhtml:li": ["Source code Weakness Analyzer", "Context-configured Source Code Weakness Analyzer"]}}}, "Effectiveness": "High"}, {"Method": "Architecture or Design Review", "Description": {"xhtml:p": "According to SOAR [REF-1479], the following detection techniques may be useful:", "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": ["Highly cost effective:", "Cost effective for partial coverage:"], "xhtml:ul": [{"xhtml:li": "Formal Methods / Correct-By-Construction"}, {"xhtml:li": "Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.)"}]}}, "Effectiveness": "High"}]}, "Potential_Mitigations": {"Mitigation": [{"Phase": "Requirements", "Description": "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."}, {"@Mitigation_ID": "MIT-3", "Phase": "Requirements", "Strategy": "Language Selection", "Description": {"xhtml:p": ["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."]}}, {"@Mitigation_ID": "MIT-4", "Phase": "Architecture and Design", "Strategy": "Libraries or Frameworks", "Description": {"xhtml:p": ["Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482].", "Use libraries or frameworks that make it easier to handle numbers without unexpected consequences.", "Examples include safe integer handling packages such as SafeInt (C++) or IntegerLib (C or C++). [REF-106]"]}}, {"@Mitigation_ID": "MIT-8", "Phase": "Implementation", "Strategy": "Input Validation", "Description": {"xhtml:p": ["Perform input validation on any numeric input by ensuring that it is within the expected range. Enforce that the input meets both the minimum and maximum requirements for the expected range.", "Use unsigned integers where possible. This makes it easier to perform validation for integer overflows. When signed integers are required, ensure that the range check includes minimum values as well as maximum values."]}}, {"@Mitigation_ID": "MIT-36", "Phase": "Implementation", "Description": {"xhtml:p": ["Understand the programming language's underlying representation and how it interacts with numeric calculation (CWE-681). Pay close attention to byte size discrepancies, precision, signed/unsigned distinctions, truncation, conversion and casting between types, \"not-a-number\" calculations, and how the language handles numbers that are too large or too small for its underlying representation. [REF-7]", "Also be careful to account for 32-bit, 64-bit, and other potential differences that may affect the numeric representation."]}}, {"@Mitigation_ID": "MIT-15", "Phase": "Architecture and Design", "Description": "For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server."}, {"@Mitigation_ID": "MIT-26", "Phase": "Implementation", "Strategy": "Compilation or Build Hardening", "Description": "Examine compiler warnings closely and eliminate problems with potential security implications, such as signed / unsigned mismatch in memory operations, or use of uninitialized variables. Even if the weakness is rarely exploitable, a single failure may lead to the compromise of the entire system."}]}, "Demonstrative_Examples": {"Demonstrative_Example": [{"@Demonstrative_Example_ID": "DX-33", "Intro_Text": "The following image processing code allocates a table for images.", "Example_Code": {"@Nature": "Bad", "@Language": "C", "xhtml:div": {"xhtml:br": [null, null, null, null, null], "#text": "img_t table_ptr; /*struct containing img data, 10kB each*/int num_imgs;...num_imgs = get_num_imgs();table_ptr = (img_t*)malloc(sizeof(img_t)*num_imgs);..."}}, "Body_Text": "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)."}, {"Intro_Text": "The following code excerpt from OpenSSH 3.3 demonstrates a classic case of integer overflow:", "Example_Code": {"@Nature": "Bad", "@Language": "C", "xhtml:div": {"xhtml:br": null, "xhtml:div": {"@style": "margin-left:1em;", "xhtml:br": null, "#text": "response = xmalloc(nresp*sizeof(char*));for (i = 0; i < nresp; i++) response[i] = packet_get_string(NULL);"}, "#text": "nresp = packet_get_int();if (nresp > 0) {}"}}, "Body_Text": "If nresp has the value 1073741824 and sizeof(char*) has its typical value of 4, then the result of the operation nresp*sizeof(char*) overflows, and the argument to xmalloc() will be 0. Most malloc() implementations will happily allocate a 0-byte buffer, causing the subsequent loop iterations to overflow the heap buffer response."}, {"Intro_Text": "Integer overflows can be complicated and difficult to detect. The following example is an attempt to show how an integer overflow may lead to undefined looping behavior:", "Example_Code": {"@Nature": "Bad", "@Language": "C", "xhtml:div": {"xhtml:br": [null, null, null], "xhtml:div": {"@style": "margin-left:1em;", "#text": "bytesRec += getFromInput(buf+bytesRec);"}, "#text": "short int bytesRec = 0;char buf[SOMEBIGNUM];\n                     while(bytesRec < MAXGET) {}"}}, "Body_Text": "In the above case, it is entirely possible that bytesRec may overflow, continuously creating a lower number than MAXGET and also overwriting the first MAXGET-1 bytes of buf."}, {"Intro_Text": "In this example the method determineFirstQuarterRevenue is used to determine the first quarter revenue for an accounting/business application. The method retrieves the monthly sales totals for the first three months of the year, calculates the first quarter sales totals from the monthly sales totals, calculates the first quarter revenue based on the first quarter sales, and finally saves the first quarter revenue results to the database.", "Example_Code": [{"@Nature": "Bad", "@Language": "C", "xhtml:div": {"xhtml:br": [null, null, null, null, null, null, null, null], "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": {"xhtml:br": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null], "xhtml:i": ["// Variable for sales revenue for the quarter", "// Calculate quarterly total", "// Calculate the total revenue for the quarter"], "#text": "float quarterRevenue = 0.0f;\n                           short JanSold = getMonthlySales(JAN); /* Get sales in January */short FebSold = getMonthlySales(FEB); /* Get sales in February */short MarSold = getMonthlySales(MAR); /* Get sales in March */\n                           \n                           \n                           short quarterSold = JanSold + FebSold + MarSold;\n                           \n                           \n                           quarterRevenue = calculateRevenueForQuarter(quarterSold);\n                           saveFirstQuarterRevenue(quarterRevenue);\n                           return 0;"}}, "#text": "#define JAN 1#define FEB 2#define MAR 3\n                     short getMonthlySales(int month) {...}\n                     float calculateRevenueForQuarter(short quarterSold) {...}\n                     int determineFirstQuarterRevenue() {}"}}, {"@Nature": "Good", "@Language": "C", "xhtml:div": {"xhtml:br": [null, null, null], "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": {"xhtml:br": [null, null, null, null, null, null, null], "xhtml:i": ["// Calculate quarterly total", "// Calculate the total revenue for the quarter"], "#text": "...\n                           \n                           long quarterSold = JanSold + FebSold + MarSold;\n                           \n                           \n                           quarterRevenue = calculateRevenueForQuarter(quarterSold);\n                           ..."}}, "#text": "...float calculateRevenueForQuarter(long quarterSold) {...}\n                     int determineFirstQuarterRevenue() {}"}}], "Body_Text": ["However, in this example the primitive type short int is used for both the monthly and the quarterly sales variables. In C the short int primitive type has a maximum value of 32768. This creates a potential integer overflow if the value for the three monthly sales adds up to more than the maximum value for the short int primitive type. An integer overflow can lead to data corruption, unexpected behavior, infinite loops and system crashes. To correct the situation the appropriate primitive type should be used, as in the example below, and/or provide some validation mechanism to ensure that the maximum value for the primitive type is not exceeded.", "Note that an integer overflow could also occur if the quarterSold variable has a primitive type long but the method calculateRevenueForQuarter has a parameter of type short."]}]}, "Observed_Examples": {"Observed_Example": [{"Reference": "CVE-2025-46687", "Description": "Chain: Javascript engine code does not perform a length check (CWE-1284) leading to integer overflow (CWE-190) causing allocation of smaller buffer than expected (CWE-131) resulting in a heap-based buffer overflow (CWE-122)", "Link": "https://www.cve.org/CVERecord?id=CVE-2025-46687"}, {"Reference": "CVE-2025-27363", "Description": "Font rendering library does not properly\n               handle assigning a signed short value to an unsigned\n               long (CWE-195), leading to an integer wraparound\n               (CWE-190), causing too small of a buffer (CWE-131),\n               leading to an out-of-bounds write\n               (CWE-787).", "Link": "https://www.cve.org/CVERecord?id=CVE-2025-27363"}, {"Reference": "CVE-2021-43537", "Description": "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)", "Link": "https://www.cve.org/CVERecord?id=CVE-2021-43537"}, {"Reference": "CVE-2019-19911", "Description": "Chain: Python library does not limit the resources used to process images that specify a very large number of bands (CWE-1284), leading to excessive memory consumption (CWE-789) or an integer overflow (CWE-190).", "Link": "https://www.cve.org/CVERecord?id=CVE-2019-19911"}, {"Reference": "CVE-2022-0545", "Description": "Chain: 3D renderer has an integer overflow (CWE-190) leading to write-what-where condition (CWE-123) using a crafted image.", "Link": "https://www.cve.org/CVERecord?id=CVE-2022-0545"}, {"Reference": "CVE-2021-30860", "Description": "Chain: improper input validation (CWE-20) leads to integer overflow (CWE-190) in mobile OS, as exploited in the wild per CISA KEV.", "Link": "https://www.cve.org/CVERecord?id=CVE-2021-30860"}, {"Reference": "CVE-2021-30663", "Description": "Chain: improper input validation (CWE-20) leads to integer overflow (CWE-190) in mobile OS, as exploited in the wild per CISA KEV.", "Link": "https://www.cve.org/CVERecord?id=CVE-2021-30663"}, {"Reference": "CVE-2018-10887", "Description": "Chain: unexpected sign extension (CWE-194) leads to integer overflow (CWE-190), causing an out-of-bounds read (CWE-125)", "Link": "https://www.cve.org/CVERecord?id=CVE-2018-10887"}, {"Reference": "CVE-2019-1010006", "Description": "Chain: compiler optimization (CWE-733) removes or modifies code used to detect integer overflow (CWE-190), allowing out-of-bounds write (CWE-787).", "Link": "https://www.cve.org/CVERecord?id=CVE-2019-1010006"}, {"Reference": "CVE-2010-1866", "Description": "Chain: integer overflow (CWE-190) causes a negative signed value, which later bypasses a maximum-only check (CWE-839), leading to heap-based buffer overflow (CWE-122).", "Link": "https://www.cve.org/CVERecord?id=CVE-2010-1866"}, {"Reference": "CVE-2010-2753", "Description": "Chain: integer overflow leads to use-after-free", "Link": "https://www.cve.org/CVERecord?id=CVE-2010-2753"}, {"Reference": "CVE-2005-1513", "Description": "Chain: integer overflow in securely-coded mail program leads to buffer overflow. In 2005, this was regarded as unrealistic to exploit, but in 2020, it was rediscovered to be easier to exploit due to evolutions of the technology.", "Link": "https://www.cve.org/CVERecord?id=CVE-2005-1513"}, {"Reference": "CVE-2002-0391", "Description": "Integer overflow via a large number of arguments.", "Link": "https://www.cve.org/CVERecord?id=CVE-2002-0391"}, {"Reference": "CVE-2002-0639", "Description": "Integer overflow in OpenSSH as listed in the demonstrative examples.", "Link": "https://www.cve.org/CVERecord?id=CVE-2002-0639"}, {"Reference": "CVE-2005-1141", "Description": "Image with large width and height leads to integer overflow.", "Link": "https://www.cve.org/CVERecord?id=CVE-2005-1141"}, {"Reference": "CVE-2005-0102", "Description": "Length value of -1 leads to allocation of 0 bytes and resultant heap overflow.", "Link": "https://www.cve.org/CVERecord?id=CVE-2005-0102"}, {"Reference": "CVE-2004-2013", "Description": "Length value of -1 leads to allocation of 0 bytes and resultant heap overflow.", "Link": "https://www.cve.org/CVERecord?id=CVE-2004-2013"}, {"Reference": "CVE-2017-1000121", "Description": "chain: unchecked message size metadata allows integer overflow (CWE-190) leading to buffer overflow (CWE-119).", "Link": "https://www.cve.org/CVERecord?id=CVE-2017-1000121"}, {"Reference": "CVE-2013-1591", "Description": "Chain: an integer overflow (CWE-190) in the image size calculation causes an infinite loop (CWE-835) which sequentially allocates buffers without limits (CWE-1325) until the stack is full.", "Link": "https://www.cve.org/CVERecord?id=CVE-2013-1591"}]}, "Functional_Areas": {"Functional_Area": ["Number Processing", "Memory Management", "Counters"]}, "Taxonomy_Mappings": {"Taxonomy_Mapping": [{"@Taxonomy_Name": "PLOVER", "Entry_Name": "Integer overflow (wrap or wraparound)"}, {"@Taxonomy_Name": "7 Pernicious Kingdoms", "Entry_Name": "Integer Overflow"}, {"@Taxonomy_Name": "CLASP", "Entry_Name": "Integer overflow"}, {"@Taxonomy_Name": "CERT C Secure Coding", "Entry_ID": "INT18-C", "Entry_Name": "Evaluate integer expressions in a larger size before comparing or assigning to that size", "Mapping_Fit": "CWE More Abstract"}, {"@Taxonomy_Name": "CERT C Secure Coding", "Entry_ID": "INT30-C", "Entry_Name": "Ensure that unsigned integer operations do not wrap", "Mapping_Fit": "CWE More Abstract"}, {"@Taxonomy_Name": "CERT C Secure Coding", "Entry_ID": "INT32-C", "Entry_Name": "Ensure that operations on signed integers do not result in overflow", "Mapping_Fit": "Imprecise"}, {"@Taxonomy_Name": "CERT C Secure Coding", "Entry_ID": "INT35-C", "Entry_Name": "Evaluate integer expressions in a larger size before comparing or assigning to that size"}, {"@Taxonomy_Name": "CERT C Secure Coding", "Entry_ID": "MEM07-C", "Entry_Name": "Ensure that the arguments to calloc(), when multiplied, do not wrap", "Mapping_Fit": "CWE More Abstract"}, {"@Taxonomy_Name": "CERT C Secure Coding", "Entry_ID": "MEM35-C", "Entry_Name": "Allocate sufficient memory for an object"}, {"@Taxonomy_Name": "WASC", "Entry_ID": "3", "Entry_Name": "Integer Overflows"}, {"@Taxonomy_Name": "Software Fault Patterns", "Entry_ID": "SFP1", "Entry_Name": "Glitch in computation"}, {"@Taxonomy_Name": "ISA/IEC 62443", "Entry_ID": "Part 3-3", "Entry_Name": "Req SR 3.5"}, {"@Taxonomy_Name": "ISA/IEC 62443", "Entry_ID": "Part 3-3", "Entry_Name": "Req SR 7.2"}, {"@Taxonomy_Name": "ISA/IEC 62443", "Entry_ID": "Part 4-1", "Entry_Name": "Req SR-2"}, {"@Taxonomy_Name": "ISA/IEC 62443", "Entry_ID": "Part 4-1", "Entry_Name": "Req SI-2"}, {"@Taxonomy_Name": "ISA/IEC 62443", "Entry_ID": "Part 4-1", "Entry_Name": "Req SVV-1"}, {"@Taxonomy_Name": "ISA/IEC 62443", "Entry_ID": "Part 4-1", "Entry_Name": "Req SVV-3"}, {"@Taxonomy_Name": "ISA/IEC 62443", "Entry_ID": "Part 4-2", "Entry_Name": "Req CR 3.5"}, {"@Taxonomy_Name": "ISA/IEC 62443", "Entry_ID": "Part 4-2", "Entry_Name": "Req CR 7.2"}]}, "Related_Attack_Patterns": {"Related_Attack_Pattern": {"@CAPEC_ID": "92"}}, "References": {"Reference": [{"@External_Reference_ID": "REF-145"}, {"@External_Reference_ID": "REF-146"}, {"@External_Reference_ID": "REF-7", "@Section": "Chapter 20, \"Integer Overflows\" Page 620"}, {"@External_Reference_ID": "REF-44", "@Section": "\"Sin 7: Integer Overflows.\" Page 119"}, {"@External_Reference_ID": "REF-106"}, {"@External_Reference_ID": "REF-150"}, {"@External_Reference_ID": "REF-62", "@Section": "Chapter 6, \"Signed Integer Boundaries\", Page 220"}, {"@External_Reference_ID": "REF-1440", "@Section": "Definition variations and ambiguity"}, {"@External_Reference_ID": "REF-1479"}, {"@External_Reference_ID": "REF-1482"}]}, "Mapping_Notes": {"Usage": "Allowed", "Rationale": "This CWE entry is at the Base level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.", "Comments": "Be careful of terminology problems with \"overflow,\" \"underflow,\" and \"wraparound\" - see Terminology Notes. Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.", "Reasons": {"Reason": {"@Type": "Acceptable-Use"}}, "Suggestions": {"Suggestion": {"@CWE_ID": "191", "@Comment": "Integer Underflow (Wrap or Wraparound). Consider CWE-191 when the result is less than the minimum value that can be represented (sometimes called \"underflows\")."}}}, "Notes": {"Note": [{"@Type": "Relationship", "#text": "Integer overflows can be primary to buffer overflows when they cause less memory to be allocated than expected."}, {"@Type": "Terminology", "xhtml:p": ["\"Integer overflow\" is\n            sometimes used to cover several types of errors, including\n            signedness errors, or buffer overflows that involve\n            manipulation of integer data types instead of\n            characters. Part of the confusion results from the fact\n            that 0xffffffff is -1 in a signed context. Other confusion\n            also arises because of the role that integer overflows\n            have in chains.", "A \"wraparound\" is a well-defined, standard\n\t\t\tbehavior that follows specific rules for how to handle\n\t\t\tsituations when the intended numeric value is too large or\n\t\t\ttoo small to be represented, as specified in standards\n\t\t\tsuch as C11.", "\"Overflow\" is sometimes conflated with\n            \"wraparound\" but typically indicates a non-standard or\n            undefined behavior.", "The \"overflow\" term is sometimes used to indicate\n\t\t\tcases where either the maximum or the minimum is exceeded,\n\t\t\tbut others might only use \"overflow\" to indicate exceeding\n\t\t\tthe maximum while using \"underflow\" for exceeding the\n\t\t\tminimum.", "Some people use \"overflow\" to mean any value\n\t\t\toutside the representable range - whether greater than the\n\t\t\tmaximum, or less than the minimum - but CWE uses\n\t\t\t\"underflow\" for cases in which the intended result is less\n\t\t\tthan the minimum.", "See [REF-1440] for additional explanation of the\n\t\t\tambiguity of terminology."]}, {"@Type": "Other", "#text": "While there may be circumstances in\n            which the logic intentionally relies on wrapping - such as\n            with modular arithmetic in timers or counters - it can\n            have security consequences if the wrap is unexpected.\n            This is especially the case if the integer overflow can be\n            triggered using user-supplied inputs."}]}, "Content_History": {"Submission": {"Submission_Name": "PLOVER", "Submission_Date": "2006-07-19", "Submission_Version": "Draft 3", "Submission_ReleaseDate": "2006-07-19"}, "Modification": [{"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2008-09-08", "Modification_Version": "1.0", "Modification_ReleaseDate": "2008-09-09", "Modification_Comment": "updated Common_Consequences, Relationships, Relationship_Notes, Taxonomy_Mappings, Terminology_Notes"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2008-10-14", "Modification_Version": "1.0.1", "Modification_ReleaseDate": "2008-10-14", "Modification_Comment": "updated Common_Consequences, Description, Potential_Mitigations, Terminology_Notes"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2008-11-24", "Modification_Version": "1.1", "Modification_ReleaseDate": "2008-11-25", "Modification_Comment": "updated Relationships, Taxonomy_Mappings"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2009-01-12", "Modification_Version": "1.2", "Modification_ReleaseDate": "2009-01-12", "Modification_Comment": "updated Description, Name"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2009-05-27", "Modification_Version": "1.4", "Modification_ReleaseDate": "2009-05-27", "Modification_Comment": "updated Demonstrative_Examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2009-10-29", "Modification_Version": "1.6", "Modification_ReleaseDate": "2009-10-29", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2010-02-16", "Modification_Version": "1.8", "Modification_ReleaseDate": "2010-02-16", "Modification_Comment": "updated Applicable_Platforms, Detection_Factors, Functional_Areas, Observed_Examples, Potential_Mitigations, References, Related_Attack_Patterns, Relationships, Taxonomy_Mappings, Terminology_Notes"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2010-04-05", "Modification_Version": "1.8.1", "Modification_ReleaseDate": "2010-04-05", "Modification_Comment": "updated Demonstrative_Examples, Detection_Factors, Potential_Mitigations, References, Related_Attack_Patterns"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2010-06-21", "Modification_Version": "1.9", "Modification_ReleaseDate": "2010-06-21", "Modification_Comment": "updated Common_Consequences, Potential_Mitigations, References"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2010-09-27", "Modification_Version": "1.10", "Modification_ReleaseDate": "2010-09-27", "Modification_Comment": "updated Observed_Examples, Potential_Mitigations"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2011-06-01", "Modification_Version": "1.13", "Modification_ReleaseDate": "2011-06-01", "Modification_Comment": "updated Common_Consequences"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2011-06-27", "Modification_Version": "2.0", "Modification_ReleaseDate": "2011-06-27", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2011-09-13", "Modification_Version": "2.1", "Modification_ReleaseDate": "2011-09-13", "Modification_Comment": "updated Potential_Mitigations, References, Relationships, Taxonomy_Mappings"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2012-05-11", "Modification_Version": "2.2", "Modification_ReleaseDate": "2012-05-15", "Modification_Comment": "updated Common_Consequences, Demonstrative_Examples, References, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2012-10-30", "Modification_Version": "2.3", "Modification_ReleaseDate": "2012-10-30", "Modification_Comment": "updated Potential_Mitigations"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2013-07-17", "Modification_Version": "2.5", "Modification_ReleaseDate": "2013-07-17", "Modification_Comment": "updated References"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2014-07-30", "Modification_Version": "2.8", "Modification_ReleaseDate": "2014-07-31", "Modification_Comment": "updated Detection_Factors, Relationships, Taxonomy_Mappings"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2015-12-07", "Modification_Version": "2.9", "Modification_ReleaseDate": "2015-12-07", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2017-01-19", "Modification_Version": "2.10", "Modification_ReleaseDate": "2017-01-19", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2017-11-08", "Modification_Version": "3.0", "Modification_ReleaseDate": "2017-11-08", "Modification_Comment": "updated Functional_Areas, Observed_Examples, References, Taxonomy_Mappings"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2018-03-27", "Modification_Version": "3.1", "Modification_ReleaseDate": "2018-03-27", "Modification_Comment": "updated References"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2019-01-03", "Modification_Version": "3.2", "Modification_ReleaseDate": "2019-01-03", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2019-09-19", "Modification_Version": "3.4", "Modification_ReleaseDate": "2019-09-19", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2020-02-24", "Modification_Version": "4.0", "Modification_ReleaseDate": "2020-02-24", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2020-06-25", "Modification_Version": "4.1", "Modification_ReleaseDate": "2020-06-25", "Modification_Comment": "updated Observed_Examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2020-08-20", "Modification_Version": "4.2", "Modification_ReleaseDate": "2020-08-20", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2020-12-10", "Modification_Version": "4.3", "Modification_ReleaseDate": "2020-12-10", "Modification_Comment": "updated Observed_Examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2021-03-15", "Modification_Version": "4.4", "Modification_ReleaseDate": "2021-03-15", "Modification_Comment": "updated Potential_Mitigations"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2021-07-20", "Modification_Version": "4.5", "Modification_ReleaseDate": "2021-07-20", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2022-06-28", "Modification_Version": "4.8", "Modification_ReleaseDate": "2022-06-28", "Modification_Comment": "updated Observed_Examples, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2022-10-13", "Modification_Version": "4.9", "Modification_ReleaseDate": "2022-10-13", "Modification_Comment": "updated Observed_Examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-01-31", "Modification_Version": "4.10", "Modification_ReleaseDate": "2023-01-31", "Modification_Comment": "updated Description, Detection_Factors"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-04-27", "Modification_Version": "4.11", "Modification_ReleaseDate": "2023-04-27", "Modification_Comment": "updated Relationships, Taxonomy_Mappings"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-06-29", "Modification_Version": "4.12", "Modification_ReleaseDate": "2023-06-29", "Modification_Comment": "updated Mapping_Notes, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-10-26", "Modification_Version": "4.13", "Modification_ReleaseDate": "2023-10-26", "Modification_Comment": "updated Observed_Examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2024-02-29", "Modification_Version": "4.14", "Modification_ReleaseDate": "2024-02-29", "Modification_Comment": "updated Observed_Examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2024-07-16", "Modification_Version": "4.15", "Modification_ReleaseDate": "2024-07-16", "Modification_Comment": "updated Alternate_Terms, Common_Consequences, Description, Diagram, Mapping_Notes, Modes_of_Introduction, Other_Notes, References, Relationship_Notes, Terminology_Notes"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2024-11-19", "Modification_Version": "4.16", "Modification_ReleaseDate": "2024-11-19", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2025-04-03", "Modification_Version": "4.17", "Modification_ReleaseDate": "2025-04-03", "Modification_Comment": "updated Applicable_Platforms, Observed_Examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2025-09-09", "Modification_Version": "4.18", "Modification_ReleaseDate": "2025-09-09", "Modification_Comment": "updated Detection_Factors, Observed_Examples, Potential_Mitigations, References"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2025-12-11", "Modification_Version": "4.19", "Modification_ReleaseDate": "2025-12-11", "Modification_Comment": "updated Applicable_Platforms, Observed_Examples, Weakness_Ordinalities"}], "Contribution": [{"@Type": "Content", "Contribution_Name": "\"Mapping CWE to 62443\" Sub-Working Group", "Contribution_Organization": "CWE-CAPEC ICS/OT SIG", "Contribution_Date": "2023-04-25", "Contribution_Comment": "Suggested mappings to ISA/IEC 62443."}, {"@Type": "Content", "Contribution_Name": "Abhi Balakrishnan", "Contribution_Date": "2024-02-29", "Contribution_Version": "4.15", "Contribution_ReleaseDate": "2024-07-16", "Contribution_Comment": "Provided diagram to improve CWE usability"}, {"@Type": "Feedback", "Contribution_Name": "Zheng Zhang", "Contribution_Organization": "Purdue University", "Contribution_Date": "2025-06-16", "Contribution_Version": "4.18", "Contribution_ReleaseDate": "2025-09-09", "Contribution_Comment": "reported CVE-2022-21668 as an incorrect observed example for this entry, when CVE-2019-19911 was intended"}], "Previous_Entry_Name": {"@Date": "2009-01-12", "#text": "Integer Overflow (Wrap or Wraparound)"}}}
