CWEweakness

CWE-404 Improper Resource Shutdown or Release

Medium Official page ↗
Abstraction
Class
Structure
Simple
Status
Draft
Likelihood of exploit
Medium
Languages
Not Language-Specific, Python
CWE version
5.0

Description

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

Extended description

When a resource is created or allocated, the developer is responsible for properly releasing the resource as well as accounting for all potential paths of expiration or invalidation, such as a set period of time or revocation.

Common consequences

• Availability, Other: DoS: Resource Consumption (Other), Varies by Context — Most unreleased resource issues result in general software reliability problems, but if an attacker can intentionally trigger a resource leak, the attacker might be able to launch a denial of service attack by depleting the resource pool. • Confidentiality: Read Application Data — When a resource containing sensitive information is not correctly shutdown, it may expose the sensitive data in a subsequent allocation.

Potential mitigations

• [Requirements] Use 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. • [Implementation] It is good practice to be responsible for freeing all resources you allocate and to be consistent with how and where you free memory in a function. If you allocate memory that you intend to free upon completion of the function, you must be sure to free the memory at all exit points for that function including error conditions. • [Implementation] Memory should be allocated/freed using matching functions such as malloc/free, new/delete, and new[]/delete[]. • [Implementation] When releasing a complex object or structure, ensure that you properly dispose of all of its member components, not just the object itself.

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

Observed examples

• CVE-1999-1127: Does not shut down named pipe connections if malformed data is sent. • CVE-2001-0830: Sockets not properly closed when attacker repeatedly connects and disconnects from server. • CVE-2002-1372: Chain: Return values of file/socket operations are not checked (CWE-252), allowing resultant consumption of file descriptors (CWE-772).

Related

Attack pattern · CAPEC (7)

Observed example · CVE (3)

  • CVE-2002-1372 Common Unix Printing System (CUPS) 1.1.14 through 1.1.17 does not properly check the return values of various file and socket operations,… vulnerability
  • CVE-2001-0830 6tunnel 0.08 and earlier does not properly close sockets that were initiated by a client, which allows remote attackers to cause a denial… vulnerability
  • CVE-1999-1127 Windows NT 4.0 does not properly shut down invalid named pipe RPC connections, which allows remote attackers to cause a denial of service… vulnerability

Can precede · CWE (1)

  • CWE-619 Dangling Database Cursor weakness

Child of · CWE (1)

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

Peer of · CWE (1)

  • CWE-405 Asymmetric Resource Consumption (Amplification) weakness

Referenced by CAPEC · weakness (7)

Referenced by CVE · weakness (868)

  • CVE-2026-118271 A security vulnerability has been detected in a2ui-project a2ui up to 0.10.6. vulnerability
  • CVE-2026-118273 A flaw has been found in a2ui-project a2ui up to 0.10.6. vulnerability
  • CVE-2026-118274 A vulnerability has been found in a2ui-project a2ui up to 0.10.6. vulnerability
  • CVE-2026-118275 A vulnerability was found in a2ui-project a2ui up to 0.10.6. vulnerability
  • CVE-2026-118276 A vulnerability was determined in a2ui-project a2ui up to 0.10.6. vulnerability
  • CVE-2026-117503 A vulnerability was determined in a2aproject a2a-go up to 2.4.0. vulnerability
  • CVE-2026-117504 A vulnerability was identified in a2aproject a2a-go up to 2.4.0. vulnerability
  • CVE-2026-117505 A security flaw has been discovered in a2aproject a2a-java up to 1.2.0.Final. vulnerability
  • CVE-2026-117506 A weakness has been identified in a2aproject a2a-java up to 1.2.0.Final. vulnerability
  • CVE-2026-115971 A vulnerability was found in Travisun Opptrix 0.4.0. vulnerability
  • CVE-2026-113872 multer is a middleware for Node.js that handles multipart/form-data file uploads. vulnerability
  • CVE-2026-101400 Vulnerability in the Siebel Apps - Marketing product of Oracle Siebel CRM (component: Marketing). vulnerability
  • CVE-2026-101401 Vulnerability in the Siebel Apps - Marketing product of Oracle Siebel CRM (component: Marketing). vulnerability
  • CVE-2026-101402 Vulnerability in the Siebel Apps - Marketing product of Oracle Siebel CRM (component: Email Marketing). vulnerability
  • CVE-2026-91302 Vulnerability in the JD Edwards EnterpriseOne Tools product of Oracle JD Edwards (component: Enterprise Infrastructure SEC). vulnerability
  • CVE-2026-91324 Vulnerability in the Oracle Solaris product of Oracle Systems (component: Libraries). vulnerability
  • CVE-2026-91330 Vulnerability in the JD Edwards EnterpriseOne Tools product of Oracle JD Edwards (component: Installation Security). vulnerability
  • CVE-2026-91427 Vulnerability in the Siebel CRM Deployment product of Oracle Siebel CRM (component: Server Infrastructure). vulnerability
  • CVE-2026-112082 A vulnerability was identified in sgl-project SGLang up to 0.5.19. vulnerability
  • CVE-2026-112083 A security flaw has been discovered in sgl-project SGLang up to 0.5.19. vulnerability
  • CVE-2026-112157 A weakness has been identified in MemTensor memmy-agent up to 1.0.9/1.1.1/1.2.2. vulnerability
  • CVE-2026-110809 A security vulnerability has been detected in sgl-project SGLang up to 0.5.19. vulnerability
  • CVE-2026-110807 A weakness has been identified in sgl-project SGLang up to 0.5.19. vulnerability
  • CVE-2026-102700 With its original introduction, GNTTAB_cache_flush was made available uniformly. vulnerability
  • CVE-2026-109107 A weakness has been identified in Wavlink WL-WN592AX6 250422. vulnerability
  • CVE-2026-109144 A vulnerability was identified in wbond certvalidator up to 0.11.1. vulnerability
  • CVE-2026-49785 Improper resource shutdown or release in Windows UEFI allows an authorized attacker to bypass a security feature locally. vulnerability
  • CVE-2026-109277 ImageMagick before 7.1.2-32 contains a policy bypass vulnerability in the -script operation due to missing checks on file descriptor… vulnerability
  • CVE-2026-108577 A vulnerability was determined in Konstanty Bialkowski libmodplug up to 0.8.9.1. vulnerability
  • CVE-2026-108681 A security flaw has been discovered in zhayujie CowAgent up to 2.1.7. vulnerability
Show all 868 ›

Referenced by CWE · child of (8)

  • CWE-299 Improper Check for Certificate Revocation weakness
  • CWE-401 Missing Release of Memory after Effective Lifetime weakness
  • CWE-459 Incomplete Cleanup weakness
  • CWE-761 Free of Pointer not at Start of Buffer weakness
  • CWE-762 Mismatched Memory Management Routines weakness
  • CWE-763 Release of Invalid Pointer or Reference weakness
  • CWE-772 Missing Release of Resource after Effective Lifetime weakness
  • CWE-775 Missing Release of File Descriptor or Handle after Effective Lifetime weakness

Referenced by CWE · has member (2)

  • CWE-1003 Weaknesses for Simplified Mapping of Published Vulnerabilities view
  • CWE-1340 CISQ Data Protection Measures view

Referenced by CWE · peer of (1)

  • CWE-239 Failure to Handle Incomplete Element weakness