Description
The product does not implement sufficient measures to prevent multiple failed authentication attempts within a short time frame.
Potential Impact
Access Control
Bypass Protection Mechanism
Demonstrative Examples
String username = request.getParameter("username");String password = request.getParameter("password");
int authResult = authenticateUser(username, password);$username = $_POST['username'];$password = $_POST['password'];sleep(2000);$isAuthenticated = authenticateUser($username, $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);
}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);}
}Mitigations & Prevention
Common protection mechanisms include:
Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482]. Consider using libraries with authentication capabilities such as OpenSSL or the ESAPI Authenticator. [REF-45]
Detection Methods
- Dynamic Analysis with Automated Results Interpretation High — According to SOAR [REF-1479], the following detection techniques may be useful:
- Dynamic Analysis with Manual Results Interpretation High — According to SOAR [REF-1479], the following detection techniques may be useful:
- Manual Static Analysis - Source Code High — According to SOAR [REF-1479], the following detection techniques may be useful:
- Automated Static Analysis - Source Code SOAR Partial — According to SOAR [REF-1479], the following detection techniques may be useful:
- Automated Static Analysis SOAR Partial — According to SOAR [REF-1479], the following detection techniques may be useful:
- Architecture or Design Review High — According to SOAR [REF-1479], the following detection techniques may be useful:
Real-World CVE Examples
| CVE ID | Description |
|---|---|
| CVE-2019-0039 | the REST API for a network OS has a high limit for number of connections, allowing brute force password guessing |
| CVE-1999-1152 | Product does not disconnect or timeout after multiple failed logins. |
| CVE-2001-1291 | Product does not disconnect or timeout after multiple failed logins. |
| CVE-2001-0395 | Product does not disconnect or timeout after multiple failed logins. |
| CVE-2001-1339 | Product does not disconnect or timeout after multiple failed logins. |
| CVE-2002-0628 | Product does not disconnect or timeout after multiple failed logins. |
| CVE-1999-1324 | User accounts not disabled when they exceed a threshold; possibly a resultant problem. |
Related Weaknesses
Taxonomy Mappings
- PLOVER: AUTHENT.MULTFAIL — Multiple Failed Authentication Attempts not Prevented
- Software Fault Patterns: SFP34 — Unrestricted authentication
Frequently Asked Questions
What is CWE-307?
CWE-307 (Improper Restriction of Excessive Authentication Attempts) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Base-level weakness. The product does not implement sufficient measures to prevent multiple failed authentication attempts within a short time frame.
How can CWE-307 be exploited?
Attackers can exploit CWE-307 (Improper Restriction of Excessive Authentication Attempts) to bypass protection mechanism. This weakness is typically introduced during the Architecture and Design phase of software development.
How do I prevent CWE-307?
Key mitigations include: Common protection mechanisms include:
What is the severity of CWE-307?
CWE-307 is classified as a Base-level weakness (Medium abstraction). It has been observed in 7 real-world CVEs.