1330
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.
Relationships
The table(s) below shows the weaknesses and high level categories that are related to this
weakness. These relationships are defined as ChildOf, ParentOf, MemberOr and give insight to
similar items that may exist at higher and lower levels of abstraction. In addition, relationships such
as PeerOf and CanAlsoBe are defined to show similar weaknesses that may want to be explored.
Relevant to the view "Research Concepts" (CWE-1000)
Nature Type ID Name Page
ChildOf 413 Improper Resource Locking 1003
Common Consequences
Scope Impact Likelihood
Confidentiality Read Application Data
Read Memory
Sensitive data that is written to a swap file may be
exposed.
Potential Mitigations
Phase: Architecture and Design
Identify data that needs to be protected from swapping and choose platform-appropriate
protection mechanisms.
Phase: Implementation
Check return values to ensure locking operations are successful.
Affected Resources
• Memory
MemberOf Relationships
This MemberOf relationships table shows additional CWE Catgeories and Views that reference this
weakness as a member. This information is often useful in understanding where a weakness fits
within the context of external information sources.
Nature Type ID Name Page
MemberOf 729 OWASP Top Ten 2004 Category A8 - Insecure Storage 711 2338
MemberOf 742 CERT C Secure Coding Standard (2008) Chapter 9 -
Memory Management (MEM)
734 2345
MemberOf 876 CERT C++ Secure Coding Section 08 - Memory
Management (MEM)
868 2376
MemberOf 963 SFP Secondary Cluster: Exposed Data 888 2400
MemberOf 1401 Comprehensive Categorization: Concurrency 1400 2526
Taxonomy Mappings
Mapped Taxonomy Name Node ID Fit Mapped Node Name
OWASP Top Ten 2004 A8 CWE More Specific Insecure Storage
CWE Version 4.14
CWE-593: Authentication Bypass: OpenSSL CTX Object Modified after SSL Objects are Created
CWE-593: Authentication Bypass: OpenSSL CTX
Object Modified after SSL Objects are Created