目標達成 すべての支援者に感謝 — 100%達成しました!

目標: 1000 CNY · 調達済み: 1000 CNY

100.0%

CWE-195 有符号至无符号转换错误 类漏洞列表 12

CWE-195 有符号至无符号转换错误 类弱点 12 条 CVE 漏洞汇总,含 AI 中文分析。

CWE-195 是符号到无符号转换错误,属于整数处理漏洞。当有符号值无法用无符号类型表示时,隐式转换会导致意外的大数值。攻击者常利用此缺陷绕过长度检查或导致缓冲区溢出,从而执行恶意代码。开发者应避免隐式转换,显式验证输入范围,并使用安全的类型转换函数,确保数据在预期范围内,防止逻辑错误引发安全危机。

MITRE CWE 官方描述
CWE:CWE-195 Signed to Unsigned Conversion Error 英文:产品使用有符号基本类型(signed primitive)并将其强制转换为无符号基本类型(unsigned primitive),如果该有符号基本类型的值无法用无符号基本类型表示,则可能产生意外值。 依赖有符号数和无符号数之间的隐式转换(implicit casts)是危险的,因为结果可能取到意外值,从而违反程序所做的假设。通常,函数会返回负值以指示失败。当函数结果用作大小参数(size parameter)时,使用这些负返回值可能导致意外结果。例如,如果将负大小值传递给标准内存复制或分配函数,它们将被隐式转换为大的无符号值。这可能导致可利用的缓冲区溢出(buffer overflow)或下溢(underflow)条件。
常见影响 (1)
IntegrityUnexpected State
Conversion between signed and unsigned values can lead to a variety of errors, but from a security standpoint is most commonly associated with integer overflow and buffer overflow vulnerabilities.
代码示例 (2)
In this example the variable amount can hold a negative value when it is returned. Because the function is declared to return an unsigned int, amount will be implicitly converted to unsigned.
unsigned int readdata () { int amount = 0; ... if (result == ERROR) amount = -1; ... return amount; }
Bad · C
In this example, depending on the return value of accecssmainframe(), the variable amount can hold a negative value when it is returned. Because the function is declared to return an unsigned value, amount will be implicitly cast to an unsigned number.
unsigned int readdata () { int amount = 0; ... amount = accessmainframe(); ... return amount; }
Bad · C

CWE-195(有符号至无符号转换错误) 是常见的弱点类别,本平台收录该类弱点关联的 12 条 CVE 漏洞。