Summary
RustDesk Client performs improper TLS certificate validation in its HTTP API client and TLS transport modules, allowing connections to proceed even when server certificates are invalid.
When combined with network-level control by an attacker, this behavior can enable Adversary-in-the-Middle (AiTM) attacks where encrypted traffic is intercepted, modified, or redirected without being reliably detected by the client.
Affected context
The vulnerability occurs in RustDesk Client deployments on Windows, macOS, Linux, iOS, and Android that use the affected HTTP API client and TLS transport modules.
In these contexts, code paths that configure TLS connections with options such as danger_accept_invalid_certs(true) may allow sessions to continue despite invalid or untrusted server certificates.
This becomes risky whenever client devices connect over untrusted or partially trusted networks (e.g., public Wi‑Fi, corporate networks with shared infrastructure, or ISP-controlled routing) where traffic can be intercepted or redirected.
Exploit preconditions
- Attack surface: Network communication between RustDesk clients and their configured servers or relay services.
- Required access: Ability to observe and manipulate network traffic (e.g., on-path attacker, compromised router, malicious access point, or upstream provider control).
- Trigger point: Client initiating or retrying a TLS connection via the HTTP API client or TLS transport routines that accept invalid certificates.
- Why exploitation is possible: Certificate validation logic is weakened or bypassed via configuration such as
danger_accept_invalid_certs(true), allowing the client to treat untrusted or spoofed certificates as valid, which removes the cryptographic guarantee of endpoint authenticity.
Why this happens
The core issue maps to CWE-295: Improper Certificate Validation, where TLS connections do not adequately verify the authenticity of the remote peer's certificate.
In this case, TLS routines are configured to accept invalid certificates (e.g., self-signed, mismatched hostnames, expired, or issued by untrusted authorities) through options like danger_accept_invalid_certs(true).
By relaxing or bypassing certificate checks, the implementation undermines the security guarantees of TLS, turning what should be an authenticated, confidential channel into one that is vulnerable to interception and impersonation.
Conceptually, this is an insecure pattern where transport security is made "convenient" at the expense of endpoint verification, trading away protections against AiTM in all environments where network paths are not fully trusted.
Potential impact
- Attackers may intercept and decrypt RustDesk client traffic, compromising the confidentiality of sessions and metadata.
- Adversaries can modify data in transit, potentially altering commands, configuration, or session parameters.
- Users may be silently connected to attacker-controlled infrastructure that impersonates legitimate RustDesk servers.
- Session tokens, credentials, or other sensitive values transported over these channels can be exposed.
- Broader account or device compromise may occur if attackers use intercepted data to pivot into other systems or services.
General mitigation guidance
Mitigation typically focuses on restoring strict, standards-compliant certificate validation and avoiding insecure TLS options in all production pathways.
Recommended defensive patterns include:
- Ensuring TLS clients always validate server certificates against a trusted root store, verifying issuer, validity period, and revocation status where supported.
- Enforcing hostname or Subject Alternative Name (SAN) checks so that certificates must match the expected server identity.
- Removing or isolating unsafe flags such as
danger_accept_invalid_certs(true)from production builds, and gating any exceptional behavior behind explicit, tightly scoped development or test-only configuration. - Implementing secure defaults where the client refuses to connect if certificate validation fails, making opt-out behavior explicit, noisy, and clearly marked as unsafe.
- Considering additional trust-hardening techniques, such as certificate pinning or key pinning for high-value endpoints, with careful lifecycle management for rotations.
- Applying least-privilege principles to network configuration, avoiding unnecessary trust in custom certificate authorities and reducing the number of entities able to terminate TLS for client traffic.
How teams detect issues like this
Detection efforts can focus on both code-level patterns and runtime behavior:
- Static analysis and code scanning
- Search for usage of functions or options that disable certificate validation (e.g., flags like
danger_accept_invalid_certs, "insecure", or "accept_invalid"). - Flag TLS client initializations where certificate verification mode is non-default, disabled, or conditionally bypassed.
- Enforce coding standards that prohibit insecure TLS configuration in shared libraries or network abstractions.
- Code review signals
- Pay close attention to network-related modules (
http_client, TLS transport layers) for shortcuts added to "fix" connectivity issues. - Review configuration parsing paths to ensure no option permits silent disabling of certificate validation for production environments.
- Question any comments or feature flags referencing "temporary," "debug," or "testing" behavior around TLS checks.
- Runtime and policy enforcement
- Use organizational policies or build-time checks that fail CI when insecure TLS options are referenced or compiled into production variants.
- Instrument telemetry or logging to surface instances where TLS connections proceed after certificate warnings or failures.
- Employ external security testing (e.g., dynamic analysis, AiTM simulations on test networks) to verify that clients correctly reject spoofed certificates.
Automated code review and SAST tools can be configured to highlight known insecure TLS patterns, especially options that relax certificate validation or hostname checks.

