---
title: "CWE-664: Improper Control of a Resource Through its Lifetime"
url: https://radicalnotion.ai/cwe/cwe-664
type: cwe
description: "The product does not maintain or incorrectly maintains control over a resource throughout its lifetime of creation, use, and release."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-664: Improper Control of a Resource Through its Lifetime

- **Abstraction:** Pillar
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 127
- **Of those, in CISA KEV:** 1
- **New in 2026:** 58
- **CWE catalog version:** 4.21

## Description

The product does not maintain or incorrectly maintains control over a resource throughout its lifetime of creation, use, and release.

## Background

Resources often have explicit instructions on how to be created, used, and destroyed. Even without explicit instructions, various principles are expected to be adhered to, such as "Do not use an object until after its creation is complete," or "do not use an object after it has been slated for destruction."

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Other | Varies by Context | When code does not follow the instructions for resource management, it can lead to unexpected behaviors and potentially exploitable states. |

## Detection methods

### Automated Static Analysis

Use Static analysis tools to check for unreleased resources.

## Demonstrative examples

### Example 1

This code allocates a socket and forks each time it receives a new connection.

Bad code:

```c
sock=socket(AF_INET, SOCK_STREAM, 0);
while (1) {
    newsock=accept(sock, ...);
    printf("A connection has been accepted\n");
    pid = fork();
}
```

The program does not track how many connections have been made, and it does not limit the number of connections. Because forking is a relatively expensive operation, an attacker would be able to cause the system to run out of CPU, processes, or memory by making a large number of connections. Alternatively, an attacker could consume all available connections, preventing others from accessing the system remotely.

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2018-1000613 | Cryptography API uses unsafe reflection when deserializing a private key |
| CVE-2019-19911 | Chain: Python library does not limit the resources used to process images that specify a very large number of bands (CWE-1284), leading to excessive memory consumption (CWE-789) or an integer overflow (CWE-190). |

## Real CVEs with this weakness (sample of 12 of 127)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2022-27518 | Unauthenticated remote arbitrary code execution | critical | 9.3 | - | Yes | 2022-12-13 |
| CVE-2025-68741 | scsi: qla2xxx: Fix improper freeing of purex item | critical | 10.0 | - | No | 2025-12-24 |
| CVE-2026-76408 | Improper Control of a Resource Through its Lifetime in Splunk SOAR | critical | 9.8 | - | No | 2026-10-21 |
| CVE-2026-76500 | Cisco Application Policy Infrastructure Controller Hardening Release: October 2026 - Improper Control of a Resource Through its Lifetime Vulnerabilities | critical | 9.8 | - | No | 2026-10-07 |
| CVE-2026-20353 | Cisco Secure Email Gateway Security Hardening Release | critical | 9.8 | - | No | 2026-09-14 |
| CVE-2026-20274 | Cisco IOS XR Software Security Hardening Release: September 2026 | critical | 9.8 | - | No | 2026-09-02 |
| CVE-2026-80630 | net/sched: sch\_fq\_codel: Do not call qdisc\_tree\_reduce\_backlog during peek before restoring qlen | critical | 9.8 | - | No | 2026-08-28 |
| CVE-2026-74267 | net/sched: sch\_codel: Do not call qdisc\_tree\_reduce\_backlog during peek before restoring qlen | critical | 9.8 | - | No | 2026-08-15 |
| CVE-2026-72046 | gve: fix header buffer corruption with header-split and HW-GRO | critical | 9.8 | - | No | 2026-08-15 |
| CVE-2026-72041 | espintcp: use sk\_msg\_free\_partial to fix partial send | critical | 9.8 | - | No | 2026-08-15 |
| CVE-2022-49194 | net: bcmgenet: Use stronger register read/writes to assure ordering | critical | 9.8 | - | No | 2025-02-26 |
| CVE-2026-124923 | Sandbox escape in the Agent component | critical | 9.6 | - | No | 2026-11-10 |

## Related attack patterns (CAPEC)

