The product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. This may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data.
N/A
Threat Mapped score: 0.0
Industry: Finiancial
Threat priority: Unclassified
CVE: CVE-2021-22991 — KEV
Incorrect URI normalization in application traffic product leads to buffer overflow, as exploited in the wild per CISA KEV.
CVE: CVE-2020-29557 — KEV
Buffer overflow in Wi-Fi router web interface, as exploited in the wild per CISA KEV.
CVE: CVE-2009-2550
Classic stack-based buffer overflow in media player using a long entry in a playlist
CVE: CVE-2009-2403
Heap-based buffer overflow in media player using a long entry in a playlist
CVE: CVE-2009-0689
large precision value in a format string triggers overflow
CVE: CVE-2009-0690
negative offset value leads to out-of-bounds read
CVE: CVE-2009-1532
malformed inputs cause accesses of uninitialized or previously-deleted objects, leading to memory corruption
CVE: CVE-2009-1528
chain: lack of synchronization leads to memory corruption
CVE: CVE-2021-29529
Chain: machine-learning product can have a heap-based buffer overflow (CWE-122) when some integer-oriented bounds are calculated by using ceiling() and floor() on floating point values (CWE-1339)
CVE: CVE-2009-0558
attacker-controlled array index leads to code execution
CVE: CVE-2009-0269
chain: -1 value from a function call was intended to indicate an error, but is used as an array index instead.
CVE: CVE-2009-0566
chain: incorrect calculations lead to incorrect pointer dereference and memory corruption
CVE: CVE-2009-1350
product accepts crafted messages that lead to a dereference of an arbitrary pointer
CVE: CVE-2009-0191
chain: malformed input causes dereference of uninitialized memory
CVE: CVE-2008-4113
OS kernel trusts userland-supplied length value, allowing reading of sensitive information
CVE: CVE-2005-1513
Chain: integer overflow in securely-coded mail program leads to buffer overflow. In 2005, this was regarded as unrealistic to exploit, but in 2020, it was rediscovered to be easier to exploit due to evolutions of the technology.
CVE: CVE-2003-0542
buffer overflow involving a regular expression with a large number of captures
CVE: CVE-2017-1000121
chain: unchecked message size metadata allows integer overflow (CWE-190) leading to buffer overflow (CWE-119).
N/A
Phase | Note |
---|---|
Implementation | N/A |
Intro: This example takes an IP address from a user, verifies that it is well formed and then looks up the hostname and copies it into a buffer.
Body: This function allocates a buffer of 64 bytes to store the hostname, however there is no guarantee that the hostname will not be larger than 64 bytes. If an attacker specifies an address which resolves to a very large hostname, then the function may overwrite sensitive data or even relinquish control flow to the attacker.
void host_lookup(char *user_supplied_addr){ struct hostent *hp; in_addr_t *addr; char hostname[64]; in_addr_t inet_addr(const char *cp); /*routine that ensures user_supplied_addr is in the right format for conversion */ validate_addr_form(user_supplied_addr); addr = inet_addr(user_supplied_addr); hp = gethostbyaddr( addr, sizeof(struct in_addr), AF_INET); strcpy(hostname, hp->h_name); }
Intro: This example applies an encoding procedure to an input string and stores it into a buffer.
Body: The programmer attempts to encode the ampersand character in the user-controlled string, however the length of the string is validated before the encoding procedure is applied. Furthermore, the programmer assumes encoding expansion will only expand a given character by a factor of 4, while the encoding of the ampersand expands by 5. As a result, when the encoding procedure expands the string it is possible to overflow the destination buffer if the attacker provides a string of many ampersands.
char * copy_input(char *user_supplied_string){ int i, dst_index; char *dst_buf = (char*)malloc(4*sizeof(char) * MAX_SIZE); if ( MAX_SIZE <= strlen(user_supplied_string) ){ die("user string too long, die evil hacker!"); } dst_index = 0; for ( i = 0; i < strlen(user_supplied_string); i++ ){ if( '&' == user_supplied_string[i] ){ dst_buf[dst_index++] = '&'; dst_buf[dst_index++] = 'a'; dst_buf[dst_index++] = 'm'; dst_buf[dst_index++] = 'p'; dst_buf[dst_index++] = ';'; } else if ('<' == user_supplied_string[i] ){ /* encode to < */ } else dst_buf[dst_index++] = user_supplied_string[i]; } return dst_buf; }
Intro: The following example asks a user for an offset into an array to select an item.
Body: The programmer allows the user to specify which element in the list to select, however an attacker can provide an out-of-bounds offset, resulting in a buffer over-read (CWE-126).
int main (int argc, char **argv) { char *items[] = {"boat", "car", "truck", "train"}; int index = GetUntrustedOffset(); printf("You selected %s\n", items[index-1]); }
Intro: In the following code, the method retrieves a value from an array at a specific array index location that is given as an input parameter to the method
Body: However, this method only verifies that the given array index is less than the maximum length of the array but does not check for the minimum value (CWE-839). This will allow a negative value to be accepted as the input array index, which will result in a out of bounds read (CWE-125) and may allow access to sensitive memory. The input array index should be checked to verify that is within the maximum and minimum range required for the array (CWE-129). In this example the if statement should be modified to include a minimum range check, as shown below.
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; }
Intro: Windows provides the _mbs family of functions to perform various operations on multibyte strings. When these functions are passed a malformed multibyte string, such as a string containing a valid leading byte followed by a single null byte, they can read or write past the end of the string buffer causing a buffer overflow. The following functions all pose a risk of buffer overflow: _mbsinc _mbsdec _mbsncat _mbsncpy _mbsnextc _mbsnset _mbsrev _mbsset _mbsstr _mbstok _mbccpy _mbslen