Read the docs

FreeRDP server crashes on unvalidated client desktop dimensions

Priority MEDIUM 42CWE-369Published · 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-4464-r7qj-pgrx. Fix status from GitHub. Impact type from CWE-369.

Summary

FreeRDP up to and including 3.30.0 server stores the client's DesktopWidth and DesktopHeight without checks during capability negotiation. A malicious RDP client can send a zero or very large size that crashes the server before authentication, through a divide by zero or a failed assertion that aborts the process. No credentials are needed when the server offers TLS or standard RDP security without NLA.

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

Description from the GitHub advisory

A pre-authentication remote crash of any server built on FreeRDP's server API (`libfreerdp`), caused by trusting client-supplied desktop dimensions during capability negotiation. **Attack direction: a malicious RDP client attacks the server** (this is a server-side defect in the capability writer; it is not the client-side codec path covered by the recent CVE wave). During the GCC phase of the RDP handshake, `gcc_read_client_core_data` stores the client's `DesktopWidth`/`DesktopHeight` (two attacker-controlled little-endian UINT16s in the CS_CORE block) with no range check, and when the server later writes its Demand Active PDU the multifragment-update capability set does tile arithmetic on those raw values inside `WINPR_ASSERT` expressions: a dimension of 0 divides by zero (SIGFPE kills the process), and a large grid such as 32768×32768 fails the assert and calls `abort()`. In a default CMake build (`WITH_VERBOSE_WINPR_ASSERT=ON`, no `NDEBUG`) — the configuration our verification used and the one the project's own build banner prints — both crash paths are live, and no credentials are needed when the server offers TLS or standard RDP security without NLA (exactly the sample-server configuration). Verified against a minimal server built on the unmodified libfreerdp **3.30.0** release (the current latest; sample-server configuration): `DesktopWidth=0` → server killed by SIGFPE (container exit 136); `32768×32768` → WINPR_ASSERT abort (exit 134) with the fatal log naming `capabilities.c:2822` verbatim; control run `1024×768` → server survives and delivers Demand Active. Additionally reproduced end-to-end against the official shipped server binary: freerdp-shadow-cli rebuilt from the same snapshot with WITH_X11=ON and run under Xvfb dies identically - DesktopWidth=0 → process exit 136 (SIGFPE), 32768×32768 → exit 134 with the same capabilities.c:2822 WINPR_ASSERT fatal, 1024×768 → process stays alive (e2e/rfb/freerdp/F1/logs_realserver/). The vulnerable lines are unchanged on current `master` (source-verified 2026-08-17), and none of the repository's 100+ published advisories (including the 2026 third-party audit wave) covers Core Data dimension validation or this capability writer — the tile code dates to 2014 (#1785/#1989) and the field has never been validated. ## Details Source (identical in the 3.30.0 release and current `master`): `libfreerdp/core/gcc.c:1186-1187` — the unvalidated source, parsed from the attacker's MCS Connect Initial: ```c Stream_Read_UINT16(s, settings->DesktopWidth); /* DesktopWidth (2 bytes) */ Stream_Read_UINT16(s, settings->DesktopHeight); /* DesktopHeight (2 bytes) */ ``` `libfreerdp/core/settings.c:1208-1209` — server-mode default: `MultifragMaxRequestSize = 0`, which is the "use defaults" marker consumed below. `libfreerdp/core/capabilities.c:2817-2822` (`rdp_write_multifragment_update_capability_set`) — the sink, reached unconditionally from `rdp_write_demand_active` (capabilities.c:4688) when the server has `ServerMode && MultifragMaxRequestSize == 0`: ```c const UINT32 tileNumX = (settings->DesktopWidth + 63) / 64; const UINT32 tileNumY = (settings->DesktopHeight + 63) / 64; WINPR_ASSERT(tileNumX < UINT32_MAX / tileNumY); /* SIGFPE when DesktopHeight == 0 */ WINPR_ASSERT(tileNumY < UINT32_MAX / tileNumX); /* SIGFPE when DesktopWidth == 0 */ WINPR_ASSERT(tileNumX * tileNumY < UINT32_MAX / 16384u); /* abort() when tile grid >= 262144 */ ``` - `WINPR_ASSERT` in a default build (`WITH_VERBOSE_WINPR_ASSERT=ON`, `cmake/CommonConfigOptions.cmake:15`; no `CMAKE_BUILD_TYPE` ⇒ no `NDEBUG`) always *evaluates* its operands — the divide-by-zero happens while evaluating the condition, and the failing condition calls `winpr_int_assert` → `abort()`. (Only a build with both verbose asserts OFF and NDEBUG defined escapes both crashes, at the cost of silently wrapping arithmetic instead.) - There is no validation anywhere between the GCC parse and the capability write (checked over `connection.c`, `peer.c`, `activation.c` and the state machine): the server accepts the session, runs Erect Domain / Attach User / channel joins and Client Info, then dies the moment it tries to send Demand Active. - Authentication position: the crash happens after the Client Info PDU but **before any credential verification** in a TLS-only or standard-RDP-security deployment (TLS encrypts but does not authenticate the client). With NLA enforced, the same crash is reachable post-authentication (attacker needs valid credentials) — the sample/default server configuration used for verification has `RdpSecurity`/`TlsSecurity` ON, `NlaSecurity` OFF, matching `server/Sample/sfreerdp-server.c`. ## PoC Verified on 2026-08-15 against a minimal server harness (`vuln_server.c` in the gist, modeled on `server/Sample/sfreerdp-server.c`) linked against `libfreerdp3.so` / `libwinpr3.so` built from the unmodified 3.30.0 release tarball with upstream default CMake options. The PoC client (`poc_client.py`, Python stdlib only) speaks real RDP: X.224 negotiation (`PROTOCOL_SSL`), a genuine TLS 1.3 handshake, MCS Connect Initial with the poisoned CS_CORE, Erect Domain / Attach User / 3× Channel Join, Client Info PDU, and auto-detect/multitransport responses. Environment: `gcc:13-bookworm` build container, server run in `debian:bookworm-slim`, attacker in `python:3.11-slim`, both on a Docker network; the server's own startup banner prints `* 'WITH_VERBOSE_WINPR_ASSERT=ON'`. ### Build & run the victim ```bash git clone https://github.com/FreeRDP/FreeRDP && cd FreeRDP cmake -B build -S . -GNinja -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF \ -DWITH_X11=OFF -DWITH_WAYLAND=OFF -DWITH_FFMPEG=OFF -DWITH_SWSCALE=OFF \ -DWITH_CLIENT=OFF -DWITH_CLIENT_CHANNELS=OFF -DWITH_PROXY=OFF \ -DWITH_MANPAGES=OFF # headless isolation only; NO CMAKE_BUILD_TYPE (no NDEBUG), # WITH_VERBOSE_WINPR_ASSERT left at default ON ninja -C build winpr freerdp # link the minimal server harness from the gist against the built libraries: gcc -O0 -g vuln_server.c -o vuln_server -Iinclude -Iwinpr/include -Ibuild $(find build -type d -name include | sed 's/^/-I/') \ $(find build -name libfreerdp3.so) $(find build -name libwinpr3.so) -lssl -lcrypto -lz -ldl -lpthread -lrt -lutil openssl req -x509 -newkey rsa:2048 -keyout server.key -out server.crt -days 30 -nodes -subj "/CN=poc" LD_LIBRARY_PATH=<dir-with-the-so's> ./vuln_server --port=3389 --cert=server.crt --key=server.key ``` The harness uses the public `freerdp_listener`/`freerdp_peer` server API with the sample's security flags (Rdp+TLS ON, NLA OFF) and — decisively — does **not** override `FreeRDP_MultifragMaxRequestSize`, i.e. it runs with the server-mode default 0, which is the library's documented default behavior for any embedder. The shipped `server/Sample/sfreerdp-server` (built by default, `WITH_SERVER=ON`) takes the same path. ### Reproduction steps 1. Start the victim and confirm it is in the vulnerable configuration — the defect needs the server in server mode with `MultifragMaxRequestSize` left at the default 0 (the library default; confirm from the startup log line `peer initialized (MultifragMaxRequestSize=0)` in our harness, or simply that nothing overrides the setting) and offering TLS without NLA, so that the crash is reached before authentication. 2. Run the attack from any machine that can reach port 3389 (each command performs the full RDP handshake with the chosen dimensions): ```bash python3 poc_client.py <host> 3389 0 1 # DesktopWidth=0 -> SIGFPE python3 poc_client.py <host> 3389 32768 32768 # 32768x32768 grid -> assert abort ``` 3. **Expected — zero dimension:** the server process is killed by SIGFPE while evaluating `UINT32_MAX / tileNumX` (tileNumX==0); the container reports exit **136** (128+8). The WLog buffer is lost on the signal, so the client side observes the crash as an abrupt EOF right after the licensing error packet (client log: `server closed the connection (EOF) - likely crashed`). 4. Variant — large grid: exit **134** (128+6, SIGABRT) and the server's fatal log pinpoints the exact sink: ``` [FATAL][com.freerdp.winpr.assert] - [winpr_int_assert]: ((tileNumX * tileNumY < (4294967295U) / 16384u)) [./libfreerdp/core/capabilities.c:rdp_write_multifragment_update_capability_set:2822] ``` 5. Control — the identical handshake with `1024 768`: the server survives the tile computation and returns the Demand Active PDU (client log: `got Demand Active era PDU (server survived the tile computation)`); only the two dimension fields differ, so the crash is attributable to them alone. ### PoC source <!--POC--> The gist carries the malicious client (`poc_client.py`), the victim harness (`vuln_server.c`), and `REPRODUCE.md` with the full steps above. ### Captured output — assert-abort path (`32768×32768`, server exit 134) client: ``` [08:26:18] MCS Connect Initial sent (CS_CORE DesktopWidth=32768 DesktopHeight=32768) [08:26:18] MCS Connect Response OK, messageChannelId=1004 [08:26:18] AttachUserConfirm OK, userId=1005 [08:26:18] ChannelJoinConfirm OK for channel 1005 [08:26:18] Client Info PDU sent (42 bytes payload) [08:26:18] server closed the connection (EOF) - likely crashed [08:26:18] RESULT=eof ``` server (last lines before death): ``` [FATAL][com.freerdp.winpr.assert] - [winpr_int_assert]: ((tileNumX * tileNumY < (4294967295U) / 16384u)) [./libfreerdp/core/capabilities.c:rdp_write_multifragment_update_capability_set:2822] ``` ### Captured output — SIGFPE path (`0×1`, server exit 136) ``` [08:26:10] MCS Connect Initial sent (CS_CORE DesktopWidth=0 DesktopHeight=1) [08:26:10] server PDU on channel 1003 secflags=0x0080 len=20 [08:26:10] server closed the connection (EOF) - likely crashed [08:26:10] RESULT=eof ``` server container: `exit=136` (SIGFPE; log buffer unflushed due to the signal). ### Captured output — control (`1024×768`, server survives) ``` [08:26:25] MCS Connect Initial sent (CS_CORE DesktopWidth=1024 DesktopHeight=768) [08:26:25] server PDU on channel 1003 secflags=0x0080 len=20 [08:26:25] server PDU on channel 1003 secflags=0x0151 len=337 [08:26:25] got Demand Active era PDU (server survived the tile computation) [08:26:25] RESULT=survived ``` ## Impact Remote denial of service of any RDP server built on libfreerdp's server API that (a) is built with the default verbose asserts (all default and oss-fuzz builds), and (b) does not override `MultifragMaxRequestSize` (the library default) — including the shipped `server/Sample/sfreerdp-server` and custom embedders (gateways, shadow-style servers). For the common TLS-only / standard-RDP-security deployments the crash precedes any client authentication: one TCP connection and one crafted CS_CORE block kill the server process; repeatable per connection at no cost to the attacker. With NLA enforced the same input requires valid credentials (authenticated DoS). No memory corruption — impact is availability only (SIGFPE/SIGABRT terminate the process). ### CVSS `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H` → **5.8 Medium** - `AV:N` — plain RDP/TCP reachability of the victim server - `AC:H` — the crash requires deployment conditions outside the attacker's control: default-build asserts (ON by default), server not overriding `MultifragMaxRequestSize` (default), and TLS/standard security rather than NLA for the unauthenticated variant - `PR:N` — no credentials needed on the tested (sample/default) configuration; NLA deployments degrade to `PR:L` - `A:H` — whole-process termination per connection, trivially repeatable; `C`/`I` unaffected ### Suggested fix Validate at the parse boundary in gcc_read_client_core_data: reject DesktopWidth/DesktopHeight of 0, and clamp or reject values beyond the server's maximum. MS-RDPBCGR §2.2.1.3.2 defines both fields as plain 16-bit unsigned integers with no range constraint; §3.3.5.3.3 specifies that oversized values are *implicitly clamped* to the server's maximum allowed width/height rather than rejected, with Microsoft's maxima documented in Appendix A notes <46>/<47> as 4096 px (RDP 5.1–7.1 servers) and 8192 px (RDP 8.0+ servers). Clamping matches the protocol's specified server behavior; outright rejection is stricter hardening. The physical dimensions have an explicit spec rule (ignored if outside 10–10000 mm). Additionally, replace the `WINPR_ASSERT`s in `rdp_write_multifragment_update_capability_set` with checked arithmetic returning `FALSE` — the function already has a `BOOL` error path, and `WINPR_ASSERT` must not be the only guard on peer-controlled arithmetic. The client-side mirror (server-supplied bitmap capability dimensions, `capabilities.c:420-421`) deserves the same validation. ### Affected versions **<= 3.30.0** (current latest release, 2026-07-16) and current `master` (source-verified 2026-08-17: gcc.c:1186-1187 and capabilities.c:2817-2822 are unchanged). Runtime verification was performed against the 3.30.0 release tarball with default CMake options. The tile computation was introduced in 2014 (#1785 / #1989); no release since has validated the dimensions, and none of the repository's published advisories (checked against the 100 most recent, spanning the 2026 audit wave) covers this path. ## Credit Reported by the diff/ambidiff security research effort (afldl). Happy to coordinate a disclosure timeline; will request a CVE once confirmed.

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
—FreeRDP<= 3.30.03.31.0Patch availableGHSA-4464-r7qj-pgrx
  • FreeRDP Vendor— Affected <= 3.30.0 Fixed in 3.31.0 Patch available GHSA-4464-r7qj-pgrx

Remediation

Upgrade FreeRDP to version 3.31.0, which fixes this issue.

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

  • Fix · GHSA-4464-r7qj-pgrx FreeRDP Fixed in 3.31.0 Advisory →

Timeline

  1. 2026-11-12 Threatist record created from GHSA-4464-r7qj-pgrx

References

Sources

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