Common Weakness Enumeration

A Community-Developed List of Software Weakness Types

CWE/SANS Top 25 Most Dangerous Software Errors
Home > CWE List > CWE- Individual Dictionary Definition (3.0)  

CWE-911: Improper Update of Reference Count

Weakness ID: 911
Abstraction: Base
Structure: Simple
Status: Incomplete
Presentation Filter:
+ Description
The software uses a reference count to manage a resource, but it does not update or incorrectly updates the reference count.
+ Extended Description
Reference counts can be used when tracking how many objects contain a reference to a particular resource, such as in memory management or garbage collection. When the reference count reaches zero, the resource can be de-allocated or reused because there are no more objects that use it. If the reference count accidentally reaches zero, then the resource might be released too soon, even though it is still in use. If all objects no longer use the resource, but the reference count is not zero, then the resource might not ever be released.
+ Relationships

The table(s) below shows the weaknesses and high level categories that are related to this weakness. These relationships are defined as ChildOf, ParentOf, MemberOf and give insight to similar items that may exist at higher and lower levels of abstraction. In addition, relationships such as PeerOf and CanAlsoBe are defined to show similar weaknesses that the user may want to explore.

+ Relevant to the view "Research Concepts" (CWE-1000)
+ Relevant to the view "Development Concepts" (CWE-699)
MemberOfCategoryCategory452Initialization and Cleanup Errors
+ Modes Of Introduction

The different Modes of Introduction provide information about how and when this weakness may be introduced. The Phase identifies a point in the software life cycle at which introduction may occur, while the Note provides a typical scenario related to introduction during the given phase.

+ Applicable Platforms
The listings below show possible areas for which the given weakness could appear. These may be for specific named Languages, Operating Systems, Architectures, Paradigms, Technologies, or a class of such platforms. The platform is listed along with how frequently the given weakness appears for that instance.


C (Sometimes Prevalent)

C++ (Sometimes Prevalent)

Class: Language-Independent (Undetermined Prevalence)

+ Likelihood Of Exploit
+ Observed Examples
chain: reference count is not decremented, leading to memory leak in OS by sending ICMP packets.
Reference count for shared memory not decremented when a function fails, potentially allowing unprivileged users to read kernel memory.
chain: improper reference count tracking leads to file descriptor consumption
chain: integer overflow in reference counter causes the same variable to be destroyed twice.
Incorrect reference count calculation leads to improper object destruction and code execution.
chain: incorrect update of reference count leads to memory leak.
chain/composite: use of incorrect data type for a reference counter allows an overflow of the counter, leading to a free of memory that is still in use.
Improper reference counting leads to failure of cryptographic operations.
chain: improper reference counting in a garbage collection routine leads to use-after-free
chain: reference count not correctly maintained when client disconnects during a large operation, leading to a use-after-free.
Reference count not always incremented, leading to crash or code execution.
improper reference counting leads to expired pointer dereference.
OS kernel increments reference count twice but only decrements once, leading to resource consumption and crash.
OS kernel driver allows code execution
improper reference counting leads to exhaustion of IP addresses
Race condition causes reference counter to be decremented prematurely, leading to the destruction of still-active object and an invalid pointer dereference.
improper reference counting leads to use-after-free
+ Weakness Ordinalities
(where the weakness exists independent of other weaknesses)
+ References
[REF-884] Mateusz "j00ru" Jurczyk. "Windows Kernel Reference Count Vulnerabilities - Case Study". 2012-11. <>.
+ Content History
Submission DateSubmitterOrganization
2012-12-21CWE Content TeamMITRE

More information is available — Please select a different filter.
Page Last Updated: January 18, 2018