目标达成 感谢每一位支持者 — 我们达成了 100% 目标!

目标: 1000 元 · 已筹: 1000

100.0%

CWE-479 信号处理例程中使用不可再入的函数 类漏洞列表 1

CWE-479 信号处理例程中使用不可再入的函数 类弱点 1 条 CVE 漏洞汇总,含 AI 中文分析。

CWE-479 属于信号处理函数使用非重入函数的漏洞。当信号中断正在执行的非重入函数时,若信号处理程序再次调用该函数,会导致内存损坏或不可预测的系统状态。攻击者可通过发送特定信号触发此竞态条件,引发拒绝服务或代码执行。开发者应确保信号处理程序仅调用异步信号安全函数,避免使用标准库中非重入的函数,从而保障系统稳定性。

MITRE CWE 官方描述
CWE:CWE-479 信号处理程序使用非重入函数 英文:该产品定义了一个调用非重入函数(non-reentrant function)的信号处理程序(signal handler)。 非重入函数(non-reentrant functions)是指那些如果在第一次调用尚未完成时就被中断并再次调用,会导致内存损坏(memory corruption)的函数。这可能导致系统状态异常,并产生不可预测的结果,其潜在后果因上下文而异,包括拒绝服务(denial of service)和代码执行(code execution)。许多函数并非重入(reentrant),但其中一些如果在信号处理程序(signal handler)中使用,可能会导致内存损坏。函数调用 syslog() 就是此类的一个例子。为了执行其功能,syslog() 会分配少量内存作为“临时空间”(scratch space)。如果 syslog() 被信号调用挂起,而信号处理程序再次调用 syslog(),则这两个函数所使用的内存将进入未定义且可能被利用的状态。malloc() 和 free() 的实现通过在全局结构中管理元数据(metadata)来跟踪哪些内存已分配、哪些内存可用,但它们是非重入的(non-reentrant)。对这些函数的同时调用可能导致元数据损坏。
常见影响 (2)
Integrity, Confidentiality, AvailabilityExecute Unauthorized Code or Commands
It may be possible to execute arbitrary code through the use of a write-what-where condition.
IntegrityModify Memory, Modify Application Data
Signal race conditions often result in data corruption.
缓解措施 (4)
RequirementsRequire languages or libraries that provide reentrant functionality, or otherwise make it easier to avoid this weakness.
Architecture and DesignDesign signal handlers to only set flags rather than perform complex functionality.
ImplementationEnsure that non-reentrant functions are not found in signal handlers.
ImplementationUse 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
代码示例 (1)
In this example, a signal handler uses syslog() to log a message:
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.
Bad · C
CVE ID标题CVSS风险等级Published
CVE-2021-26948 HTMLDOC 代码问题漏洞 — htmldoc 7.8 -2022-03-03

CWE-479(信号处理例程中使用不可再入的函数) 是常见的弱点类别,本平台收录该类弱点关联的 1 条 CVE 漏洞。