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

Variant Draft Simple

CWE版本: 4.18

更新日期: 2025-09-09

弱点描述

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

常见后果

影响范围: 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.

潜在缓解措施

阶段: 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.

有效性: Defense in Depth

检测方法

方法: 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.)

有效性: High

观察示例

参考: 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.

引入模式

阶段 说明
Implementation -

适用平台

编程语言
C (Undetermined) C++ (Undetermined)

分类映射

分类名称 条目ID 条目名称 映射适配度
CLASP - Unsafe function call from a signal handler -
CERT C Secure Coding SIG30-C Call only asynchronous-safe functions within signal handlers Exact
CERT C Secure Coding SIG34-C Do not call signal() from within interruptible signal handlers -
The CERT Oracle Secure Coding Standard for Java (2011) EXP01-J Never dereference null pointers -
Software Fault Patterns SFP3 Use of an improper API -
关键信息

CWE ID: CWE-479

抽象级别: Variant

结构: Simple

状态: Draft

利用可能性: Low

相关弱点