← PHP / Laravel · Contents

PHP-009 / Beginner

Direct string comparison instead of password_verify

A02:2021 Cryptographic Failures · CWE-256 / CWE-697 Incorrect Comparison

Why is this a problem?

Incorrect hash comparison logic can be bypassed or leak timing information.

How to fix it

php
if (Hash::check($input, $user->password)) { /* login */ }

Further reading