CWEweakness
CWE-401 Missing Release of Memory after Effective Lifetime
Medium
Official page ↗
- Alternate terms
- Memory Leak
- Abstraction
- Variant
- Structure
- Simple
- Status
- Draft
- Likelihood of exploit
- Medium
- Languages
- C, C++, Not Language-Specific
- CWE version
- 5.0
Description
The product does not sufficiently track and release allocated memory after it has been used, making the memory unavailable for reallocation and reuse.
Common consequences
• Availability: DoS: Crash, Exit, or Restart, DoS: Instability, DoS: Resource Consumption (CPU), DoS: Resource Consumption (Memory) — Most memory leaks result in general product reliability problems, but if an attacker can intentionally trigger a memory leak, the attacker might be able to launch a denial of service attack (by crashing or hanging the program) or take advantage of other unexpected program behavior resulting from a low memory condition.
• Other: Reduce Performance
Potential mitigations
• [Implementation] Choose a language or tool that provides automatic memory management, or makes manual memory management less error-prone.
For example, glibc in Linux provides protection against free of invalid pointers.
When using Xcode to target OS X or iOS, enable automatic reference counting (ARC) [REF-391].
To help correctly and consistently manage memory when programming in C++, consider using a smart pointer class such as std::auto_ptr (defined by ISO/IEC ISO/IEC 14882:2003), std::shared_ptr and std::unique_ptr (specified by an upcoming revision of the C++ standard, informally referred to as C++ 1x), or equivalent solutions such as Boost.
• [Architecture and Design] Use an abstraction library to abstract away risky APIs. Not a complete solution.
• [Architecture and Design, Build and Compilation] Consider using the Boehm-Demers-Weiser garbage collector (bdwgc), which can help avoid leaks.
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.
• Automated Dynamic Analysis: Use tools that are integrated during
compilation to insert runtime error-checking mechanisms
related to memory safety errors, such as AddressSanitizer
(ASan) for C/C++ [REF-1518] or valgrind [REF-480].
• 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.)
Observed examples
• CVE-2005-3119: Memory leak because function does not free() an element of a data structure.
• CVE-2004-0427: Memory leak when counter variable is not decremented.
• CVE-2002-0574: Chain: reference count is not decremented, leading to memory leak in OS by sending ICMP packets.
• CVE-2005-3181: Kernel uses wrong function to release a data structure, preventing data from being properly tracked by other code.
• CVE-2004-0222: Memory leak via unknown manipulations as part of a protocol test suite.
• CVE-2001-0136: Memory leak via a series of the same command.
Related
Observed example · CVE (6)
- CVE-2005-3119 Memory leak in the request_key_auth_destroy function in request_key_auth in Linux kernel 2.6.10 up to 2.6.13 allows local users to cause a… vulnerability
- CVE-2005-3181 The audit system in Linux kernel 2.6.6, and other versions before 2.6.13.4, when CONFIG_AUDITSYSCALL is enabled, uses an incorrect function… vulnerability
- CVE-2004-0427 The do_fork function in Linux 2.4.x before 2.4.26, and 2.6.x before 2.6.6, does not properly decrement the mm_count counter when an error… vulnerability
- CVE-2004-0222 Multiple memory leaks in isakmpd in OpenBSD 3.4 and earlier allow remote attackers to cause a denial of service (memory exhaustion) via… vulnerability
- CVE-2002-0574 Memory leak in FreeBSD 4.5 and earlier allows remote attackers to cause a denial of service (memory exhaustion) via ICMP echo packets that… vulnerability
- CVE-2001-0136 Memory leak in ProFTPd 1.2.0rc2 allows remote attackers to cause a denial of service via a series of USER commands, and possibly SIZE… vulnerability
Child of · CWE (2)
Referenced by CVE · weakness (2,016)
- CVE-2026-116146 ImageMagick before 6.9.13-58 and 7.x before 7.1.2-33 contains a memory leak in the MSL decoder that fails to release allocated memory when… vulnerability
- CVE-2026-116150 ImageMagick before 7.1.2-33 contains a memory leak vulnerability in the FPX encoder that allows attackers to exhaust memory by supplying a… vulnerability
- CVE-2026-116151 ImageMagick before 6.9.13-58 and 7.x before 7.1.2-33 contains a memory leak in the JNG encoder that fails to release allocated memory when… vulnerability
- CVE-2026-116152 ImageMagick before 7.1.2-33 contains a memory leak vulnerability in the MAT decoder that fails to release allocated memory in a specific… vulnerability
- CVE-2026-116154 ImageMagick before 6.9.13-58 and 7.x before 7.1.2-33 contains a memory leak in its XML parsing code, where allocated memory is not released… vulnerability
- CVE-2026-116155 ImageMagick before 6.9.13-58 and 7.x before 7.1.2-33 contains a memory leak in the handling of XMP profiles by various decoders. vulnerability
- CVE-2026-116156 ImageMagick before 6.9.13-58 and 7.x before 7.1.2-33 contains a memory leak caused by a missing cleanup when the -set profile option is… vulnerability
- CVE-2026-116157 ImageMagick before 7.1.2-33 contains a memory leak vulnerability in PerlMagick that fails to free values returned when reading image… vulnerability
- CVE-2026-116158 ImageMagick before 7.1.2-33 contains a memory leak vulnerability in the magick compare command caused by missing cleanup when an operation… vulnerability
- CVE-2026-116159 ImageMagick before 6.9.13-58 and 7.x before 7.1.2-33 contains a memory leak in the handling of the -cdl (color decision list) option, where… vulnerability
- CVE-2026-114613 MessagePack is the serializer implementation for Python msgpack.org. vulnerability
- CVE-2026-76489 Multiple Cisco products are affected by a vulnerability in the memory management implementation of Snort 3 that could allow an… vulnerability
- CVE-2026-110672 Cpanel::JSON::XS versions before 4.80 for Perl leak the decoded key of an object rejected for a duplicate key or a missing colon in… vulnerability
- CVE-2026-110677 Cpanel::JSON::XS versions from 4.28 before 4.80 for Perl leak the array collecting duplicate key values under dupkeys_as_arrayref in… vulnerability
- CVE-2026-110684 Cpanel::JSON::XS versions from 3.0202 before 4.80 for Perl leak memory and retain overloaded objects when encoding values as strings in… vulnerability
- CVE-2026-110685 Cpanel::JSON::XS versions before 4.80 for Perl leak the decoded arguments of a tagged value when its THAW method dies in decode_tag. vulnerability
- CVE-2026-77684 The Bluetooth Classic Hands-Free Profile HF role in subsys/bluetooth/host/classic/hfp_hf.c does not release the AT command buffers that are… vulnerability
- CVE-2026-110754 Text::CSV_XS versions before 1.65 for Perl leak the parsed fields of a record that fails to parse in getline. vulnerability
- CVE-2026-101025 Description NGINX JavaScript (njs) has a vulnerability where the built-in njs engine leaks a libxml2 parser context when xml.parse() fails. vulnerability
- CVE-2026-102032 A Missing Release of Memory after Effective Lifetime vulnerability in the l2ald process of Juniper Networks Junos OS and Junos OS Evolved… vulnerability
- CVE-2026-102051 An Improper Release of Memory Before Removing Last Reference vulnerability in the l2cpd process of Juniper Networks Junos OS and Junos OS… vulnerability
- CVE-2026-102053 An Improper Release of Memory Before Removing Last Reference vulnerability in the l2ald process of Juniper Networks Junos OS and Junos OS… vulnerability
- CVE-2026-102081 A Missing Release of Memory after Effective Lifetime vulnerability in the packet forwarding engine (PFE) of Juniper Networks Junos OS on… vulnerability
- CVE-2026-70033 Missing release of memory after effective lifetime in Remote Desktop Gateway Service allows an unauthorized attacker to deny service over a… vulnerability
- CVE-2026-70155 Missing release of memory after effective lifetime in Windows DNS allows an unauthorized attacker to deny service over a network. vulnerability
- CVE-2026-83677 Missing release of memory after effective lifetime in Windows DHCP Client allows an unauthorized attacker to deny service over a network. vulnerability
- CVE-2026-109260 ImageMagick before 6.9.13-57 and 7.x before 7.1.2-32 contains a memory leak in the PNG encoder, which does not release allocated memory… vulnerability
- CVE-2026-109261 ImageMagick before 6.9.13-57 and 7.x before 7.1.2-32 contains a memory leak in the GIF encoder because allocated memory is not released… vulnerability
- CVE-2026-109262 ImageMagick before 6.9.13-57 and 7.x before 7.1.2-32 contains a memory leak in the SVG encoder (WriteSVGImage) that fails to release… vulnerability
- CVE-2026-109263 ImageMagick before 6.9.13-57 and 7.x before 7.1.2-32 contains a memory leak in the YUV encoder, which fails to release allocated memory… vulnerability
Referenced by CWE · can precede (1)
- CWE-390 Detection of Error Condition Without Action weakness