CWE-771: Missing Reference to Active Allocated Resource
The product does not properly maintain a reference to a resource that has been allocated, which prevents the resource from being reclaimed.
Last updated
Overview
This does not necessarily apply in languages or frameworks that automatically perform garbage collection, since the removal of all references may act as a signal that the resource is ready to be reclaimed.
Real-world CVEs
6 recorded CVEs are caused by CWE-771 (Missing Reference to Active Allocated Resource). The highest-severity and most recent are shown first. 2 new CWE-771 CVEs have been recorded so far in 2026 (2 in 2025).
- CVE-2023-20244High · CVSS 8.6 · EPSS 37th2023-11-01
- CVE-2021-34720High · CVSS 8.6 · EPSS 60th2021-09-09
- CVE-2026-3039
BIND 9 server memory exhaustion during GSS-API TKEY negotiation
High · CVSS 7.5 · EPSS 21th2026-05-20 - CVE-2026-20004High · CVSS 7.4 · EPSS 23th2026-03-25
- CVE-2025-21090Medium · CVSS 6.5 · EPSS 26th2025-08-12
Common consequences
What can happen when CWE-771 is exploited.
DoS: Resource Consumption (Other)
Affects: Availability
An attacker that can influence the allocation of resources that are not properly maintained could deplete the available resource pool and prevent all other processes from accessing the same type of resource.
How it happens
When it is introduced
Typically introduced during these phases of the software lifecycle.
How to prevent it
Practical mitigations for CWE-771, grouped by where in the lifecycle they apply.
Use resource-limiting settings provided by the operating system or environment. For example, when managing system resources in POSIX, setrlimit() can be used to set limits for certain types of resources, and getrlimit() can determine how many resources are available. However, these functions are not available on all operating systems.
When the current levels get close to the maximum that is defined for the application (see CWE-770), then limit the allocation of further resources to privileged users; alternately, begin releasing resources for less-privileged users. While this mitigation may protect the system from attack, it will not necessarily stop attackers from adversely impacting other users.
Ensure that the application performs the appropriate error checks and error handling in case resources become unavailable (CWE-703).
How to detect it
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.)
Terminology & mappings
Mapped taxonomies
- CERT C Secure Coding: Close files when they are no longer needed (FIO42-C) — CWE More Abstract fit
- CERT C Secure Coding: Free dynamically allocated memory when no longer needed (MEM31-C) — CWE More Abstract fit
- Software Fault Patterns: Failure to Release Resource (SFP14)
- ISA/IEC 62443: Req SR 7.2 (Part 3-3)
- ISA/IEC 62443: Req SVV-1 (Part 4-1)
- ISA/IEC 62443: Req CR 7.2 (Part 4-2)
Frequently asked questions
Common questions about CWE-771.
What is CWE-771?
The product does not properly maintain a reference to a resource that has been allocated, which prevents the resource from being reclaimed.
What CVEs are caused by CWE-771?
6 recorded CVEs are attributed to CWE-771, including CVE-2023-20244, CVE-2021-34720, CVE-2026-3039.
How do you prevent CWE-771?
Use resource-limiting settings provided by the operating system or environment. For example, when managing system resources in POSIX, setrlimit() can be used to set limits for certain types of resources, and getrlimit() can determine how many resources are available. However, these functions are not available on all operating systems.
How is CWE-771 detected?
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.)
What are the consequences of CWE-771?
Exploiting CWE-771 can lead to: DoS: Resource Consumption (Other).
Is CWE-771 actively exploited?
6 recorded CVEs are caused by CWE-771; none are currently in CISA's KEV catalog of actively exploited flaws.
References
- MITRE CWE definition (CWE-771) (opens in a new tab)
- CWE-771 vulnerabilities on NVD (opens in a new tab)
- Learn: What is a CWE?
Weakness data is sourced from the MITRE CWE catalog (v4.20). CVE associations are aggregated and kept current by RadicalNotion.AI.
Stay ahead of CWE-771
Get alerted the moment a new CWE-771 vulnerability affects your stack, with AI-written analysis, severity context, and remediation guidance.