CWE-401: Missing Release of Memory after Effective Lifetime
low-riskThe product does not sufficiently track and release allocated memory after it has been used, making the memory unavailable for reallocation and reuse.
Common Consequences
Detection Methods
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 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.)
Real-World Examples (10)
| CVE | CVSS | EPSS | KEV |
|---|---|---|---|
| CVE-2018-0891 | 4.3 | 56.6% | — |
| CVE-2018-17240 | 7.5 | 42.5% | — |
| CVE-2016-4232 | 7.5 | 29.7% | — |
| CVE-2021-3492 | 8.8 | 24.4% | — |
| CVE-2021-3492 | 8.8 | 24.4% | — |
| CVE-2020-13934 | 7.5 | 23.4% | — |
| CVE-2016-6304 | 7.5 | 18.0% | — |
| CVE-2018-0832 | 4.7 | 17.1% | — |
| CVE-2018-0901 | 4.7 | 16.4% | — |
| CVE-2019-12265 | 5.3 | 16.4% | — |