CWE-125: Out-of-bounds Read

BaseDraft🏆 #7 in Top 25 (2024)

The product reads data past the end, or before the beginning, of the intended buffer.

View on MITRE
2,117Related CVEs
18.64Severity Score
Back to CWE Lookup

Technical Details

Structure
Simple
Vulnerability Mapping
ALLOWED

Applicable To

Languages
CC++Memory-Unsafe
Platforms

🏆 CWE Top 25 Historical Ranking

2023:#7
Score: 14.60
2,043 CVEs
2024:#7=
Score: 18.64
2,117 CVEs
Trend:Stable (no rank change)

Source-backed guidance

Additional facts reviewed against primary or authoritative security sources.

Test reads at every buffer boundary

Review each pointer dereference and array subscript to establish that it refers to an element of the same array object. Exercise empty inputs, the final valid element, the one-past-the-end index, missing terminators, negative values before unsigned conversion, and overflow in size calculations. Use static or runtime analysis that detects out-of-bounds array and pointer access as a second line of evidence.

ARR30-C: Do not form or use out-of-bounds pointers or array subscriptsCarnegie Mellon SEI

Prefer memory-safe parsing and validate every read boundary

Use a memory-safe language for new parsers and migrate exposed unsafe components where feasible. Where unsafe code remains, validate source length, offset, read width, terminators, and size arithmetic before every access. Enable compiler and runtime memory-safety defenses and test truncated and boundary-length inputs; hardening may reduce exploitation but does not correct an out-of-bounds read.

Secure by Design Alert: Eliminating Buffer Overflow VulnerabilitiesCISA

Apply lessons from CVE-2025-5777 in Citrix NetScaler ADC and Gateway

NVD maps CVE-2025-5777 to CWE-125; insufficient input validation caused an out-of-bounds read that could expose memory when affected Gateway or AAA virtual-server configurations were enabled. Use the case to test protocol parsing with truncated requests, verify response buffers never include adjacent memory, and monitor edge appliances for unexpected disclosure behavior.

CVE-2025-5777 DetailNIST National Vulnerability Database

Prioritize CWE-125 using its 2025 CWE Top 25 evidence

CWE-125 ranked #8 in the 2025 CWE Top 25 with a score of 7.88. The ranking table recorded 3 mapped vulnerabilities in CISA KEV for this measurement window. Use the rank to prioritize systemic prevention, detection coverage, and recurring-root-cause metrics across the portfolio, while retaining asset exposure and business impact for individual finding severity decisions.

2025 CWE Top 25 Most Dangerous Software WeaknessesMITRE CWE

Detect invalid reads with AddressSanitizer

Compile native targets with AddressSanitizer and execute malformed, truncated, empty, maximum-length, and one-past-the-end cases. Include parser error recovery and logging paths, since an invalid read can occur after the primary validation rejects an input. Preserve symbolized traces and add the triggering input to regression tests; pair dynamic coverage with review of pointer arithmetic and length conversions.

AddressSanitizerLLVM Project

Frequently Asked Questions

What is CWE-125: Out-of-bounds Read?+

CWE-125: Out-of-bounds Read is a Common Weakness Enumeration (CWE) entry maintained by MITRE. The product reads data past the end, or before the beginning, of the intended buffer.

Is CWE-125 in the CWE Top 25 Most Dangerous Software Weaknesses?+

Yes. CWE-125 ranked #7 in the CWE Top 25 for 2024, associated with 2,117 CVEs that year. The CWE Top 25 highlights the most common and impactful software weaknesses based on real-world vulnerability data.

What are the security consequences of Out-of-bounds Read?+

If exploited, CWE-125 (Out-of-bounds Read) it can compromise Confidentiality, Availability and Other, leading to outcomes such as Read Memory, Bypass Protection Mechanism, DoS: Crash, Exit, or Restart and Varies by Context.

How do you prevent or mitigate Out-of-bounds Read?+

Recommended mitigations for CWE-125 include: Use a language that provides appropriate memory abstractions.

Which programming languages are affected by Out-of-bounds Read?+

CWE-125 commonly affects C, C++ and Memory-Unsafe. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.

What are real-world examples of Out-of-bounds Read?+

MITRE documents real CVEs mapped to CWE-125, including CVE-2023-1018, CVE-2020-11899, CVE-2014-0160, CVE-2021-40985 and CVE-2018-10887. You can look up the full details of each CVE, including CVSS scores and remediation guidance, on our CVE Lookup tool.

What is the difference between a CWE and a CVE?+

A CWE (Common Weakness Enumeration) like CWE-125 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.

Learn More

Advertisement