Unlock of a Resource that is not Locked

Incomplete Base
Structure: Simple
Description

This vulnerability occurs when a program tries to unlock a resource, such as a mutex or semaphore, that is not currently in a locked state.

Extended Description

Attempting to unlock a resource that isn't locked is a logic error that can lead to unpredictable system behavior. The specific consequences depend heavily on the underlying locking mechanism, but often involve corrupting the resource's internal state or the memory structures used to manage lock ownership. This corruption can trigger crashes, cause data races, or leave the resource in an inconsistent state for subsequent operations. For developers, this highlights the importance of maintaining strict symmetry between lock and unlock calls. Always ensure your unlock logic is only executed on a code path where a successful lock was previously acquired. Using RAII (Resource Acquisition Is Initialization) patterns or language constructs like `synchronized` blocks can help automate this pairing and prevent such manual management errors.

Common Consequences 1
Scope: IntegrityConfidentialityAvailabilityOther

Impact: DoS: Crash, Exit, or RestartExecute Unauthorized Code or CommandsModify MemoryOther

Depending on the locking being used, an unlock operation might not have any adverse effects. When effects exist, the most common consequence will be a corruption of the state of the product, possibly leading to a crash or exit; depending on the implementation of the unlocking, memory corruption or code execution could occur.

Observed Examples 3
CVE-2010-4210function in OS kernel unlocks a mutex that was not previously locked, causing a panic or overwrite of arbitrary memory.
CVE-2008-4302Chain: OS kernel does not properly handle a failure of a function call (Improper Handling of Exceptional Conditions), leading to an unlock of a resource that was not locked (Unlock of a Resource that is not Locked), with resultant crash.
CVE-2009-1243OS kernel performs an unlock in some incorrect circumstances, leading to panic.
Related Weaknesses