Read the docs

Unbounded RDPGFX scaled-output geometry can abort an X11 FreeRDP client

Priority LOW 30CWE-20Published · Updated

Key facts

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

Attack profile from CVSS 3.1 · GHSA-wffv-rjv2-h2x2. Fix status from GitHub. Impact type from CWE-617.

Summary

FreeRDP up to and including 3.32.1 does not bound oversized target width, target height, or output origin values that a malicious or compromised RDP server sends in an RDPGFX MAPSURFACETOSCALEDOUTPUT PDU. An X11 client with verbose checked casts can abort when it handles these values, which is a reachable assertion (CWE-617) caused by improper input validation (CWE-20). A remote attacker needs a server that the victim connects to, and the server must create a surface before mapping it to oversized scaled output. The advisory states that no full-session wire-to-abort run was preserved, and the reported aborts come from focused tests.

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

Description from the GitHub advisory

### Summary A malicious or compromised RDP server can supply oversized `targetWidth`, `targetHeight`, or output origin in an RDPGFX `MAPSURFACETOSCALEDOUTPUT` PDU. FreeRDP stores these 32-bit values on the mapped graphics surface without bounding them to later X11 coordinates or buffers. In a verbose-assert X11 client, a later X Expose event on the default software-GDI path can reach a checked `UINT16` cast of the oversized output extent. With `/gdi:hw` and an X visual requiring a stage buffer, an oversized target width reaches `freerdp_image_scale`'s destination-stride assertion; a focused real-function test exited 134. There is no preserved full-session wire-to-abort run for this finding. ### Root cause `rdpgfx_recv_map_surface_to_scaled_output_pdu` in `channels/rdpgfx/client/rdpgfx_main.c` reads server-supplied 32-bit target dimensions. `gdi_MapSurfaceToScaledOutput` in `libfreerdp/gdi/gfx.c` stores them verbatim. The default `gdi_OutputUpdate` clamps painting to the local desktop, but `xf_OutputExpose` in `client/X11/xf_gfx.c` casts the stored output extent to `UINT16` during an X Expose. The optional hardware-GDI `xf_OutputUpdate` computes scaled output dimensions without checking the fixed-size stage buffer before calling `freerdp_image_scale`. ### Attack requirements and impact The victim must connect an X11 FreeRDP client with RDPGFX to a server controlled by the attacker, and the server must create a surface before mapping it to oversized scaled output. The default-path abort additionally needs a later X Expose event and verbose checked casts. The focused scale-assert run requires `/gdi:hw` and a local X visual whose color format creates a stage buffer; the preserved 24-bit Xvfb visual did not create one. A focused WinPR checked-cast probe also aborted for an oversized hardware-GDI destination coordinate. No live malicious-server session demonstrated these final aborts. A conditional heap-write theory for optional SWSCALE/Cairo builds remains untested. ### Validation and reproduction The preserved real-function test mapped a 100×100 surface to a 200×100 target. It recorded `dwidth=200`, `stageScanline=464` bytes, and a fatal `freerdp_image_scale` assertion that destination stride must cover `nXDst + nDstWidth`; the process exited 134. A 100×400 control returned without a write because no scaling backend was compiled. A separate checked-cast probe calculated `nXDst=2,970,000,000` from a 3,000,000,000-pixel target width and aborted. These are focused tests, not a full network PoC. ### Reproduction This complete focused harness reproduces X11 surface sizing and calls the real `freerdp_image_scale` with the scaled-output dimensions computed by `xf_OutputUpdate`. Save it as `cand11.c` and compile against a matching FreeRDP build. It bypasses the RDPGFX wire parser and X11 callback selection, so its abort applies when the optional path is actually exercised; no full-session malicious-server replay was preserved. ```c /* Focused test for the rdpgfx scaled-output target-size issue in * client/X11/xf_gfx.c:xf_OutputUpdate(). * * The server controls outputTargetWidth/Height via * RDPGFX_CMDID_MAPSURFACETOSCALEDOUTPUT. xf_OutputUpdate computes * sx = outputTargetWidth / mappedWidth; * dwidth = lround(swidth * sx); * and (when surface->stage != NULL, i.e. gdi->dstFormat != surface format) * calls * freerdp_image_scale(stage, gdi->dstFormat, stageScanline, nXSrc, nYSrc, * dwidth, dheight, gdi->data, gdi->format, gdi->scanline, * nXSrc, nYSrc, swidth, sheight); * with no clamp of dwidth/dheight against the stage buffer. * * This test reproduces the X11 surface sizing/allocation exactly as * xf_CreateSurface() does (width/height padded to 16, scanline = padded*4+16) * and calls the real freerdp_image_scale() with the arguments xf_OutputUpdate * would pass for a server-supplied target size. * * Expected on this build (WITH_CAIRO=OFF, WITH_SWSCALE=OFF, asserts ON): * case A (targetWidth = 2*mappedWidth): WINPR_ASSERT abort inside * freerdp_image_scale (nDstStep/bpp >= nXDst+nDstWidth fails) * case B (targetWidth = mappedWidth, targetHeight = 4*mappedHeight): * asserts pass; function returns FALSE (no scaling backend) so no * write happens in this build. With WITH_SWSCALE/WITH_CAIRO the * backend behavior requires a separate instrumented test. * * Build: gcc -O0 -g -o xf_gfx_scale_overflow xf_gfx_scale_overflow.c \ * $(pkg-config --cflags --libs freerdp3) * Run: ./xf_gfx_scale_overflow A|B */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <freerdp/codec/color.h> /* exact x11_pad_scanline() from client/X11/xf_gfx.c */ static UINT32 x11_pad_scanline(UINT32 scanline, UINT32 inPad) { if (inPad > 0) { const UINT32 align = inPad / 8; const UINT32 pad = align - scanline % align; if (align != pad) scanline += pad; } if (scanline % 16) scanline += 16 - scanline % 16; return scanline; } int main(int argc, char** argv) { if (argc != 2) return 2; const char mode = argv[1][0]; /* Server-supplied createSurface size (<= MAX_SURFACE_SIZE=32766). */ const UINT32 mappedWidth = 100; const UINT32 mappedHeight = 100; /* xf_CreateSurface: padded surface dims + stage buffer. */ const UINT32 sWidth = x11_pad_scanline(mappedWidth, 16); const UINT32 sHeight = x11_pad_scanline(mappedHeight, 16); const UINT32 pad = 16; /* xfc->scanline_pad (Xvfb 24bpp: 32; with 16 no change here) */ const UINT32 bpp = 4; UINT32 scanline = sWidth * bpp; scanline = x11_pad_scanline(scanline, pad) + 16; UINT32 stageScanline = sWidth * bpp; stageScanline = x11_pad_scanline(stageScanline, pad) + 16; BYTE* data = calloc(1, (size_t)scanline * sHeight); BYTE* stage = calloc(1, (size_t)stageScanline * sHeight); if (!data || !stage) return 3; printf("surface mapped %ux%u padded %ux%u scanline=%u stageScanline=%u " "stage_bytes=%zu\n", mappedWidth, mappedHeight, sWidth, sHeight, scanline, stageScanline, (size_t)stageScanline * sHeight); /* Server-controlled scaled-output target. */ UINT32 targetWidth, targetHeight; if (mode == 'A') { targetWidth = mappedWidth * 2; /* xf_OutputUpdate: sx = 2 */ targetHeight = mappedHeight; } else { targetWidth = mappedWidth; /* sx = 1 -> width assert passes */ targetHeight = mappedHeight * 4; } const double sx = 1.0 * targetWidth / mappedWidth; const double sy = 1.0 * targetHeight / mappedHeight; /* Full-surface invalid rect (0,0,mappedWidth,mappedHeight) clipped by * region16_intersect_rect() against mappedWidth/mappedHeight in * xf_OutputUpdate. */ const UINT32 nXSrc = 0, nYSrc = 0; const UINT32 swidth = mappedWidth, sheight = mappedHeight; const UINT32 dwidth = (UINT32)(swidth * sx); const UINT32 dheight = (UINT32)(sheight * sy); printf("target %ux%u -> sx=%f sy=%f dwidth=%u dheight=%u\n", targetWidth, targetHeight, sx, sy, dwidth, dheight); fflush(stdout); /* freerdp_image_scale(stage, gdi->dstFormat, stageScanline, nXSrc, nYSrc, * dwidth, dheight, gdi->data, gdi->format, scanline, * nXSrc, nYSrc, swidth, sheight); */ const BOOL rc = freerdp_image_scale(stage, PIXEL_FORMAT_BGRX32, stageScanline, nXSrc, nYSrc, dwidth, dheight, data, PIXEL_FORMAT_BGRA32, scanline, nXSrc, nYSrc, swidth, sheight); printf("freerdp_image_scale rc=%d (returned normally, no scaling backend)\n", rc); free(data); free(stage); return 0; } ``` ```sh cc -O0 -g cand11.c $(pkg-config --cflags --libs freerdp3) -o cand11 ./cand11 A # 100x100 mapped surface, 200x100 target; expected assertion/exit 134 ./cand11 B # 100x400 target; control in the no-scaling-backend build ``` In the preserved no-SWSCALE/no-Cairo build, mode A aborted at the `freerdp_image_scale` destination-stride assertion (exit 134), with `dwidth=200` and a 464-byte staging stride. Mode B returned without an out-of-bounds write because no scaling backend was compiled. The default `SoftwareGdi` setting blocks the specific software-update callback path, although a source-supported X Expose path remains; no live network trigger or backend-dependent write was observed. ### Remediation Check the server's output origin and scaled target geometry in wide arithmetic before storing it. Reject extents outside the client's supported coordinate and display limits. Ensure hardware-GDI scaling cannot write beyond its allocated stage buffer, and test the default Expose and optional scaling paths with oversized targets. No fixed release was identified.

Why it matters now

Fix Fixed FreeRDP (c): 3.32.2

SSVC decision points

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

Affected products

VendorProductAffected versionsFixed inStatusSource
—FreeRDP (c)<= 3.32.13.32.2Patch availableGHSA-wffv-rjv2-h2x2
  • FreeRDP (c) Vendor— Affected <= 3.32.1 Fixed in 3.32.2 Patch available GHSA-wffv-rjv2-h2x2

Remediation

Upgrade FreeRDP to version 3.32.2, which fixes this issue. CISA has not listed this vulnerability in its Known Exploited Vulnerabilities catalog.

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

  • Fix · GHSA-wffv-rjv2-h2x2 FreeRDP (c) Fixed in 3.32.2 Advisory →

Timeline

  1. 2026-11-12 Threatist record created from GHSA-wffv-rjv2-h2x2

References

Sources

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