10 vulnerabilities classified as CWE-364 (信号处理例程中的竞争条件). AI Chinese analysis included.
CWE-364 represents a signal handler race condition, a concurrency weakness arising when asynchronous signal handlers interact unsafely with shared resources or global state. Because signals can interrupt normal program execution at unpredictable moments, handlers often access data structures without proper synchronization, creating a window for race conditions. Attackers typically exploit this vulnerability by triggering specific signals to manipulate the timing of execution, thereby corrupting application state or memory. This corruption can lead to severe consequences, including denial of service, arbitrary code execution, or privilege escalation. To mitigate this risk, developers must ensure that signal handlers remain simple and avoid calling non-async-signal-safe functions. Implementing robust synchronization mechanisms, such as mutexes or atomic operations, and carefully designing critical sections to exclude signal interruptions are essential strategies for preventing these dangerous race conditions in concurrent software environments.
char *logMessage; void handler (int sigNum) { syslog(LOG_NOTICE, "%s\n", logMessage); free(logMessage); /* artificially increase the size of the timing window to make demonstration of this weakness easier. */ sleep(10); exit(0); } int main (int argc, char* argv[]) { logMessage = strdup(argv[1]); /* Register signal handlers. */ signal(SIGHUP, handler); signal(SIGTERM, handler); /* artificially increase the size of the timing window to make demonstration of this weakness easier. */ sleep(10); }#include <signal.h> #include <syslog.h> #include <string.h> #include <stdlib.h> void *global1, *global2; char *what; void sh (int dummy) { syslog(LOG_NOTICE,"%s\n",what); free(global2); free(global1); /* Sleep statements added to expand timing window for race condition */ sleep(10); exit(0); } int main (int argc,char* argv[]) { what=argv[1]; global1=strdup(argv[2]); global2=malloc(340); signal(SIGHUP,sh); signal(SIGTERM,sh); /* Sleep statements added to expand timing window for race condition */ sleep(10); exit(0); }Vulnerabilities classified as CWE-364 (信号处理例程中的竞争条件) represent 10 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.