CWE-404: Improper Resource Shutdown or Release

low-risk

The product does not release or incorrectly releases a resource before it is made available for re-use.

Abstraction: Class

Common Consequences

Availability DoS: Resource Consumption (Other)
Confidentiality Read Application Data

Detection Methods

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.

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

Real-World Examples (10)

CVE CVSS EPSS KEV
CVE-2018-8120 7.0 94.1% Y
CVE-2018-8120 7.0 94.1% Y
CVE-2018-8406 7.8 50.0% Y
CVE-2018-8406 7.8 50.0% Y
CVE-2018-8405 7.8 50.0% Y
CVE-2018-8405 7.8 50.0% Y
CVE-2024-0546 5.3 36.6%
CVE-2018-8450 8.8 36.3%
CVE-2018-8639 7.8 33.2% Y
CVE-2018-8639 7.8 33.2% Y
3
/ 100
low-risk
Active Threat 2/50 · Minimal
Exploit Availability 1/50 · Minimal