CWE-125 跨界内存读 类弱点 2897 条 CVE 漏洞汇总,含 AI 中文分析。
CWE-125 越界读取属于内存安全漏洞,指程序访问了缓冲区边界之外的内存区域。攻击者利用此缺陷可读取敏感数据或引发信息泄露,甚至通过特定构造触发逻辑错误以辅助后续攻击。开发者应严格实施边界检查,确保索引在有效范围内,并使用支持自动边界检测的高级语言或静态分析工具,从源头杜绝非法内存访问。
int getValueFromArray(int *array, int len, int index) { int value; // check that the array index is less than the maximum // length of the array if (index < len) { // get the value at the specified index of the array value = array[index]; } // if array index is invalid then output error message // and return value indicating error else { printf("Value is: %d\n", array[index]); value = -1; } return value; }... // check that the array index is within the correct // range of values for the array if (index >= 0 && index < len) { ...int processMessageFromSocket(int socket) { int success; char buffer[BUFFER_SIZE]; char message[MESSAGE_SIZE]; // get message from socket and store into buffer //Ignoring possibliity that buffer > BUFFER_SIZE if (getMessage(socket, buffer, BUFFER_SIZE) > 0) { // place contents of the buffer into message structure ExMessage *msg = recastBuffer(buffer); // copy message body into string for processing int index; for (index = 0; index < msg->msgLength; index++) { message[index] = msg->msgBody[index]; } message[index] = '\0'; // process message success = processMessage(message); } return success; }CWE-125(跨界内存读) 是常见的弱点类别,本平台收录该类弱点关联的 2897 条 CVE 漏洞。