---
title: "CWE-591: Sensitive Data Storage in Improperly Locked Memory"
url: https://radicalnotion.ai/cwe/cwe-591
type: cwe
description: "The product stores sensitive data in memory that is not locked, or that has been incorrectly locked."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-591: Sensitive Data Storage in Improperly Locked Memory

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 75
- **Of those, in CISA KEV:** 2
- **New in 2026:** 0
- **CWE catalog version:** 4.21

## Description

The product stores sensitive data in memory that is not locked, or that has been incorrectly locked.

## Background

On Windows systems, the VirtualLock function can lock a page of memory to ensure that it will remain present in memory and not be swapped to disk. However, on older versions of Windows, such as 95, 98, or Me, the VirtualLock() function is only a stub and provides no protection. On POSIX systems, the mlock() call ensures that a page will stay resident in memory but does not guarantee that the page will not appear in the swap. Some platforms, in particular Linux, do make the guarantee that the page will not be swapped, but this is non-standard and is not portable. Calls to mlock() also require supervisor privilege.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | The developer might use functions such as VirtualLock() or mlock(). On some systems, this does not guarantee that the page will not appear in the swap. See Background Details. |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality | Read Application Data, Read Memory | The memory, including sensitive data, might be written to swap files on disk by the virtual memory manager, possibly making the data more accessible to adversaries. |

## Potential mitigations

### Architecture and Design

Identify data that needs to be protected from swapping and choose platform-appropriate protection mechanisms.

### Implementation

When using potentially risky functions such as mlock() or VirtualLock(), check return values to ensure that locking operations are successful.

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2024-38106 | OS kernel stores sensitive data in improperly locked memory, allowing local users to gain privileges by winning a race condition |

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

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2023-28229 | Windows CNG Key Isolation Service Elevation of Privilege Vulnerability | high | 8.8 | - | Yes | 2023-04-11 |
| CVE-2024-38106 | Windows Kernel Elevation of Privilege Vulnerability | high | 7.0 | - | Yes | 2024-08-13 |
| CVE-2024-38131 | Clipboard Virtual Channel Extension Remote Code Execution Vulnerability | high | 8.8 | - | No | 2024-08-13 |
| CVE-2025-27482 | Windows Remote Desktop Services Remote Code Execution Vulnerability | high | 8.1 | - | No | 2025-04-08 |
| CVE-2025-24045 | Windows Remote Desktop Services Remote Code Execution Vulnerability | high | 8.1 | - | No | 2025-03-11 |
| CVE-2025-24035 | Windows Remote Desktop Services Remote Code Execution Vulnerability | high | 8.1 | - | No | 2025-03-11 |
| CVE-2025-21224 | Windows Line Printer Daemon (LPD) Service Remote Code Execution Vulnerability | high | 8.1 | - | No | 2025-01-14 |
| CVE-2025-21309 | Windows Remote Desktop Services Remote Code Execution Vulnerability | high | 8.1 | - | No | 2025-01-14 |
| CVE-2025-21294 | Microsoft Digest Authentication Remote Code Execution Vulnerability | high | 8.1 | - | No | 2025-01-14 |
| CVE-2024-49128 | Windows Remote Desktop Services Remote Code Execution Vulnerability | high | 8.1 | - | No | 2024-12-10 |
| CVE-2024-49132 | Windows Remote Desktop Services Remote Code Execution Vulnerability | high | 8.1 | - | No | 2024-12-10 |
| CVE-2024-49123 | Windows Remote Desktop Services Remote Code Execution Vulnerability | high | 8.1 | - | No | 2024-12-10 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-413](https://radicalnotion.ai/cwe/cwe-413) | Improper Resource Locking |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| OWASP Top Ten 2004 | Insecure Storage | A8 | CWE More Specific |
| CERT C Secure Coding | Ensure that sensitive data is not written out to disk | MEM06-C | - |
| Software Fault Patterns | Exposed Data | SFP23 | - |

## Frequently asked questions

### What is CWE-591?

The product stores sensitive data in memory that is not locked, or that has been incorrectly locked.

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

75 recorded CVEs are attributed to CWE-591, including CVE-2023-28229, CVE-2024-38106 and CVE-2024-38131. 2 are listed in CISA's Known Exploited Vulnerabilities (KEV) catalog.

### Is CWE-591 part of the OWASP Top 10?

CWE-591 maps to OWASP Top Ten 2004: Insecure Storage (A8) in the OWASP security taxonomy.

### How do you prevent CWE-591?

Identify data that needs to be protected from swapping and choose platform-appropriate protection mechanisms.

### What are the consequences of CWE-591?

Exploiting CWE-591 can lead to: Read Application Data, Read Memory.

### Is CWE-591 actively exploited?

Yes. 2 CWE-591 vulnerabilities are in CISA's KEV catalog of actively exploited flaws, out of 75 recorded CVEs.

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

---

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