An out-of-bounds read occurs when software accesses memory outside the boundaries of a buffer, array, or similar data structure, reading data it wasn't intended to see.

This vulnerability happens when a program uses an incorrect index, offset, or pointer that references a memory location before the start or after the end of a valid buffer. For example, using `buffer[size]` or `buffer[-1]` triggers this issue. The result is that the application reads data from adjacent memory locations, which could be uninitialized, contain sensitive information from other parts of the program, or even cause a crash. While this flaw doesn't directly allow data modification like its 'write' counterpart, it remains a serious security risk. Attackers can exploit it to leak sensitive information, bypass security controls, or gather data to enable further attacks. It's a common root cause for information disclosure and is often the first step in more complex exploit chains.
Impact: Read Memory
An attacker could get secret values such as cryptographic keys, PII, memory addresses, or other information that could be used in additional attacks.
Impact: Bypass Protection Mechanism
Out-of-bounds memory could contain memory addresses or other information that can be used to bypass ASLR and other protection mechanisms in order to improve the reliability of exploiting a separate weakness for code execution.
Impact: DoS: Crash, Exit, or Restart
An attacker could cause a segmentation fault or crash by causing memory to be read outside of the bounds of the buffer. This is especially likely when the code reads a variable amount of data and assumes that a sentinel exists to stop the read operation, such as a NUL in a string.
Impact: Varies by Context
The read operation could produce other undefined or unexpected results.
Strategy: Input Validation
Strategy: Language Selection
c
// check that the array index is less than the maximum*
c
cc
// check that the array index is within the correct*
cc
// get message from socket and store into buffer*
c
c
// process message* success = processMessage(message);} return success;}