Recently Laravel 4 was updated to address a security concern: there was a CSRF vulnerability in their code.
Here's the old code:
if (Session::token() != Input::get('_token'))
{
throw new Illuminate\Session\TokenMismatchException;
}
And here's their fix (note the !==
):
if (Session::token() !== Input::get('_token'))
{
throw new Illuminate\Session\TokenMismatchException;
}
I understand the difference between ==
and ===
in PHP (basically the latter is more strict because it checks type), and I understand what CSRF is and how to address it, but I don't fully understand why this specific case creates a vulnerability, or how an attacker would exploit it.