Multiple Operations on Resource in Single-Operation Context

Draft Class
Structure: Simple
Description

This vulnerability occurs when a software component performs the same action on a resource multiple times, even though the action is designed to be executed only once. This redundant execution can lead to unintended side effects, data corruption, or resource exhaustion.

Extended Description

Think of this like accidentally hitting 'send' on an email twice. The core issue is that a function or method lacks a proper guard to prevent re-execution on the same target. This often happens in event handlers that don't debounce user clicks, in loops with flawed termination conditions, or when cleanup and initialization routines incorrectly overlap. The duplicate operations waste system resources and can put the application or data into an inconsistent, unpredictable state. For developers, the fix involves implementing idempotence—ensuring an operation produces the same result whether it's run once or multiple times. This can be achieved by using flags to track completion, employing atomic operations, or designing APIs that safely handle repeated calls. Thorough testing with edge cases, especially around user interactions and error recovery paths, is crucial to catch this subtle but impactful flaw.

Common Consequences 1
Scope: Other

Impact: Other

Demonstrative Examples 2

ID : DX-149

The following code shows a simple example of a double free vulnerability.

Code Example:

Bad
C
c
Double free vulnerabilities have two common (and sometimes overlapping) causes:
- Error conditions and other exceptional circumstances - Confusion over which part of the program is responsible for freeing the memory
Although some double free vulnerabilities are not much more complicated than this example, most are spread out across hundreds of lines of code or even different files. Programmers seem particularly susceptible to freeing global variables more than once.

ID : DX-184

This code binds a server socket to port 21, allowing the server to listen for traffic on that port.

Code Example:

Bad
C
c

/unlink the socket if already bound to avoid an error when bind() is called/*

c
This code may result in two servers binding a socket to same port, thus receiving each other's traffic. This could be used by an attacker to steal packets meant for another process, such as a secure FTP server.
Observed Examples 3
CVE-2009-0935Attacker provides invalid address to a memory-reading function, causing a mutex to be unlocked twice
CVE-2019-13351file descriptor double close can cause the wrong file to be associated with a file descriptor.
CVE-2004-1939XSS protection mechanism attempts to remove "/" that could be used to close tags, but it can be bypassed using double encoded slashes (%252F)
Applicable Platforms
Languages:
Not Language-Specific : Undetermined
Modes of Introduction
Implementation
Notes
RelationshipThis weakness is probably closely associated with other issues related to doubling, such as Duplicate Key in Associative List (Alist) (duplicate key in alist) or Struts: Duplicate Validation Forms (Struts duplicate validation forms). It's usually a case of an API contract violation (7PK - API Abuse).