Laravel's signed URLs are commonly used for passwordless magic logins, email verification, and one-click actions. A subtle mismatch between how URLs were generated and how routes were matched meant you could request a completely valid signed URL for your own account, send it back untouched, and have Laravel bind a different user.
No signature forgery was involved. Laravel verified one representation of the path and bound the model from another.
How the mismatch works
Consider a magic-login route that binds a User by a custom route key like slug:
Route::get('/magic-login/{user:slug}', function (User $user) {
Auth::login($user);
return (string) Auth::id();
})->middleware(['web', 'signed'])->name('magic-login');
Now say a victim's slug is victim, and an attacker sets their own slug to %76ictim (%76 is the hex code for ASCII v).
When the app generates a signed link for the attacker's model via URL::signedRoute('magic-login', ['user' => $attacker]), RouteUrlGenerator dropped the raw slug straight into the path without escaping %:
/magic-login/%76ictim?expires=...&signature=...
UrlGenerator signed that exact raw path. When the attacker visits the link:
- The
signedmiddleware checks the HMAC against the raw request path (/magic-login/%76ictim). It matches. - Laravel's router runs
rawurldecode()on the matched path segment, turning%76ictimintovictim. - Implicit route model binding queries
userswhereslug = 'victim'and logs the attacker in as the victim.
The whole chain ran without changing a single byte of the URL or signature:
Generated URL: /magic-login/%76ictim
Signature check: valid (checked on raw path)
Decoded param: victim
Bound model: User(slug: "victim")
Where the bug lived
Inside src/Illuminate/Routing/RouteUrlGenerator.php, both replaceRouteParameters() and replaceNamedParameters() pulled parameter values and substituted them directly into the URI string. Because % wasn't encoded as %25, any percent triplet inside a route key survived into the generated URL and was later decoded a second time by the router.
The fix
Taylor fixed this in PR #61475 by adding encodeParameter() to RouteUrlGenerator so %, ?, and # in route parameters are encoded before substitution:
// src/Illuminate/Routing/RouteUrlGenerator.php
protected function encodeParameter($value)
{
return is_string($value) || $value instanceof Stringable
? strtr((string) $value, ['%' => '%25', '?' => '%3F', '#' => '%23'])
: $value;
}
Now a model with slug %76ictim generates /magic-login/%2576ictim. When the router decodes %25 back to %, model binding receives the literal %76ictim instead of colliding with victim.
The fix shipped on September 8, 2026 in Laravel 13.31.0 and Laravel 12.69.2. No public CVE was assigned, so if your app uses signed routes with user-controlled slugs or string route keys, make sure you're on 12.69.2+ or 13.31.0+.