---
title: "CWE-188: Reliance on Data/Memory Layout"
url: https://radicalnotion.ai/cwe/cwe-188
type: cwe
description: "The product makes invalid assumptions about how protocol data or memory is organized at a lower level."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-188: Reliance on Data/Memory Layout

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

## Description

The product makes invalid assumptions about how protocol data or memory is organized at a lower level.

## Modes of introduction

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

## Applicable platforms

**Languages:** C (Undetermined), C++ (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Integrity, Confidentiality | Modify Memory, Read Memory | This can result in unintended program behavior, including the unintended modifications or reading of sensitive memory. An implementation might access an unintended field in the protocol data/memory (such as a packet), treating data of one type as data of another type. |

## Potential mitigations

### Implementation, Architecture and Design

In flat address space situations, never allow computing memory addresses as offsets from another memory address.

### Architecture and Design

Fully specify protocol layout unambiguously, providing a structured grammar (e.g., a compilable yacc grammar).

### Testing

Testing: Test that the implementation properly handles each case in the protocol grammar.

## Detection methods

### Fuzzing

Fuzz testing (fuzzing) is a powerful technique for generating large numbers of diverse inputs - either randomly or algorithmically - and dynamically invoking the code with those inputs. Even with random inputs, it is often capable of generating unexpected results such as crashes, memory corruption, or resource consumption. Fuzzing effectively produces repeatable test cases that clearly indicate bugs, which helps developers to diagnose the issues.

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

In this example function, the memory address of variable b is derived by adding 1 to the address of variable a. This derived address is then used to assign the value 0 to b.

Bad code:

```c
void example() {
    char a;
    char b;
    *(&a + 1) = 0;
}
```

Here, b may not be one byte past a. It may be one byte in front of a. Or, they may have three bytes between them because they are aligned on 32-bit boundaries.

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-68860 | - | medium | 6.8 | - | No | 2026-09-03 |
| CVE-2026-21493 | iccDEV has Type Confusion during XML Curve Serialization | medium | 6.6 | - | No | 2026-01-06 |
| CVE-2023-52995 | riscv/kprobe: Fix instruction simulation of JALR | medium | 5.5 | - | No | 2025-03-27 |
| CVE-2023-52561 | arm64: dts: qcom: sdm845-db845c: Mark cont splash memory region as reserved | medium | 5.5 | - | No | 2024-03-02 |
| CVE-2020-35920 | socket2 invalidly assumes the memory layout of std::net::SocketAddr | medium | 5.5 | - | No | 2020-12-31 |
| CVE-2020-35921 | miow invalidly assumes the memory layout of std::net::SocketAddr | medium | 5.5 | - | No | 2020-12-31 |
| CVE-2020-35922 | mio invalidly assumes the memory layout of std::net::SocketAddr | medium | 5.5 | - | No | 2020-12-31 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-435](https://radicalnotion.ai/cwe/cwe-435) | Improper Interaction Between Multiple Correctly-Behaving Entities |
| Parent | [CWE-1105](https://radicalnotion.ai/cwe/cwe-1105) | Insufficient Encapsulation of Machine-Dependent Functionality |
| Child | [CWE-198](https://radicalnotion.ai/cwe/cwe-198) | Use of Incorrect Byte Ordering |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| CLASP | Reliance on data layout | - | - |

## Frequently asked questions

### What is CWE-188?

The product makes invalid assumptions about how protocol data or memory is organized at a lower level.

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

7 recorded CVEs are attributed to CWE-188, including CVE-2026-68860, CVE-2026-21493 and CVE-2023-52995.

### How do you prevent CWE-188?

In flat address space situations, never allow computing memory addresses as offsets from another memory address.

### How is CWE-188 detected?

Fuzzing: Fuzz testing (fuzzing) is a powerful technique for generating large numbers of diverse inputs - either randomly or algorithmically - and dynamically invoking the code with those inputs. Even with random inputs, it is often capable of generating unexpected results such as crashes, memory corruption, or resource consumption. Fuzzing effectively produces repeatable test cases that clearly indicate bugs, which helps developers to diagnose the issues.

### What are the consequences of CWE-188?

Exploiting CWE-188 can lead to: Modify Memory, Read Memory.

### Is CWE-188 actively exploited?

7 recorded CVEs are caused by CWE-188; none are currently in CISA's KEV catalog of actively exploited flaws.

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

---

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