← PHP / Laravel · Contents

PHP-053 / Advanced

Reusing or storing password-reset tokens in plaintext

A07:2021 Identification and Authentication Failures · CWE-640 Weak Password Recovery Mechanism

Why is this a problem?

Tokens that do not expire or are stored in plaintext can be abused immediately if stolen.

How to fix it

php
// Use Laravel's default Password Broker: store token hashes, set expiry (expire), and delete after use
config(['auth.passwords.users.expire' => 15]);

Further reading