CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer

ClassStableExploit Likelihood: High🏆 #15 in Top 25 (2024)

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.

View on MITRE
819Related CVEs
13.60Severity Score
Back to CWE Lookup

Technical Details

Structure
Simple
Vulnerability Mapping
DISCOURAGED

Applicable To

Languages
CC++Memory-UnsafeAssembly
Platforms

🏆 CWE Top 25 Historical Ranking

2023:#17
Score: 4.75
752 CVEs
2024:#15↑2
Score: 13.60
819 CVEs
Trend:Worsening (moved down 2 ranks)

Source-backed guidance

Additional facts reviewed against primary or authoritative security sources.

Combine analysis methods around the CWE-119 trust boundary

MITRE identifies automated static analysis, automated dynamic analysis, binary review, manual review as applicable detection approaches. Use them to establish the actual memory object, permitted operation, offset, width, and lifetime for every pointer or index influenced by external data. Require a reproducible trace from the initiating input or state transition to the unsafe behavior, record coverage gaps, and confirm suspected findings dynamically where safe; no single technique establishes complete coverage.

CWE-119: detection methods and operational guidanceMITRE CWE

Move exposed memory operations to memory-safe abstractions

Prefer a memory-safe language for new components and migrate exposed unsafe parsers where feasible. Where unsafe code remains, encapsulate pointer arithmetic, use bounded containers, validate lengths and allocation arithmetic, and enable compiler and runtime defenses. Treat those defenses as transitional controls: correctness still requires every read and write to remain within the intended object.

Secure by Design Alert: Eliminating Buffer Overflow VulnerabilitiesCISA

Apply lessons from CVE-2025-31277 in Apple Safari and multiple Apple operating systems

NVD maps CVE-2025-31277 to CWE-119; processing maliciously crafted web content could violate memory-buffer bounds and lead to memory corruption. Use the case to prioritize browser-facing parsers, fuzz structured content under memory-safety instrumentation, and treat corruption reports as potentially exploitable rather than ordinary crashes.

CVE-2025-31277 DetailNIST National Vulnerability Database

Track CWE-119 as #15 in the 2024 CWE Top 25

CWE-119 ranked #15 in the 2024 CWE Top 25 with a score of 13.60. Use this annual evidence to prioritize systemic prevention, detection coverage, and recurring-root-cause metrics across the portfolio, while retaining asset exposure, exploitability, and business impact for severity decisions on individual findings.

2024 CWE Top 25 Most Dangerous Software WeaknessesMITRE CWE

Track CWE-119 as #17 in the 2023 CWE Top 25

CWE-119 ranked #17 in the 2023 CWE Top 25 with a score of 4.75. Use this annual evidence to prioritize systemic prevention, detection coverage, and recurring-root-cause metrics across the portfolio, while retaining asset exposure, exploitability, and business impact for severity decisions on individual findings.

2023 CWE Top 25 Most Dangerous Software WeaknessesMITRE CWE

Establish object bounds before pointer arithmetic

For every array subscript, pointer offset, or copy loop, establish the actual object bounds and prove the access remains within them. Exercise empty buffers, the final valid element, one-past-the-end values, negative inputs before unsigned conversion, and overflow in size calculations. Add static or runtime analysis that detects out-of-bounds pointer and array use.

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

Frequently Asked Questions

What is CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer?+

CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer is a Common Weakness Enumeration (CWE) entry maintained by MITRE. 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.

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

Yes. CWE-119 ranked #15 in the CWE Top 25 for 2024, associated with 819 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 Improper Restriction of Operations within the Bounds of a Memory Buffer?+

If exploited, CWE-119 (Improper Restriction of Operations within the Bounds of a Memory Buffer) it can compromise Integrity, Confidentiality and Availability, leading to outcomes such as Execute Unauthorized Code or Commands, Modify Memory, Read Memory, DoS: Crash, Exit, or Restart, DoS: Resource Consumption (CPU) and DoS: Resource Consumption (Memory).

How is Improper Restriction of Operations within the Bounds of a Memory Buffer detected?+

CWE-119 can be detected using Automated Static Analysis - Binary or Bytecode, Manual Static Analysis - Binary or Bytecode, Dynamic Analysis with Automated Results Interpretation, Dynamic Analysis with Manual Results Interpretation, Manual Static Analysis - Source Code and Automated Static Analysis - Source Code. Combining automated tooling with manual review typically yields the best coverage.

Which programming languages are affected by Improper Restriction of Operations within the Bounds of a Memory Buffer?+

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

What are real-world examples of Improper Restriction of Operations within the Bounds of a Memory Buffer?+

MITRE documents real CVEs mapped to CWE-119, including CVE-2021-22991, CVE-2025-47153, CVE-2020-29557, CVE-2009-2550 and CVE-2009-2403. 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-119 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