Use-after-free race in FreeRDP drdynvc client channel close
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
FreeRDP's drdynvc client has a use-after-free race between dvcman_call_on_receive() and dvcman_channel_close() (CWE-416, CWE-362). A malicious or compromised RDP server can send DYNVC_CLOSE on the close path while a concurrent DYNVC_DATA on the receive path still calls OnDataReceived through the callback that was freed. AddressSanitizer reports a heap-use-after-free in dvcman_call_on_receive at channels/drdynvc/client/drdynvc_main.c:520. Any FreeRDP client connected to such a server is affected, and CISA has not added it to KEV.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
Description from the GitHub advisory
Summary A use-after-free race in the drdynvc client between dvcman_call_on_receive() and dvcman_channel_close() lets a server-driven DYNVC_CLOSE running on the close path free the channel callback while a concurrent DYNVC_DATA on the receive path is still calling OnDataReceived through it. ASan confirms heap-use-after-free in dvcman_call_on_receive at channels/drdynvc/client/drdynvc_main.c:520. The defect is reachable on any FreeRDP client connected to a malicious or compromised RDP server. ▎ Note for maintainers — this appears to be a silent fix. Commits e02e052f ("[channels,drdynvc] reset channel_callback before close", 2026-01-26) and cb7f295b ("[channels,drdynvc] check pointer before reset", 2026-01-27) restructure exactly this section of ▎ dvcman_channel_close() to invalidate channel->channel_callback = NULL before invoking cb->OnClose (which frees the callback). The diff in 3.21.0...3.22.0 for channels/drdynvc/client/drdynvc_main.c matches the race window described here. 3.21.0 and earlier are ▎ vulnerable; 3.22.0 and later contain the fix. This advisory is therefore submitted as a CVE/credit request for the already-shipped silent fix, not as a new defect against current main. Details Vulnerable code (FreeRDP ≤ 3.21.0, channels/drdynvc/client/drdynvc_main.c): dvcman_channel_close() invokes the user callback's OnClose, which frees the callback object, before invalidating channel->channel_callback: // channels/drdynvc/client/drdynvc_main.c — pre-3.22.0 { IWTSVirtualChannelCallback* cb = channel->channel_callback; if (cb) { check_open_close_receive(channel); IFCALL(cb->OnClose, cb); // <-- frees the callback } } channel->channel_callback = NULL; // <-- happens after the free Concurrently, dvcman_call_on_receive() (called from dvcman_receive_channel_data() → drdynvc_process_data() → drdynvc_order_recv() on the drdynvc client thread) reads the same field with no lock and dispatches into it: // channels/drdynvc/client/drdynvc_main.c, dvcman_call_on_receive (~L460-L520) IWTSVirtualChannelCallback* cb = channel->channel_callback; if (cb) return cb->OnDataReceived(cb, data); // <-- racing read after free The refCounter mechanism on the channel structure does not protect channel_callback itself — it only governs lifetime of the enclosing DVCMAN_CHANNEL. So even in cases where the channel object survives, the callback pointer it holds can be a freed allocation while dvcman_call_on_receive is still mid-call. Fix already in tree (3.22.0): // channels/drdynvc/client/drdynvc_main.c — 3.22.0+ { check_open_close_receive(channel); IWTSVirtualChannelCallback* cb = channel->channel_callback; channel->channel_callback = NULL; // <-- NULL'd before the free if (cb) { IFCALL(cb->OnClose, cb); } } This closes the read-after-free window for dvcman_call_on_receive and is the right minimal fix. Component / paths: - Source: channels/drdynvc/client/drdynvc_main.c - Read site (sink): dvcman_call_on_receive() ≈ L460-L520 - Write site (source): dvcman_channel_close() ≈ L509-L515 - Reach path: drdynvc_virtual_channel_client_thread → drdynvc_order_recv → drdynvc_process_data → dvcman_receive_channel_data → dvcman_call_on_receive CWE: CWE-416 (Use-After-Free) with CWE-362 (Concurrent Execution Using Shared Resource with Improper Synchronization). Affected versions: FreeRDP ≤ 3.21.0. Fixed: 3.22.0 (commit e02e052f, hardened by cb7f295b). PoC A self-contained C harness that re-instantiates the exact structure layouts and access patterns of DVCMAN_CHANNEL and dvcman_channel_close / dvcman_call_on_receive from drdynvc_main.c, then races a data thread against a close thread. The harness is not a simulation — it links the same logic and demonstrates the bug under sanitizers. Live reproduction against a real xfreerdp client (3.21.0 / c93c627c) connected to a test RDP server is also captured. Build (standalone harness): # Thread-Sanitizer build (data-race report) gcc -fsanitize=thread -g -O1 -pthread -o poc_tsan poc_dvc_uaf.c # Address-Sanitizer build (UAF report) gcc -fsanitize=address -g -O1 -pthread -o poc_asan poc_dvc_uaf.c Run: ./poc_asan # ASan: heap-use-after-free in dvcman_call_on_receive ./poc_tsan # TSan: data race on channel_callback Live client trace (FreeRDP 3.21.0, ASan build, against a controllable RDP test server that emits DYNVC_DATA and DYNVC_CLOSE back-to-back on a custom DVC channel): [DVC_TRACE] order_recv: Cmd=0x05 Sp=0 cbChId=0 remaining=11 [DVC_TRACE] order_recv: Cmd=0x01 Sp=0 cbChId=0 remaining=35 [DVC_TRACE] order_recv: Cmd=0x03 Sp=0 cbChId=0 remaining=9 [DVC_TRACE] process_data: ChannelId=42 state=1 compressed=0 [RACE_DEMO] Launched close thread, sleeping 50ms... [RACE_DEMO] Close thread calling dvcman_channel_close()... [RACE_DEMO] Close thread done. [RACE_DEMO] Dereferencing freed cb=0x7bb5365e60e0 (channel_callback now=(nil)) ==3490159==ERROR: AddressSanitizer: heap-use-after-free on address 0x7bb5365e60e0 ... READ of size 8 at 0x7bb5365e60e0 thread T6 #0 dvcman_call_on_receive drdynvc_main.c:520 #1 dvcman_receive_channel_data drdynvc_main.c:952 #2 drdynvc_process_data drdynvc_main.c:1501 #3 drdynvc_order_recv drdynvc_main.c:1581 #4 drdynvc_virtual_channel_client_thread drdynvc_main.c:1762 freed by thread T0: #0 free #1 OnClose (in dvcman_channel_close at drdynvc_main.c ~L514 pre-fix) Full PoC sources, ASan/TSan logs, the build Dockerfile, and the adversarial RDP-server harness are in poc-evidence-freerdp/artifacts/VENDOR-dvc_uaf_race/ of the attached evidence tarball. Impact - Vulnerability class: Use-after-free / data race (CWE-416 + CWE-362). - Attacker model: Any RDP server the FreeRDP client connects to. No special FreeRDP build flags — drdynvc is on by default and the affected code path runs whenever a dynamic virtual channel is opened, used, and closed (the standard lifecycle for audin, rdpgfx, rail, urbdrc, plug-in DVCs, etc.). - Who is impacted: All deployments running FreeRDP ≤ 3.21.0 as a client (xfreerdp, wlfreerdp, sdl-freerdp, FreeRDP-based front-ends such as Remmina, GNOME Connections, KRDC). Server-side and ≥ 3.22.0 clients are not affected. - Reachability: Trivial. A malicious server can deterministically schedule DYNVC_DATA and DYNVC_CLOSE back-to-back on the same channel ID; the race window is wide enough to hit on the first attempt under typical Linux client schedulers, and any TLS-MitM or compromised RDP gateway has equivalent capability. - Severity outcome: Minimum DoS (heap-use-after-free in the renderer thread → SIGSEGV / abort in the connected RDP client). Heap-grooming a controlled callback object behind the freed pointer is plausible (tcache poison → controlled vtable → RIP control); the supplied PoC demonstrates the UAF read primitive but does not weaponize the vtable. Recommend treating as High for client-side RCE risk in line with comparable drdynvc/channel UAFs already published as CVEs (e.g., CVE-2026-22856/22857 in the IRP path, CVE-2024-22211 in freerdp_bitmap_planar_context_reset). - Disclosure ask: Please assign a CVE for the silent fix shipped in 3.22.0 (commits e02e052f + cb7f295b) and include the affected-range information so downstream packagers (Debian, Ubuntu, RHEL, Fedora, FreeBSD ports) can backport rather than assume the version is unfixed because no advisory was published. Researcher: J Laratro (d0sf3t), [email protected] — happy to coordinate any further validation or co-author the eventual GHSA.
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 | <= 3.21.0 | > 3.22.0 | Patch available | GHSA-3mv2-5q57-2v8h |
- FreeRDP Vendor— Affected <= 3.21.0 Fixed in > 3.22.0 Patch available GHSA-3mv2-5q57-2v8h
Remediation
Upgrade FreeRDP to a version later than 3.22.0. Versions 3.21.0 and earlier are affected.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
- Fix · GHSA-3mv2-5q57-2v8h FreeRDP Fixed in > 3.22.0 Advisory →
Timeline
- 2026-11-12 Threatist record created from GHSA-3mv2-5q57-2v8h
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences