CWE-459: Incomplete Cleanup
Also known as: Insufficient Cleanup
The product does not properly "clean up" and remove temporary or supporting resources after they have been used.
Last updated
Also known as: Insufficient Cleanup
The product does not properly "clean up" and remove temporary or supporting resources after they have been used.
Last updated
CWE-459 (Incomplete Cleanup) is a base-level software weakness catalogued by MITRE in the Common Weakness Enumeration (CWE). It describes a recurring type of mistake that can lead to exploitable security vulnerabilities.
368 recorded CVEs are caused by CWE-459 (Incomplete Cleanup). The highest-severity and most recent are shown first. 160 new CWE-459 CVEs have been recorded so far in 2026 (59 in 2025).
Upgrading doesn't prevent exploiting vulnerable XWiki documents
btrfs: handle lack of space when cleaning up verity items
mmc: sdhci-of-aspeed: Remove children before releasing SDC resources
RDMA/srpt: Fix srpt_alloc_rw_ctxs() unwind counters
netfilter: x_tables: add and use xtables_unregister_table_exit
ext4: drop extent cache when splitting extent fails
Vikunja Vulnerable to Account Takeover via Password Reset Token Reuse
jfs: truncate good inode pages when hard link is 0
RDMA/rtrs: Add missing deinit() call
Apache ShardingSphere-Proxy: MySQL authentication bypass
Metasys session token
Improper Privilege Management in Gitea
Showing 12 of 368 recorded CWE-459 CVEs. Get an alert for each new one, with AI-written analysis and fixes.
Monitor these CVEsWhat can happen when CWE-459 is exploited.
Other, Read Application Data, Modify Application Data, DoS: Resource Consumption (Other)
Affects: Other, Confidentiality, Integrity
It is possible to overflow the number of temporary files because directories typically have limits on the number of files allowed. This could create a denial of service problem.
Typically introduced during these phases of the software lifecycle.
Languages
Practical mitigations for CWE-459, grouped by where in the lifecycle they apply.
Temporary files and other supporting resources should be deleted/released immediately after they are no longer needed.
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.)
Effectiveness: High
MITRE examples of the weakness in code.
Stream resources in a Java application should be released in a finally block, otherwise an exception thrown before the call to close() would result in an unreleased I/O resource. In the example below, the close() method is called in the try block (incorrect).
Vulnerable example
try {
InputStream is = new FileInputStream(path);
byte b[] = new byte[is.available()];
is.read(b);
is.close();
} catch (Throwable t) {
log.error("Something bad happened: " + t.getMessage());
}Real CVEs that MITRE cites as examples of this weakness.
Common questions about CWE-459.
Weakness data is sourced from the MITRE CWE catalog (v4.21). CVE associations are aggregated and kept current by RadicalNotion.AI.
Get an alert when a new CWE-459 CVE affects your products, with AI-written analysis and remediation steps.