Weakness · High
CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer
What it is
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.
- Severity (our rating)
- High
- Likelihood of exploit
- High
- Introduced during
- Implementation
- Exploited in the wild
- 88 known exploited CVEs
What an attacker can do
- Execute Unauthorized Code or Commands (Integrity, Confidentiality, Availability)
- Modify Memory (Integrity, Confidentiality, Availability)
- Read Memory (Availability, Confidentiality)
- DoS: Crash, Exit, or Restart (Availability, Confidentiality)
- DoS: Resource Consumption (CPU) (Availability, Confidentiality)
- DoS: Resource Consumption (Memory) (Availability, Confidentiality)
How to prevent it
Requirements
- Use a language that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. For example, many languages that perform their own memory management, such as Java and Perl, are not subject to buffer overflows. Other languages, such as Ada and C#, typically provide overflow protection, but the protection can be disabled by the programmer. Be wary that a language's interface to native code may still be subject to overflows, even if the language itself is theoretically safe.
Architecture and Design
- Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. Examples include the Safe C String Library (SafeStr) by Messier and Viega, and the Strsafe.h library from Microsoft. These libraries provide safer versions of overflow-prone string-handling functions.
Operation
- Use automatic buffer overflow detection mechanisms that are offered by certain compilers or compiler extensions. Examples include: the Microsoft Visual Studio /GS flag, Fedora/Red Hat FORTIFY_SOURCE GCC flag, StackGuard, and ProPolice, which provide various mechanisms including canary-based detection and range/index checking. D3-SFCV (Stack Frame Canary Validation) from D3FEND discusses canary-based detection in detail.
- Run or compile the software using features or extensions that randomly arrange the positions of a program's executable and libraries in memory. Because this makes the addresses unpredictable, it can prevent an attacker from reliably jumping to exploitable code. Examples include Address Space Layout Randomization (ASLR) and Position-Independent Executables (PIE). Imported modules may be similarly realigned if their default memory addresses conflict with other modules, in a process known as "rebasing" (for Windows) and "prelinking" (for Linux) using randomly generated addresses. ASLR for libraries cannot be used in conjunction with prelink since it would require relocating the libraries at run-time, defeating the whole purpose of prelinking. For more information on these techniques see D3-SAOR (Segment Address Offset Randomization) from D3FEND.
- Use a CPU and operating system that offers Data Execution Protection (using hardware NX or XD bits) or the equivalent techniques that simulate this feature in software, such as PaX. These techniques ensure that any instruction executed is exclusively at a memory address that is part of the code segment. For more information on these techniques see D3-PSEP (Process Segment Execution Prevention) from D3FEND.
Implementation
- Consider adhering to the following rules when allocating and managing an application's memory: Double check that the buffer is as large as specified. When using functions that accept a number of bytes to copy, such as strncpy(), be aware that if the destination buffer size is equal to the source buffer size, it may not NULL-terminate the string. Check buffer boundaries if accessing the buffer in a loop and make sure there is no danger of writing past the allocated space. If necessary, truncate all input strings to a reasonable length before passing them to the copy and concatenation functions.
- Replace unbounded copy functions with analogous functions that support length arguments, such as strcpy with strncpy. Create these if they are not available.
How to find it
- Automated Static Analysis. This weakness can often be detected using automated static analysis tools. Many modern tools use data flow analysis or constraint-based techniques to minimize the number of false positives. Automated static analysis generally does not account for environmental considerations when reporting out-of-bounds memory operations. This can make it difficult for users to determine which warnings should be investigated first. For example, an analysis tool might report buffer overflows that originate from command line arguments in a program that is not expected to run with setuid or other special privileges.
- Automated Dynamic Analysis. This weakness can be detected using dynamic tools and techniques that interact with the software using large test suites with many diverse inputs, such as fuzz testing (fuzzing), robustness testing, and fault injection. The software's operation may slow down, but it should not become unstable, crash, or generate incorrect results.
- 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++.
- Automated Static Analysis - Binary or Bytecode. According to SOAR, the following detection techniques may be useful: Cost effective for partial coverage: Binary / Bytecode Quality Analysis Bytecode Weakness Analysis - including disassembler + source code weakness analysis Binary Weakness Analysis - including disassembler + source code weakness analysis
- Manual Static Analysis - Binary or Bytecode. According to SOAR, the following detection techniques may be useful: Cost effective for partial coverage: Binary / Bytecode disassembler - then use manual analysis for vulnerabilities & anomalies
- Dynamic Analysis with Automated Results Interpretation. According to SOAR, the following detection techniques may be useful: Cost effective for partial coverage: Web Application Scanner Web Services Scanner Database Scanners
- Dynamic Analysis with Manual Results Interpretation. According to SOAR, the following detection techniques may be useful: Cost effective for partial coverage: Fuzz Tester Framework-based Fuzzer
- Manual Static Analysis - Source Code. According to SOAR, the following detection techniques may be useful: Cost effective for partial coverage: Focused Manual Spotcheck - Focused manual analysis of source Manual Source Code Review (not inspections)
- Automated Static Analysis - Source Code. According to SOAR, the following detection techniques may be useful: Highly cost effective: Source code Weakness Analyzer Context-configured Source Code Weakness Analyzer Cost effective for partial coverage: Source Code Quality Analyzer
- Architecture or Design Review. According to SOAR, the following detection techniques may be useful: Highly cost effective: Formal Methods / Correct-By-Construction Cost effective for partial coverage: Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.)
Exploited in the wild: 88 CVEs
Vulnerabilities caused by CWE-119 that attackers have used, from CISA's Known Exploited Vulnerabilities catalog, newest first.
- CVE-2026-88779Citrix NetScaler Improper Restriction of Operations within the Bounds of a Memory Buffer Vulnerability · added October 4, 2026
- CVE-2026-88772Citrix NetScaler Improper Restriction of Operations within the Bounds of a Memory Buffer Vulnerability · added September 27, 2026
- CVE-2026-88771Citrix NetScaler Improper Input Validation Vulnerability · added September 27, 2026
- CVE-2026-8452Citrix NetScaler ADC and NetScaler Gateway Improper Restriction of Operations within the Bounds of a Memory Buffer Vulnerability · added August 26, 2026
- CVE-2009-3459Adobe Acrobat and Reader Heap-Based Buffer Overflow Vulnerability · added May 20, 2026
- CVE-2025-31277Apple Multiple Products Buffer Overflow Vulnerability · added March 20, 2026
- CVE-2026-3910Google Chromium V8 Improper Restriction of Operations Within the Bounds of a Memory Buffer Vulnerability · added March 13, 2026
- CVE-2026-20700Apple Multiple Buffer Overflow Vulnerability · added February 12, 2026
- CVE-2025-7775Citrix NetScaler Memory Overflow Vulnerability · added August 26, 2025
- CVE-2014-3931Multi-Router Looking Glass (MRLG) Buffer Overflow Vulnerability · added July 7, 2025
- CVE-2025-6543Citrix NetScaler ADC and Gateway Buffer Overflow Vulnerability · added June 30, 2025
- CVE-2017-1000253 ransomwareLinux Kernel PIE Stack Buffer Corruption Vulnerability · added September 9, 2024
- CVE-2023-6549Citrix NetScaler ADC and NetScaler Gateway Buffer Overflow Vulnerability · added January 17, 2024
- CVE-2023-4966 ransomwareCitrix NetScaler ADC and NetScaler Gateway Buffer Overflow Vulnerability · added October 18, 2023
- CVE-2017-6742Cisco IOS and IOS XE Software SNMP Remote Code Execution Vulnerability · added April 19, 2023
- CVE-2022-22706Arm Mali GPU Kernel Driver Unspecified Vulnerability · added March 30, 2023
- CVE-2013-2597Code Aurora ACDB Audio Driver Stack-based Buffer Overflow Vulnerability · added September 15, 2022
- CVE-2018-7445MikroTik RouterOS Stack-Based Buffer Overflow Vulnerability · added September 8, 2022
- CVE-2021-30983Apple iOS and iPadOS Buffer Overflow Vulnerability · added June 27, 2022
- CVE-2018-4344Apple Multiple Products Memory Corruption Vulnerability · added June 27, 2022
- CVE-2017-6862NETGEAR Multiple Devices Buffer Overflow Vulnerability · added June 8, 2022
- CVE-2016-1646Google Chromium V8 Out-of-Bounds Read Vulnerability · added June 8, 2022
- CVE-2013-1331Microsoft Office Buffer Overflow Vulnerability · added June 8, 2022
- CVE-2012-1889Microsoft XML Core Services Memory Corruption Vulnerability · added June 8, 2022
- CVE-2010-2883Adobe Acrobat and Reader Stack-Based Buffer Overflow Vulnerability · added June 8, 2022
- CVE-2010-2572Microsoft PowerPoint Buffer Overflow Vulnerability · added June 8, 2022
- CVE-2009-3953Adobe Acrobat and Reader Universal 3D Remote Code Execution Vulnerability · added June 8, 2022
- CVE-2009-0563Microsoft Office Buffer Overflow Vulnerability · added June 8, 2022
- CVE-2007-5659Adobe Acrobat and Reader Buffer Overflow Vulnerability · added June 8, 2022
- CVE-2015-2425Microsoft Internet Explorer Memory Corruption Vulnerability · added May 25, 2022
- CVE-2015-2360Microsoft Win32k Privilege Escalation Vulnerability · added May 25, 2022
- CVE-2014-8439Adobe Flash Player Dereferenced Pointer Vulnerability · added May 25, 2022
- CVE-2017-0149Microsoft Internet Explorer Memory Corruption Vulnerability · added May 24, 2022
- CVE-2017-0005Microsoft Windows Graphics Device Interface (GDI) Privilege Escalation Vulnerability · added May 24, 2022
- CVE-2016-6366Cisco Adaptive Security Appliance (ASA) SNMP Buffer Overflow Vulnerability · added May 24, 2022
- CVE-2016-4657Apple iOS Webkit Memory Corruption Vulnerability · added May 24, 2022
- CVE-2019-8720WebKitGTK Memory Corruption Vulnerability · added May 23, 2022
- CVE-2016-4523Trihedral VTScada (formerly VTS) Denial-of-Service Vulnerability · added April 15, 2022
- CVE-2015-3113Adobe Flash Player Heap-Based Buffer Overflow Vulnerability · added April 13, 2022
- CVE-2015-2502Microsoft Internet Explorer Memory Corruption Vulnerability · added April 13, 2022
- CVE-2016-7201Microsoft Edge Memory Corruption Vulnerability · added March 28, 2022
- CVE-2016-7200Microsoft Edge Memory Corruption Vulnerability · added March 28, 2022
- CVE-2016-0189 ransomwareMicrosoft Internet Explorer Memory Corruption Vulnerability · added March 28, 2022
- CVE-2015-2426Microsoft Windows Adobe Type Manager Library Remote Code Execution Vulnerability · added March 28, 2022
- CVE-2015-2419Microsoft Internet Explorer Memory Corruption Vulnerability · added March 28, 2022
- CVE-2013-3660Microsoft Win32k Privilege Escalation Vulnerability · added March 28, 2022
- CVE-2013-1690Mozilla Firefox and Thunderbird Denial-of-Service Vulnerability · added March 28, 2022
- CVE-2012-2034Adobe Flash Player Memory Corruption Vulnerability · added March 28, 2022
- CVE-2010-4398Microsoft Windows Kernel Stack-Based Buffer Overflow Vulnerability · added March 28, 2022
- CVE-2016-10174NETGEAR WNR2000v5 Router Buffer Overflow Vulnerability · added March 25, 2022
- CVE-2014-6332Microsoft Windows Object Linking & Embedding (OLE) Automation Array Remote Code Execution Vulnerability · added March 25, 2022
- CVE-2010-4344Exim Heap-Based Buffer Overflow Vulnerability · added March 25, 2022
- CVE-2017-0101 ransomwareMicrosoft Windows Transaction Manager Privilege Escalation Vulnerability · added March 15, 2022
- CVE-2015-2546 ransomwareMicrosoft Win32k Memory Corruption Vulnerability · added March 15, 2022
- CVE-2018-0175Cisco IOS, XR, and XE Software Buffer Overflow Vulnerability · added March 3, 2022
- CVE-2018-0167Cisco IOS, XR, and XE Software Buffer Overflow Vulnerability · added March 3, 2022
- CVE-2018-0151Cisco IOS Software and Cisco IOS XE Software Quality of Service Remote Code Execution Vulnerability · added March 3, 2022
- CVE-2017-11826Microsoft Office Remote Code Execution Vulnerability · added March 3, 2022
- CVE-2017-8540Microsoft Malware Protection Engine Improper Restriction of Operations Vulnerability · added March 3, 2022
- CVE-2017-6744Cisco IOS Software SNMP Remote Code Execution Vulnerability · added March 3, 2022
- CVE-2017-6743Cisco IOS and IOS XE Software SNMP Remote Code Execution Vulnerability · added March 3, 2022
- CVE-2017-6740Cisco IOS and IOS XE Software SNMP Remote Code Execution Vulnerability · added March 3, 2022
- CVE-2017-6739Cisco IOS and IOS XE Software SNMP Remote Code Execution Vulnerability · added March 3, 2022
- CVE-2017-6738Cisco IOS and IOS XE Software SNMP Remote Code Execution Vulnerability · added March 3, 2022
- CVE-2017-6737Cisco IOS and IOS XE Software SNMP Remote Code Execution Vulnerability · added March 3, 2022
- CVE-2017-6736Cisco IOS and IOS XE Software SNMP Remote Code Execution Vulnerability · added March 3, 2022
- CVE-2016-7193Microsoft Office Memory Corruption Vulnerability · added March 3, 2022
- CVE-2015-5119Adobe Flash Player Use-After-Free Vulnerability · added March 3, 2022
- CVE-2015-2424Microsoft PowerPoint Memory Corruption Vulnerability · added March 3, 2022
- CVE-2015-1642Microsoft Office Memory Corruption Vulnerability · added March 3, 2022
- CVE-2013-3346Adobe Reader and Acrobat Memory Corruption Vulnerability · added March 3, 2022
- CVE-2013-1675Mozilla Firefox Information Disclosure Vulnerability · added March 3, 2022
- CVE-2011-1889Microsoft Forefront TMG Remote Code Execution Vulnerability · added March 3, 2022
- CVE-2010-3333Microsoft Office Stack-based Buffer Overflow Vulnerability · added March 3, 2022
- CVE-2008-2992 ransomwareAdobe Reader and Acrobat Input Validation Vulnerability · added March 3, 2022
- CVE-2017-0222Microsoft Internet Explorer Remote Code Execution Vulnerability · added February 25, 2022
- CVE-2014-1761Microsoft Word Memory Corruption Vulnerability · added February 15, 2022
- CVE-2020-0796 ransomwareMicrosoft SMBv3 Remote Code Execution Vulnerability · added February 10, 2022
- CVE-2014-4404Apple OS X Heap-Based Buffer Overflow Vulnerability · added February 10, 2022
- CVE-2021-22991F5 BIG-IP Traffic Management Microkernel Buffer Overflow · added January 18, 2022
- CVE-2021-33771Microsoft Windows Kernel Privilege Escalation Vulnerability · added November 3, 2021
- CVE-2021-31979Microsoft Windows Kernel Privilege Escalation Vulnerability · added November 3, 2021
- CVE-2021-30666Apple iOS WebKit Buffer Overflow Vulnerability · added November 3, 2021
- CVE-2020-29557D-Link DIR-825 R1 Devices Buffer Overflow Vulnerability · added November 3, 2021
- CVE-2018-6789 ransomwareExim Buffer Overflow Vulnerability · added November 3, 2021
- CVE-2017-11882 ransomwareMicrosoft Office Memory Corruption Vulnerability · added November 3, 2021
- CVE-2017-11774Microsoft Office Outlook Security Feature Bypass Vulnerability · added November 3, 2021
- CVE-2017-7269Microsoft Windows Server Buffer Overflow Vulnerability · added November 3, 2021
H2 Security
Found it in your code?
We review where it appears, fix it with your team, and check it was not already used against you.
Talk to our teamT Academy
Stop writing it in the first place
Learn to build software and systems without weaknesses like this one, with practice on real hosts in your browser, every objective checked on the machine.
Start freeSource: MITRE Common Weakness Enumeration, CWE version 4.19.1. CWE is a trademark of The MITRE Corporation.