---
title: "CWE-307: Improper Restriction of Excessive Authentication Attempts"
url: https://radicalnotion.ai/cwe/cwe-307
type: cwe
description: "The product does not implement sufficient measures to prevent multiple failed authentication attempts within a short time frame."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-307: Improper Restriction of Excessive Authentication Attempts

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 707
- **Of those, in CISA KEV:** 0
- **New in 2026:** 251
- **CWE catalog version:** 4.21

## Description

The product does not implement sufficient measures to prevent multiple failed authentication attempts within a short time frame.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Architecture and Design | COMMISSION: This weakness refers to an incorrect design related to an architectural security tactic. |

## Applicable platforms

**Languages:** Go (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Access Control | Bypass Protection Mechanism | 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. |

## Potential mitigations

### Architecture and Design

Common protection mechanisms include:

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

### Architecture and Design (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 \[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

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Highly cost effective:

Cost effective for partial coverage:

- Web Application Scanner
- Web Services Scanner
- Database Scanners
- Host-based Vulnerability Scanners - Examine configuration for flaws, verifying that audit mechanisms work, ensure host configuration meets certain predefined criteria

Effectiveness: High

### Dynamic Analysis with Manual Results Interpretation

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Highly cost effective:

Cost effective for partial coverage:

- Fuzz Tester
- Framework-based Fuzzer
- Forced Path Execution

Effectiveness: High

### Manual Static Analysis - Source Code

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Highly cost effective:

- Focused Manual Spotcheck - Focused manual analysis of source
- Manual Source Code Review (not inspections)

Effectiveness: High

### Automated Static Analysis - Source Code

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Cost effective for partial coverage:

- Source code Weakness Analyzer
- Context-configured Source Code Weakness Analyzer

Effectiveness: SOAR Partial

### Automated Static Analysis

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Cost effective for partial coverage:

- Configuration Checker

Effectiveness: SOAR Partial

### Architecture or Design Review

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Highly cost effective:

Cost effective for partial coverage:

- Formal Methods / Correct-By-Construction
- Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.)

Effectiveness: High

## 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 \[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.

### Example 2

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

Bad code:

```java
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.

Bad code:

```php
$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.

Bad code:

```c
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);
}
```

Good code:

```c
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);
    }
}
```

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.

### Example 5

Consider this example from a real-world attack against the iPhone \[REF-1218\]. An attacker can use brute force methods; each time there is a failed guess, the attacker quickly cuts the power before the failed entry is recorded, effectively bypassing the intended limit on the number of failed authentication attempts. Note that this attack requires removal of the cell phone battery and connecting directly to the phone's power source, and the brute force attack is still time-consuming.

### Example 6

The following example code is a snippet from the JTAG wrapper module in the RISC-V debug module of the HACK@DAC'21 Openpiton SoC \[REF-1355\]. To make sure that the JTAG is accessed securely, the developers have included a primary authentication mechanism based on a password.

Bad code:

```systemverilog
...
    PassChkValid: begin
        if(hashValid) begin
            if(exp_hash == pass_hash) begin
                pass_check = 1'b1;
            end else begin
                pass_check = 1'b0;
            end state_d = Idle;
        end else begin
            state_d = PassChkValid;
        end
    end
...
```

Good code:

```systemverilog
...
case (state_q)
    Idle: begin
    ...
        else if ( (dm::dtm_op_e'(dmi.op) == dm::DTM_PASS) && (miss_pass_check_cnt_q != 2'b11) )
        begin
            state_d = Write;
            pass_mode = 1'b1;
        end
    ...
    end
    ...
    PassChkValid: begin
        if(hashValid) begin
            if(exp_hash == pass_hash) begin
                pass_check = 1'b1;
            end else begin
                pass_check = 1'b0;
                miss_pass_check_cnt_d = miss_pass_check_cnt_q + 1
            end
            state_d = Idle;
        end else begin
            state_d = PassChkValid;
        end
    end
...
```

