CWEweakness

CWE-666 Operation on Resource in Wrong Phase of Lifetime

Official page ↗
Abstraction
Class
Structure
Simple
Status
Draft
Languages
Not Language-Specific
CWE version
5.0

Description

The product performs an operation on a resource at the wrong phase of the resource's lifecycle, which can lead to unexpected behaviors.

Common consequences

• Other: Varies by Context, Modify Application Data — Using a resource before it has been fully initialized could cause corruption or incorrect data to be used.

Potential mitigations

• [Architecture and Design] Follow the resource's lifecycle from creation to release. • [Implementation] For each phase, it is important to follow the specifications outlined for how to operate on the resource and to ensure that the resource is in the expected phase. Otherwise, if a resource is in one phase but the operation is not valid for that phase (i.e., an incorrect phase of the resource's lifetime), then this can produce resultant weaknesses.

Detection methods

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

Observed examples

• CVE-2006-5051: Chain: Signal handler contains too much functionality (CWE-828), introducing a race condition (CWE-362) that leads to a double free (CWE-415).

Related

Observed example · CVE (1)

  • CVE-2006-5051 Signal handler race condition in OpenSSH before 4.4 allows remote attackers to cause a denial of service (crash), and possibly execute… vulnerability

Child of · CWE (1)

  • CWE-664 Improper Control of a Resource Through its Lifetime weakness

Referenced by CVE · weakness (4)

  • CVE-2026-16148 The ITE it82xx2 USB device-controller driver initialized its bus-suspend detection work with k_work_init_delayable(&priv->suspended_work,… vulnerability
  • CVE-2026-15460 The Bluetooth Classic (BR/EDR) L2CAP receive handler bt_l2cap_br_recv() in subsys/bluetooth/host/classic/l2cap_br.c dispatched inbound data… vulnerability
  • CVE-2026-68930 Russh is a Rust SSH client & server library. vulnerability
  • CVE-2026-64162 In the Linux kernel, the following vulnerability has been resolved: idpf: fix read_dev_clk_lock spinlock init in idpf_ptp_init() In… vulnerability

Referenced by CWE · child of (5)

  • CWE-415 Double Free weakness
  • CWE-593 Authentication Bypass: OpenSSL CTX Object Modified after SSL Objects are Created weakness
  • CWE-605 Multiple Binds to the Same Port weakness
  • CWE-672 Operation on a Resource after Expiration or Release weakness
  • CWE-826 Premature Release of Resource During Expected Lifetime weakness