Summary
The Incus incus webui command starts a local web server that accepts an authentication token via URL and then persists it in a cookie for subsequent requests.
Due to improper validation of the token in the URL, an attacker who can reach the temporary localhost web server may gain the same Incus access as the user who launched incus webui, enabling local privilege escalation or remote abuse via UI interaction tricks.
Affected context
This vulnerability affects environments where:
- Users run
incus webui, which spawns a temporary HTTP server bound to localhost on a random port. - Browser-based authentication relies on a token provided in the URL, which is then copied into a cookie.
- Other local users or processes can scan localhost ports or influence browser traffic.
- Remote attackers can trick a local user (e.g., via phishing, malicious links, or local malware) into interacting with the Incus Web UI.
The risk is higher on multi-user systems or desktops where users run Incus with elevated or extensive permissions.
Exploit preconditions
- Attack surface: Temporary HTTP server listening on
localhoston a random port, started byincus webui. - Required access (local attacker):
- Ability to enumerate or guess the random localhost port where the Incus Web UI is listening.
- Network access to
127.0.0.1on that port from the same host (e.g., as a different local user or process). - Required access (remote-assisted attacker):
- Ability to convince the local user to interact with the Incus Web UI (e.g., via malicious browser navigation, scripts, or instructions).
- Trigger point: HTTP requests sent to the Incus Web UI that include a (possibly invalid or forged) authentication token in the URL.
- Why exploitation is possible: The server accepts invalid or improperly verified tokens from the URL as valid and establishes a session cookie from them, while only the cookie-based token is correctly validated later. This mismatch in validation logic lets an attacker bypass the intended authentication step and gain a session with the user's level of Incus access.
Why this happens
The fundamental issue is an improper authentication check (CWE-287) caused by inconsistent validation between different authentication paths.
The web server behind incus webui is designed to:
- Provide a URL embedding a one-time authentication token.
- Accept that token via URL, then set a persistent cookie for further authenticated requests.
While the code correctly validates the token contained in the cookie, it does not enforce equivalent validation when the token is supplied via the URL itself. As a result, the presence of any token-like value in the URL is treated as sufficient for authentication, bypassing the intended proof-of-possession requirement. This pattern reflects a common bug class where multiple authentication mechanisms or entry points are implemented but their verification logic diverges, leaving at least one path effectively unauthenticated or weakly authenticated.
Potential impact
- An unprivileged local user may gain the same Incus privileges as the user who ran
incus webui. - An attacker can access, manage, or manipulate the victim's Incus containers and virtual machines.
- Incus operations (start/stop/delete instances, modify configuration, access console logs) can be performed without the victim's awareness.
- Indirect access to underlying system resources exposed via Incus-managed workloads could occur.
- In multi-user environments, this can serve as a stepping stone for broader local privilege escalation.
General mitigation guidance
Effective mitigation focuses on strong, consistent authentication enforcement and minimizing exposure of local administrative interfaces:
- Ensure all authentication entry points (URL tokens, cookies, headers) share a single, consistent validation routine that rejects malformed or unexpected tokens.
- Treat URL-embedded tokens as secrets and verify them with the same strictness as tokens stored in cookies or other credentials.
- Constrain local web administrative interfaces to the minimal viable exposure, for example by:
- Restricting binding to specific loopback addresses or namespaces.
- Applying OS-level access controls (e.g., firewalls or socket permissions) to limit which users/processes can connect.
- Design token lifetimes to be short and single-use where possible, invalidating them immediately after initial authentication.
- Reduce the permission scope of the Incus process where operationally possible, applying least-privilege principles to limit blast radius if UI access is abused.
How teams detect issues like this
Detection can target both code-level weaknesses and suspicious runtime behavior:
- Static analysis and code review:
- Look for authentication logic that handles tokens differently across multiple code paths (e.g., URL parameters vs. cookies vs. headers).
- Flag any path where a token's structure or existence is checked without verifying its authenticity against a server-side store or cryptographic mechanism.
- Identify handlers that set authenticated session cookies without a preceding robust credential or token verification call.
- Policy and testing:
- Incorporate security tests that attempt to authenticate with malformed, random, or replayed tokens, including via alternate channels (URL, cookie, query parameters).
- Enforce architectural policies that centralize authentication decisions in a dedicated component rather than scattering checks across handlers.
- Operational monitoring:
- Log authentication attempts, including source (URL parameter vs. cookie) and validation outcomes, and review anomalies such as successful sessions established from clearly invalid token values.
- Automated code scanning tools, SAST platforms, or custom linters can be configured to search for inconsistent authentication patterns and missed validation steps, especially around local admin UIs.

