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

目标: 1000 元 · 已筹: 1000

100.0%

CWE-662 不恰当的同步机制 类漏洞列表 3

CWE-662 不恰当的同步机制 类弱点 3 条 CVE 漏洞汇总,含 AI 中文分析。

CWE-662属于并发安全漏洞,指产品在多线程或进程访问共享资源时,缺乏正确的同步机制,导致多个实体同时访问本应互斥的资源。攻击者可利用此竞争条件,通过精心构造的时序攻击引发数据损坏、逻辑错误或拒绝服务。开发者应避免此类问题,需使用锁、信号量等同步原语确保资源访问的原子性与互斥性,并严格审查并发代码逻辑,以保障系统稳定性与数据一致性。

MITRE CWE 官方描述
CWE:CWE-662 不正确的同步(Improper Synchronization) 英文:该产品利用多个线程、进程、组件或系统来允许对共享资源的临时访问,而该资源在同一时间只能被一个进程独占访问,但它没有正确地同步这些操作,这可能导致多个线程或进程同时访问该资源。 同步(Synchronization)指的是一系列行为和机制,允许多个独立运行的进程或线程确保以可预测的方式操作共享资源,且彼此之间不产生干扰。某些共享资源操作无法以原子方式(atomically)执行;也就是说,必须保证多个步骤按顺序执行,不受其他进程的干扰。同步机制(Synchronization mechanisms)种类繁多,但可能包括锁定(locking)、互斥锁(mutexes)和信号量(semaphores)。当对共享资源的多步操作无法保证不受干扰地独立执行时,其产生的行为可能是不可预测的。不正确的同步(Improper synchronization)可能导致数据或内存损坏(data or memory corruption)、拒绝服务(denial of service)等后果。
常见影响 (1)
Integrity, Confidentiality, OtherModify Application Data, Read Application Data, Alter Execution Logic
缓解措施 (1)
ImplementationUse industry standard APIs to synchronize your code.
代码示例 (2)
The following function attempts to acquire a lock in order to perform operations on a shared resource.
void f(pthread_mutex_t *mutex) { pthread_mutex_lock(mutex); /* access shared resource */ pthread_mutex_unlock(mutex); }
Bad · C
int f(pthread_mutex_t *mutex) { int result; result = pthread_mutex_lock(mutex); if (0 != result) return result; /* access shared resource */ return pthread_mutex_unlock(mutex); }
Good · C
The following code intends to fork a process, then have both the parent and child processes print a single line.
static void print (char * string) { char * word; int counter; for (word = string; counter = *word++; ) { putc(counter, stdout); fflush(stdout); /* Make timing window a little larger... */ sleep(1); } } int main(void) { pid_t pid; pid = fork(); if (pid == -1) { exit(-2); } else if (pid == 0) { print("child\n"); } else { print("PARENT\n"); } exit(0); }
Bad · C
CVE ID标题CVSS风险等级Published
CVE-2025-27104 Vyper 安全漏洞 — vyper 8.8 -2025-02-21
CVE-2024-7409 QEMU NBD Server 安全漏洞 7.5AIHighAI2024-08-05
CVE-2024-32644 Evmos 安全漏洞 — evmos 9.1 Critical2024-04-19

CWE-662(不恰当的同步机制) 是常见的弱点类别,本平台收录该类弱点关联的 3 条 CVE 漏洞。