CWE-522 不充分的凭证保护机制
Insufficiently Protected Credentials
结构: Simple
Abstraction: Base
状态: Incomplete
被利用可能性: unkown
基本描述
This weakness occurs when the application transmits or stores authentication credentials and uses an insecure method that is susceptible to unauthorized interception and/or retrieval.
相关缺陷
-
cwe_Nature: ChildOf cwe_CWE_ID: 287 cwe_View_ID: 1000 cwe_Ordinal: Primary
-
cwe_Nature: ChildOf cwe_CWE_ID: 287 cwe_View_ID: 1003 cwe_Ordinal: Primary
-
cwe_Nature: ChildOf cwe_CWE_ID: 668 cwe_View_ID: 1000
常见的影响
范围 | 影响 | 注释 |
---|---|---|
Access Control | Gain Privileges or Assume Identity | An attacker could gain access to user accounts and access sensitive data used by the user accounts. |
可能的缓解方案
Architecture and Design
策略:
Use an appropriate security mechanism to protect the credentials.
Architecture and Design
策略:
Make appropriate use of cryptography to protect the credentials.
Implementation
策略:
Use industry standards to protect the credentials (e.g. LDAP, keystore, etc.).
示例代码
例
This code changes a user's password.
bad PHP
$pass = $_GET['pass'];
$checkpass = $_GET['checkpass'];
if ($pass == $checkpass) {
}
While the code confirms that the requesting user typed the same new password twice, it does not confirm that the user requesting the password change is the same user whose password will be changed. An attacker can request a change of another user's password and gain control of the victim's account.
例
The following code reads a password from a properties file and uses the password to connect to a database.
bad Java
Properties prop = new Properties();
prop.load(new FileInputStream("config.properties"));
String password = prop.getProperty("password");
DriverManager.getConnection(url, usr, password);
...
This code will run successfully, but anyone who has access to config.properties can read the value of password. If a devious employee has access to this information, they can use it to break into the system.
例
The following code reads a password from the registry and uses the password to create a new network credential.
bad Java
String password = regKey.GetValue(passKey).toString();
NetworkCredential netCred = new NetworkCredential(username,password,domain);
...
This code will run successfully, but anyone who has access to the registry key used to store the password can read the value of password. If a devious employee has access to this information, they can use it to break into the system
例
Both of these examples verify a password by comparing it to a stored compressed version.
bad C
return(0);
}
printf("Entering Diagnostic Mode...n");
return(1);
}
bad Java
}
//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.
分析过的案例
标识 | 说明 | 链接 |
---|---|---|
CVE-2007-0681 | Web app allows remote attackers to change the passwords of arbitrary users without providing the original password, and possibly perform other unauthorized actions. | https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-0681 |
CVE-2000-0944 | Web application password change utility doesn't check the original password. | https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-0944 |
CVE-2005-3435 | product authentication succeeds if user-provided MD5 hash matches the hash in its database; this can be subjected to replay attacks. | https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-3435 |
CVE-2005-0408 | chain: product generates predictable MD5 hashes using a constant value combined with username, allowing authentication bypass. | https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-0408 |
分类映射
映射的分类名 | ImNode ID | Fit | Mapped Node Name |
---|---|---|---|
OWASP Top Ten 2007 | A7 | CWE More Specific | Broken Authentication and Session Management |
OWASP Top Ten 2004 | A3 | CWE More Specific | Broken Authentication and Session Management |
相关攻击模式
- CAPEC-102
- CAPEC-474
- CAPEC-50
- CAPEC-551
- CAPEC-555
- CAPEC-560
- CAPEC-561
- CAPEC-644
- CAPEC-645
引用
文章来源于互联网:scap中文网
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论