CWE-459: Incomplete Cleanup (Base)

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



Alternate Terms: ::TERM:Insufficient Cleanup::

Applicable Platforms: ::LANGUAGE CLASS:Not Language-Specific:LANGUAGE PREVALENCE:Undetermined::

Modes of Introduction: ::PHASE:Implementation::



Common Consequences: ::SCOPE:Other:SCOPE:Confidentiality:SCOPE:Integrity:IMPACT:Other:IMPACT:Read Application Data:IMPACT:Modify Application Data:IMPACT:DoS: Resource Consumption (Other):NOTE: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.::

Detection Methods: ::METHOD:Automated Static Analysis:DESCRIPTION: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::

Potential Mitigations: ::PHASE:Architecture and Design Implementation:DESCRIPTION:Temporary files and other supporting resources should be deleted/released immediately after they are no longer needed.::

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

Functional Areas: ::File Processing::


Notes: ::TYPE:Relationship:NOTE:CWE-459 is a child of CWE-404 because, while CWE-404 covers any type of improper shutdown or release of a resource, CWE-459 deals specifically with a multi-step shutdown process in which a crucial step for proper cleanup is omitted or impossible. That is, CWE-459 deals specifically with a cleanup or shutdown process that does not successfully remove all potentially sensitive data.::TYPE:Relationship:NOTE:Overlaps other categories such as permissions and containment. Concept needs further development. This could be primary (e.g. leading to infoleak) or resultant (e.g. resulting from unhandled error conditions or early termination).::