---
title: "CWE-127: Buffer Under-read"
url: https://radicalnotion.ai/cwe/cwe-127
type: cwe
description: "The product reads from a buffer using buffer access mechanisms such as indexes or pointers that reference memory locations prior to 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-127: Buffer Under-read

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 13
- **Of those, in CISA KEV:** 0
- **New in 2026:** 7
- **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 prior to the targeted buffer.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | This typically occurs when the pointer or its index is decremented to a position before the buffer, when pointer arithmetic results in a position before the beginning of the valid memory location, or when a negative index is used. This may result in exposure of sensitive information or possibly a crash. |

## 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. |

## 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 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

Bad code:

```c
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;
}
```

Good code:

```c
...

// check that the array index is within the correct

// range of values for the array
if (index >= 0 && index < len) {

...
```

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 reading data before the beginning of the buffer (CWE-127) 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.

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2021-40985 | HTML conversion package has a buffer under-read, allowing a crash |

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

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-103119 | Apache Tomcat: AJP response mix-up | critical | 9.1 | - | No | 2026-10-20 |
| CVE-2025-20359 | Multiple Cisco Products Snort 3 MIME Information Disclosure or Denial of Service Vulnerability | critical | 9.1 | - | No | 2025-10-15 |
| CVE-2024-10395 | net: lib: http\_server: Buffer Under-read | high | 8.6 | - | No | 2025-02-03 |
| CVE-2026-110758 | Text::CSV\_XS versions before 1.65 for Perl read before the start of an all-blank field under allow\_whitespace in strip\_trail\_whitespace | high | 7.5 | - | No | 2026-10-16 |
| CVE-2026-5928 | Potential buffer under-read in ungetwc | high | 7.5 | - | No | 2026-04-20 |
| CVE-2020-1918 | - | high | 7.5 | - | No | 2021-03-10 |
| CVE-2020-5360 | - | high | 7.5 | - | No | 2020-12-16 |
| CVE-2025-32050 | Libsoup: integer overflow in append\_param\_quoted | medium | 5.9 | - | No | 2025-04-03 |
| CVE-2024-25629 | c-ares out of bounds read in ares\_\_read\_line() | medium | 5.5 | - | No | 2024-02-23 |
| CVE-2025-71450 | inih before r63 Stack Buffer Under-Read in ini\_parse\_stream Discard Loop | medium | 4.8 | - | No | 2026-11-02 |
| CVE-2026-45683 | OpenTelemetry eBPF Instrumentation: Java TLS ioctl kprobe allows kernel memory disclosure | low | 3.8 | - | No | 2026-06-02 |
| CVE-2026-125206 | FFmpeg through 9.0.2 Out-of-Bounds Read via prores\_ks Interlaced Alpha Encoding | low | 2.0 | - | No | 2026-11-09 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-125](https://radicalnotion.ai/cwe/cwe-125) | Out-of-bounds Read |
| Parent | [CWE-786](https://radicalnotion.ai/cwe/cwe-786) | Access of Memory Location Before Start of Buffer |

## Taxonomy mappings

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

## Frequently asked questions

### What is CWE-127?

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

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

13 recorded CVEs are attributed to CWE-127, including CVE-2026-103119, CVE-2025-20359 and CVE-2024-10395.

### How is CWE-127 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-127?

Exploiting CWE-127 can lead to: Read Memory, Bypass Protection Mechanism.

### Is CWE-127 actively exploited?

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

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

---

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