- [CAPEC-196](https://radicalnotion.ai/capec/capec-196): Session Credential Falsification through Forging
- [CAPEC-21](https://radicalnotion.ai/capec/capec-21): Exploitation of Trusted Identifiers
- [CAPEC-60](https://radicalnotion.ai/capec/capec-60): Reusing Session IDs (aka Session Replay)
- [CAPEC-61](https://radicalnotion.ai/capec/capec-61): Session Fixation
- [CAPEC-62](https://radicalnotion.ai/capec/capec-62): Cross Site Request Forgery

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Child | [CWE-118](https://radicalnotion.ai/cwe/cwe-118) | Incorrect Access of Indexable Resource |
| Child | [CWE-221](https://radicalnotion.ai/cwe/cwe-221) | Information Loss or Omission |
| Child | [CWE-372](https://radicalnotion.ai/cwe/cwe-372) | Incomplete Internal State Distinction |
| Child | [CWE-400](https://radicalnotion.ai/cwe/cwe-400) | Uncontrolled Resource Consumption |
| Child | [CWE-404](https://radicalnotion.ai/cwe/cwe-404) | Improper Resource Shutdown or Release |
| Child | [CWE-410](https://radicalnotion.ai/cwe/cwe-410) | Insufficient Resource Pool |
| Child | [CWE-471](https://radicalnotion.ai/cwe/cwe-471) | Modification of Assumed-Immutable Data (MAID) |
| Child | [CWE-487](https://radicalnotion.ai/cwe/cwe-487) | Reliance on Package-level Scope |
| Child | [CWE-501](https://radicalnotion.ai/cwe/cwe-501) | Trust Boundary Violation |
| Child | [CWE-580](https://radicalnotion.ai/cwe/cwe-580) | clone() Method Without super.clone() |
| Child | [CWE-610](https://radicalnotion.ai/cwe/cwe-610) | Externally Controlled Reference to a Resource in Another Sphere |
| Child | [CWE-662](https://radicalnotion.ai/cwe/cwe-662) | Improper Synchronization |
| Child | [CWE-665](https://radicalnotion.ai/cwe/cwe-665) | Improper Initialization |
| Child | [CWE-666](https://radicalnotion.ai/cwe/cwe-666) | Operation on Resource in Wrong Phase of Lifetime |
| Child | [CWE-668](https://radicalnotion.ai/cwe/cwe-668) | Exposure of Resource to Wrong Sphere |
| Child | [CWE-669](https://radicalnotion.ai/cwe/cwe-669) | Incorrect Resource Transfer Between Spheres |
| Child | [CWE-673](https://radicalnotion.ai/cwe/cwe-673) | External Influence of Sphere Definition |
| Child | [CWE-706](https://radicalnotion.ai/cwe/cwe-706) | Use of Incorrectly-Resolved Name or Reference |
| Child | [CWE-911](https://radicalnotion.ai/cwe/cwe-911) | Improper Update of Reference Count |
| Child | [CWE-913](https://radicalnotion.ai/cwe/cwe-913) | Improper Control of Dynamically-Managed Code Resources |
| Child | [CWE-922](https://radicalnotion.ai/cwe/cwe-922) | Insecure Storage of Sensitive Information |
| Child | [CWE-1229](https://radicalnotion.ai/cwe/cwe-1229) | Creation of Emergent Resource |
| Child | [CWE-1250](https://radicalnotion.ai/cwe/cwe-1250) | Improper Preservation of Consistency Between Independent Representations of Shared State |
| Child | [CWE-1329](https://radicalnotion.ai/cwe/cwe-1329) | Reliance on Component That is Not Updateable |
| Child | [CWE-1472](https://radicalnotion.ai/cwe/cwe-1472) | Generation of Credential with Long Expiration |
| Child | [CWE-1473](https://radicalnotion.ai/cwe/cwe-1473) | Improper Expiration of Cached Data |
| Child | [CWE-1474](https://radicalnotion.ai/cwe/cwe-1474) | Non-Equivalent Data Transformation |
| Child | [CWE-1475](https://radicalnotion.ai/cwe/cwe-1475) | Incomplete Data/State Propagation |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| CERT C Secure Coding | Do not alternately input and output from a stream without an intervening flush or positioning call | FIO39-C | CWE More Abstract |

## Frequently asked questions

### What is CWE-664?

The product does not maintain or incorrectly maintains control over a resource throughout its lifetime of creation, use, and release.

### What CVEs are caused by CWE-664?

127 recorded CVEs are attributed to CWE-664, including CVE-2022-27518, CVE-2025-68741 and CVE-2026-76408. 1 is listed in CISA's Known Exploited Vulnerabilities (KEV) catalog.

### How is CWE-664 detected?

Automated Static Analysis: Use Static analysis tools to check for unreleased resources.

### What are the consequences of CWE-664?

Exploiting CWE-664 can lead to: Varies by Context.

### Is CWE-664 actively exploited?

Yes. 1 CWE-664 vulnerability is in CISA's KEV catalog of actively exploited flaws, out of 127 recorded CVEs.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/664.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-664). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
