Unsafe Function Call from a Signal Handler |
Weakness ID: 479 (Weakness Variant) | Status: Draft |
Description Summary
Extended Description
There are several functions which -- under certain circumstances, if used in a signal handler -- may result in the corruption of memory, allowing for exploitation of the process.
Scope | Effect |
---|---|
Access Control | It may be possible to execute arbitrary code through the use of a write-what-where condition. |
Integrity | Signal race conditions often result in data corruption. |
Example 1
See Signal handler race condition, for an example usage of free() in a signal handler which is exploitable.
Requirements specification: A language might be chosen, which is not subject to this flaw, through a guarantee of reentrant code. |
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. Also, use sanity checks to ensure that state is consistently performing asynchronous actions which effect the state of execution. |
This flaw is a subset of race conditions occurring in signal handler calls which is concerned primarily with memory corruption caused by calls to non-reentrant functions in signal handlers. Non-reentrant functions are functions that cannot safely be called, interrupted, and then recalled before the first call has finished without resulting in memory corruption. The function call syslog() is an example of this. In order to perform its functionality, it allocates a small amount of memory as "scratch space." If syslog() is suspended by a signal call and the signal handler calls syslog(), the memory used by both of these functions enters an undefined, and possibly, exploitable state. |
Nature | Type | ID | Name | View(s) this relationship pertains to![]() |
---|---|---|---|---|
ChildOf | ![]() | 398 | Indicator of Poor Code Quality | Development Concepts (primary)699 |
ChildOf | ![]() | 429 | Handler Errors | Development Concepts699 |
ChildOf | ![]() | 634 | Weaknesses that Affect System Processes | Resource-specific Weaknesses (primary)631 |
ChildOf | ![]() | 691 | Insufficient Control Flow Management | Research Concepts (primary)1000 |
ChildOf | ![]() | 745 | CERT C Secure Coding Section 11 - Signals (SIG) | Weaknesses Addressed by the CERT C Secure Coding Standard (primary)734 |
PeerOf | ![]() | 123 | Write-what-where Condition | Research Concepts1000 |
PeerOf | ![]() | 364 | Signal Handler Race Condition | Research Concepts1000 |
Mapped Taxonomy Name | Node ID | Fit | Mapped Node Name |
---|---|---|---|
CLASP | Unsafe function call from a signal handler | ||
CERT C Secure Coding | SIG30-C | Call only asynchronous-safe functions within signal handlers | |
CERT C Secure Coding | SIG32-C | Do not call longjmp() from inside a signal handler | |
CERT C Secure Coding | SIG33-C | Do not recursively invoke the raise() function | |
CERT C Secure Coding | SIG34-C | Do not call signal() from within interruptible signal handlers |
Submissions | ||||
---|---|---|---|---|
Submission Date | Submitter | Organization | Source | |
CLASP | Externally Mined | |||
Modifications | ||||
Modification Date | Modifier | Organization | Source | |
2008-07-01 | Eric Dalci | Cigital | External | |
updated Time of Introduction | ||||
2008-09-08 | CWE Content Team | MITRE | Internal | |
updated Applicable Platforms, Common Consequences, Description, Relationships, Other Notes, Taxonomy Mappings | ||||
2008-11-24 | CWE Content Team | MITRE | Internal | |
updated Relationships, Taxonomy Mappings |