CWE-244 · Słabość
Improper Clearing of Heap Memory Before Release ('Heap Inspection')
- Abstrakcja
- Wariant
- Status
- Szkic
- Dodano
- 19 lipca 2006
- Ostatnia zmiana
- 11 grudnia 2025
Opis
Using realloc() to resize buffers that store sensitive information can leave the sensitive information exposed to attack, because it is not removed from memory.
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.
Skutki
Confidentiality, Other
Read Memory; Other
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.
Przykłady podatności
- CVE-2019-3733 Cryptography library does not clear heap memory before release
Słabość nadrzędna
Może prowadzić do
Kiedy powstaje
- Implementation
Dotyczy
Memory-Unsafe, C, C++
Źródła
- Seven Pernicious Kingdoms: A Taxonomy of Software Security Errors — Katrina Tsipenyuk, Brian Chess, Gary McGraw, NIST, 2005
Wpis z katalogu CWE 4.20.