CWE•Base•Incomplete•6 recent CVEs
CWE-364Signal Handler Race Condition
Description
The product uses a signal handler that introduces a race condition.
[object Object]
Common consequences
- Integrity,Confidentiality,Availability→Modify Application Data,Modify Memory,DoS: Crash, Exit, or Restart,Execute Unauthorized Code or CommandsIt 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 IdentityIf 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
- RequirementsUse a language that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.
- Architecture and DesignDesign 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.
- ImplementationOnly 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.