CWE-313 在文件或磁盘上的明文存储

Cleartext Storage in a File or on Disk

结构: Simple

Abstraction: Variant

状态: Draft

被利用可能性: unkown

基本描述

The application stores sensitive information in cleartext in a file, or on disk.

扩展描述

The sensitive information could be read by attackers with access to the file, or with physical or administrator access to the raw disk. Even if the information is encoded in a way that is not human-readable, certain techniques could determine which encoding is being used, then decode the information.

相关缺陷

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

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

适用平台

Language: {'cwe_Class': 'Language-Independent', 'cwe_Prevalence': 'Undetermined'}

常见的影响

范围 影响 注释
Confidentiality Read Application Data

示例代码

The following examples show a portion of properties and configuration files for Java and ASP.NET applications. The files include username and password information but they are stored in cleartext.

This Java example shows a properties file with a cleartext username / password pair.

bad Java


# Java Web App ResourceBundle properties file
...
webapp.ldap.username=secretUsername
webapp.ldap.password=secretPassword
...

The following example shows a portion of a configuration file for an ASP.Net application. This configuration file includes username and password information for a connection to a database but the pair is stored in cleartext.

bad ASP.NET

...
<connectionStrings>
<add name="ud_DEV" connectionString="connectDB=uDB; uid=db2admin; pwd=password; dbalias=uDB;" providerName="System.Data.Odbc" />
</connectionStrings>
...

Username and password information should not be included in a configuration file or a properties file in cleartext as this will allow anyone who can read the file access to the resource. If possible, encrypt this information and avoid CWE-260 and CWE-13

分析过的案例

标识 说明 链接
CVE-2001-1481 Cleartext credentials in world-readable file. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-1481
CVE-2005-1828 Password in cleartext in config file. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-1828
CVE-2005-2209 Password in cleartext in config file. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-2209
CVE-2002-1696 Decrypted copy of a message written to disk given a combination of options and when user replies to an encrypted message. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-1696
CVE-2004-2397 Cleartext storage of private key and passphrase in log file when user imports the key. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-2397

Notes

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
PLOVER Plaintext Storage in File or on Disk
Software Fault Patterns SFP23 Exposed Data