用户工具

站点工具


cwe:cn:definition:307

CWE-307:过多认证尝试的限制不恰当

Description Summary

The software does not implement sufficient measures to prevent multiple failed authentication attempts within in a short time frame, making it more susceptible to brute force attacks.

Common Consequences

Scope Technical Impace Note
Access_ControlBypass protection mechanismAn attacker could perform an arbitrary number of authentication attempts using different passwords, and eventually gain access to the targeted account.

Detection Methods

Detection Method - 1

=== Dynamic Analysis with automated results interpretation === According to SOAR, the following detection techniques may be useful:

Detection Method - 2

Dynamic Analysis with manual results interpretation

According to SOAR, the following detection techniques may be useful:

Detection Method - 3

Manual Static Analysis - Source Code

According to SOAR, the following detection techniques may be useful:

Detection Method - 4

Automated Static Analysis - Source Code

According to SOAR, the following detection techniques may be useful:

Detection Method - 5

Automated Static Analysis

According to SOAR, the following detection techniques may be useful:

Detection Method - 6

Architecture / Design Review

According to SOAR, the following detection techniques may be useful:

Potential Mitigations

Mitigation - 1

Architecture and Design

Common protection mechanisms include:

Mitigation - 2

Architecture and Design

Strategy:Libraries or Frameworks

Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.

For example, use anti-CSRF packages such as the OWASP CSRFGuard. [R.352.3]

Another example is the ESAPI Session Management control, which includes a component for CSRF. [R.352.9]

2013/05/30 09:36

Demonstrative Examples

Example - 1

In January 2009, an attacker was able to gain administrator access to a Twitter server because the server did not restrict the number of login attempts. The attacker targeted a member of Twitter's support team and was able to successfully guess the member's password using a brute force attack by guessing a large number of common words. Once the attacker gained access as the member of the support staff, he used the administrator panel to gain access to 33 accounts that belonged to celebrities and politicians. Ultimately, fake Twitter messages were sent that appeared to come from the compromised accounts.

Example - 2

The following code, extracted from a servlet's doPost() method, performs an authentication lookup every time the servlet is invoked.

String username = request.getParameter("username"); 
String password = request.getParameter("password"); 
 
int authResult = authenticateUser(username, password); 

However, the software makes no attempt to restrict excessive authentication attempts.

Example - 3

This code attempts to limit the number of login attempts by causing the process to sleep before completing the authentication.

$username = $_POST['username']; 
$password = $_POST['password']; 
sleep(2000); 
$isAuthenticated = authenticateUser($username, $password); 

However, there is no limit on parallel connections, so this does not increase the amount of time an attacker needs to complete an attack.

Example - 4

In the following C/C++ example the validateUser method opens a socket connection, reads a username and password from the socket and attempts to authenticate the username and password.

int validateUser(char *host, int port) 
{ 
int socket = openSocketConnection(host, port); 
if (socket < 0) { 
printf("Unable to open socket connection"); 
return(FAIL); 
 
} 
 
int isValidUser = 0; 
char username[USERNAME_SIZE]; 
char password[PASSWORD_SIZE]; 
 
while (isValidUser == 0) { 
if (getNextMessage(socket, username, USERNAME_SIZE) > 0) { 
if (getNextMessage(socket, password, PASSWORD_SIZE) > 0) { 
isValidUser = AuthenticateUser(username, password); 
 
} 
 
} 
 
} 
return(SUCCESS); 
 
} 

The validateUser method will continuously check for a valid username and password without any restriction on the number of authentication attempts made. The method should limit the number of authentication attempts made to prevent brute force attacks as in the following example code.

int validateUser(char *host, int port) 
{ 
... 
 
int count = 0; 
while ((isValidUser == 0) && (count < MAX_ATTEMPTS)) { 
if (getNextMessage(socket, username, USERNAME_SIZE) > 0) { 
if (getNextMessage(socket, password, PASSWORD_SIZE) > 0) { 
isValidUser = AuthenticateUser(username, password); 
 
} 
 
} 
count++; 
 
} 
if (isValidUser) { 
return(SUCCESS); 
 
} 
else { 
return(FAIL); 
 
} 
 
} 

Observed Examples

Reference Description
CVE-1999-1152Product does not disconnect or timeout after multiple failed logins.
CVE-2001-1291Product does not disconnect or timeout after multiple failed logins.
CVE-2001-0395Product does not disconnect or timeout after multiple failed logins.
CVE-2001-1339Product does not disconnect or timeout after multiple failed logins.
CVE-2002-0628Product does not disconnect or timeout after multiple failed logins.
CVE-1999-1324User accounts not disabled when they exceed a threshold; possibly a resultant problem.
cwe/cn/definition/307.txt · 最后更改: 2014/09/04 14:31 (外部编辑)