Modes Of Introduction
Implementation
Applicable Platforms
Language
Name: C (Undetermined)
Name: C++ (Undetermined)
Class: Not Language-Specific (Undetermined)
Common Consequences
Scope |
Impact |
Likelihood |
Availability | DoS: Resource Consumption (Memory)
Note: Not controlling memory allocation can result in a request for too much system memory, possibly leading to a crash of the application due to out-of-memory conditions, or the consumption of a large amount of memory on the system. | |
Observed Examples
References |
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). |
| program uses ::alloca() for encoding messages, but large messages trigger segfault |
| memory consumption and daemon exit by specifying a large value in a length field |
| large value in a length field leads to memory consumption and crash when no more memory is available |
| large key size in game program triggers crash when a resizing function cannot allocate enough memory |
| large Content-Length HTTP header value triggers application crash in instant messaging application due to failure in memory allocation |
Potential Mitigations
Phases : Implementation // Architecture and Design
Perform adequate input validation against any value that influences the amount of memory that is allocated. Define an appropriate strategy for handling requests that exceed the limit, and consider supporting a configuration option so that the administrator can extend the amount of memory to be used if necessary.
Phases : Operation
Run your program using system-provided resource limits for memory. This might still cause the program to crash or exit, but the impact to the rest of the system will be minimized.
Detection Methods
Fuzzing
Fuzz testing (fuzzing) is a powerful technique for generating large numbers of diverse inputs - either randomly or algorithmically - and dynamically invoking the code with those inputs. Even with random inputs, it is often capable of generating unexpected results such as crashes, memory corruption, or resource consumption. Fuzzing effectively produces repeatable test cases that clearly indicate bugs, which helps developers to diagnose the issues.
Effectiveness : High
Automated Static Analysis
Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
Effectiveness : High
Vulnerability Mapping Notes
Justification : This CWE entry is at the Variant level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.
Comment : 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.
NotesNotes
This weakness can be closely associated with integer overflows (CWE-190). Integer overflow attacks would concentrate on providing an extremely large number that triggers an overflow that causes less memory to be allocated than expected. By providing a large value that does not trigger an integer overflow, the attacker could still cause excessive amounts of memory to be allocated.
Uncontrolled memory allocation is possible in many languages, such as dynamic array allocation in perl or initial size parameters in Collections in Java. However, languages like C and C++ where programmers have the power to more directly control memory management will be more susceptible.
References
REF-62
The Art of Software Security Assessment
Mark Dowd, John McDonald, Justin Schuh.
REF-962
Automated Source Code Security Measure (ASCSM)
Object Management Group (OMG).
http://www.omg.org/spec/ASCSM/1.0/
Submission
Name |
Organization |
Date |
Date release |
Version |
CWE Content Team |
MITRE |
2009-10-21 +00:00 |
2009-10-29 +00:00 |
1.6 |
Modifications
Name |
Organization |
Date |
Comment |
CWE Content Team |
MITRE |
2010-02-16 +00:00 |
updated Taxonomy_Mappings |
CWE Content Team |
MITRE |
2011-03-29 +00:00 |
updated Common_Consequences, Observed_Examples |
CWE Content Team |
MITRE |
2011-06-01 +00:00 |
updated Common_Consequences |
CWE Content Team |
MITRE |
2012-05-11 +00:00 |
updated References |
CWE Content Team |
MITRE |
2017-11-08 +00:00 |
updated Applicable_Platforms, Taxonomy_Mappings |
CWE Content Team |
MITRE |
2019-01-03 +00:00 |
updated References, Relationships, Taxonomy_Mappings |
CWE Content Team |
MITRE |
2019-06-20 +00:00 |
updated Relationships |
CWE Content Team |
MITRE |
2020-02-24 +00:00 |
updated Relationships |
CWE Content Team |
MITRE |
2020-06-25 +00:00 |
updated Relationships |
CWE Content Team |
MITRE |
2020-08-20 +00:00 |
updated Relationships |
CWE Content Team |
MITRE |
2020-12-10 +00:00 |
updated Alternate_Terms, Demonstrative_Examples, Description, Likelihood_of_Exploit, Name, Observed_Examples, Relationships, Time_of_Introduction |
CWE Content Team |
MITRE |
2021-03-15 +00:00 |
updated Demonstrative_Examples, Relationships |
CWE Content Team |
MITRE |
2022-10-13 +00:00 |
updated Observed_Examples |
CWE Content Team |
MITRE |
2023-04-27 +00:00 |
updated Detection_Factors, Relationships |
CWE Content Team |
MITRE |
2023-06-29 +00:00 |
updated Mapping_Notes, Relationships |