CVE-2026-142636: Laravel: Sanctum guard can resolve the lowest-ID user when evaluated inside an eager-loaded Eloquent relation definition
Laravel is a web application framework. Prior to 12.73.0, When an authenticated user is first resolved while Eloquent is initializing an eager-loaded relation, Eloquent's relation constraints are temporarily disabled. A lazy key-constrained lookup made during that window, such as Sanctum's token owner lookup, runs without its key restriction. The guard can then return the lowest-ID user (often an administrator) instead of the token's owner. This affects applications that call the guard inside a relation definition used with eager loading, for example in optional-authentication routes. A low-privilege token could then read that user's data, and the wrong user remains cached for the rest of the request. Routes where authentication middleware resolves the user first were not affected in testing. This issue is fixed in version 12.73.0.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 12.73.0
Event History
Frequently Asked Questions
Which applications are exposed to this issue?
Applications using Laravel before 12.73.0 are affected only when the Sanctum guard is first resolved from within an Eloquent relation definition that is being eager-loaded. Optional-authentication routes are an example; routes where authentication middleware resolves the user before relation initialization were not affected in testing.
What does an attacker need to exploit it?
An attacker needs a low-privilege Sanctum token and access to a route that triggers the vulnerable eager-loaded relation path before the guard has otherwise resolved the authenticated user. Under those conditions, the token owner lookup can return the lowest-ID user instead of the token owner.
What is the impact during an affected request?
The application can treat the lowest-ID user, often an administrator, as the authenticated user. That user identity remains cached for the rest of the request, potentially allowing the low-privilege token to read that user's data.
What can be done if upgrading is not immediately possible?
Avoid resolving the Sanctum guard inside relation definitions used with eager loading. Ensure authentication middleware resolves the user before those relations are initialized, as routes with that ordering were not affected in testing.
How can I determine whether a route is affected?
Review routes that use eager-loaded Eloquent relations and determine whether their relation definitions call or otherwise first resolve the Sanctum guard. A route is most concerning when it permits optional authentication and does not have authentication middleware that resolves the user first.