---
title: "CWE-825: Expired Pointer Dereference"
url: https://radicalnotion.ai/cwe/cwe-825
type: cwe
description: "The product dereferences a pointer that contains a location for memory that was previously valid, but is no longer valid."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-825: Expired Pointer Dereference

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

## Description

The product dereferences a pointer that contains a location for memory that was previously valid, but is no longer valid.

## Background

When a product releases memory, but it maintains a pointer to that memory, then the memory might be re-allocated at a later time. If the original pointer is accessed to read or write data, then this could cause the product to read or modify data that is in use by a different function or process.

## Alternate terms

- Dangling pointer

## Modes of introduction

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

## Applicable platforms

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

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality | Read Memory | If the expired pointer is used in a read operation, an attacker might be able to control data read in by the application. |
| Availability | DoS: Crash, Exit, or Restart | If the expired pointer references a memory location that is not accessible to the product, or points to a location that is "malformed" (such as NULL) or larger than expected by a read or write operation, then a crash may occur. |
| Integrity, Confidentiality, Availability | Execute Unauthorized Code or Commands | If the expired pointer is used in a function call, or points to unexpected data in a write operation, then code execution may be possible. |

## Potential mitigations

### Architecture and Design

Choose a language that provides automatic memory management.

### Implementation

When freeing pointers, be sure to set them to NULL once they are freed. However, the utilization of multiple or complex data structures may lower the usefulness of this strategy.

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

### 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 following code shows a simple example of a use after free error:

Bad code:

```c
char* ptr = (char*)malloc (SIZE);
if (err) {
    abrt = 1;
    free(ptr);
}
...
if (abrt) {
    logError("operation aborted before commit", ptr);
}
```

When an error occurs, the pointer is immediately freed. However, this pointer is later incorrectly used in the logError function.

### Example 2

The following code shows a simple example of a double free error:

Bad code:

```c
char* ptr = (char*)malloc (SIZE);
...
if (abrt) {
    free(ptr);
}
...
free(ptr);
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2023-26463 | Chain: IPSec VPN product uses the same variable for multiple purposes in the same function (CWE-1109), leading to incorrect access control (CWE-284) and expired pointer dereference (CWE-825) |
| CVE-2008-5013 | access of expired memory address leads to arbitrary code execution |
| CVE-2010-3257 | stale pointer issue leads to denial of service and possibly other consequences |
| CVE-2008-0062 | Chain: a message having an unknown message type may cause a reference to uninitialized memory resulting in a null pointer dereference (CWE-476) or dangling pointer (CWE-825), possibly crashing the system or causing heap corruption. |
| CVE-2007-1211 | read of value at an offset into a structure after the offset is no longer valid |

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

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2015-6791 | chromium-browser: Various fixes from internal audits, fuzzing and other initiatives | critical | 10.0 | - | No | 2015-12-14 |
| CVE-2026-99761 | batman-adv: stop originator purge worker before freeing TT | critical | 9.8 | - | No | 2026-11-20 |
| CVE-2026-99690 | ocfs2: cache the mount context for dentry lock callbacks | critical | 9.8 | - | No | 2026-11-20 |
| CVE-2026-99634 | mptcp: do not use Fast Open on MP\_JOIN subflows | critical | 9.8 | - | No | 2026-11-20 |
| CVE-2026-99513 | lockd: Fix use-after-free in nlmsvc\_retry\_blocked | critical | 9.8 | - | No | 2026-11-19 |
| CVE-2026-99310 | nfsd: hold cl\_lock in client\_has\_openowners() | critical | 9.8 | - | No | 2026-11-16 |
| CVE-2026-98548 | sctp: discard the rest of the packet on a stale-cookie error | critical | 9.8 | - | No | 2026-10-18 |
| CVE-2026-98490 | net: openvswitch: conntrack: fix helper UAF due to extensions realloc | critical | 9.8 | - | No | 2026-10-18 |
| CVE-2026-98370 | xfrm: fix compat ALLOCSPI request use-after-free | critical | 9.8 | - | No | 2026-10-06 |
| CVE-2026-98341 | wifi: cfg80211: don't free driver-owned scan requests | critical | 9.8 | - | No | 2026-10-06 |
| CVE-2026-98330 | wifi: cfg80211: get the wiphy out of a dying network namespace | critical | 9.8 | - | No | 2026-10-06 |
| CVE-2026-98320 | netfilter: flowtable: hold reference on ct until flow is released | critical | 9.8 | - | No | 2026-10-06 |

## 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-672](https://radicalnotion.ai/cwe/cwe-672) | Operation on a Resource after Expiration or Release |
| Child | [CWE-415](https://radicalnotion.ai/cwe/cwe-415) | Double Free |
| Child | [CWE-416](https://radicalnotion.ai/cwe/cwe-416) | Use After Free |
| Can precede | [CWE-125](https://radicalnotion.ai/cwe/cwe-125) | Out-of-bounds Read |
| Can precede | [CWE-787](https://radicalnotion.ai/cwe/cwe-787) | Out-of-bounds Write |
| Related | [CWE-562](https://radicalnotion.ai/cwe/cwe-562) | Return of Stack Variable Address |

## Frequently asked questions

### What is CWE-825?

The product dereferences a pointer that contains a location for memory that was previously valid, but is no longer valid.

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

808 recorded CVEs are attributed to CWE-825, including CVE-2015-6791, CVE-2026-99761 and CVE-2026-99690.

### How do you prevent CWE-825?

Choose a language that provides automatic memory management.

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

Exploiting CWE-825 can lead to: Read Memory, DoS: Crash, Exit, or Restart, Execute Unauthorized Code or Commands.

### Is CWE-825 actively exploited?

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

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

---

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