← PHP / Laravel · Contents

PHP-055 / Intermediate

Flawed "remember me" token design

A07:2021 Identification and Authentication Failures · CWE-613 Insufficient Session Expiration

Why is this a problem?

A permanent token remains valid even after the password changes.

How to fix it

php
Auth::login($user, remember: true);  // Use Laravel's remember_token regeneration; invalidate sessions when the password changes

Further reading