CWE-772: Missing Release of Resource after Effective Lifetime

What is CWE-772?

CWE-772 is Missing Release of Resource after Effective Lifetime. The flaw arises when the product does not release a resource after its effective lifetime has ended, i.e., after the resource is no longer needed. The database currently holds 85 vulnerabilities mapped to CWE-772 and none of them are in the CISA Known Exploited Vulnerabilities catalog.

OWASP Top 10 Rank-
Related CVES (365 days)85
AbstractionBase
Likelihood of exploitHigh

Vulnerabilities mapped to CWE-772

85 vulnerabilities1600% increase year over year

No data

No vulnerability data in CISA KEV for CWE-772

Official definition

ByMitre CWE

The product does not release a resource after its effective lifetime has ended, i.e., after the resource is no longer needed.

Characteristics

Modes of introduction

  • Implementation

Common consequences

ImpactScopeExplanation
DoS: Resource Consumption (Other), DoS: Resource Consumption (Memory), DoS: Resource Consumption (CPU)AvailabilityAn attacker that can influence the allocation of resources that are not properly released could deplete the available resource pool and prevent all other processes from accessing the same type of resource. Frequently-affected resources include memory, CPU, disk space, power or battery, etc.

Risk mitigations

  1. Language Selection · RequirementsUse 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.
  2. ImplementationIt is good practice to be responsible for freeing all resources you allocate and to be consistent with how and where you free resources in a function. If you allocate resources that you intend to free upon completion of the function, you must be sure to free the resources at all exit points for that function including error conditions.
  3. Resource Limitation · Operation, Architecture and DesignUse resource-limiting settings provided by the operating system or environment. For example, when managing system resources in POSIX, setrlimit() can be used to set limits for certain types of resources, and getrlimit() can determine how many resources are available. However, these functions are not available on all operating systems. When the current levels get close to the maximum that is defined for the application (see CWE-770), then limit the allocation of further resources to privileged users; alternately, begin releasing resources for less-privileged users. While this mitigation may protect the system from attack, it will not necessarily stop attackers from adversely impacting other users. Ensure that the application performs the appropriate error checks and error handling in case resources become unavailable (CWE-703).

Detection methods

MethodApproachEffectiveness
Automated Static AnalysisAutomated 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.)High

Representative vulnerabilities

Sources (2)

CWE™ Program, operated by The MITRE Corporation. Copyright © 2006–2026, The MITRE Corporation. The MITRE Corporation hereby grants you a non-exclusive, royalty-free license to use CWE for research, development, and commercial purposes. CWE Terms of Use.

Learn more

Run an in-depth assessment with complete web risk management

CyStack VulnScan continuously discovers assets, validates vulnerabilities, and helps security teams prioritize remediation across the organization.