CWE-772: Missing Release of Resource after Effective Lifetime
CWE版本: 4.18
更新日期: 2025-09-09
弱点描述
The product does not release a resource after its effective lifetime has ended, i.e., after the resource is no longer needed.
常见后果
影响范围: Availability
技术影响: DoS: Resource Consumption (Other) DoS: Resource Consumption (Memory) DoS: Resource Consumption (CPU)
说明: An 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.
潜在缓解措施
阶段: Requirements
策略: Language Selection
阶段: Implementation
描述: It 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.
阶段: Operation Architecture and Design
策略: Resource Limitation
观察示例
参考: CVE-2007-0897
Chain: anti-virus product encounters a malformed file but returns from a function without closing a file descriptor (CWE-775) leading to file descriptor consumption (CWE-400) and failed scans.
参考: CVE-2001-0830
Sockets not properly closed when attacker repeatedly connects and disconnects from server.
参考: CVE-1999-1127
Does not shut down named pipe connections if malformed data is sent.
参考: CVE-2009-2858
Chain: memory leak (CWE-404) leads to resource exhaustion.
参考: CVE-2009-2054
Product allows exhaustion of file descriptors when processing a large number of TCP packets.
参考: CVE-2008-2122
Port scan triggers CPU consumption with processes that attempt to read data from closed sockets.
参考: CVE-2007-4103
Product allows resource exhaustion via a large number of calls that do not complete a 3-way handshake.
参考: CVE-2002-1372
Chain: Return values of file/socket operations are not checked (CWE-252), allowing resultant consumption of file descriptors (CWE-772).
引入模式
| 阶段 | 说明 |
|---|---|
| Implementation | - |
适用平台
技术
分类映射
| 分类名称 | 条目ID | 条目名称 | 映射适配度 |
|---|---|---|---|
| CERT C Secure Coding | FIO42-C | Close files when they are no longer needed | CWE More Abstract |
| CERT C Secure Coding | MEM31-C | Free dynamically allocated memory when no longer needed | CWE More Abstract |
| OMG ASCSM | ASCSM-CWE-772 | - | |
| OMG ASCRM | ASCRM-CWE-772 | - | |
| Software Fault Patterns | SFP14 | Failure to Release Resource | - |