---
title: "CWE-479: Signal Handler Use of a Non-reentrant Function"
url: https://radicalnotion.ai/cwe/cwe-479
type: cwe
description: "The product defines a signal handler that calls a non-reentrant function."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-479: Signal Handler Use of a Non-reentrant Function

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Draft
- **Likelihood of exploit:** Low
- **CVEs with this as primary weakness:** 2
- **Of those, in CISA KEV:** 0
- **New in 2026:** 1
- **CWE catalog version:** 4.21

## Description

The product defines a signal handler that calls a non-reentrant function.

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.

## Background

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.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Applicable platforms

**Languages:** C (Undetermined), C++ (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| 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 | Many functions are not reentrant, but some of them can result in the corruption of memory if they are used in a signal handler. |
| Availability | Unexpected State, DoS: Crash, Exit, or Restart | This can lead to an unexpected system state and unpredictable results with a variety of potential consequences depending on context, including program crash. |

## Potential mitigations

### Requirements

Require languages or libraries that provide reentrant functionality, or otherwise make it easier to avoid this weakness.

### Architecture and Design

Design signal handlers to only set flags rather than perform complex functionality.

### Implementation

Ensure that non-reentrant functions are not found in signal handlers.

### 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

## 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

## Demonstrative examples

### Example 1

In this example, a signal handler uses syslog() to log a message:

Bad code:

```c
char *message;
void sh(int dummy) {
    syslog(LOG_NOTICE,"%s\n",message);
    sleep(10);
    exit(0);
}
int main(int argc,char* argv[]) {
    ...
    signal(SIGHUP,sh);
    signal(SIGTERM,sh);
    sleep(10);
    exit(0);
}
If the execution of the first call to the signal handler is suspended after invoking syslog(), and the signal handler is called a second time, the memory allocated by syslog() enters an undefined, and possibly, exploitable state.
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2005-0893 | signal handler calls function that ultimately uses malloc() |
| CVE-2004-2259 | SIGCHLD signal to FTP server can cause crash under heavy load while executing non-reentrant functions like malloc/free. |

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-44011 | Craft CMS: Potential authenticated Remote Code Execution via malicious attached Behavior | high | 8.6 | - | No | 2026-05-12 |
| CVE-2021-26948 | htmldoc: null pointer dereference in copy\_image() | high | 7.8 | - | No | 2022-03-03 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-663](https://radicalnotion.ai/cwe/cwe-663) | Use of a Non-reentrant Function in a Concurrent Context |
| Parent | [CWE-828](https://radicalnotion.ai/cwe/cwe-828) | Signal Handler with Functionality that is not Asynchronous-Safe |
| Can precede | [CWE-123](https://radicalnotion.ai/cwe/cwe-123) | Write-what-where Condition |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| CLASP | Unsafe function call from a signal handler | - | - |
| CERT C Secure Coding | Call only asynchronous-safe functions within signal handlers | SIG30-C | Exact |
| CERT C Secure Coding | Do not call signal() from within interruptible signal handlers | SIG34-C | - |
| The CERT Oracle Secure Coding Standard for Java (2011) | Never dereference null pointers | EXP01-J | - |
| Software Fault Patterns | Use of an improper API | SFP3 | - |

## Frequently asked questions

### What is CWE-479?

The product defines a signal handler that calls a non-reentrant function.

### What CVEs are caused by CWE-479?

2 recorded CVEs are attributed to CWE-479, including CVE-2026-44011 and CVE-2021-26948.

### How do you prevent CWE-479?

Require languages or libraries that provide reentrant functionality, or otherwise make it easier to avoid this weakness.

### How is CWE-479 detected?

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.)

### What are the consequences of CWE-479?

Exploiting CWE-479 can lead to: Execute Unauthorized Code or Commands, Modify Memory, Modify Application Data, Unexpected State, DoS: Crash, Exit, or Restart.

### Is CWE-479 actively exploited?

2 recorded CVEs are caused by CWE-479; none are currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/479.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-479). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
