Missing rate limits on authentication endpoints

Missing rate limits on C# authentication endpoints

Description

Check which rate limit applies to login, PIN or token verification requests. A global policy may already cover the endpoint.

Potential impact

Repeated attempts can make password guessing or the use of compromised credentials more likely to succeed. They also put pressure on authentication services and log storage.

Remediation

Register a policy for authentication requests with ASP.NET Core’s AddRateLimiter and run UseRateLimiter after routing. Consider account lockouts, progressive delays and MFA as additional controls.

Examples

Before

csharp
[HttpPost("login")]
public IActionResult Login([FromBody] LoginRequest request)
{
    return Ok();
}

After

csharp
[EnableRateLimiting("login")]
[HttpPost("login")]
public IActionResult Login([FromBody] LoginRequest request)
{
    return Ok();
}

Both actions return only Ok(). The second uses EnableRateLimiting("login") to apply the registered login policy.

References