← PHP / Laravel · 目次

PHP-054 / 上級

セッションのみによる二段階認証状態の信頼

A07:2021 Identification and Authentication Failures · CWE-304 Missing Critical Step in Authentication

なぜ問題になるのか?

OTP ステップを飛ばして /dashboard に直接アクセスすると 2FA が無力化されます。

修正方法

php
session(['2fa:pending' => $user->id]);      // OTP 成功後にのみ Auth::login と regenerate()

参考資料