/

CVE-2026-76840

Severity:

CRITICAL RISK

(9.6)

Buffer Overflow (CWE-787) in RustDesk Windows Clipboard

CVE-2026-76840

Deferred

Vulnerability type

Category:

Out-of-Bounds Write

CWE:

CWE-20, CWE-787

Impact:

Memory Corruption and Potential Remote Code Execution

Severity:

CRITICAL RISK

(9.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A critical bounds-checking flaw in RustDesk's Windows clipboard redirection can cause peer-supplied data to be copied beyond the end of a paste consumer's buffer. When a local user pastes remote clipboard file contents, a malicious or compromised peer may trigger heap corruption and potentially influence code execution in the affected process.

Affected context

The vulnerability occurs in RustDesk's Windows clipboard redirection path when a remote peer provides file contents through the CLIPRDR protocol. It becomes risky when a local user pastes remote clipboard file data into an OLE consumer such as Windows Explorer, and the response length supplied by the peer exceeds the destination buffer requested by the consumer.

Exploit preconditions

  • Attack surface: Windows clipboard file redirection over a RustDesk session
  • Required access: A peer must be able to participate in or compromise a RustDesk connection and provide clipboard file-content responses
  • Trigger point: A local user must paste remote clipboard file contents through an OLE consumer
  • Why exploitation is possible: The response length is trusted and copied without being bounded by the caller-provided destination size, allowing data to extend past the allocated buffer

Why this happens

The underlying bug is improper input validation and an out-of-bounds write. RustDesk copies a peer-controlled file-content length into a caller-provided buffer without first enforcing that the length is no greater than the buffer capacity. The available comparison only handles a short-read condition after the copy has occurred, so it cannot prevent an oversized write. This maps primarily to CWE-787: Out-of-bounds Write, with CWE-20: Improper Input Validation describing the failure to constrain untrusted protocol data.

Potential impact

  • A malicious peer could cause heap memory corruption in the local clipboard consumer
  • The application or affected Windows process could crash
  • An attacker could potentially influence corrupted memory and achieve code execution
  • The issue could compromise the confidentiality or integrity of data handled by the affected process
  • A successful attack could provide a stepping stone to broader endpoint compromise, depending on process privileges and exploitability

General mitigation guidance

Mitigation generally focuses on treating all peer-supplied protocol lengths as untrusted and enforcing destination-size limits before any memory operation.

Common defensive patterns include:

  • Clamp or reject response lengths that exceed the caller-provided buffer capacity
  • Validate protocol fields before allocating, copying, or processing associated data
  • Use bounded copy operations whose limits are derived from the actual destination size
  • Ensure short-read and oversized-response handling occurs before the copy
  • Reduce clipboard redirection privileges and disable remote file clipboard features where they are not required
  • Run desktop-session components with the least privilege practical and apply defense-in-depth endpoint protections

How teams detect issues like this

Organizations can look for this class of defect through:

  • Static analysis rules identifying memory copies whose length derives from network or peer-controlled fields
  • Code review checks tracing protocol lengths from response parsing through allocation and copy operations
  • Tests that send zero-length, short, boundary-sized, and oversized protocol responses
  • Fuzzing of CLIPRDR file-content response handling and OLE clipboard integration
  • Policy enforcement requiring explicit bounds checks before every buffer write
  • Automated security review tools that flag untrusted size values used in memory operations

Sources

SourceLink
github.comgithub.com/FreeRDP/FreeRDP/security/advisories/GHSA-m37j-jcr2-8gcc
github.comgithub.com/rustdesk/rustdesk
github.comgithub.com/rustdesk/rustdesk/blob/1.4.9/libs/clipboard/src/windows/wf_cliprdr.c
github.comgithub.com/rustdesk/rustdesk/pull/15515
vulncheck.comvulncheck.com/advisories/rustdesk-through-heap-buffer-overflow-via-unvalidated-cliprdr-filecontentsresponse-length

Frequently asked

questions

Exploitation depends on a remote peer being able to provide malicious clipboard file-content responses and on a local user pasting those remote contents. It is not necessarily exploitable solely by sending an unauthenticated network packet.

The attacker generally needs to control or compromise a peer participating in a RustDesk session, or otherwise influence the peer-supplied CLIPRDR response. The local clipboard redirection feature must also be active.

Validate and constrain the peer-supplied length against the destination buffer capacity before performing any copy. Oversized responses should be rejected or safely truncated according to the protocol's intended behavior.

Treat protocol lengths as untrusted, use bounded memory operations, add boundary-focused tests and fuzzing, and review every data flow from external size fields to allocation or copy routines.

Find out what's already
exploitable in your codebase.