---
title: "CWE-123: Write-what-where Condition"
url: https://radicalnotion.ai/cwe/cwe-123
type: cwe
description: "Any condition where the attacker has the ability to write an arbitrary value to an arbitrary location, often as the result of a buffer overflow."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-123: Write-what-where Condition

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Draft
- **Likelihood of exploit:** High
- **CVEs with this as primary weakness:** 64
- **Of those, in CISA KEV:** 2
- **New in 2026:** 23
- **CWE catalog version:** 4.21

## Description

Any condition where the attacker has the ability to write an arbitrary value to an arbitrary location, often as the result of a buffer overflow.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Applicable platforms

**Languages:** Memory-Unsafe (Undetermined), C (Undetermined), C++ (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Integrity, Confidentiality, Availability, Access Control | Modify Memory, Execute Unauthorized Code or Commands, Gain Privileges or Assume Identity, DoS: Crash, Exit, or Restart, Bypass Protection Mechanism | Clearly, write-what-where conditions can be used to write data to areas of memory outside the scope of a policy. Also, they almost invariably can be used to execute arbitrary code, which is usually outside the scope of a program's implicit security policy. If the attacker can overwrite a pointer's worth of memory (usually 32 or 64 bits), they can redirect a function pointer to their own malicious code. Even when the attacker can only modify a single byte arbitrary code execution can be possible. Sometimes this is because the same problem can be exploited repeatedly to the same effect. Other times it is because the attacker can overwrite security-critical application-specific data -- such as a flag indicating whether the user is an administrator. |
| Integrity, Availability | DoS: Crash, Exit, or Restart, Modify Memory | Many memory accesses can lead to program termination, such as when writing to addresses that are invalid for the current process. |
| Access Control, Other | Bypass Protection Mechanism, Other | When the consequence is arbitrary code execution, this can often be used to subvert any other security service. |

## Potential mitigations

### Architecture and Design (Language Selection)

Use a language that provides appropriate memory abstractions.

### Operation

Use OS-level preventative functionality integrated after the fact. Not a complete solution.

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

The classic example of a write-what-where condition occurs when the accounting information for memory allocations is overwritten in a particular fashion. Here is an example of potentially vulnerable code:

Bad code:

```c
#define BUFSIZE 256
int main(int argc, char **argv) {
    char *buf1 = (char *) malloc(BUFSIZE);
    char *buf2 = (char *) malloc(BUFSIZE);
    strcpy(buf1, argv[1]);
    free(buf2);
}
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2019-19911 | Chain: Python library does not limit the resources used to process images that specify a very large number of bands (CWE-1284), leading to excessive memory consumption (CWE-789) or an integer overflow (CWE-190). |
| CVE-2022-0545 | Chain: 3D renderer has an integer overflow (CWE-190) leading to write-what-where condition (CWE-123) using a crafted image. |

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

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2025-22225 | VMware ESXi Arbitrary Write Vulnerability | critical | 9.3 | - | Yes | 2025-03-04 |
| CVE-2026-46300 | net: skbuff: preserve shared-frag marker during coalescing | high | 7.8 | - | Yes | 2026-05-23 |
| CVE-2024-42479 | llama.cpp allows write-what-where in rpc\_server::set\_tensor | critical | 10.0 | - | No | 2024-08-12 |
| CVE-2025-69809 | - | critical | 9.8 | - | No | 2026-03-16 |
| CVE-2022-38143 | OpenImageIO RLE encoded BMP image out-of-bounds write vulnerability | critical | 9.8 | - | No | 2022-12-23 |
| CVE-2021-38441 | Eclipse CycloneDDS Write-what-where Condition | critical | 9.8 | - | No | 2022-05-05 |
| CVE-2021-38449 | AUVESY Versiondog | critical | 9.8 | - | No | 2021-10-22 |
| CVE-2020-2001 | PAN-OS: Panorama External control of file vulnerability leads to privilege escalation | critical | 9.8 | - | No | 2020-05-13 |
| CVE-2014-5435 | Write-what-where Condition in Honeywell Experion PKS | critical | 9.8 | - | No | 2019-04-08 |
| CVE-2015-8271 | RTMPDump librtmp AMF3 Class Member Count Remote Code Execution Vulnerability | critical | 9.8 | - | No | 2017-04-13 |
| CVE-2026-94146 | BioStar BIOS Update Utility IOCTL BSMEM64\_W10.sys sub\_110BC write-what-where | critical | 9.3 | - | No | 2026-09-21 |
| CVE-2026-94142 | BioStar Temperature Monitor Utility IOCTL BS\_HWMIO64\_W10.sys sub\_1105C write-what-where | critical | 9.3 | - | No | 2026-09-21 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-119](https://radicalnotion.ai/cwe/cwe-119) | Improper Restriction of Operations within the Bounds of a Memory Buffer |
| Parent | [CWE-787](https://radicalnotion.ai/cwe/cwe-787) | Out-of-bounds Write |
| Peer | [CWE-415](https://radicalnotion.ai/cwe/cwe-415) | Double Free |
| Related | [CWE-120](https://radicalnotion.ai/cwe/cwe-120) | Buffer Copy without Checking Size of Input |
| Related | [CWE-134](https://radicalnotion.ai/cwe/cwe-134) | Use of Externally-Controlled Format String |
| Related | [CWE-364](https://radicalnotion.ai/cwe/cwe-364) | Signal Handler Race Condition |
| Related | [CWE-416](https://radicalnotion.ai/cwe/cwe-416) | Use After Free |
| Related | [CWE-479](https://radicalnotion.ai/cwe/cwe-479) | Signal Handler Use of a Non-reentrant Function |
| Related | [CWE-590](https://radicalnotion.ai/cwe/cwe-590) | Free of Memory not on the Heap |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| CLASP | Write-what-where condition | - | - |
| CERT C Secure Coding | Do not form or use out-of-bounds pointers or array subscripts | ARR30-C | Imprecise |
| CERT C Secure Coding | Guarantee that library functions do not form invalid pointers | ARR38-C | Imprecise |
| CERT C Secure Coding | Guarantee that storage for strings has sufficient space for character data and the null terminator | STR31-C | Imprecise |
| CERT C Secure Coding | Do not pass a non-null-terminated character sequence to a library function that expects a string | STR32-C | Imprecise |
| Software Fault Patterns | Faulty Buffer Access | SFP8 | - |

## Frequently asked questions

### What is CWE-123?

Any condition where the attacker has the ability to write an arbitrary value to an arbitrary location, often as the result of a buffer overflow.

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

64 recorded CVEs are attributed to CWE-123, including CVE-2025-22225, CVE-2026-46300 and CVE-2024-42479. 2 are listed in CISA's Known Exploited Vulnerabilities (KEV) catalog.

### How do you prevent CWE-123?

Use a language that provides appropriate memory abstractions.

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

Exploiting CWE-123 can lead to: Modify Memory, Execute Unauthorized Code or Commands, Gain Privileges or Assume Identity, DoS: Crash, Exit, or Restart, Bypass Protection Mechanism, Other.

### Is CWE-123 actively exploited?

Yes. 2 CWE-123 vulnerabilities are in CISA's KEV catalog of actively exploited flaws, out of 64 recorded CVEs.

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

---

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