Failure to Clear Heap Memory Before Release ('Heap Inspection') |
Weakness ID: 244 (Weakness Variant) | Status: Draft |
Description Summary
Extended Description
When sensitive data such as a password or an encryption key is not removed from memory, it could be exposed to an attacker using a "heap inspection" attack that reads the sensitive data using memory dumps or other methods. The realloc() function is commonly used to increase the size of a block of allocated memory. This operation often requires copying the contents of the old memory block into a new and larger block. This operation leaves the contents of the original block intact but inaccessible to the program, preventing the program from being able to scrub sensitive data from memory. If an attacker can later examine the contents of a memory dump, the sensitive data could be exposed.
Scope | Effect |
---|---|
Confidentiality | Be careful using vfork() and fork() in security sensitive code. The process state will not be cleaned up and will contain traces of data from past use. |
Example 1
The following code calls realloc() on a buffer containing sensitive data:
There is an attempt to scrub the sensitive data from memory, but realloc() is used, so a copy of the data can still be exposed in the memory originally allocated for cleartext_buffer.
Nature | Type | ID | Name | View(s) this relationship pertains to![]() |
---|---|---|---|---|
ChildOf | ![]() | 226 | Sensitive Information Uncleared Before Release | Research Concepts (primary)1000 |
ChildOf | ![]() | 227 | Failure to Fulfill API Contract ('API Abuse') | Development Concepts (primary)699 Seven Pernicious Kingdoms (primary)700 |
ChildOf | ![]() | 633 | Weaknesses that Affect Memory | Resource-specific Weaknesses (primary)631 |
ChildOf | ![]() | 742 | CERT C Secure Coding Section 08 - Memory Management (MEM) | Weaknesses Addressed by the CERT C Secure Coding Standard (primary)734 |
CanPrecede | ![]() | 669 | Incorrect Resource Transfer Between Spheres | Research Concepts1000 |
MemberOf | ![]() | 630 | Weaknesses Examined by SAMATE | Weaknesses Examined by SAMATE (primary)630 |
Mapped Taxonomy Name | Node ID | Fit | Mapped Node Name |
---|---|---|---|
7 Pernicious Kingdoms | Heap Inspection | ||
CERT C Secure Coding | MEM03-C | Clear sensitive information stored in reusable resources returned for reuse |
A weakness where code path has: 1. start statement that stores information in a buffer 2. end statement that resize the buffer and 3. path does not contain statement that performs cleaning of the buffer |
Submissions | ||||
---|---|---|---|---|
Submission Date | Submitter | Organization | Source | |
7 Pernicious Kingdoms | Externally Mined | |||
Modifications | ||||
Modification Date | Modifier | Organization | Source | |
2008-08-01 | KDM Analytics | External | ||
added/updated white box definitions | ||||
2008-09-08 | CWE Content Team | MITRE | Internal | |
updated Applicable Platforms, Name, Relationships, Other Notes, Taxonomy Mappings | ||||
2008-10-14 | CWE Content Team | MITRE | Internal | |
updated Relationships | ||||
2008-11-24 | CWE Content Team | MITRE | Internal | |
updated Relationships, Taxonomy Mappings | ||||
2009-05-27 | CWE Content Team | MITRE | Internal | |
updated Demonstrative Examples, Name | ||||
2009-10-29 | CWE Content Team | MITRE | Internal | |
updated Common Consequences, Description, Other Notes | ||||
Previous Entry Names | ||||
Change Date | Previous Entry Name | |||
2008-04-11 | Heap Inspection | |||
2008-09-09 | Failure to Clear Heap Memory Before Release | |||
2009-05-27 | Failure to Clear Heap Memory Before Release (aka 'Heap Inspection') | |||