CWE-364: Signal Handler Race Condition
Description
The product uses a signal handler that introduces a race condition.
- Abstraction
- BaseA weakness specific enough to point to detection and prevention methods.
- Likelihood of exploit
- Medium
- Status
- Incomplete
Common consequences
- IntegrityConfidentialityAvailability
Modify Application Data; Modify Memory; DoS: Crash, Exit, or Restart; Execute Unauthorized Code or Commands
It may be possible to cause data corruption and possibly execute arbitrary code by modifying global variables or data structures at unexpected times, violating the assumptions of code that uses this global data.
- Access Control
Gain Privileges or Assume Identity
If a signal handler interrupts code that is executing with privileges, it may be possible that the signal handler will also be executed with elevated privileges, possibly making subsequent exploits more severe.
Potential mitigations
- RequirementsLanguage Selection
Use a language that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.
- Architecture and Design
Design signal handlers to only set flags, rather than perform complex functionality. These flags can then be checked and acted upon within the main program loop.
- Implementation
Only use reentrant functions within signal handlers. Also, use validation to ensure that state is consistent while performing asynchronous actions that affect the state of execution.
Related weaknesses
Parent weaknesses
Child weaknesses
CAPEC attack patterns that exploit it
CWE 4.20 links no CAPEC attack pattern to this weakness.