---
title: "CWE-758: Reliance on Undefined, Unspecified, or Implementation-Defined Behavior"
url: https://radicalnotion.ai/cwe/cwe-758
type: cwe
description: "The product uses an API function, data structure, or other entity in a way that relies on properties that are not always guaranteed to hold for that entity."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-758: Reliance on Undefined, Unspecified, or Implementation-Defined Behavior

- **Abstraction:** Class
- **Structure:** Simple
- **Status:** Incomplete
- **CVEs with this as primary weakness:** 25
- **Of those, in CISA KEV:** 0
- **New in 2026:** 17
- **CWE catalog version:** 4.21

## Description

The product uses an API function, data structure, or other entity in a way that relies on properties that are not always guaranteed to hold for that entity.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Porting | This can lead to resultant weaknesses when the required properties change, such as when the product is ported to a different platform. |
| Implementation | This can lead to resultant weaknesses if an interaction error (CWE-435) occurs. |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Other | Reduce Maintainability, Unexpected State, Quality Degradation | - |

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

## Demonstrative examples

### Example 1

This code assumes a particular function will always be found at a particular address. It assigns a pointer to that address and calls the function.

Bad code:

```c
int (*pt2Function) (float, char, char)=0x08040000;
int result2 = (*pt2Function) (12, 'a', 'b');
// Here we can inject code to execute.
```

The same function may not always be found at the same memory address. This could lead to a crash, or an attacker may alter the memory at the expected address, leading to arbitrary code execution.

### Example 2

The following function returns a stack address.

Bad code:

```c
char* getName() {
    char name[STR_MAX];
    fillInName(name);
    return name;
}
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2006-1902 | Change in C compiler behavior causes resultant buffer overflows in programs that depend on behaviors that were undefined in the C standard. |

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

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-4705 | Undefined behavior in the WebRTC: Signaling component | critical | 9.8 | - | No | 2026-03-24 |
| CVE-2026-4724 | Undefined behavior in the Audio/Video component | critical | 9.1 | - | No | 2026-03-24 |
| CVE-2026-21677 | iccDEV has Undefined Behavior in CIccCLUT::Init() | high | 8.8 | - | No | 2026-01-06 |
| CVE-2023-30624 | Wasmtime has Undefined Behavior in Rust runtime functions | high | 8.8 | - | No | 2023-04-27 |
| CVE-2026-100771 | Undefined behavior in the DOM: Streams component | high | 8.1 | - | No | 2026-09-29 |
| CVE-2026-4718 | Undefined behavior in the WebRTC: Signaling component | high | 8.1 | - | No | 2026-03-24 |
| CVE-2026-23274 | netfilter: xt\_IDLETIMER: reject rev0 reuse of ALARM timer labels | high | 7.8 | - | No | 2026-03-20 |
| CVE-2024-53126 | vdpa: solidrun: Fix UB bug with devres | high | 7.8 | - | No | 2024-12-04 |
| CVE-2024-50222 | iov\_iter: fix copy\_page\_from\_iter\_atomic() if KMAP\_LOCAL\_FORCE\_MAP | high | 7.8 | - | No | 2024-11-09 |
| CVE-2020-36433 | Unaligned memory allocation in chunky | high | 7.5 | - | No | 2021-08-08 |
| CVE-2026-16441 | Eclipse OpenJ9 : Method resolution default method precedence failure | medium | 6.9 | - | No | 2026-07-21 |
| CVE-2026-31436 | dmaengine: idxd: fix possible wrong descriptor completion in llist\_abort\_desc() | medium | 6.8 | - | No | 2026-04-22 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-710](https://radicalnotion.ai/cwe/cwe-710) | Improper Adherence to Coding Standards |
| Child | [CWE-474](https://radicalnotion.ai/cwe/cwe-474) | Use of Function with Inconsistent Implementations |
| Child | [CWE-562](https://radicalnotion.ai/cwe/cwe-562) | Return of Stack Variable Address |
| Child | [CWE-587](https://radicalnotion.ai/cwe/cwe-587) | Assignment of a Fixed Address to a Pointer |
| Child | [CWE-588](https://radicalnotion.ai/cwe/cwe-588) | Attempt to Access Child of a Non-structure Pointer |
| Child | [CWE-1038](https://radicalnotion.ai/cwe/cwe-1038) | Insecure Automated Optimizations |
| Child | [CWE-1102](https://radicalnotion.ai/cwe/cwe-1102) | Reliance on Machine-Dependent Data Representation |
| Child | [CWE-1103](https://radicalnotion.ai/cwe/cwe-1103) | Use of Platform-Dependent Third Party Components |
| Child | [CWE-1105](https://radicalnotion.ai/cwe/cwe-1105) | Insufficient Encapsulation of Machine-Dependent Functionality |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| CERT C Secure Coding | Ensure size arguments for variable length arrays are in a valid range | ARR32-C | CWE More Abstract |
| CERT C Secure Coding | Detect errors when converting a string to a number | ERR34-C | Imprecise |
| CERT C Secure Coding | Do not depend on the order of evaluation for side effects | EXP30-C | CWE More Abstract |
| CERT C Secure Coding | Do not read uninitialized memory | EXP33-C | CWE More Abstract |
| CERT C Secure Coding | Do not access a closed file | FIO46-C | CWE More Abstract |
| CERT C Secure Coding | Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand | INT34-C | CWE More Abstract |
| CERT C Secure Coding | Converting a pointer to integer or integer to pointer | INT36-C | CWE More Abstract |
| CERT C Secure Coding | Do not access freed memory | MEM30-C | CWE More Abstract |
| CERT C Secure Coding | Do not introduce unnecessary platform dependencies | MSC14-C | - |
| CERT C Secure Coding | Do not depend on undefined behavior | MSC15-C | - |
| CERT C Secure Coding | Ensure that control never reaches the end of a non-void function | MSC37-C | CWE More Abstract |

## Frequently asked questions

### What is CWE-758?

The product uses an API function, data structure, or other entity in a way that relies on properties that are not always guaranteed to hold for that entity.

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

25 recorded CVEs are attributed to CWE-758, including CVE-2026-4705, CVE-2026-4724 and CVE-2026-21677.

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

Exploiting CWE-758 can lead to: Reduce Maintainability, Unexpected State, Quality Degradation.

### Is CWE-758 actively exploited?

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

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

---

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