Summary
A logic flaw in Tauri's is_local_url() function on Windows and Android causes some remote URLs to be misclassified as trusted local origins.
By controlling a domain whose first subdomain matches an app's custom scheme, an attacker may be able to trick Tauri into treating attacker-controlled content as local, enabling server-side request forgery–style interactions and other trust-boundary bypasses.
Affected context
This vulnerability affects Tauri applications built with versions 2.0 through 2.11.0 running on Windows and Android that:
- Use custom URI schemes which Tauri maps to
http://<scheme>.localhost/ - Rely on
is_local_url()(or APIs that depend on it) to distinguish trusted local origins from remote content - Grant elevated capabilities, additional APIs, or relaxed security assumptions to "local" origins
The issue manifests when origin checks only inspect the first subdomain of a URL, allowing certain attacker-controlled domains to be treated as local.
Exploit preconditions
- Attack surface: WebView-based Tauri apps on Windows and Android that:
- Register custom URI schemes
- Perform origin-based privilege decisions using
is_local_url()or related mechanisms - Required access: Ability to lure a user into visiting attacker-controlled domains (e.g., via link, redirect, or embedded web content).
- Trigger point: A navigation, request, or origin check where the application or framework invokes
is_local_url()to verify whether the URL is local. - Why exploitation is possible: The origin validation logic considers only the first subdomain and the
.localhostmapping, which can be mirrored by an attacker-controlled hostname whose leading subdomain matches the custom scheme, causing remote content to be misclassified as trusted local origin.
Why this happens
The root cause is a flawed origin validation routine that performs insufficient verification of hostnames when determining whether a URL is local.
On Windows and Android, Tauri maps custom protocol handlers to HTTP origins like http://<scheme>.localhost/ because the platform WebView cannot serve custom schemes directly. The is_local_url() function then attempts to recognize these local origins but only checks the first subdomain component.
This behavior aligns with CWE-918: Server-Side Request Forgery (SSRF) in the broader sense that untrusted, external endpoints are incorrectly treated as internal or trusted. The underlying bug is an origin trust boundary error: equating "shares a subdomain prefix" with "is the local loopback origin," which allows attacker-controlled domains to pass as local.
Potential impact
- Attacker-controlled web pages may be treated as trusted "local" content by the Tauri app.
- Remote content could gain access to privileged JavaScript APIs or capabilities intended only for local origins.
- Potential abuse of higher-privileged operations exposed to "local" pages, such as file access, IPC channels, or OS integrations.
- Bypass of origin-based access controls, leading to data exposure or modification within the application.
- Expansion of the attack surface for chaining with other vulnerabilities (e.g., XSS in a "local" context becoming significantly more impactful).
General mitigation guidance
Mitigation should focus on hardening origin validation and minimizing trust based on hostnames alone:
- Use strict origin comparisons that match full hostnames, schemes, and ports, rather than partial or subdomain-only checks.
- Treat
localhost-style mappings as trusted only when they resolve to loopback interfaces or are constructed internally, not when derived from or comparable to external hostnames. - Avoid granting broad, powerful privileges solely on the basis of an origin string; use additional trust signals such as signed bundles, explicit allowlists, or out-of-band configuration.
- Design application APIs so that even "local" web content is constrained by least privilege, with granular, capability-based access rather than blanket local-origin trust.
- Normalize and canonicalize URLs before comparison to reduce ambiguity and avoid edge cases in host parsing.
How teams detect issues like this
Detection efforts can concentrate on identifying overly permissive origin checks and hostname-based trust assumptions:
- Use static analysis or code search to find functions that:
- Perform partial hostname comparisons (e.g., checking only subdomains or suffixes) for security decisions.
- Treat any domain pattern that "looks like" localhost as trusted without verifying its actual network location.
- During code review, flag logic that:
- Grants elevated permissions based on
localhostor similar naming conventions. - Relies on URL string parsing instead of robust origin/URL APIs.
- Incorporate security-focused linting or automated review tools to enforce policies like "no hostname substring matching for origin trust decisions."
- Add runtime logging or telemetry around origin-based privilege grants to detect unexpected external origins being classified as "local."

