---
title: "CWE-126: Buffer Over-read"
url: https://radicalnotion.ai/cwe/cwe-126
type: cwe
description: "The product reads from a buffer using buffer access mechanisms such as indexes or pointers that reference memory locations after the targeted buffer."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-126: Buffer Over-read

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 593
- **Of those, in CISA KEV:** 0
- **New in 2026:** 200
- **CWE catalog version:** 4.21

## Description

The product reads from a buffer using buffer access mechanisms such as indexes or pointers that reference memory locations after the targeted buffer.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Applicable platforms

**Languages:** Memory-Unsafe (Undetermined), C (Undetermined), C++ (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality | Read Memory | - |
| Confidentiality | Bypass Protection Mechanism | By reading out-of-bounds memory, an attacker might be able to get secret values, such as memory addresses, which can bypass protection mechanisms such as ASLR in order to improve the reliability and likelihood of exploiting a separate weakness to achieve code execution instead of just denial of service. |
| Availability, Integrity | DoS: Crash, Exit, or Restart | An attacker might be able to cause a crash or other denial of service by causing the product to read a memory location that is not allowed (such as a segmentation fault), or to cause other conditions in which the read operation returns more data than is expected. |

## Detection methods

### Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

Effectiveness: High

### Automated Dynamic Analysis

Use tools that are integrated during compilation to insert runtime error-checking mechanisms related to memory safety errors, such as AddressSanitizer (ASan) for C/C++ \[REF-1518\].

Effectiveness: Moderate. Crafted inputs are necessary to reach the code containing the error, such as generated by fuzzers. Also, these tools may reduce performance, and they only report the error condition - not the original mistake that led to the error.

## Demonstrative examples

### Example 1

In the following C/C++ example, the method processMessageFromSocket() will get a message from a socket, save the message into a buffer, and place the contents of the buffer into a structure that contains the message length and the message body. Then a for loop is used to copy the message body into a local character string, which will be passed to another method for processing.

Bad code:

```c
int processMessageFromSocket(int socket) {
    // initialize variable to represent the failure case by default
    int success = -1;
    char buffer[BUFFER_SIZE];
    char message[MESSAGE_SIZE];

    // get message from socket and store into buffer
    // for clarity of this example, ignore the possibility 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;
}
```

However, the message length variable (msgLength) from the structure is used as the condition for ending the for loop without validating that msgLength accurately reflects the actual length of the message body (CWE-606). If msgLength indicates a length that is longer than the size of a message body (CWE-130), then this can result in a buffer over-read by reading past the end of the buffer (CWE-126).

### Example 2

The following C/C++ example demonstrates a buffer over-read due to a missing NULL terminator. The main method of a pattern matching utility that looks for a specific pattern within a specific file uses the string strncpy() method to copy the command line user input file name and pattern to the Filename and Pattern character arrays respectively.

Bad code:

```c
int main(int argc, char **argv)
{
    char Filename[256];
    char Pattern[32];

    /* Validate number of parameters and ensure valid content */
    ...

    /* copy filename parameter to variable, may cause off-by-one overflow */
    strncpy(Filename, argv[1], sizeof(Filename));

    /* copy pattern parameter to variable, may cause off-by-one overflow */
    strncpy(Pattern, argv[2], sizeof(Pattern));

    printf("Searching file: %s for the pattern: %s\n", Filename, Pattern);
    Scan_File(Filename, Pattern);
}
```

Good code:

```c
/* copy filename parameter to variable, no off-by-one overflow */
strncpy(Filename, argv[2], sizeof(Filename)-1);
Filename[255]='\0';

/* copy pattern parameter to variable, no off-by-one overflow */
strncpy(Pattern, argv[3], sizeof(Pattern)-1);
Pattern[31]='\0';
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2026-7320 | Out-of-bounds read in audio processor used in a common web browser, allowing a read of the global data section |
| CVE-2022-1733 | Text editor has out-of-bounds read past end of line while indenting C code |
| CVE-2014-0160 | Chain: "Heartbleed" bug receives an inconsistent length parameter (CWE-130) enabling an out-of-bounds read (CWE-126), returning memory that could include private cryptographic keys and other sensitive data. |
| CVE-2009-2523 | Chain: product does not handle when an input string is not NULL terminated, leading to buffer over-read or heap-based buffer overflow. |

## Real CVEs with this weakness (sample of 12 of 593)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-83888 | Windows CD-ROM Driver Elevation of Privilege Vulnerability | critical | 9.8 | - | No | 2026-10-13 |
| CVE-2024-49839 | Buffer Over-read in WLAN Host Cmn | critical | 9.8 | - | No | 2025-02-03 |
| CVE-2023-36397 | Windows Pragmatic General Multicast (PGM) Remote Code Execution Vulnerability | critical | 9.8 | - | No | 2023-11-14 |
| CVE-2023-22385 | Buffer Over-read in Data Modem | critical | 9.8 | - | No | 2023-10-03 |
| CVE-2019-3563 | - | critical | 9.8 | - | No | 2019-04-29 |
| CVE-2018-14790 | Buffer Over-read in Fuji Electric FRENIC Devices | critical | 9.8 | - | No | 2018-10-01 |
| CVE-2017-7679 | httpd: mod\_mime buffer overread | critical | 9.8 | - | No | 2017-06-20 |
| CVE-2024-38373 | FreeRTOS-Plus-TCP Buffer Over-Read in DNS Response Parser | critical | 9.6 | - | No | 2024-06-24 |
| CVE-2025-12106 | openvpn: OpenVPN heap buffer overflow | critical | 9.1 | - | No | 2025-12-01 |
| CVE-2024-49846 | Buffer Over-read in Multi-Mode Call Processor | critical | 9.1 | - | No | 2025-05-06 |
| CVE-2024-21456 | Buffer Over-read in WLAN HOST | critical | 9.1 | - | No | 2024-07-01 |
| CVE-2023-6936 | Heap-buffer over-read with WOLFSSL\_CALLBACKS | critical | 9.1 | - | No | 2024-02-20 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-125](https://radicalnotion.ai/cwe/cwe-125) | Out-of-bounds Read |
| Parent | [CWE-788](https://radicalnotion.ai/cwe/cwe-788) | Access of Memory Location After End of Buffer |
| Related | [CWE-170](https://radicalnotion.ai/cwe/cwe-170) | Improper Null Termination |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | Buffer over-read | - | - |
| Software Fault Patterns | Faulty Buffer Access | SFP8 | - |

## Frequently asked questions

### What is CWE-126?

The product reads from a buffer using buffer access mechanisms such as indexes or pointers that reference memory locations after the targeted buffer.

### What CVEs are caused by CWE-126?

593 recorded CVEs are attributed to CWE-126, including CVE-2026-83888, CVE-2024-49839 and CVE-2023-36397.

### How is CWE-126 detected?

Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

### What are the consequences of CWE-126?

Exploiting CWE-126 can lead to: Read Memory, Bypass Protection Mechanism, DoS: Crash, Exit, or Restart.

### Is CWE-126 actively exploited?

593 recorded CVEs are caused by CWE-126; none are currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/126.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-126). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
