← PHP / Laravel · 目次

PHP-025 / 中級

ログイン試行のレート制限未適用

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

なぜ問題になるのか?

クレデンシャルスタッフィングなどの自動化された総当たり攻撃が可能になります。

修正方法

php
Route::post('/login', [AuthController::class, 'login'])->middleware('throttle:5,1');
// または RateLimiter::for で IP とメールの組み合わせを制限し、失敗累積でロック

参考資料