2 vulnerabilities classified as CWE-839 (未进行最小值检查的数值范围比较). AI Chinese analysis included.
CWE-839 represents a numeric range comparison weakness where software validates that an input does not exceed a maximum threshold but neglects to verify that the value meets a minimum boundary. This oversight is typically exploited by attackers supplying negative numbers or unexpectedly low values, which can bypass logic assuming positive inputs, leading to buffer overflows, integer underflows, or unauthorized access. Developers often encounter this when using signed integers for inherently positive data without explicit lower-bound checks. To prevent such vulnerabilities, engineers must implement comprehensive input validation that explicitly enforces both upper and lower limits. Utilizing unsigned integer types where appropriate and rigorously testing edge cases, including negative and zero values, ensures that all numeric inputs remain within the expected safe range, thereby eliminating the potential for exploitation through boundary violations.
DataPacket *packet; int numHeaders; PacketHeader *headers; sock=AcceptSocketConnection(); ReadPacket(packet, sock); numHeaders =packet->headers; if (numHeaders > 100) { ExitError("too many headers!"); } headers = malloc(numHeaders * sizeof(PacketHeader); ParsePacketHeaders(packet, headers);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| CVE ID | Title | CVSS | Severity | Published |
|---|---|---|---|---|
| CVE-2023-0425 | Buffer overflow in global memory region — Freelance controllers AC 700F | 8.6 | High | 2023-08-07 |
| CVE-2019-20925 | Denial of service via malformed network packet — MongoDB Server | 7.5 | High | 2020-11-24 |
Vulnerabilities classified as CWE-839 (未进行最小值检查的数值范围比较) represent 2 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.