[Forgot Password]
Login  Register Subscribe

30479

 
 

423868

 
 

249461

 
 

909

 
 

195508

 
 

282

Paid content will be excluded from the download.


Download | Alert*
CWE
view XML

Uncontrolled Memory Allocation

ID: 789Date: (C)2012-05-14   (M)2022-10-10
Type: weaknessStatus: DRAFT
Abstraction Type: Variant





Description

The product allocates memory based on an untrusted size value, but it does not validate or incorrectly validates the size, allowing arbitrary amounts of memory to be allocated.

Likelihood of Exploit: Low

Applicable Platforms
Language: C
Language: C++
Language Class: All

Time Of Introduction

  • Implementation
  • Architecture and Design

Common Consequences

ScopeTechnical ImpactNotes
Availability
 
DoS: resource consumption (memory)
 
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.
 

Detection Methods
None

Potential Mitigations

PhaseStrategyDescriptionEffectivenessNotes
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.
 
  
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.
 
  

Relationships
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.

Related CWETypeViewChain
CWE-789 CanPrecede CWE-476 Weakness CWE-1000  

Demonstrative Examples   (Details)

  1. Consider the following code, which accepts an untrusted size value and allocates a buffer to contain a string of the given size.
  2. Consider the following code, which accepts an untrusted size value and uses the size as an initial capacity for a HashMap.
  3. The following code obtains an untrusted number that it used as an index into an array of messages.

Observed Examples

  1. CVE-2008-1708 : memory consumption and daemon exit by specifying a large value in a length field
  2. CVE-2008-0977 : large value in a length field leads to memory consumption and crash when no more memory is available
  3. CVE-2006-3791 : large key size in game program triggers crash when a resizing function cannot allocate enough memory
  4. CVE-2004-2589 : large Content-Length HTTP header value triggers application crash in instant messaging application due to failure in memory allocation

For more examples, refer to CVE relations in the bottom box.

White Box Definitions
None

Black Box Definitions
None

Taxynomy Mappings

TaxynomyIdNameFit
WASC 35
 
SOAP Array Abuse
 
 

References:

  1. Mark Dowd John McDonald Justin Schuh .The Art of Software Security Assessment 1st Edition. Addison Wesley. Section:'Chapter 10, "Resource Limits", Page 574.'. Published on 2006.
CVE    5
CVE-2021-1283
CVE-2021-1568
CVE-2021-34869
CVE-2021-34868
...

© SecPod Technologies