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

目标: 1000 元 · 已筹: 1000

100.0%

CWE-194 未预期的符号扩展 类漏洞列表 4

CWE-194 未预期的符号扩展 类弱点 4 条 CVE 漏洞汇总,含 AI 中文分析。

CWE-194 属于数据转换与处理漏洞。当负数在转换为更大数据类型时发生意外的符号扩展,会导致数值异常,进而引发缓冲区溢出或逻辑错误。攻击者常利用此缺陷构造恶意输入,触发内存破坏或绕过安全校验。开发者应严格验证数据类型转换逻辑,使用无符号类型或显式检查符号位,确保数值扩展符合预期,从而消除潜在风险。

MITRE CWE 官方描述
CWE:CWE-194 Unexpected Sign Extension(意外符号扩展) 英文:产品对某个数值执行操作,导致该数值在转换为更大的数据类型时被进行符号扩展(sign extended)。当原始数值为负数时,这会产生意外的值,从而导致结果性弱点(resultant weaknesses)。
常见影响 (1)
Integrity, Confidentiality, Availability, OtherRead Memory, Modify Memory, Other
When an unexpected sign extension occurs in code that operates directly on memory buffers, such as a size value or a memory index, then it could cause the program to write or read outside the boundaries of the intended buffer. If the numeric value is associated with an application-level resource, su…
缓解措施 (1)
ImplementationAvoid using signed variables if you don't need to represent negative values. When negative values are needed, perform validation after you save those values to larger data types, or before passing them to functions that are expecting unsigned values.
代码示例 (1)
The following code reads a maximum size and performs a sanity check on that size. It then performs a strncpy, assuming it will not exceed the boundaries of the array. While the use of "short s" is forced in this particular example, short int's are frequently used within real-world code, such as code that processes structured data.
int GetUntrustedInt () { return(0x0000FFFF); } void main (int argc, char **argv) { char path[256]; char *input; int i; short s; unsigned int sz; i = GetUntrustedInt(); s = i; /* s is -1 so it passes the safety check - CWE-697 */ if (s > 256) { DiePainfully("go away!\n"); } /* s is sign-extended and saved in sz */ sz = s; /* output: i=65535, s=-1, sz=4294967295 - your mileage may vary */ printf("i=%d, s=%d, sz=%u\n", i, s, sz); input = GetUserInput("Enter pathname:"); /* strncpy interprets s as unsigned int, so it's treated as MAX_INT (CWE-195), enabling buffer overflow (CWE-119) */ strncpy(pat
Bad · C
CVE ID标题CVSS风险等级Published
CVE-2022-32138 CODESYS 安全漏洞 — Runtime Toolkit 8.8 High2022-06-24
CVE-2021-38434 FATEK Automation WinProladder 安全漏洞 — WinProladder 7.8 High2021-10-18
CVE-2020-13544 Softmaker Office 安全漏洞 — Softmaker 7.8 -2021-01-06
CVE-2018-10887 libgit2 数字错误漏洞 — libgit2 8.1 -2018-07-10

CWE-194(未预期的符号扩展) 是常见的弱点类别,本平台收录该类弱点关联的 4 条 CVE 漏洞。