Improper Update of Reference Count

Incomplete Base
Structure: Simple
Description

This vulnerability occurs when a program uses a reference counter to track resource usage but fails to update the count correctly, either by missing an update or applying an incorrect value.

Extended Description

Reference counting is a common technique for managing resources like memory blocks or file handles. The system tracks how many active pointers or handles refer to a resource, and the resource is only freed when this count drops to zero. If the count is accidentally decremented too early, the resource can be prematurely released while still in use, leading to crashes or use-after-free errors. Conversely, if the reference count isn't decremented when a reference is removed, the count never reaches zero. This creates a resource leak, where unused memory or handles are never reclaimed. Over time, these leaks degrade performance and can exhaust system resources, causing instability or denial of service.

Common Consequences 2
Scope: Availability

Impact: DoS: Resource Consumption (Memory)DoS: Resource Consumption (Other)

An adversary that can cause a resource counter to become inaccurate may be able to create situations where resources are not accounted for and not released, thus causing resources to become scarce for future needs.

Scope: Availability

Impact: DoS: Crash, Exit, or Restart

An adversary that can cause a resource counter to become inaccurate may be able to force an error that causes the product to crash or exit out of its current operation.

Observed Examples 17
CVE-2002-0574chain: reference count is not decremented, leading to memory leak in OS by sending ICMP packets.
CVE-2004-0114Reference count for shared memory not decremented when a function fails, potentially allowing unprivileged users to read kernel memory.
CVE-2006-3741chain: improper reference count tracking leads to file descriptor consumption
CVE-2007-1383chain: integer overflow in reference counter causes the same variable to be destroyed twice.
CVE-2007-1700Incorrect reference count calculation leads to improper object destruction and code execution.
CVE-2008-2136chain: incorrect update of reference count leads to memory leak.
CVE-2008-2785chain/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.
CVE-2008-5410Improper reference counting leads to failure of cryptographic operations.
CVE-2009-1709chain: improper reference counting in a garbage collection routine leads to use-after-free
CVE-2009-3553chain: reference count not correctly maintained when client disconnects during a large operation, leading to a use-after-free.
CVE-2009-3624Reference count not always incremented, leading to crash or code execution.
CVE-2010-0176improper reference counting leads to expired pointer dereference.
CVE-2010-0623OS kernel increments reference count twice but only decrements once, leading to resource consumption and crash.
CVE-2010-2549OS kernel driver allows code execution
CVE-2010-4593improper reference counting leads to exhaustion of IP addresses
CVE-2011-0695Race condition causes reference counter to be decremented prematurely, leading to the destruction of still-active object and an invalid pointer dereference.
CVE-2012-4787improper reference counting leads to use-after-free
References 1
Windows Kernel Reference Count Vulnerabilities - Case Study
Mateusz "j00ru" Jurczyk
11-2012
ID: REF-884
Likelihood of Exploit

Medium

Applicable Platforms
Languages:
C : SometimesC++ : SometimesNot Language-Specific : Undetermined
Modes of Introduction
Implementation