---
title: "CWE-459: Incomplete Cleanup"
url: https://radicalnotion.ai/cwe/cwe-459
type: cwe
description: "The product does not properly \"clean up\" and remove temporary or supporting resources after they have been used."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-459: Incomplete Cleanup

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 369
- **Of those, in CISA KEV:** 0
- **New in 2026:** 161
- **CWE catalog version:** 4.21

## Description

The product does not properly "clean up" and remove temporary or supporting resources after they have been used.

## Alternate terms

- Insufficient Cleanup

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Applicable platforms

**Languages:** Python (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Other, Confidentiality, Integrity | Other, Read Application Data, Modify Application Data, DoS: Resource Consumption (Other) | 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. |

## Potential mitigations

### Architecture and Design, Implementation

Temporary files and other supporting resources should be deleted/released immediately after they are no longer needed.

## Detection methods

### 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.)

Effectiveness: High

## Demonstrative examples

### Example 1

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).

Bad code:

```java
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());
}
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2000-0552 | World-readable temporary file not deleted after use. |
| CVE-2005-2293 | Temporary file not deleted after use, leaking database usernames and passwords. |
| CVE-2002-0788 | Interaction error creates a temporary file that can not be deleted due to strong permissions. |
| CVE-2002-2066 | Alternate data streams for NTFS files are not cleared when files are wiped (alternate channel / infoleak). |
| CVE-2002-2067 | Alternate data streams for NTFS files are not cleared when files are wiped (alternate channel / infoleak). |
| CVE-2002-2068 | Alternate data streams for NTFS files are not cleared when files are wiped (alternate channel / infoleak). |
| CVE-2002-2069 | Alternate data streams for NTFS files are not cleared when files are wiped (alternate channel / infoleak). |
| CVE-2002-2070 | Alternate data streams for NTFS files are not cleared when files are wiped (alternate channel / infoleak). |
| CVE-2005-1744 | Users not logged out when application is restarted after security-relevant changes were made. |

## Real CVEs with this weakness (sample of 12 of 369)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2023-36468 | Upgrading doesn't prevent exploiting vulnerable XWiki documents | critical | 10.0 | - | No | 2023-06-29 |
| CVE-2026-98279 | btrfs: handle lack of space when cleaning up verity items | critical | 9.8 | - | No | 2026-10-06 |
| CVE-2026-98209 | mmc: sdhci-of-aspeed: Remove children before releasing SDC resources | critical | 9.8 | - | No | 2026-10-06 |
| CVE-2026-100075 | RDMA/srpt: Fix srpt\_alloc\_rw\_ctxs() unwind counters | critical | 9.8 | - | No | 2026-09-25 |
| CVE-2026-64078 | netfilter: x\_tables: add and use xtables\_unregister\_table\_exit | critical | 9.8 | - | No | 2026-07-19 |
| CVE-2026-45899 | ext4: drop extent cache when splitting extent fails | critical | 9.8 | - | No | 2026-05-27 |
| CVE-2026-28268 | Vikunja Vulnerable to Account Takeover via Password Reset Token Reuse | critical | 9.8 | - | No | 2026-02-27 |
| CVE-2025-39743 | jfs: truncate good inode pages when hard link is 0 | critical | 9.8 | - | No | 2025-09-11 |
| CVE-2025-21805 | RDMA/rtrs: Add missing deinit() call | critical | 9.8 | - | No | 2025-02-27 |
| CVE-2022-45347 | Apache ShardingSphere-Proxy: MySQL authentication bypass | critical | 9.8 | - | No | 2022-12-22 |
| CVE-2021-36205 | Metasys session token | critical | 9.8 | - | No | 2022-04-15 |
| CVE-2021-45330 | Improper Privilege Management in Gitea | critical | 9.8 | - | No | 2022-02-09 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-404](https://radicalnotion.ai/cwe/cwe-404) | Improper Resource Shutdown or Release |
| Child | [CWE-226](https://radicalnotion.ai/cwe/cwe-226) | Sensitive Information in Resource Not Removed Before Reuse |
| Child | [CWE-460](https://radicalnotion.ai/cwe/cwe-460) | Improper Cleanup on Thrown Exception |
| Child | [CWE-568](https://radicalnotion.ai/cwe/cwe-568) | finalize() Method Without super.finalize() |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | Incomplete Cleanup | - | - |
| OWASP Top Ten 2004 | Insecure Configuration Management | A10 | CWE More Specific |
| CERT C Secure Coding | Close files when they are no longer needed | FIO42-C | CWE More Abstract |
| CERT C Secure Coding | Free dynamically allocated memory when no longer needed | MEM31-C | CWE More Abstract |
| The CERT Oracle Secure Coding Standard for Java (2011) | Release resources when they are no longer needed | FIO04-J | - |
| The CERT Oracle Secure Coding Standard for Java (2011) | Do not operate on files in shared directories | FIO00-J | - |
| Software Fault Patterns | Failure to release resource | SFP14 | - |
| OpenSSF Secure Coding Guide for Python | Complete Resource Cleanup | pyscg-0035 | - |

## Frequently asked questions

### What is CWE-459?

The product does not properly "clean up" and remove temporary or supporting resources after they have been used.

### What CVEs are caused by CWE-459?

369 recorded CVEs are attributed to CWE-459, including CVE-2023-36468, CVE-2026-98279 and CVE-2026-98209.

### Is CWE-459 part of the OWASP Top 10?

CWE-459 maps to OWASP Top Ten 2004: Insecure Configuration Management (A10) in the OWASP security taxonomy.

### How do you prevent CWE-459?

Temporary files and other supporting resources should be deleted/released immediately after they are no longer needed.

### How is CWE-459 detected?

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.)

### What are the consequences of CWE-459?

Exploiting CWE-459 can lead to: Other, Read Application Data, Modify Application Data, DoS: Resource Consumption (Other).

### Is CWE-459 actively exploited?

369 recorded CVEs are caused by CWE-459; none are currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/459.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-459). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