## Observed examples

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

## Real CVEs with this weakness (sample of 12 of 707)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-122142 | CVE-2026-122142 | critical | 9.8 | - | No | 2026-11-17 |
| CVE-2026-84473 | CVE-2026-84473 | critical | 9.8 | - | No | 2026-11-06 |
| CVE-2026-76779 | - | critical | 9.8 | - | No | 2026-10-09 |
| CVE-2026-56592 | HCL BigFix Service Management is affected by multiple security vulnerabilities. | critical | 9.8 | - | No | 2026-09-18 |
| CVE-2026-44596 | Yamcs: No Rate Limiting on Authentication Endpoint | critical | 9.8 | - | No | 2026-07-16 |
| CVE-2026-6853 | OTP Bypass in Başbelen Group's Pause+ Mobile App | critical | 9.8 | - | No | 2026-06-12 |
| CVE-2026-8760 | Login with OTP \<= 1.6 - Unauthenticated Authentication Bypass via OTP Brute Force | critical | 9.8 | - | No | 2026-05-27 |
| CVE-2026-43914 | Vaultwarden: Brute-force protection bypass vulnerability | critical | 9.8 | - | No | 2026-05-11 |
| CVE-2025-31991 | HCL DevOps Velocity is susceptible to brute-force attacks | critical | 9.8 | - | No | 2026-04-13 |
| CVE-2026-22278 | - | critical | 9.8 | - | No | 2026-01-22 |
| CVE-2025-12995 | - | critical | 9.8 | - | No | 2025-12-04 |
| CVE-2025-56221 | - | critical | 9.8 | - | No | 2025-10-17 |

## Related attack patterns (CAPEC)

- [CAPEC-16](https://radicalnotion.ai/capec/capec-16): Dictionary-based Password Attack
- [CAPEC-49](https://radicalnotion.ai/capec/capec-49): Password Brute Forcing
- [CAPEC-560](https://radicalnotion.ai/capec/capec-560): Use of Known Domain Credentials
- [CAPEC-565](https://radicalnotion.ai/capec/capec-565): Password Spraying
- [CAPEC-600](https://radicalnotion.ai/capec/capec-600): Credential Stuffing
- [CAPEC-652](https://radicalnotion.ai/capec/capec-652): Use of Known Kerberos Credentials
- [CAPEC-653](https://radicalnotion.ai/capec/capec-653): Use of Known Operating System Credentials

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-287](https://radicalnotion.ai/cwe/cwe-287) | Improper Authentication |
| Parent | [CWE-799](https://radicalnotion.ai/cwe/cwe-799) | Improper Control of Interaction Frequency |
| Parent | [CWE-1390](https://radicalnotion.ai/cwe/cwe-1390) | Weak Authentication |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | Multiple Failed Authentication Attempts not Prevented | AUTHENT.MULTFAIL | - |
| Software Fault Patterns | Unrestricted authentication | SFP34 | - |
| OWASP Golang Secure Coding Practices Guide | Authentication and Password Management | - | - |

## Frequently asked questions

### What is CWE-307?

The product does not implement sufficient measures to prevent multiple failed authentication attempts within a short time frame.

### What CVEs are caused by CWE-307?

707 recorded CVEs are attributed to CWE-307, including CVE-2026-122142, CVE-2026-84473 and CVE-2026-76779.

### Is CWE-307 part of the OWASP Top 10?

CWE-307 maps to OWASP Golang Secure Coding Practices Guide: Authentication and Password Management in the OWASP security taxonomy.

### How do you prevent CWE-307?

Common protection mechanisms include:

### How is CWE-307 detected?

Dynamic Analysis with Automated Results Interpretation: According to SOAR, the following detection techniques may be useful:

### What are the consequences of CWE-307?

Exploiting CWE-307 can lead to: Bypass Protection Mechanism.

### Is CWE-307 actively exploited?

707 recorded CVEs are caused by CWE-307; none are currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/307.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-307). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
