Summary
A Cross-Site Request Forgery (CSRF) issue in the RustDesk Client's custom URI scheme handler (rustdesk://) allows untrusted web content to trigger privileged actions without user consent.
By abusing the rustdesk://password/ handler and related FFI bridge routines, an attacker could set or change a permanent password and thereby escalate privileges on systems running RustDesk Client up to version 1.4.5.
Affected context
The vulnerability occurs in RustDesk Client deployments that:
- Register and handle the custom URI scheme
rustdesk://on Windows, macOS, Linux, iOS, or Android - Process
rustdesk://password/URIs in the Flutter layer (flutter/lib/common.dart) and FFI modules (src/flutter_ffi.rs) - Allow the URI handler to perform state-changing operations such as
bind.MainSetPermanentPassword()without robust origin validation or user confirmation
It becomes risky when a user has RustDesk Client installed and configured, and then visits a malicious or compromised website or application capable of launching rustdesk:// URIs on the same device.
Exploit preconditions
- Attack surface: Local application invoked through system-level URI scheme handling from a browser, email client, chat app, or other application capable of opening external links.
- Required access: The attacker needs to convince a victim to open a crafted URL (e.g., clicking a link, viewing a page that auto-invokes the URI scheme, or interacting with content that triggers the handler).
- Trigger point: A
rustdesk://password/or similarly structured URI is processed by the RustDesk Client's Flutter URI handler and passed through the FFI bridge tobind.MainSetPermanentPassword(). - Why exploitation is possible: The URI scheme handler treats inbound requests as sufficiently trusted, does not enforce strong CSRF-like protections (such as explicit user confirmation or trusted-origin checks), and directly performs privileged configuration changes when the link is opened.
Why this happens
The core issue is a combination of:
- CWE-352: Cross-Site Request Forgery (CSRF): The RustDesk Client's custom URI handler allows external contexts (like web pages) to trigger sensitive, state-changing operations as a side effect of opening a specially crafted link, without requiring an in-app user action or robust consent.
- CWE-285: Improper Authorization: The privileged routine
bind.MainSetPermanentPassword()is exposed through the URI handling and FFI bridge without adequate authorization checks or a trustworthy indication that the request originated from an authenticated, local, or explicitly consenting user.
Conceptually, the design treats a "link open" event as equivalent to a trusted, interactive request from the user. This violates common security expectations that custom URL handlers and deep links must validate intent, enforce authorization, or require explicit confirmation before applying sensitive configuration changes.
Potential impact
- An attacker may set or overwrite the permanent password used by RustDesk Client without the user's knowledge.
- The attacker could gain remote access to the user's system by leveraging the attacker-controlled permanent password.
- Existing access controls and trust relationships within RustDesk sessions can be weakened or bypassed.
- Compromise of endpoint confidentiality and integrity through unauthorized remote control or screen access.
- Potential pivoting into wider network environments if the compromised host has broader access.
General mitigation guidance
Effective mitigation focuses on treating custom URI handlers as untrusted entry points and hardening privileged operations exposed through them:
- Require explicit, in-app user confirmation (e.g., dialog or secondary action) before applying any configuration or password changes initiated via
rustdesk://URIs. - Implement strict authorization and intent checks around sensitive routines such as
MainSetPermanentPassword(), ensuring they are only callable from authenticated, trusted UI flows rather than direct URI invocations. - Introduce CSRF-style defenses into the deep link handling path, such as single-use tokens, user presence checks, or binding actions to an active, foreground session.
- Narrow the scope of the URI scheme: avoid exposing direct "set password" or similar high-privilege operations, and instead route through safer, higher-level flows that inherently enforce user interaction.
- Apply the principle of least privilege within FFI bridge modules so that only necessary functionality is accessible from external triggers, and sensitive APIs are gated behind explicit checks.
How teams detect issues like this
To detect and prevent similar vulnerabilities, organizations and developers can:
- Perform code reviews focused on custom URI/deep link handlers (
rustdesk://*), tracing which internal functions can be invoked and whether they require user interaction or authorization. - Use static analysis or manual inspection to flag:
- Direct calls from URI handlers into state-changing routines (e.g., password setters, configuration writers) without intermediate validation.
- FFI bridge functions that expose security-sensitive capabilities to external triggers without explicit security checks.
- Define secure coding policies for deep links and external protocol handlers, such as "no direct privileged actions from URI handlers" and "all password or credential changes must originate from authenticated UI flows."
- Apply dynamic testing by crafting benign test URIs and verifying that they cannot change security-critical settings without user confirmation.

