CWE-591: Sensitive Data Storage in Improperly Locked Memory

VariantDraft

The product stores sensitive data in memory that is not locked, or that has been incorrectly locked, which might cause the memory to be written to swap files on disk by the virtual memory manager. This can make the data more accessible to external actors.

View on MITRE
Back to CWE Lookup

Extended Description

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. Therefore, it is unsuitable for use as a protection mechanism for sensitive data. 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. Return values for both of these calls must be checked to ensure that the lock operation was actually successful.

Technical Details

Structure
Simple
Vulnerability Mapping
ALLOWED

Applicable To

Languages
Not Language-Specific
Platforms

Source-backed guidance

Additional facts reviewed against primary or authoritative security sources.

Verify controls for CWE-591 with SSDF evidence

Use NIST SSDF verification and vulnerability-response practices to detect CWE-591, Sensitive Data Storage in Improperly Locked Memory, throughout the product lifecycle. Derive review questions, static or dynamic checks, and negative tests from the CWE's causal behavior; define the components and lifecycle stages each check covers; and retain findings with enough evidence to distinguish the root cause from symptoms and impacts. Track escapes and false negatives, then improve the verification plan after every confirmed occurrence.

NIST SP 800-218 Secure Software Development FrameworkNational Institute of Standards and Technology

Address Sensitive Data Storage in Improperly Locked Memory during Architecture and Design

MITRE associates mitigation with Architecture and Design, and Implementation; recorded impacts include Read Application Data, and Read Memory; observed examples include CVE-2024-38106. Use these source-defined anchors to turn CWE-591 into implementation, review, and verification checks for the affected component.

CWE-591: Sensitive Data Storage in Improperly Locked MemoryMITRE CWE

Triage CWE-591 against known exploitation evidence

Use CISA's Known Exploited Vulnerabilities catalog to test whether a vulnerability mapped to CWE-591, Sensitive Data Storage in Improperly Locked Memory, has evidence of exploitation in the wild. Confirm the CVE-to-CWE root-cause mapping independently before attaching the example, then capture the affected product, required action, and remediation deadline. A missing KEV match is not evidence that the weakness is unexploited, and a KEV entry must not be generalized to every occurrence of this CWE.

Known Exploited Vulnerabilities CatalogCybersecurity and Infrastructure Security Agency

Apply precise root-cause mapping to CWE-591

Apply MITRE's full root-cause mapping guidance when using CWE-591, Sensitive Data Storage in Improperly Locked Memory. Separate weakness language from attacker prerequisites and technical impact, check the entry's abstraction and vulnerability-mapping notes, and prefer the most specific Base or Variant supported by the evidence. Record the rejected alternatives and require an independent review before the mapping is used for remediation trends or program metrics.

CVE to CWE Root Cause Mapping GuidanceMITRE CWE

Validate CWE-591 with root-cause mapping checks

Apply MITRE's root-cause mapping quick tips to CWE-591, Sensitive Data Storage in Improperly Locked Memory. Confirm the finding describes the causal weakness rather than an impact or attack pattern, compare the abstraction and mapping notes with plausible alternatives, and have a second reviewer challenge the selection. Preserve the evidence and reasoning so recurring defects can be measured against one consistent identifier.

CVE to CWE Root Cause Mapping Quick TipsMITRE CWE

Frequently Asked Questions

What is CWE-591: Sensitive Data Storage in Improperly Locked Memory?+

CWE-591: Sensitive Data Storage in Improperly Locked Memory is a Common Weakness Enumeration (CWE) entry maintained by MITRE. The product stores sensitive data in memory that is not locked, or that has been incorrectly locked, which might cause the memory to be written to swap files on disk by the virtual memory manager. This can make the data more accessible to external actors. 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. Therefore, it is unsuitable for use as a protection mechanism for sensitive data. 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. Return values for both of these calls must be checked to ensure that the lock operation was actually successful.

What are the security consequences of Sensitive Data Storage in Improperly Locked Memory?+

If exploited, CWE-591 (Sensitive Data Storage in Improperly Locked Memory) it can compromise Confidentiality, leading to outcomes such as Read Application Data and Read Memory.

How do you prevent or mitigate Sensitive Data Storage in Improperly Locked Memory?+

Recommended mitigations for CWE-591 include: Identify data that needs to be protected from swapping and choose platform-appropriate protection mechanisms. Check return values to ensure locking operations are successful.

Which programming languages are affected by Sensitive Data Storage in Improperly Locked Memory?+

CWE-591 commonly affects Not Language-Specific. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.

What are real-world examples of Sensitive Data Storage in Improperly Locked Memory?+

MITRE documents real CVEs mapped to CWE-591, including CVE-2024-38106. 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-591 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

Advertisement