CWE-825: Expired Pointer Dereference

Export to Word

Description

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

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.


ThreatScore

Threat Mapped score: 1.9

Industry: Finiancial

Threat priority: P3 - Important (Medium)


Observed Examples (CVEs)

Related Attack Patterns (CAPEC)

N/A


Attack TTPs

N/A

Modes of Introduction

Phase Note
None listed.

Common Consequences

Potential Mitigations

Applicable Platforms


Demonstrative Examples

Intro: The following code shows a simple example of a use after free error:

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

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

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

Body: Double free vulnerabilities have two common (and sometimes overlapping) causes:

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

Notes

← Back to CWE list