The product defines a signal handler that calls a non-reentrant function.
View on MITRENon-reentrant functions are functions that cannot safely be called, interrupted, and then recalled before the first call has finished without resulting in memory corruption. This can lead to an unexpected system state and unpredictable results with a variety of potential consequences depending on context, including denial of service and code execution. Many functions are not reentrant, but some of them can result in the corruption of memory if they are used in a signal handler. 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. Implementations of malloc() and free() manage metadata in global structures in order to track which memory is allocated versus which memory is available, but they are non-reentrant. Simultaneous calls to these functions can cause corruption of the metadata.
It may be possible to execute arbitrary code through the use of a write-what-where condition.
Signal race conditions often result in data corruption.
Require languages or libraries that provide reentrant functionality, or otherwise make it easier to avoid this weakness.
Design signal handlers to only set flags rather than perform complex functionality.
Ensure that non-reentrant functions are not found in signal handlers.
No detection method information available for this CWE.
In this example, a signal handler uses syslog() to log a message:
SIGCHLD signal to FTP server can cause crash under heavy load while executing non-reentrant functions like malloc/free.
View DetailsNo relationship information available for this CWE.
CWE-479: Signal Handler Use of a Non-reentrant Function is a Common Weakness Enumeration (CWE) entry maintained by MITRE. The product defines a signal handler that calls a non-reentrant function. 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. This can lead to an unexpected system state and unpredictable results with a variety of potential consequences depending on context, including denial of service and code execution. Many functions are not reentrant, but some of them can result in the corruption of memory if they are used in a signal handler. 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. Implementations of malloc() and free() manage metadata in global structures in order to track which memory is allocated versus which memory is available, but they are non-reentrant. Simultaneous calls to these functions can cause corruption of the metadata.
If exploited, CWE-479 (Signal Handler Use of a Non-reentrant Function) it can compromise Integrity, Confidentiality and Availability, leading to outcomes such as Execute Unauthorized Code or Commands, Modify Memory and Modify Application Data.
Recommended mitigations for CWE-479 include: Require languages or libraries that provide reentrant functionality, or otherwise make it easier to avoid this weakness. Design signal handlers to only set flags rather than perform complex functionality. Ensure that non-reentrant functions are not found in signal handlers.
CWE-479 commonly affects C and C++. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.
MITRE documents real CVEs mapped to CWE-479, including CVE-2005-0893 and CVE-2004-2259. You can look up the full details of each CVE, including CVSS scores and remediation guidance, on our CVE Lookup tool.
A CWE (Common Weakness Enumeration) like CWE-479 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.