{"@ID": "307", "@Name": "Improper Restriction of Excessive Authentication Attempts", "@Abstraction": "Base", "@Structure": "Simple", "@Status": "Draft", "@Diagram": "/data/images/CWE-307-Diagram.png", "Description": "The product does not implement sufficient measures to prevent multiple failed authentication attempts within a short time frame.", "Related_Weaknesses": {"Related_Weakness": [{"@Nature": "ChildOf", "@CWE_ID": "1390", "@View_ID": "1000", "@Ordinal": "Primary"}, {"@Nature": "ChildOf", "@CWE_ID": "287", "@View_ID": "1003", "@Ordinal": "Primary"}, {"@Nature": "ChildOf", "@CWE_ID": "799", "@View_ID": "1000"}]}, "Weakness_Ordinalities": {"Weakness_Ordinality": {"Ordinality": "Primary"}}, "Applicable_Platforms": {"Language": {"@Class": "Not Language-Specific", "@Prevalence": "Undetermined"}}, "Modes_Of_Introduction": {"Introduction": {"Phase": "Architecture and Design", "Note": "COMMISSION: This weakness refers to an incorrect design related to an architectural security tactic."}}, "Common_Consequences": {"Consequence": {"Scope": "Access Control", "Impact": "Bypass Protection Mechanism", "Note": "An attacker could perform an arbitrary number of authentication attempts using different passwords, and eventually gain access to the targeted account using a brute force attack."}}, "Detection_Methods": {"Detection_Method": [{"Method": "Dynamic Analysis with Automated Results Interpretation", "Description": {"xhtml:p": "According to SOAR [REF-1479], the following detection techniques may be useful:", "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": ["Highly cost effective:", "Cost effective for partial coverage:"], "xhtml:ul": [{"xhtml:li": ["Web Application Scanner", "Web Services Scanner", "Database Scanners"]}, {"xhtml:li": "Host-based Vulnerability Scanners - Examine configuration for flaws, verifying that audit mechanisms work, ensure host configuration meets certain predefined criteria"}]}}, "Effectiveness": "High"}, {"Method": "Dynamic Analysis with Manual Results Interpretation", "Description": {"xhtml:p": "According to SOAR [REF-1479], the following detection techniques may be useful:", "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": ["Highly cost effective:", "Cost effective for partial coverage:"], "xhtml:ul": [{"xhtml:li": ["Fuzz Tester", "Framework-based Fuzzer"]}, {"xhtml:li": "Forced Path Execution"}]}}, "Effectiveness": "High"}, {"Method": "Manual Static Analysis - Source Code", "Description": {"xhtml:p": "According to SOAR [REF-1479], the following detection techniques may be useful:", "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": "Highly cost effective:", "xhtml:ul": {"xhtml:li": ["Focused Manual Spotcheck - Focused manual analysis of source", "Manual Source Code Review (not inspections)"]}}}, "Effectiveness": "High"}, {"Method": "Automated Static Analysis - Source Code", "Description": {"xhtml:p": "According to SOAR [REF-1479], the following detection techniques may be useful:", "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": "Cost effective for partial coverage:", "xhtml:ul": {"xhtml:li": ["Source code Weakness Analyzer", "Context-configured Source Code Weakness Analyzer"]}}}, "Effectiveness": "SOAR Partial"}, {"Method": "Automated Static Analysis", "Description": {"xhtml:p": "According to SOAR [REF-1479], the following detection techniques may be useful:", "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": "Cost effective for partial coverage:", "xhtml:ul": {"xhtml:li": "Configuration Checker"}}}, "Effectiveness": "SOAR Partial"}, {"Method": "Architecture or Design Review", "Description": {"xhtml:p": "According to SOAR [REF-1479], the following detection techniques may be useful:", "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": ["Highly cost effective:", "Cost effective for partial coverage:"], "xhtml:ul": [{"xhtml:li": "Formal Methods / Correct-By-Construction"}, {"xhtml:li": "Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.)"}]}}, "Effectiveness": "High"}]}, "Potential_Mitigations": {"Mitigation": [{"Phase": "Architecture and Design", "Description": {"xhtml:p": "Common protection mechanisms include:", "xhtml:ul": {"xhtml:li": ["Disconnecting the user after a small number of failed attempts", "Implementing a timeout", "Locking out a targeted account", "Requiring a computational task on the user's part."]}}}, {"@Mitigation_ID": "MIT-4", "Phase": "Architecture and Design", "Strategy": "Libraries or Frameworks", "Description": {"xhtml:p": ["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]"]}}]}, "Demonstrative_Examples": {"Demonstrative_Example": [{"@Demonstrative_Example_ID": "DX-117", "Intro_Text": "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 [REF-236]. 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. After gaining access as the member of the support staff, the attacker 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.", "References": {"Reference": [{"@External_Reference_ID": "REF-236"}, {"@External_Reference_ID": "REF-1479"}, {"@External_Reference_ID": "REF-1482"}]}}, {"Intro_Text": "The following code, extracted from a servlet's doPost() method, performs an authentication lookup every time the servlet is invoked.", "Example_Code": {"@Nature": "Bad", "@Language": "Java", "xhtml:div": {"xhtml:br": [null, null, null], "#text": "String username = request.getParameter(\"username\");String password = request.getParameter(\"password\");\n                     int authResult = authenticateUser(username, password);"}}, "Body_Text": "However, the software makes no attempt to restrict excessive authentication attempts."}, {"Intro_Text": "This code attempts to limit the number of login attempts by causing the process to sleep before completing the authentication.", "Example_Code": {"@Nature": "Bad", "@Language": "PHP", "xhtml:div": {"xhtml:br": [null, null, null], "#text": "$username = $_POST['username'];$password = $_POST['password'];sleep(2000);$isAuthenticated = authenticateUser($username, $password);"}}, "Body_Text": "However, there is no limit on parallel connections, so this does not increase the amount of time an attacker needs to complete an attack."}, {"Intro_Text": "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.", "Example_Code": [{"@Nature": "Bad", "@Language": "C", "xhtml:div": {"xhtml:br": null, "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": {"xhtml:br": [null, null, null, null, null, null, null, null], "xhtml:div": [{"@style": "margin-left:1em;", "xhtml:br": null, "#text": "printf(\"Unable to open socket connection\");return(FAIL);"}, {"@style": "margin-left:1em;", "xhtml:div": {"xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": {"@style": "margin-left:1em;", "#text": "isValidUser = AuthenticateUser(username, password);"}, "#text": "if (getNextMessage(socket, password, PASSWORD_SIZE) > 0) {}"}, "#text": "if (getNextMessage(socket, username, USERNAME_SIZE) > 0) {}"}}], "#text": "int socket = openSocketConnection(host, port);if (socket < 0) {}\n                           int isValidUser = 0;char username[USERNAME_SIZE];char password[PASSWORD_SIZE];\n                           while (isValidUser == 0) {}return(SUCCESS);"}}, "#text": "int validateUser(char *host, int port){}"}}, {"@Nature": "Good", "@Language": "C", "xhtml:div": {"xhtml:br": null, "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": {"xhtml:br": [null, null, null, null, null], "xhtml:div": [{"@style": "margin-left:1em;", "xhtml:div": {"xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": {"@style": "margin-left:1em;", "#text": "isValidUser = AuthenticateUser(username, password);"}, "#text": "if (getNextMessage(socket, password, PASSWORD_SIZE) > 0) {}"}, "xhtml:br": null, "#text": "if (getNextMessage(socket, username, USERNAME_SIZE) > 0) {}count++;"}}, {"@style": "margin-left:1em;", "#text": "return(SUCCESS);"}, {"@style": "margin-left:1em;", "#text": "return(FAIL);"}], "#text": "...\n                           int count = 0;while ((isValidUser == 0) && (count < MAX_ATTEMPTS)) {}if (isValidUser) {}else {}"}}, "#text": "int validateUser(char *host, int port){}"}}], "Body_Text": "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."}, {"Intro_Text": "Consider this example from a\n\t\t    real-world attack against the iPhone\n\t\t    [REF-1218]. An attacker can use brute force\n\t\t    methods; each time there is a failed guess, the\n\t\t    attacker quickly cuts the power before the failed\n\t\t    entry is recorded, effectively bypassing the\n\t\t    intended limit on the number of failed\n\t\t    authentication attempts. Note that this attack\n\t\t    requires removal of the cell phone battery and\n\t\t    connecting directly to the phone's power source,\n\t\t    and the brute force attack is still\n\t\t    time-consuming."}]}, "Observed_Examples": {"Observed_Example": [{"Reference": "CVE-2019-0039", "Description": "the REST API for a network OS has a high limit for number of connections, allowing brute force password guessing", "Link": "https://www.cve.org/CVERecord?id=CVE-2019-0039"}, {"Reference": "CVE-1999-1152", "Description": "Product does not disconnect or timeout after multiple failed logins.", "Link": "https://www.cve.org/CVERecord?id=CVE-1999-1152"}, {"Reference": "CVE-2001-1291", "Description": "Product does not disconnect or timeout after multiple failed logins.", "Link": "https://www.cve.org/CVERecord?id=CVE-2001-1291"}, {"Reference": "CVE-2001-0395", "Description": "Product does not disconnect or timeout after multiple failed logins.", "Link": "https://www.cve.org/CVERecord?id=CVE-2001-0395"}, {"Reference": "CVE-2001-1339", "Description": "Product does not disconnect or timeout after multiple failed logins.", "Link": "https://www.cve.org/CVERecord?id=CVE-2001-1339"}, {"Reference": "CVE-2002-0628", "Description": "Product does not disconnect or timeout after multiple failed logins.", "Link": "https://www.cve.org/CVERecord?id=CVE-2002-0628"}, {"Reference": "CVE-1999-1324", "Description": "User accounts not disabled when they exceed a threshold; possibly a resultant problem.", "Link": "https://www.cve.org/CVERecord?id=CVE-1999-1324"}]}, "Taxonomy_Mappings": {"Taxonomy_Mapping": [{"@Taxonomy_Name": "PLOVER", "Entry_ID": "AUTHENT.MULTFAIL", "Entry_Name": "Multiple Failed Authentication Attempts not Prevented"}, {"@Taxonomy_Name": "Software Fault Patterns", "Entry_ID": "SFP34", "Entry_Name": "Unrestricted authentication"}]}, "Related_Attack_Patterns": {"Related_Attack_Pattern": [{"@CAPEC_ID": "16"}, {"@CAPEC_ID": "49"}, {"@CAPEC_ID": "560"}, {"@CAPEC_ID": "565"}, {"@CAPEC_ID": "600"}, {"@CAPEC_ID": "652"}, {"@CAPEC_ID": "653"}]}, "References": {"Reference": [{"@External_Reference_ID": "REF-45"}, {"@External_Reference_ID": "REF-236"}, {"@External_Reference_ID": "REF-1218"}]}, "Mapping_Notes": {"Usage": "Allowed", "Rationale": "This CWE entry is at the Base level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.", "Comments": "Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.", "Reasons": {"Reason": {"@Type": "Acceptable-Use"}}}, "Content_History": {"Submission": {"Submission_Name": "PLOVER", "Submission_Date": "2006-07-19", "Submission_Version": "Draft 3", "Submission_ReleaseDate": "2006-07-19"}, "Modification": [{"Modification_Name": "Sean Eidemiller", "Modification_Organization": "Cigital", "Modification_Date": "2008-07-01", "Modification_Version": "1.0", "Modification_ReleaseDate": "2008-09-09", "Modification_Comment": "added/updated demonstrative examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2008-09-08", "Modification_Version": "1.0", "Modification_ReleaseDate": "2008-09-09", "Modification_Comment": "updated Relationships, Taxonomy_Mappings"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2009-03-10", "Modification_Version": "1.3", "Modification_ReleaseDate": "2009-03-10", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2009-07-27", "Modification_Version": "1.5", "Modification_ReleaseDate": "2009-07-27", "Modification_Comment": "updated Observed_Examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2009-12-28", "Modification_Version": "1.7", "Modification_ReleaseDate": "2009-12-28", "Modification_Comment": "updated Applicable_Platforms, Demonstrative_Examples, Potential_Mitigations"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2010-02-16", "Modification_Version": "1.8", "Modification_ReleaseDate": "2010-02-16", "Modification_Comment": "updated Demonstrative_Examples, Name, Potential_Mitigations, Relationships, Taxonomy_Mappings"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2010-04-05", "Modification_Version": "1.8.1", "Modification_ReleaseDate": "2010-04-05", "Modification_Comment": "updated Demonstrative_Examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2011-03-29", "Modification_Version": "1.12", "Modification_ReleaseDate": "2011-03-30", "Modification_Comment": "updated Demonstrative_Examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2011-06-01", "Modification_Version": "1.13", "Modification_ReleaseDate": "2011-06-01", "Modification_Comment": "updated Common_Consequences"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2011-06-27", "Modification_Version": "2.0", "Modification_ReleaseDate": "2011-06-27", "Modification_Comment": "updated Common_Consequences, Related_Attack_Patterns, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2011-09-13", "Modification_Version": "2.1", "Modification_ReleaseDate": "2011-09-13", "Modification_Comment": "updated Potential_Mitigations, References, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2012-05-11", "Modification_Version": "2.2", "Modification_ReleaseDate": "2012-05-15", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2014-07-30", "Modification_Version": "2.8", "Modification_ReleaseDate": "2014-07-31", "Modification_Comment": "updated Detection_Factors, Relationships, Taxonomy_Mappings"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2017-11-08", "Modification_Version": "3.0", "Modification_ReleaseDate": "2017-11-08", "Modification_Comment": "updated Demonstrative_Examples, Modes_of_Introduction, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2019-06-20", "Modification_Version": "3.3", "Modification_ReleaseDate": "2019-06-20", "Modification_Comment": "updated Demonstrative_Examples, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2020-02-24", "Modification_Version": "4.0", "Modification_ReleaseDate": "2020-02-24", "Modification_Comment": "updated Detection_Factors, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2020-08-20", "Modification_Version": "4.2", "Modification_ReleaseDate": "2020-08-20", "Modification_Comment": "updated Related_Attack_Patterns"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2021-10-28", "Modification_Version": "4.6", "Modification_ReleaseDate": "2021-10-28", "Modification_Comment": "updated Demonstrative_Examples, References, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2022-10-13", "Modification_Version": "4.9", "Modification_ReleaseDate": "2022-10-13", "Modification_Comment": "updated Demonstrative_Examples, Description, Observed_Examples, References, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-04-27", "Modification_Version": "4.11", "Modification_ReleaseDate": "2023-04-27", "Modification_Comment": "updated Demonstrative_Examples, References, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-06-29", "Modification_Version": "4.12", "Modification_ReleaseDate": "2023-06-29", "Modification_Comment": "updated Mapping_Notes"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2024-11-19", "Modification_Version": "4.16", "Modification_ReleaseDate": "2024-11-19", "Modification_Comment": "updated Common_Consequences, Description, Diagram"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2025-09-09", "Modification_Version": "4.18", "Modification_ReleaseDate": "2025-09-09", "Modification_Comment": "updated Demonstrative_Examples, Detection_Factors, Potential_Mitigations, References"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2025-12-11", "Modification_Version": "4.19", "Modification_ReleaseDate": "2025-12-11", "Modification_Comment": "updated Relationships, Weakness_Ordinalities"}], "Contribution": {"@Type": "Content", "Contribution_Name": "Abhi Balakrishnan", "Contribution_Date": "2024-09-10", "Contribution_Version": "4.16", "Contribution_ReleaseDate": "2024-11-19", "Contribution_Comment": "Contributed usability diagram concepts used by the CWE team"}, "Previous_Entry_Name": [{"@Date": "2008-04-11", "#text": "Multiple Failed Authentication Attempts not Prevented"}, {"@Date": "2010-02-16", "#text": "Failure to Restrict Excessive Authentication Attempts"}]}}
