| Impact | Details |
|---|---|
|
DoS: Resource Consumption (Other); Varies by Context |
Scope: Availability, Other
Most unreleased resource issues result in general software reliability problems, but if an attacker can intentionally trigger a resource leak, the attacker might be able to launch a denial of service attack by depleting the resource pool.
|
|
Read Application Data |
Scope: Confidentiality
When a resource containing sensitive information is not correctly shutdown, it may expose the sensitive data in a subsequent allocation.
|
| Phase(s) | Mitigation |
|---|---|
|
Requirements |
Strategy: Language Selection Use a language that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. For example, languages such as Java, Ruby, and Lisp perform automatic garbage collection that releases memory for objects that have been deallocated. |
|
Implementation |
It is good practice to be responsible for freeing all resources you allocate and to be consistent with how and where you free memory in a function. If you allocate memory that you intend to free upon completion of the function, you must be sure to free the memory at all exit points for that function including error conditions.
|
|
Implementation |
Memory should be allocated/freed using matching functions such as malloc/free, new/delete, and new[]/delete[].
|
|
Implementation |
When releasing a complex object or structure, ensure that you properly dispose of all of its member components, not just the object itself.
|
| Nature | Type | ID | Name |
|---|---|---|---|
| ChildOf | Pillar Pillar - a weakness that is the most abstract type of weakness and represents a theme for all class/base/variant weaknesses related to it. A Pillar is different from a Category as a Pillar is still technically a type of weakness that describes a mistake, while a Category represents a common characteristic used to group related things. | 664 | Improper Control of a Resource Through its Lifetime |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 299 | Improper Check for Certificate Revocation |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 459 | Incomplete Cleanup |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 763 | Release of Invalid Pointer or Reference |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 772 | Missing Release of Resource after Effective Lifetime |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 1266 | Improper Scrubbing of Sensitive Data from Decommissioned Device |
| PeerOf | Variant Variant - a weakness that is linked to a certain type of product, typically involving a specific language or technology. More specific than a Base weakness. Variant level weaknesses typically describe issues in terms of 3 to 5 of the following dimensions: behavior, property, technology, language, and resource. | 239 | Failure to Handle Incomplete Element |
| PeerOf | Class Class - a weakness that is described in a very abstract fashion, typically independent of any specific language or technology. More specific than a Pillar Weakness, but more general than a Base Weakness. Class level weaknesses typically describe issues in terms of 1 or 2 of the following dimensions: behavior, property, and resource. | 405 | Asymmetric Resource Consumption (Amplification) |
| CanPrecede | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 619 | Dangling Database Cursor ('Cursor Injection') |
| Nature | Type | ID | Name |
|---|---|---|---|
| MemberOf | View View - a subset of CWE entries that provides a way of examining CWE content. The two main view structures are Slices (flat lists) and Graphs (containing relationships between entries). | 1003 | Weaknesses for Simplified Mapping of Published Vulnerabilities |
| ParentOf | Variant Variant - a weakness that is linked to a certain type of product, typically involving a specific language or technology. More specific than a Base weakness. Variant level weaknesses typically describe issues in terms of 3 to 5 of the following dimensions: behavior, property, technology, language, and resource. | 401 | Missing Release of Memory after Effective Lifetime |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 459 | Incomplete Cleanup |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 763 | Release of Invalid Pointer or Reference |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 772 | Missing Release of Resource after Effective Lifetime |
| Nature | Type | ID | Name |
|---|---|---|---|
| ParentOf | Variant Variant - a weakness that is linked to a certain type of product, typically involving a specific language or technology. More specific than a Base weakness. Variant level weaknesses typically describe issues in terms of 3 to 5 of the following dimensions: behavior, property, technology, language, and resource. | 401 | Missing Release of Memory after Effective Lifetime |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 772 | Missing Release of Resource after Effective Lifetime |
| ParentOf | Variant Variant - a weakness that is linked to a certain type of product, typically involving a specific language or technology. More specific than a Base weakness. Variant level weaknesses typically describe issues in terms of 3 to 5 of the following dimensions: behavior, property, technology, language, and resource. | 775 | Missing Release of File Descriptor or Handle after Effective Lifetime |
| Nature | Type | ID | Name |
|---|---|---|---|
| ParentOf | Variant Variant - a weakness that is linked to a certain type of product, typically involving a specific language or technology. More specific than a Base weakness. Variant level weaknesses typically describe issues in terms of 3 to 5 of the following dimensions: behavior, property, technology, language, and resource. | 761 | Free of Pointer not at Start of Buffer |
| ParentOf | Variant Variant - a weakness that is linked to a certain type of product, typically involving a specific language or technology. More specific than a Base weakness. Variant level weaknesses typically describe issues in terms of 3 to 5 of the following dimensions: behavior, property, technology, language, and resource. | 762 | Mismatched Memory Management Routines |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 763 | Release of Invalid Pointer or Reference |
| ParentOf | Base Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource. | 772 | Missing Release of Resource after Effective Lifetime |
| ParentOf | Variant Variant - a weakness that is linked to a certain type of product, typically involving a specific language or technology. More specific than a Base weakness. Variant level weaknesses typically describe issues in terms of 3 to 5 of the following dimensions: behavior, property, technology, language, and resource. | 775 | Missing Release of File Descriptor or Handle after Effective Lifetime |
| Phase | Note |
|---|---|
| Implementation |
Class: Not Language-Specific (Undetermined Prevalence)
Example 1
The following method never closes the new file handle. Given enough time, the Finalize() method for BufferReader should eventually call Close(), but there is no guarantee as to how long this action will take. In fact, there is no guarantee that Finalize() will ever be invoked. In a busy environment, the Operating System could use up all of the available file handles before the Close() function is called.
The good code example simply adds an explicit call to the Close() function when the system is done using the file. Within a simple example such as this the problem is easy to see and fix. In a real system, the problem may be considerably more obscure.
Example 2
This code attempts to open a connection to a database and catches any exceptions that may occur.
If an exception occurs after establishing the database connection and before the same connection closes, the pool of database connections may become exhausted. If the number of available connections is exceeded, other users cannot access this resource, effectively denying access to the application.
Example 3
Under normal conditions the following C# code executes a database query, processes the results returned by the database, and closes the allocated SqlConnection object. But if an exception occurs while executing the SQL or processing the results, the SqlConnection object is not closed. If this happens often enough, the database will run out of available cursors and not be able to execute any more SQL queries.
Example 4
The following C function does not close the file handle it opens if an error occurs. If the process is long-lived, the process can run out of file handles.
Example 5
In this example, the program does not use matching functions such as malloc/free, new/delete, and new[]/delete[] to allocate/deallocate the resource.
Example 6
In this example, the program calls the delete[] function on non-heap memory.
Note: this is a curated list of examples for users to understand the variety of ways in which this weakness can be introduced. It is not a complete list of all CVEs that are related to this CWE entry.
| Reference | Description |
|---|---|
|
Does not shut down named pipe connections if malformed data is sent.
|
|
|
Sockets not properly closed when attacker repeatedly connects and disconnects from server.
|
|
| Ordinality | Description |
|---|---|
|
Primary
|
(where the weakness exists independent of other weaknesses)
Improper release or shutdown of resources can be primary to resource exhaustion, performance, and information confidentiality problems to name a few.
|
Resultant
|
(where the weakness is typically related to the presence of some other weaknesses)
Improper release or shutdown of resources can be resultant from improper error handling or insufficient resource tracking.
|
| Method | Details |
|---|---|
|
Automated Dynamic Analysis |
This weakness can be detected using dynamic tools and techniques that interact with the software using large test suites with many diverse inputs, such as fuzz testing (fuzzing), robustness testing, and fault injection. The software's operation may slow down, but it should not become unstable, crash, or generate incorrect results. Resource clean up errors might be detected with a stress-test by calling the software simultaneously from a large number of threads or processes, and look for evidence of any unexpected behavior. The software's operation may slow down, but it should not become unstable, crash, or generate incorrect results. Effectiveness: Moderate |
|
Manual Dynamic Analysis |
Identify error conditions that are not likely to occur during normal usage and trigger them. For example, run the product under low memory conditions, run with insufficient privileges or permissions, interrupt a transaction before it is completed, or disable connectivity to basic network services such as DNS. Monitor the software for any unexpected behavior. If you trigger an unhandled exception or similar error that was discovered and handled by the application's environment, it may still indicate unexpected conditions that were not handled by the application itself.
|
|
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 |
| Nature | Type | ID | Name |
|---|---|---|---|
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 398 | 7PK - Code Quality |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 730 | OWASP Top Ten 2004 Category A9 - Denial of Service |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 743 | CERT C Secure Coding Standard (2008) Chapter 10 - Input Output (FIO) |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 752 | 2009 Top 25 - Risky Resource Management |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 857 | The CERT Oracle Secure Coding Standard for Java (2011) Chapter 14 - Input Output (FIO) |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 876 | CERT C++ Secure Coding Section 08 - Memory Management (MEM) |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 877 | CERT C++ Secure Coding Section 09 - Input Output (FIO) |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 882 | CERT C++ Secure Coding Section 14 - Concurrency (CON) |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 982 | SFP Secondary Cluster: Failure to Release Resource |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1147 | SEI CERT Oracle Secure Coding Standard for Java - Guidelines 13. Input Output (FIO) |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1162 | SEI CERT C Coding Standard - Guidelines 08. Memory Management (MEM) |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1163 | SEI CERT C Coding Standard - Guidelines 09. Input Output (FIO) |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1306 | CISQ Quality Measures - Reliability |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1308 | CISQ Quality Measures - Security |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1309 | CISQ Quality Measures - Efficiency |
| MemberOf | ViewView - a subset of CWE entries that provides a way of examining CWE content. The two main view structures are Slices (flat lists) and Graphs (containing relationships between entries). | 1340 | CISQ Data Protection Measures |
| MemberOf | CategoryCategory - a CWE entry that contains a set of other entries that share a common characteristic. | 1416 | Comprehensive Categorization: Resource Lifecycle Management |
Rationale
This CWE entry is a Class and might have Base-level children that would be more appropriateComments
Examine children of this entry to see if there is a better fitRelationship
| Mapped Taxonomy Name | Node ID | Fit | Mapped Node Name |
|---|---|---|---|
| PLOVER | Improper resource shutdown or release | ||
| 7 Pernicious Kingdoms | Unreleased Resource | ||
| OWASP Top Ten 2004 | A9 | CWE More Specific | Denial of Service |
| CERT C Secure Coding | FIO42-C | CWE More Abstract | Close files when they are no longer needed |
| CERT C Secure Coding | MEM31-C | CWE More Abstract | Free dynamically allocated memory when no longer needed |
| The CERT Oracle Secure Coding Standard for Java (2011) | FIO04-J | Release resources when they are no longer needed | |
| Software Fault Patterns | SFP14 | Failure to release resource |
| Submissions | ||
|---|---|---|
| Submission Date | Submitter | Organization |
|
2006年07月19日
(CWE Draft 3, 2006年07月19日) |
PLOVER | |
| Modifications | ||
| Modification Date | Modifier | Organization |
| 2023年10月26日 | CWE Content Team | MITRE |
| updated Observed_Examples | ||
| 2023年06月29日 | CWE Content Team | MITRE |
| updated Mapping_Notes | ||
| 2023年04月27日 | CWE Content Team | MITRE |
| updated Detection_Factors, Relationships, Time_of_Introduction | ||
| 2023年01月31日 | CWE Content Team | MITRE |
| updated Description, Detection_Factors | ||
| 2022年10月13日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2021年07月20日 | CWE Content Team | MITRE |
| updated Related_Attack_Patterns | ||
| 2021年03月15日 | CWE Content Team | MITRE |
| updated Demonstrative_Examples | ||
| 2020年12月10日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2020年08月20日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2020年06月25日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2020年02月24日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2019年06月20日 | CWE Content Team | MITRE |
| updated Related_Attack_Patterns, Relationships | ||
| 2019年01月03日 | CWE Content Team | MITRE |
| updated Relationships, Taxonomy_Mappings, Type | ||
| 2017年11月08日 | CWE Content Team | MITRE |
| updated Applicable_Platforms, Functional_Areas, Likelihood_of_Exploit, Relationships, Taxonomy_Mappings | ||
| 2017年05月03日 | CWE Content Team | MITRE |
| updated Related_Attack_Patterns | ||
| 2017年01月19日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2015年12月07日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2014年07月30日 | CWE Content Team | MITRE |
| updated Relationships, Taxonomy_Mappings | ||
| 2014年06月23日 | CWE Content Team | MITRE |
| updated Related_Attack_Patterns | ||
| 2014年02月18日 | CWE Content Team | MITRE |
| updated Demonstrative_Examples | ||
| 2012年05月11日 | CWE Content Team | MITRE |
| updated Demonstrative_Examples, References, Relationships, Taxonomy_Mappings | ||
| 2011年09月13日 | CWE Content Team | MITRE |
| updated Relationships, Taxonomy_Mappings | ||
| 2011年06月27日 | CWE Content Team | MITRE |
| updated Common_Consequences | ||
| 2011年06月01日 | CWE Content Team | MITRE |
| updated Common_Consequences, Relationships, Taxonomy_Mappings | ||
| 2011年03月29日 | CWE Content Team | MITRE |
| updated Weakness_Ordinalities | ||
| 2010年12月13日 | CWE Content Team | MITRE |
| updated Demonstrative_Examples | ||
| 2010年06月21日 | CWE Content Team | MITRE |
| updated Detection_Factors, Potential_Mitigations | ||
| 2010年02月16日 | CWE Content Team | MITRE |
| updated Potential_Mitigations, Relationships | ||
| 2009年10月29日 | CWE Content Team | MITRE |
| updated Other_Notes | ||
| 2009年07月27日 | CWE Content Team | MITRE |
| updated Demonstrative_Examples, Related_Attack_Patterns | ||
| 2009年05月27日 | CWE Content Team | MITRE |
| updated Description, Relationships | ||
| 2009年03月10日 | CWE Content Team | MITRE |
| updated Potential_Mitigations | ||
| 2009年01月12日 | CWE Content Team | MITRE |
| updated Common_Consequences, Likelihood_of_Exploit, Other_Notes, Potential_Mitigations, Relationship_Notes, Relationships, Weakness_Ordinalities | ||
| 2008年11月24日 | CWE Content Team | MITRE |
| updated Relationships, Taxonomy_Mappings | ||
| 2008年10月14日 | CWE Content Team | MITRE |
| updated Relationships | ||
| 2008年09月08日 | CWE Content Team | MITRE |
| updated Description, Relationships, Other_Notes, Taxonomy_Mappings | ||
| 2008年08月15日 | Veracode | |
| Suggested OWASP Top Ten 2004 mapping | ||
| 2008年07月01日 | Eric Dalci | Cigital |
| updated Time_of_Introduction | ||
Use of the Common Weakness Enumeration (CWE™) and the associated references from this website are subject to the Terms of Use. CWE is sponsored by the U.S. Department of Homeland Security (DHS) Cybersecurity and Infrastructure Security Agency (CISA) and managed by the Homeland Security Systems Engineering and Development Institute (HSSEDI) which is operated by The MITRE Corporation (MITRE). Copyright © 2006–2025, The MITRE Corporation. CWE, CWSS, CWRAF, and the CWE logo are trademarks of The MITRE Corporation.