Read the docs

Heap buffer overflow in FreeRDP RoutingToken handling

Priority MEDIUM 53CWE-122Published · Updated

Key facts

Attack vector
Network
Privileges required
None
User interaction
Required
Attack complexity
Low
Impact type
Code execution
Confidentiality · integrity · availability
High · High · High
Fix status
Fixed

Attack profile from CVSS 3.1 · GHSA-2vf2-grvj-6g8x. Fix status from GitHub. Impact type from CWE-122 and the CVSS impact.

Summary

FreeRDP 2.x, and 3.x before 3.31.0, contains a heap-based buffer overflow in the client's handling of the RoutingToken during server redirection. A malicious RDP server sends an attacker-controlled load balance info field that is copied into a fixed 512-byte stream without a length check. An attacker needs no credentials, only a victim who connects to the malicious server, and the overflow crashes the client, or leads to code execution when chained with an information leak.

Written with Claude Haiku 5.5 from the sources below · 2026-11-12

Description from the GitHub advisory

This is a report on behalf of Julien Lair, Security Researcher at Quarkslab (quarkslab.com) If you are interested in known how this vulnerability was discovered, read the researcher's blog post [here](https://blog.quarkslab.com/from-ai-agents-to-rce-building-a-vulnerability-research-workflow.html) ## Summary Remote code execution on the RDP client, when chained with the memory leak from Vuln2. Without that leak the same bug is a denial of service (the client crashes). The attacker is the RDP server the victim connects to. No credentials are needed. ## Affected products FreeRDP, the whole 2.x and 3.x line. We confirmed the bug by reading the source at 2.0.0, 2.11.7, 3.0.0, 3.5.0, 3.10.0, 3.24.2, the latest release 3.28.0 and current master. Remmina 1.4.x is affected through the system libfreerdp it links (it ships no RDP code of its own). Other clients that link a libfreerdp client are very likely affected too (GNOME Connections, KRDC, Apache Guacamole guacd). We did not verify those by version. ## Tested products FreeRDP `993499447` (unmodified client `xfreerdp 3.27.2-dev0`, on Ubuntu 26.04 with glibc 2.43-2ubuntu2), ASLR + NX on: RCE (`id` = root). FreeRDP 3.24.2 and Remmina 1.4.40 (its libfreerdp): leak + DoS confirmed dynamically. ## Technical description The bug is reached in five steps. The line numbers below are from the tested build `993499447` (same build as the PoC). The overflow itself, steps 3 and 4, is byte for byte identical from 2.0.0 to current master (`a6dad4b66`). Nothing on the code path bounds the length of the attacker-controlled field before it is copied into a fixed 512-byte stream, so a malicious server gets a direct heap overflow whose contents it fully controls. ### Step 1: the server sends the redirection cookie A malicious server sends a Server Redirection PDU whose LB_LOAD_BALANCE_INFO field is fully attacker controlled. The client reads the field (raw bytes plus a server-chosen length), performs no validation on its content, and stores it verbatim. The field is opaque, and the comment even notes it need not be NUL terminated: ```c // libfreerdp/core/redirection.c, rdp_recv_server_redirection_pdu() (993499447) 720: if (!rdp_redirection_read_data(LB_LOAD_BALANCE_INFO, s, &redirection->LoadBalanceInfoLength, 721: &redirection->LoadBalanceInfo)) // raw read, attacker length 722: return STATE_RUN_FAILED; ... // libfreerdp/core/redirection.c, rdp_redirection_apply_settings() 606: /* LoadBalanceInfo may not contain a null terminator */ 607: freerdp_settings_set_pointer_len(settings, FreeRDP_LoadBalanceInfo, 608: redirection->LoadBalanceInfo, 609: redirection->LoadBalanceInfoLength); // stored verbatim ``` The server controls every byte and the full length, and those bytes travel unchanged to the overflow in step 4. ### Step 2: on reconnect the cookie becomes the RoutingToken The redirection makes the client reconnect, and on the new connection it hands the stored cookie to the negotiation layer: ```c // libfreerdp/core/connection.c (993499447) 446: if (settings->LoadBalanceInfo && (settings->LoadBalanceInfoLength > 0)) 448: if (!nego_set_routing_token(rdp->nego, settings->LoadBalanceInfo, 449: settings->LoadBalanceInfoLength)) ``` ### Step 3: verbatim copy into nego, no length check ```c // libfreerdp/core/nego.c, nego_set_routing_token() (993499447) 1928: nego->RoutingTokenLength = RoutingTokenLength; // = LoadBalanceInfoLength 1929: nego->RoutingToken = (BYTE*)malloc(nego->RoutingTokenLength); 1934: CopyMemory(nego->RoutingToken, RoutingToken, nego->RoutingTokenLength); // exact copy ``` The copy is exact and no upper bound is enforced. ### Step 4: the overflow ```c // libfreerdp/core/nego.c, nego_send_negotiation_request() (993499447) 1083: s = Stream_New(nullptr, 512); // fixed 512-byte buffer 1092: length = TPDU_CONNECTION_REQUEST_LENGTH; // ~11-byte header 1094: Stream_Seek(s, length); 1098: Stream_Write(s, nego->RoutingToken, nego->RoutingTokenLength); // memcpy, no capacity check ``` Stream_Write copies straight into the buffer at the cursor with no capacity check (nothing calls Stream_EnsureRemainingCapacity first). About 501 bytes are free after the header, so any RoutingToken longer than that writes past the end of the 512 byte allocation. The bytes written are the attacker's, from step 3. ### Step 5: from overflow to code execution The chunk right after the negotiation buffer is, deterministically (cliprdr allocation order), the clipboard request_table, a wHashTable. It is present when clipboard file redirection (FUSE) is compiled in, which is the default on Linux desktop builds. At session teardown: ``` freerdp_disconnect -> xf_post_disconnect -> xf_clipboard_free -> cliprdr_file_context_free() // client/common/client_cliprdr_file.c:2104 -> HashTable_Free(file->request_table) // :2126 ``` HashTable_Free walks the buckets and calls each entry's free callback. By overwriting the wHashTable fields (numOfBuckets, bucketArray, fnObjectFree) through the overflow, the attacker redirects that call to system(). The address could be obtained by leveraging another vuln (reported separately) to defeat ASLR. The overflow in nego.c has never been bounded and is present on current master. The correct fix is to bound RoutingTokenLength (or size the stream dynamically) in nego.c, so an oversized cookie can never write past the 512 byte buffer.

Why it matters now

Fix Fixed FreeRDP: 3.31.0

SSVC decision points

Not available: CISA has not published SSVC decision points for this record.

Affected products

VendorProductAffected versionsFixed inStatusSource
—FreeRDP2.x—No fix listedGHSA-2vf2-grvj-6g8x
—FreeRDP<= 3.30.03.31.0Patch availableGHSA-2vf2-grvj-6g8x
  • FreeRDP Vendor— Affected 2.x Fixed in — No fix listed GHSA-2vf2-grvj-6g8x
  • FreeRDP Vendor— Affected <= 3.30.0 Fixed in 3.31.0 Patch available GHSA-2vf2-grvj-6g8x

Remediation

Upgrade FreeRDP 3.x to version 3.31.0. The sources list no fixed version for FreeRDP 2.x.

Written with Claude Haiku 5.5 from the sources below · 2026-11-12

  • Fix · GHSA-2vf2-grvj-6g8x FreeRDP Fixed in 3.31.0 Advisory →

Timeline

  1. 2026-11-12 Threatist record created from GHSA-2vf2-grvj-6g8x

References

Sources

This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences