The vulnerability allows any authenticated user, even those without Nova access, to modify boolean attributes on any Nova resource. This is due to improper authorization on the toggle endpoint. The analysis of the patch commit 1ebf0a153b67d800da29a4bce65a973553b4326d reveals the vulnerable function and the fixes applied.
The primary vulnerable function is ToggleController::toggle. The patch shows the removal of a weak authentication check based on configurable guards and the introduction of robust authorization checks using Nova's own policies (authorizedToUpdate) and middleware (nova:api).
Specifically, the old code in ToggleController.php contained this logic:
// Check authentication against configured guards
$guards = config('nova-toggle-5.guards', ['web']);
$hasAccess = collect($guards)->contains(fn($guard) => auth()->guard($guard)->check());
if (!$hasAccess) {
return response()->json(['error' => 'Unauthorized'], 403);
}
This was the only authorization check performed. An attacker who is authenticated on the application (e.g., a regular user) could send a request to the toggle endpoint (/nova-vendor/nova-toggle/toggle/{resource}/{resourceId}) and flip any boolean value on any model, as the endpoint also lacked a whitelist for which attributes could be toggled.
The patch addresses this by:
- Changing the route middleware in
ToggleServiceProvider.php from ['web', 'auth:...'] to ['nova:api'], which ensures only users who can view the Nova dashboard can access the endpoint.
- In
ToggleController::toggle, adding a check to see if the user is authorized to update the specific resource: if (! $novaResource->authorizedToUpdate($request)) ...
- In
ToggleController::toggle, adding a check to ensure the attribute being modified is actually defined as a Toggle field on the resource, preventing arbitrary boolean column modification.
Therefore, the function ToggleController::toggle is the exact location where the insufficient authorization checks were performed, making it the vulnerable function that would appear in a runtime profile during exploitation.