← PHP / Laravel · Contents

PHP-025 / Intermediate

No login rate limiting

A07:2021 Identification and Authentication Failures · CWE-307 Improper Restriction of Excessive Authentication Attempts

Why is this a problem?

Automated guessing attacks, including credential stuffing, are possible.

How to fix it

php
Route::post('/login', [AuthController::class, 'login'])->middleware('throttle:5,1');
// Alternatively use RateLimiter::for to limit the IP/email combination and lock on repeated failures

Further reading