CWE-825: Expired Pointer Dereference

BaseIncomplete

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

View on MITRE
Back to CWE Lookup

Extended Description

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. Depending on how the newly-allocated memory is used, this could lead to a denial of service, information exposure, or code execution.

Technical Details

Structure
Simple

Applicable To

Languages
CC++
Platforms

Frequently Asked Questions

What is CWE-825: Expired Pointer Dereference?+

CWE-825: Expired Pointer Dereference is a Common Weakness Enumeration (CWE) entry maintained by MITRE. The product dereferences a pointer that contains a location for memory that was previously valid, but is no longer valid. 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. Depending on how the newly-allocated memory is used, this could lead to a denial of service, information exposure, or code execution.

What are the security consequences of Expired Pointer Dereference?+

If exploited, CWE-825 (Expired Pointer Dereference) it can compromise Confidentiality, Availability and Integrity, leading to outcomes such as Read Memory, DoS: Crash, Exit, or Restart and Execute Unauthorized Code or Commands.

How do you prevent or mitigate Expired Pointer Dereference?+

Recommended mitigations for CWE-825 include: Choose a language that provides automatic memory management. 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.

Which programming languages are affected by Expired Pointer Dereference?+

CWE-825 commonly affects C and C++. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.

What are real-world examples of Expired Pointer Dereference?+

MITRE documents real CVEs mapped to CWE-825, including CVE-2008-5013, CVE-2010-3257, CVE-2008-0062 and CVE-2007-1211. You can look up the full details of each CVE, including CVSS scores and remediation guidance, on our CVE Lookup tool.

What is the difference between a CWE and a CVE?+

A CWE (Common Weakness Enumeration) like CWE-825 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.

Learn More