cipi/gui 4.1.1: client-writable Livewire $can map lets a view-only panel user act as admin on any app
Description
Affected: cipi/gui 4.1.1 (cipi-sh/gui, commit 6e7df4c), src/Livewire/AppDetail.php. Reported here because cipi/gui has no SECURITY.md of its own and the cipi SECURITY.md routes related projects to this channel.
AppDetail computes the caller's abilities once in mount() and keeps them in a public Livewire property without #[Locked]:
// src/Livewire/AppDetail.php:48 public array $can = []; // :285 (mount only) $this->can = Access::appAbilityMap($this->panelUser(), (int) ($this->serverId ?? 0), $this->appName); // :2034 - the only gate for every action protected function allowed(string $ability): bool { if ($this->can[$ability] ?? false) { return true; } ... }
Livewire applies client updates to every public property that is not #[Locked] (HandleComponents::updateProperty; only BaseLocked throws). $appName is public too. So a panel user who was granted only view on one app can post the component's real snapshot with
"updates": {"can": {"view":true,"deploy":true,"edit":true,"env":true,"logs":true,"run":true,"delete":true}, "appName": "<any other app on a server they can see>"}
and call any action. The panel then performs it with its own server API token: read/write .env (APP_KEY, DB passwords), run Artisan commands (runArtisan), change repo/branch (next deploy runs attacker code), delete apps, rotate the webhook secret.
Proof (local lab, published package, no live host): a PHPUnit test logs in as a user with only view on shop, takes the genuine wire:snapshot from GET /apps/shop and posts it to the Livewire update URI with the updates above and calls [loadEnv, deleteApp, runArtisan]. Response 200; the panel sends GET /api/apps/blog/env, DELETE /api/apps/blog and POST /api/apps/blog/artisan with the panel's Bearer token, for an app the user has no grant on. The control (same user, no tampering) is refused, matching the project's own PermissionsTest. The same pattern exists in Concerns/ManagesAsyncJobs.php ($activeJobId public): setting another job id + pollJob makes the panel fetch that job's output (which can contain one-time DB/SSH passwords) - it needs the job UUID.
Not by design: README and PermissionsTest treat can as the boundary ("a user gets what an admin grants... View, Deploy, Edit, Environment..."), and ServerManage/Databases/Apps re-check serverAllowed() inside each action.
Fix: re-check Access::can(auth()->user(), $ability, $serverId, $appName) inside each action (re-validating appName), or mark $can, $appName, $activeJobId, $jobRunning as #[Locked] and re-derive them per request.
Requires: an authenticated non-admin panel account with at least view on one app. Not reachable unauthenticated. Full PHPUnit PoC available on request.
kta1kri - github.com/