What is CWE-787?
The product writes data past the end, or before the beginning, of the intended buffer.
CWE-787 is a base-level weakness in MITRE’s Common Weakness Enumeration, with a MITRE likelihood of exploit of High. Applicable platforms: Language: Memory-Unsafe; Language: C; Language: C++; Language: Assembly; Technology: ICS/OT.
Source: MITRE CWE (CWE-787 definition, reproduced verbatim). Counts and linkage below are Threadlinqs data.
Consequences
- Integrity — Modify Memory, Execute Unauthorized Code or Commands. Write operations could cause memory corruption. In some cases, an adversary can modify control data such as return addresses in order to execute unexpected code.
- Availability — DoS: Crash, Exit, or Restart. Attempting to access out-of-range, invalid, or unauthorized memory could cause the product to crash.
- Other — Unexpected State. Subsequent write operations can produce undefined or unexpected results.
Source: MITRE CWE, common consequences.
How CWE-787 is exploited in the wild
Threadlinqs maps 74 CVEs to CWE-787, published between 2016-08-25 and 2026-09-28. 21 are listed in CISA’s Known Exploited Vulnerabilities catalog, the authoritative record of exploitation in the wild, and 7 are tied to ransomware campaigns. By CVSS v3 severity the set splits into 16 critical, 38 high, 13 medium. The highest EPSS score in the set is 99.5% (CVE-2020-16040), the modelled probability of exploitation in the next 30 days. 141 tracked threats reference CWE-787 directly or through a CVE it covers; the most recent is “Multiple Vulnerabilities in Microsoft Edge prior to 154.0.4258.53 (HK GovCERT A26-10-03)” (2026-10-02). Affected products concentrate in Apple (10), Google (9), zephyrproject (7), among 48 vendors in total.
Vulnerabilities (CVEs)
Showing 40 of 74 CVEs mapped to CWE-787, CISA KEV first, then by CVSS score.
- CVE-2022-42475 — CISA KEV · CVSS 9.8 critical · EPSS 93.9% · published 2023-01-02
- CVE-2023-34048 — CISA KEV · CVSS 9.8 critical · EPSS 93.2% · published 2023-10-25
- CVE-2024-21762 — CISA KEV · CVSS 9.8 critical · EPSS 92.7% · published 2024-02-09
- CVE-2023-27997 — CISA KEV · CVSS 9.8 critical · EPSS 90.9% · published 2023-06-13
- CVE-2026-34621 — CISA KEV · CVSS 9.8 critical · EPSS 9.8% · published 2026-04-13
- CVE-2026-0300 — CISA KEV · CVSS 9.8 critical · EPSS 4.5% · published 2026-05-06
- CVE-2025-0282 — CISA KEV · CVSS 9 critical · EPSS 94.1% · published 2025-01-08
- CVE-2016-4657 — CISA KEV · CVSS 8.8 high · EPSS 63.5% · published 2016-08-25
- CVE-2026-87491 — CISA KEV · CVSS 8.8 high · EPSS 3.1% · published 2026-09-09
- CVE-2025-14174 — CISA KEV · CVSS 8.8 high · EPSS 0.9% · published 2025-12-12
- CVE-2026-3909 — CISA KEV · CVSS 8.8 high · EPSS 0.2% · published 2026-03-13
- CVE-2023-32435 — CISA KEV · CVSS 8.8 high · EPSS 0.2% · published 2023-06-23
- CVE-2023-42917 — CISA KEV · CVSS 8.8 high · EPSS 0.0% · published 2023-11-30
- CVE-2023-28206 — CISA KEV · CVSS 8.6 high · EPSS 16.4% · published 2023-04-10
- CVE-2025-22225 — CISA KEV · CVSS 8.2 high · EPSS 8.5% · published 2025-03-04
- CVE-2018-0802 — CISA KEV · CVSS 7.8 high · EPSS 93.8% · published 2018-01-10
- CVE-2021-4034 — CISA KEV · CVSS 7.8 high · EPSS 87.8% · published 2022-01-28
- CVE-2016-4656 — CISA KEV · CVSS 7.8 high · EPSS 21.3% · published 2016-08-25
- CVE-2024-53197 — CISA KEV · CVSS 7.8 high · EPSS 3.5% · published 2024-12-27
- CVE-2024-53104 — CISA KEV · CVSS 7.8 high · EPSS 3.3% · published 2024-12-02
- CVE-2022-32917 — CISA KEV · CVSS 7.8 high · EPSS 0.5% · published 2022-09-20
- CVE-2026-44747 — CVSS 9.9 critical · published 2026-07-14
- CVE-2021-39275 — CVSS 9.8 critical · EPSS 39.4% · published 2021-09-16
- CVE-2025-54957 — CVSS 9.8 critical · EPSS 1.5% · published 2025-10-20
- CVE-2026-65414 — CVSS 9.8 critical · EPSS 0.9% · published 2026-09-14
- CVE-2026-69819 — CVSS 9.8 critical · EPSS 0.9% · published 2026-09-08
- CVE-2026-85437 — CVSS 9.8 critical · EPSS 0.6% · published 2026-09-03
- CVE-2026-87438 — CVSS 9.6 critical · EPSS 0.4% · published 2026-09-09
- CVE-2026-10881 — CVSS 9.6 critical · EPSS 0.3% · published 2026-06-04
- CVE-2026-68579 — CVSS 9.6 critical · EPSS 0.2% · published 2026-08-02
- CVE-2023-38545 — CVSS 8.8 high · EPSS 78.4% · published 2023-10-18
- CVE-2026-85452 — CVSS 8.8 high · EPSS 0.3% · published 2026-09-03
- CVE-2026-8461 — CVSS 8.8 high · EPSS 0.3% · published 2026-06-18
- CVE-2026-56711 — CVSS 8.8 high · EPSS 0.2% · published 2026-09-09
- CVE-2026-16807 — CVSS 8.8 high · EPSS 0.2% · published 2026-07-23
- CVE-2026-4675 — CVSS 8.8 high · EPSS 0.0% · published 2026-03-24
- CVE-2026-48095 — CVSS 8.8 high · EPSS 0.0% · published 2026-06-05
- CVE-2026-86950 — CVSS 8.8 high · published 2026-09-28
- CVE-2026-0799 — CVSS 8.7 high · EPSS 0.1% · published 2026-09-05
- CVE-2026-8718 — CVSS 8.4 high · EPSS 0.1% · published 2026-08-10
Affected vendors
- Apple — 10 CVEs
- Google — 9 CVEs
- zephyrproject — 7 CVEs
- Linux — 5 CVEs
- Microsoft — 5 CVEs
- Fortinet — 3 CVEs
- Red Hat — 3 CVEs
- FastStone — 2 CVEs
- NetworkConfiguration — 2 CVEs
- Vmware — 2 CVEs
- AcademySoftwareFoundation — 1 CVE
- Adobe — 1 CVE
Threat activity
141 tracked threats cite CWE-787; the 25 most recent are listed.
- Multiple Vulnerabilities in Microsoft Edge prior to 154.0.4258.53 (HK GovCERT A26-10-03)CRITICAL
- Google Chrome 154 Update Fixes 32 Security Flaws Including Critical ANGLE Buffer Overflow (CVE-2026-102331)CRITICAL
- Apple CoreGraphics Out-of-Bounds Write (CVE-2026-86950) Possibly Exploited in Targeted AttacksHIGH
- UTA0565 Chains Chrome and Windows Zero-Days (CVE-2026-85046, CVE-2026-87491, CVE-2026-85880) to Deploy CLEANGULP MalwareCRITICAL
- Citrix Patches Two Actively Exploited NetScaler Zero-Days (CVE-2026-88771, CVE-2026-88772)CRITICAL
- Multiple Vulnerabilities in Google Chrome Patched in Stable Channel Update 154.0.8037.57 (GovCERT.HK A26-09-37)MEDIUM
- CISA Flags Three Actively Exploited Linux Kernel Vulnerabilities: kTLS Receive-Path Disclosure/DoS, ebtables SNAT Privilege Escalation, and AF_ALG Race Condition (CVE-2025-39682, CVE-2026-53266, CVE-2025-39964)CRITICAL
- "LPE Quartet": Public Exploits Released for Four Linux Kernel Local-Root Flaws (DirtyAH6, TUNderflow, PPPoEject, DiagSpill)HIGH
- Attacker Maintains Root-Level MeshCentral Backdoor Inside Thai ISP 3BB, Targets RADIUS Subscriber-Credential Databases (CVE-2024-21762 Toolkit Staged)HIGH
- Apple Ships 273-CVE Coordinated Security Update Across iOS 27, macOS, watchOS, tvOS, visionOS, Safari, and Xcode — Bundles a Previously KEV-Listed Pre-Auth Screen Sharing RCECRITICAL
- PeckBirdy JScript C2 Framework Hides China-Aligned APT Infrastructure Inside a Casino-Site Network (CVE-2020-16040)HIGH
- CVE-2025-37947: Out-of-Bounds Write in Linux ksmbd Kernel SMB Server Enables Local Privilege EscalationHIGH
- Multiple Vulnerabilities in Fortigate NGFW on RUGGEDCOM APE1808 Devices (SSA-864900) — Including Actively Exploited FortiCloud SSO Bypass (CVE-2025-59718/-59719) and FortiOS Heap Overflow (CVE-2025-25249)CRITICAL
- Multiple Fortinet FortiOS Vulnerabilities (incl. CVE-2024-23113) Affect Siemens RUGGEDCOM APE1808 via Bundled Fortinet NGFW < V7.4.3 (SSA-832273)CRITICAL
- VLC Media Player: Integer Overflow in AllocatePicture (CVE-2026-56711) and RTSP Heap Out-of-Bounds Read (CVE-2026-73324)HIGH
- CVE-2025-25249: Fortinet Heap-Based Buffer Overflow Exploited to Deploy PivotC2 RAT on FortiGate DevicesCRITICAL
- CVE-2026-0310: PAN-OS XML Processing Out-of-Bounds Write Enables Unauthenticated Root RCECRITICAL
- Zero-click Pixel 10 exploit chain: VPU driver mmap flaw (CVE-2026-0106) enables arbitrary kernel read/write, chained with Dolby decoder RCE (CVE-2025-54957)CRITICAL
- September 2026 Microsoft Patch Tuesday — Record 966+ Vulnerabilities with Two Actively Exploited Zero-Days (CVE-2026-81963, CVE-2026-85880) and Multiple Critical Wormable RCEsCRITICAL
- Microsoft September 2026 Patch Tuesday — 999 CVEs, 3 actively exploited zero-days (CVE-2026-85880, CVE-2026-81963, CVE-2026-85046)CRITICAL
- Serbian Authorities Deploy Pegasus and NoviSpy Spyware Against Journalists, Opposition Politicians, and Student ProtestersHIGH
- EtherHiding: Blockchain-Based C2 on Polygon Fuels ClickFix Backdoor + Banking-Trojan Extension Campaign Adopted by Criminal, North Korean, and Iran-Linked ActorsHIGH
- UniBLEed: Unauthenticated Root RCE Chain Over Bluetooth in Unitree G1 EDU Humanoid Robot (CVE-2026-76639, CVE-2026-76640)CRITICAL
- Adobe and Nvidia Patch Dozens of Vulnerabilities Across Multiple Products, Including Two Critical Flaws in Nvidia's NemoClaw AI Agent Stack and a CVSS 10.0 Adobe Campaign Classic ChainCRITICAL
- Chinese-speaking threat group UAT-10147 uses agentic AI to automate exploitation of internet-facing web serversHIGH
Mitigations
- Requirements / Language Selection: 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 / Libraries or Frameworks: 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 [REF-57], and the Strsafe.h library from Microsoft [REF-56]. These libraries provide safer versions of overflow-prone string-handling functions.
- Operation, Build and Compilation / Environment Hardening: 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 [REF-1334] discusses canary-based detection in detail.
- 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.
- Operation, Build and Compilation / Environment Hardening: 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) [REF-58] [REF-60] and Position-Independent Executables (PIE) [REF-64]. 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) [REF-1332] using randomly generated addresses. ASLR for libraries cannot be used in conjunction with prelink since it would…
- Operation / Environment Hardening: 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 [REF-60] [REF-61]. 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 [REF-1336].
- Implementation: Replace unbounded copy functions with analogous functions that support length arguments, such as strcpy with strncpy. Create these if they are not available.
Source: MITRE CWE, potential mitigations.
Detection methods (MITRE CWE)
- Automated Static Analysis (effectiveness: High): 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…
- 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 (effectiveness: Moderate): 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].
Source: MITRE CWE, detection methods. Threadlinqs detection rules for the threats above are Blue tier and higher.