CWE-591 敏感数据存储于加锁不恰当的内存区域

Sensitive Data Storage in Improperly Locked Memory

结构: Simple

Abstraction: Variant

状态: Draft

被利用可能性: unkown

基本描述

The application 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.

相关缺陷

  • cwe_Nature: ChildOf cwe_CWE_ID: 413 cwe_View_ID: 1000 cwe_Ordinal: Primary

  • cwe_Nature: ChildOf cwe_CWE_ID: 413 cwe_View_ID: 699 cwe_Ordinal: Primary

常见的影响

范围 影响 注释
Confidentiality ['Read Application Data', 'Read Memory'] Sensitive data that is written to a swap file may be exposed.

可能的缓解方案

Architecture and Design

策略:

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

Implementation

策略:

Check return values to ensure locking operations are successful.

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
OWASP Top Ten 2004 A8 CWE More Specific Insecure Storage
CERT C Secure Coding MEM06-C Ensure that sensitive data is not written out to disk
Software Fault Patterns SFP23 Exposed Data