---
title: "CWE-415: Double Free"
url: https://radicalnotion.ai/cwe/cwe-415
type: cwe
description: "The product calls free() twice on the same memory address."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-415: Double Free

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Draft
- **Likelihood of exploit:** High
- **CVEs with this as primary weakness:** 961
- **Of those, in CISA KEV:** 5
- **New in 2026:** 299
- **CWE catalog version:** 4.21

## Description

The product calls free() twice on the same memory address.

## Alternate terms

- Double-free

## Modes of introduction

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

## Applicable platforms

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

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Integrity, Confidentiality, Availability | Modify Memory, Execute Unauthorized Code or Commands | - |

## Potential mitigations

### Architecture and Design

Choose a language that provides automatic memory management.

### Implementation

Ensure that each allocation is freed only once. After freeing a chunk, set the pointer to NULL to ensure the pointer cannot be freed again. In complicated error conditions, be sure that clean-up routines respect the state of allocation properly. If the language is object oriented, ensure that object destructors delete each chunk of memory only once.

### Implementation

Use a static analysis tool to find double free instances.

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

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

The following code shows a simple example of a double free vulnerability.

Bad code:

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

### Example 2

While contrived, this code should be exploitable on Linux distributions that do not ship with heap-chunk check summing turned on.

Bad code:

```c
#include <stdio.h>
#include <unistd.h>
#define BUFSIZE1 512
#define BUFSIZE2 ((BUFSIZE1/2) - 8)

int main(int argc, char **argv) {
    char *buf1R1;
    char *buf2R1;
    char *buf1R2;
    buf1R1 = (char *) malloc(BUFSIZE2);
    buf2R1 = (char *) malloc(BUFSIZE2);
    free(buf1R1);
    free(buf2R1);
    buf1R2 = (char *) malloc(BUFSIZE1);
    strncpy(buf1R2, argv[1], BUFSIZE1-1);
    free(buf2R1);
    free(buf1R2);
}
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2006-5051 | Chain: Signal handler contains too much functionality (CWE-828), introducing a race condition (CWE-362) that leads to a double free (CWE-415). |
| CVE-2004-0642 | Double free resultant from certain error conditions. |
| CVE-2004-0772 | Double free resultant from certain error conditions. |
| CVE-2005-1689 | Double free resultant from certain error conditions. |
| CVE-2003-0545 | Double free from invalid ASN.1 encoding. |
| CVE-2003-1048 | Double free from malformed GIF. |
| CVE-2005-0891 | Double free from malformed GIF. |
| CVE-2002-0059 | Double free from malformed compressed data. |

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

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-33824 | Windows Internet Key Exchange (IKE) Service Extensions Remote Code Execution Vulnerability | critical | 9.8 | - | Yes | 2026-04-14 |
| CVE-2014-0502 | Adobe Flash Player Double Free Vulnerablity | high | 8.7 | - | Yes | 2014-02-21 |
| CVE-2020-9859 | Apple Multiple Products Code Execution Vulnerability | high | 8.5 | - | Yes | 2020-06-05 |
| CVE-2018-4990 | Adobe Acrobat and Reader Double Free Vulnerability | high | 8.4 | - | Yes | 2018-07-09 |
| CVE-2021-22600 | Double Free in net/packet/af\_packet.c leading to priviledge escalation | high | 7.3 | - | Yes | 2022-01-26 |
| CVE-2018-0101 | Cisco Adaptive Security Appliance Remote Code Execution and Denial of Service Vulnerability | critical | 10.0 | - | No | 2018-01-29 |
| CVE-2026-89078 | Double Free in GitLab | critical | 9.9 | - | No | 2026-09-23 |
| CVE-2026-112732 | Microsoft Office Visio Remote Code Execution Vulnerability | critical | 9.8 | - | No | 2026-11-24 |
| CVE-2026-56971 | - | critical | 9.8 | - | No | 2026-11-10 |
| CVE-2026-95901 | Microsoft DirectMusic Remote Code Execution Vulnerability | critical | 9.8 | - | No | 2026-11-10 |
| CVE-2026-88218 | Windows DNS Remote Code Execution Vulnerability | critical | 9.8 | - | No | 2026-11-10 |
| CVE-2026-58968 | Elevation of privilege in System | critical | 9.8 | - | No | 2026-11-02 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-666](https://radicalnotion.ai/cwe/cwe-666) | Operation on Resource in Wrong Phase of Lifetime |
| Parent | [CWE-672](https://radicalnotion.ai/cwe/cwe-672) | Operation on a Resource after Expiration or Release |
| Parent | [CWE-825](https://radicalnotion.ai/cwe/cwe-825) | Expired Pointer Dereference |
| Parent | [CWE-1341](https://radicalnotion.ai/cwe/cwe-1341) | Multiple Releases of Same Resource or Handle |
| Peer | [CWE-123](https://radicalnotion.ai/cwe/cwe-123) | Write-what-where Condition |
| Peer | [CWE-416](https://radicalnotion.ai/cwe/cwe-416) | Use After Free |
| Related | [CWE-364](https://radicalnotion.ai/cwe/cwe-364) | Signal Handler Race Condition |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | DFREE - Double-Free Vulnerability | - | - |
| 7 Pernicious Kingdoms | Double Free | - | - |
| CLASP | Doubly freeing memory | - | - |
| CERT C Secure Coding | Allocate and free memory in the same module, at the same level of abstraction | MEM00-C | - |
| CERT C Secure Coding | Store a new value in pointers immediately after free() | MEM01-C | - |
| CERT C Secure Coding | Do not access freed memory | MEM30-C | CWE More Specific |
| CERT C Secure Coding | Free dynamically allocated memory exactly once | MEM31-C | - |
| Software Fault Patterns | Faulty Memory Release | SFP12 | - |

## Frequently asked questions

### What is CWE-415?

The product calls free() twice on the same memory address.

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

961 recorded CVEs are attributed to CWE-415, including CVE-2026-33824, CVE-2014-0502 and CVE-2020-9859. 5 are listed in CISA's Known Exploited Vulnerabilities (KEV) catalog.

### How do you prevent CWE-415?

Choose a language that provides automatic memory management.

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

Exploiting CWE-415 can lead to: Modify Memory, Execute Unauthorized Code or Commands.

### Is CWE-415 actively exploited?

Yes. 5 CWE-415 vulnerabilities are in CISA's KEV catalog of actively exploited flaws, out of 961 recorded CVEs.

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

---

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