CWE-257 以可恢复格式存储口令

admin 2022年1月5日21:04:47评论64 views字数 2547阅读8分29秒阅读模式

CWE-257 以可恢复格式存储口令

Storing Passwords in a Recoverable Format

结构: Simple

Abstraction: Base

状态: Incomplete

被利用可能性: High

基本描述

The storage of passwords in a recoverable format makes them subject to password reuse attacks by malicious users. In fact, it should be noted that recoverable encrypted passwords provide no significant benefit over plaintext passwords since they are subject not only to reuse by malicious attackers but also by malicious insiders. If a system administrator can recover a password directly, or use a brute force search on the available information, the administrator can use the password on other accounts.

相关缺陷

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

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

  • cwe_Nature: PeerOf cwe_CWE_ID: 259 cwe_View_ID: 1000

适用平台

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

常见的影响

范围 影响 注释
['Confidentiality', 'Access Control'] Gain Privileges or Assume Identity User's passwords may be revealed.
Access Control Gain Privileges or Assume Identity Revealed passwords may be reused elsewhere to impersonate the users in question.

可能的缓解方案

Architecture and Design

策略:

Use strong, non-reversible encryption to protect stored passwords.

示例代码

Both of these examples verify a password by comparing it to a stored compressed version.

bad C

int VerifyAdmin(char *password) {

if (strcmp(compress(password), compressed_password)) {

printf("Incorrect Password!n");
return(0);

}
printf("Entering Diagnostic Mode...n");
return(1);

}

bad Java

int VerifyAdmin(String password) {

if (passwd.Equals(compress(password), compressed_password)) {

return(0);

}
//Diagnostic Mode

return(1);

}

Because a compression algorithm is used instead of a one way hashing algorithm, an attacker can recover compressed passwords stored in the database.

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 plaintext.

This Java example shows a properties file with a plaintext 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 plaintext.

bad ASP.NET

...


...

Username and password information should not be included in a configuration file or a properties file in plaintext 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.

Notes

分类映射

映射的分类名 ImNode ID Fit Mapped Node Name
CLASP Storing passwords in a recoverable format
Software Fault Patterns SFP23 Exposed Data

相关攻击模式

  • CAPEC-49

文章来源于互联网:scap中文网

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年1月5日21:04:47
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   CWE-257 以可恢复格式存储口令http://cn-sec.com/archives/612809.html

发表评论

匿名网友 填写信息