CAPEC-26: Leveraging Race Conditions
Description
The adversary targets a race condition occurring when multiple processes access and manipulate the same resource concurrently, and the outcome of the execution depends on the particular order in which the access takes place. The adversary can leverage a race condition by running the race, modifying the resource and modifying the normal execution flow. For instance, a race condition can occur while accessing a file: the adversary can trick the system by replacing the original file with their version and cause the system to read the malicious file.
- Likelihood of attack
- High
- Typical severity
- High
- Abstraction
- MetaA decidedly abstract characterisation of a methodology or technique.
Mechanism of attack: Manipulate Timing and State
Prerequisites
- A resource is accessed/modified concurrently by multiple processes such that a race condition exists.
- The adversary has the ability to modify the resource.
Skills required
- MediumBeing able to run the race requires basic knowledge of concurrent processing including synchonization techniques.
Consequences
- ConfidentialityAccess ControlAuthorization
Gain Privileges
- Integrity
Modify Data
Mitigations
- Use safe libraries to access resources such as files.
- Be aware that improper use of access function calls such as chown(), tempfile(), chmod(), etc. can cause a race condition.
- Use synchronization to control the flow of execution.
- Use static analysis tools to find race conditions.
- Pay attention to concurrency problems related to the access of resources.
Related weaknesses (CWE)
- CWE-362Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
- CWE-363Race Condition Enabling Link Following
- CWE-366Race Condition within a Thread
- CWE-368Context Switching Race Condition
- CWE-370Missing Check for Certificate Revocation after Initial Check
- CWE-662Improper Synchronization
- CWE-665Improper Initialization
- CWE-667Improper Locking
- CWE-689Permission Race Condition During Resource Copy
- CWE-1223Race Condition for Write-Once Attributes
- CWE-1254Incorrect Comparison Logic Granularity
- CWE-1298Hardware Logic Contains Race Conditions