Tous les articles

Authentication bypass in Laravel's TokenGuard, move to 13.29.0 or 12.68.0

When Laravel's built-in TokenGuard is configured as a standard token-based API guard, an attacker may be able to log in as another user without knowing that user's API token. The flaw was published on 23 October as CVE-2026-114509 and is marked critical. The fixes are laravel/framework 13.29.0 and 12.68.0.

The attacker sends a non-string credential value that is mishandled in the authentication query. The advisory says that on MySQL and MariaDB, under some database configurations, the query matches an unintended user record instead of failing. The impact is account takeover. On any route protected by the guard, an unauthenticated person can act as another user.

Who is affected

The advisory only talks about the built-in TokenGuard.

  • If you use a guard with 'driver' => 'token' in config/auth.php, you may be affected.
  • On the 13.x line, versions older than 13.29.0 are affected, and apart from that, versions older than 12.68.0.
  • If your database is MySQL or MariaDB the risk is higher, because the advisory names those two.

If you use a Sanctum, Passport or JWT based setup, the advisory does not cover those. It is still worth keeping the framework up to date.

Start by looking at your configuration.

grep -n "'driver' => 'token'" config/auth.php
composer show laravel/framework | grep -E '^versions'

If the first command prints a result, you use TokenGuard.

How to fix it

composer update laravel/framework
composer show laravel/framework | grep -E '^versions'
php artisan config:clear && php artisan cache:clear

If you are on 13.x you need to reach 13.29.0 or later. If you are on an older line you need to reach 12.68.0 or later, because the advisory counts every version older than 12.68.0 as affected. If you pinned the version in composer.json (something like "laravel/framework": "13.28.*"), loosen the constraint. In production restart PHP-FPM and your queue workers after the deploy, because old processes keep running old code.

If you cannot update right away

These are not Laravel's recommendations, just what we would try. None of them replaces the update.

Add a middleware that checks the token is a string. It rejects credentials that arrive as an array or object before they reach the guard.

public function handle($request, Closure $next)
{
    if ($request->has('api_token') && ! is_string($request->input('api_token'))) {
        abort(400);
    }

    return $next($request);
}

Search your server logs for token requests that arrive in array form. They may be attack attempts.

grep -E 'api_token(\[|%5B)' /var/log/nginx/access.log

In the long run consider moving to Sanctum, which Laravel recommends. That is our suggestion too and is not required for the patch.

Sources

Related posts

Written by sheduxdev.

Authentication bypass in Laravel's TokenGuard, move to 13.29.0 or 12.68.0 | TurkishPvP LLC