Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CWE-404 (不恰当的资源关闭或释放) — Vulnerability Class 343

343 vulnerabilities classified as CWE-404 (不恰当的资源关闭或释放). AI Chinese analysis included.

CWE-404 represents a critical resource management weakness where software fails to properly release or incorrectly frees allocated resources, such as memory, file handles, or network connections, before they are reused. This flaw typically leads to resource exhaustion, causing application crashes, denial of service, or system instability as available resources dwindle. Attackers often exploit this by triggering repeated allocations without corresponding releases, effectively starving the system of necessary assets. To mitigate this risk, developers must implement rigorous lifecycle management, ensuring every allocated resource has a corresponding release mechanism. This involves using structured cleanup routines, leveraging language-specific garbage collection or smart pointers, and accounting for all execution paths, including error conditions and timeouts, to guarantee resources are consistently returned to the pool for safe reuse.

MITRE CWE Description
The product does not release or incorrectly releases a resource before it is made available for re-use. 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 (2)
Availability, OtherDoS: 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.
ConfidentialityRead Application Data
When a resource containing sensitive information is not correctly shutdown, it may expose the sensitive data in a subsequent allocation.
Mitigations (4)
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.
ImplementationIt 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.
ImplementationMemory should be allocated/freed using matching functions such as malloc/free, new/delete, and new[]/delete[].
ImplementationWhen releasing a complex object or structure, ensure that you properly dispose of all of its member components, not just the object itself.
Examples (2)
The following method never closes the new file handle. Given enough time, the Finalize() method for BufferReader should eventually call Close(), but there is no guarantee as to how long this action will take. In fact, there is no guarantee that Finalize() will ever be invoked. In a busy environment, the Operating System could use up all of the available file handles before the Close() function is …
private void processFile(string fName) { BufferReader fil = new BufferReader(new FileReader(fName)); String line; while ((line = fil.ReadLine()) != null) { processLine(line); } }
Bad · Java
private void processFile(string fName) { BufferReader fil = new BufferReader(new FileReader(fName)); String line; while ((line = fil.ReadLine()) != null) { processLine(line); } fil.Close(); }
Good · Java
This code attempts to open a connection to a database and catches any exceptions that may occur.
try { Connection con = DriverManager.getConnection(some_connection_string); } catch ( Exception e ) { log( e ); }
Bad · Java
CVE IDTitleCVSSSeverityPublished
CVE-2019-5636 Beckhoff TwinCAT Discovery Service Denial of Service — TwinCAT 2 5.3 Medium2019-11-21
CVE-2019-0049 Junos OS: RPD process crashes when BGP peer restarts — Junos OS 7.5 -2019-07-11
CVE-2019-0052 SRX Series: srxpfe process crash while JSF/UTM module parses specific HTTP packets — Junos OS 7.5 -2019-07-11
CVE-2019-1705 Cisco Adaptive Security Appliance Software VPN Denial of Service Vulnerability — Cisco Adaptive Security Appliance (ASA) Software 5.9 -2019-05-03
CVE-2019-1706 Cisco Adaptive Security Appliance Software IPsec Denial of Service Vulnerability — Cisco Adaptive Security Appliance (ASA) Software 8.6 -2019-05-03
CVE-2019-1708 Cisco Adaptive Security Appliance Software and Cisco Firepower Threat Defense Software MOBIKE Denial of Service Vulnerability — Cisco Adaptive Security Appliance (ASA) Software 8.6 -2019-05-03
CVE-2019-0042 Incorrect messages from Juniper Identity Management Service (JIMS) can trigger Denial of Service or firewall bypass conditions for SRX series devices — Juniper Identity Management Service 4.2 -2019-04-10
CVE-2019-0043 Junos OS: RPD process crashes upon receipt of a specific SNMP packet — Junos OS 7.5 -2019-04-10
CVE-2019-0044 Junos OS: SRX5000 series: Kernel crash (vmcore) upon receipt of a specific packet on fxp0 interface — Junos OS 7.5 -2019-04-10
CVE-2019-0019 BGP packets can trigger rpd crash when BGP tracing is enabled. — Junos OS 7.5 -2019-04-10
CVE-2019-0028 Junos OS: RPD process crashes due to specific BGP peer restarts condition. — Junos OS 7.5 -2019-04-10
CVE-2018-8836 WAGO 750 Series PLCs 安全漏洞 — WAGO 750 Series 5.3 -2018-04-03
CVE-2017-11480 Elasticsearch Packetbeat PostgreSQL protocol handler 安全漏洞 — Packetbeat 7.5 -2017-12-08

Vulnerabilities classified as CWE-404 (不恰当的资源关闭或释放) represent 343 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.