1737
CanPrecede 123 Write-what-where Condition 323
Applicable Platforms
Language : C (Prevalence = Undetermined)
Language : C++ (Prevalence = Undetermined)
Likelihood Of Exploit
Low
Common Consequences
Scope Impact Likelihood
Integrity
Confidentiality
Availability
Execute Unauthorized Code or Commands
It may be possible to execute arbitrary code through the
use of a write-what-where condition.
Integrity Modify Memory
Modify Application Data
Signal race conditions often result in data corruption.
Detection Methods
Automated Static Analysis
Automated static analysis, commonly referred to as Static Application Security Testing (SAST),
can find some instances of this weakness by analyzing source code (or binary/compiled code)
without having to execute it. Typically, this is done by building a model of data flow and control
flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input)
with "sinks" (destinations where the data interacts with external components, a lower layer such
as the OS, etc.)
Effectiveness = High
Potential Mitigations
Phase: Requirements
Require languages or libraries that provide reentrant functionality, or otherwise make it easier to
avoid this weakness.
Phase: Architecture and Design
Design signal handlers to only set flags rather than perform complex functionality.
Phase: Implementation
Ensure that non-reentrant functions are not found in signal handlers.
Phase: Implementation
Use sanity checks to reduce the timing window for exploitation of race conditions. This is only
a partial solution, since many attacks might fail, but other attacks still might work within the
narrower window, even accidentally.
Effectiveness = Defense in Depth
Demonstrative Examples
Example 1:
In this example, a signal handler uses syslog() to log a message:
CWE Version 4.14
CWE-479: Signal Handler Use of a Non-reentrant Function
CWE-479: Signal Handler Use of a Non-reentrant Function