Read the docs

Uninitialized memory disclosure in FreeRDP RDPGFX ResetGraphics

Priority MEDIUM 44CWE-200Published · Updated

Key facts

Attack vector
Network
Privileges required
Low
User interaction
None
Attack complexity
Low
Impact type
Information disclosure
Confidentiality · integrity · availability
High · None · None
Fix status
Fixed

Attack profile from CVSS 3.1 · GHSA-r7jx-j9h7-j4xj. Fix status from GitHub. Impact type from CWE-200.

Summary

FreeRDP from 2.0.0 through 3.30.0 has an uninitialized memory flaw in the RDPGFX server's ResetGraphics serializer, which leaves the padding bytes of each PDU unset (CWE-908). A remote attacker with low privileges can receive up to 300 bytes of stale heap memory from the server, which exposes sensitive information (CWE-200).

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

Description from the GitHub advisory

# FreeRDP RDPGFX ResetGraphics discloses up to 300 bytes of uninitialized heap memory Discovery credit: Bynario Atlas CVSS v3.1 (standalone root cause): `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N` (6.5, Medium) CWE(s): `CWE-908` (Use of Uninitialized Resource), `CWE-200` (Exposure of Sensitive Information) ## Summary > Disclosure note: This finding was identified and validated by Bynario Atlas, an AI automated pipeline. The technical claims and supporting evidence were manually reviewed before submission. The disclosure path is already mitigated on master by commit `483c9388119f06bac420d92053cff9ef94e83bea`, which changed fresh stream allocation from `malloc()` to `calloc()`. No released tag contains that mitigation, and the `ResetGraphics` serializer still omits the padding write. This report documents the security impact in affected releases so the project can assess an advisory and an explicit serializer fix; it is not asserting that the validated stale-heap disclosure remains observable on current master. In FreeRDP 2.0.0 through 3.30.0, the RDPGFX server serializes every `ResetGraphics` PDU as 340 bytes but advances over the unused padding without initializing it. Those releases allocate the stream backing buffer with `malloc()`. A one-monitor reset therefore sends 40 initialized bytes followed by 300 bytes of stale heap content to the RDP client. The leak has exposed live heap pointers and GLib function pointers over TCP. It can defeat heap ASLR and disclose the GLib module base. ## Affected versions and preconditions - Source-confirmed in released FreeRDP 2.0.0 through 3.30.0; runtime-tested on FreeRDP 3.30.0. - The RDPGFX server serializer was introduced before FreeRDP 2.0.0 and every inspected release through 3.30.0 uses an uninitialized `Stream_New()` buffer. - Current master at commit `9626564421df72c84f891afdbc0b20bf702f369f` still skips the padding write. - Master commit `483c9388119f06bac420d92053cff9ef94e83bea` changed fresh `Stream_New()` buffers from `malloc()` to `calloc()`. This incidentally mitigates this disclosure path on master, although the faulty serializer still omits an explicit padding write. ## Technical Analysis ### Background `ResetGraphics` has a fixed wire size of 340 bytes: ```text RDPGFX header 8 bytes width/height/monitorCount 12 bytes MONITOR_DEF array 20 bytes per monitor padding remaining bytes to 340 ``` The server limits `monitorCount` to fewer than 16 and creates a stream sized for the complete fixed PDU. ### Vulnerability The serializer writes the header and defined fields, then seeks to the fixed end: ```c wStream* s = rdpgfx_server_single_packet_new( log, RDPGFX_CMDID_RESETGRAPHICS, 340 - RDPGFX_HEADER_SIZE); /* header, dimensions, count, and monitor definitions are written */ const size_t pos = Stream_GetPosition(s); Stream_SafeSeek(s, 340 - pos); return rdpgfx_server_single_packet_send(context, s); ``` This snippet is quoted from FreeRDP 3.24.1 through 3.30.0 and master. FreeRDP 2.0.0 through 3.24.0 spells the same defect as `Stream_SetPosition(s, RDPGFX_RESET_GRAPHICS_PDU_SIZE)`, which likewise advances across the transmitted padding without initializing it. `Stream_SafeSeek()` changes the stream position; it does not write or clear the skipped range. Through FreeRDP 3.30.0, `Stream_New(NULL, size)` obtains the backing bytes with `malloc(size)`, so the range retains prior heap content. For the ordinary one-monitor case: ```text initialized: 8 + 12 + 20 = 40 bytes transmitted: 340 bytes uninitialized disclosure: 300 bytes ``` With 15 monitors, 20 padding bytes remain uninitialized. The issue therefore discloses between 20 and 300 bytes per PDU for reachable nonzero monitor counts. ### Reachability The peer must reach an active RDPGFX dynamic virtual channel, complete the RDPGFX capability exchange, and cause the server integration to call `ResetGraphics`. Display creation and monitor-layout changes are normal triggers. Authentication requirements are set by the embedding FreeRDP server. The issue was reproduced through a live GNOME Remote Desktop server. A normal graphics reset produced a 340-byte PDU over TCP whose padding contained stale addresses from the server process. ## Reproduction 1. Build FreeRDP 3.30.0 with the RDPGFX server channel enabled. 2. Run a server that negotiates RDPGFX with a test client. 3. Arrange for a freed allocation in the same size class to contain recognizable non-secret marker bytes, or run the server under a memory-initialization checker. 4. Request or trigger a one-monitor `ResetGraphics` operation. 5. Capture and decompress the outbound RDPGFX PDU. 6. Verify that bytes 0 through 39 contain the defined header and monitor data, while bytes 40 through 339 contain prior heap content rather than zeros. Appendix A contains the compact component PoC used to capture the bytes passed to the real compressor. The complete server/network setup is environment- dependent and spans the FreeRDP client, RDPGFX negotiation, a GNOME Remote Desktop session, and capture/decompression tooling; that setup, the TCP capture, build glue, and raw evidence are available privately on request. ## Impact ### Observed The real serializer recovered every complete marker word available in the 300-byte padding region after same-size heap reuse. In a live daemon run, the wire response contained a heap pointer and the GLib `g_uint_hash` and `g_uint_equal` function pointers. The leak was sufficient to recover the heap and GLib addresses used by a separate memory-corruption composition. ### Inferred The exact data depends on allocator history. It may contain pointers, fragments of prior protocol messages, credentials, or other process data. Repeated resets can provide additional samples, although allocator reuse may return the prior PDU unless other same-size allocations intervene. ## Remediation Suggestions - Consider publishing a security advisory for affected releases that identifies commit `483c9388119f06bac420d92053cff9ef94e83bea` as an interim mitigation and records the first tag containing it once available. Until then, affected users can apply that commit or the explicit serializer fix below. - Replace the seek over padding with an explicit zero write: ```c const size_t padding = RDPGFX_RESET_GRAPHICS_PDU_SIZE - pos; if (!Stream_EnsureRemainingCapacity(s, padding)) { Stream_Free(s, TRUE); return CHANNEL_RC_NO_MEMORY; } Stream_Zero(s, padding); ``` This serializer patch was applied to FreeRDP 3.30.0 and the `freerdp` and `rdpgfx-server` targets compiled successfully on 2026-08-23. The patched serializer was not run through the component or network PoC, so this is a compile-tested patch suggestion rather than a runtime-validated fix. - Retain zero-initialized stream allocation as defense in depth, not as the serializer fix. - Audit all outbound serializers for `Stream_Seek`, `Stream_SafeSeek`, or `Stream_SetPosition` across transmitted regions. - Add a regression test that pre-fills the backing allocation with nonzero bytes and requires every `ResetGraphics` padding byte to be zero. ## Appendix A: Real-serializer component PoC This is the complete single-file Linux/ELF harness used for component validation, with only internal labels removed. It includes the unmodified FreeRDP 3.30.0 server translation unit and intercepts `zgfx_compress_to_stream()` to capture exactly the 340 source bytes about to be compressed. This exact appendix was compiled and run on Linux/glibc with GCC 15.2.0 against FreeRDP 3.30.0 in both Debug and Release-with-LTO builds. Both runs exited successfully with the same result: ```text PDU size: 340 bytes initialized: 40 bytes; never written: 300 bytes non-zero padding bytes: 185 / 300 recovered donor words: 37 of 37 ``` Place it in `channels/rdpgfx/server/` and add it as an internal test target, compiling it together with `../rdpgfx_common.c` and using the same include paths and libraries as `rdpgfx-server`. ```c #include <stdio.h> #include <string.h> #include <stdlib.h> #include <stdint.h> #include "rdpgfx_main.c" /* Real FreeRDP source, unmodified. */ static BYTE g_captured[512]; static size_t g_captured_len; /* Capture the serializer output before lossless ZGFX compression. */ int zgfx_compress_to_stream(ZGFX_CONTEXT* zgfx, wStream* sDst, const BYTE* pSrcData, UINT32 SrcSize, UINT32* pFlags) { (void)zgfx; (void)sDst; (void)pFlags; g_captured_len = SrcSize < sizeof(g_captured) ? SrcSize : sizeof(g_captured); memcpy(g_captured, pSrcData, g_captured_len); return -1; /* Abort the real send after capturing its input. */ } /* Fill the 340-byte size class with recognizable pointer-shaped words. */ #define NDONOR 64 static void poison_size_class(void) { void* donors[NDONOR]; for (int i = 0; i < NDONOR; i++) { donors[i] = malloc(340); volatile uint64_t* words = donors[i]; for (size_t n = 0; n < 340 / sizeof(uint64_t); n++) words[n] = UINT64_C(0x00005555aa000000) | ((uint64_t)i << 8) | n; } for (int i = 0; i < NDONOR; i++) free(donors[i]); } int main(void) { RdpgfxServerContext context; RdpgfxServerPrivate priv; RDPGFX_RESET_GRAPHICS_PDU pdu; MONITOR_DEF monitor; memset(&context, 0, sizeof(context)); memset(&priv, 0, sizeof(priv)); context.priv = &priv; priv.log = WLog_Get("poc.resetgraphics"); priv.activeCapSet.version = RDPGFX_CAPVERSION_106; memset(&monitor, 0, sizeof(monitor)); monitor.right = 1920; monitor.bottom = 1080; monitor.flags = 1; memset(&pdu, 0, sizeof(pdu)); pdu.width = 1920; pdu.height = 1080; pdu.monitorCount = 1; pdu.monitorDefArray = &monitor; poison_size_class(); (void)rdpgfx_send_reset_graphics_pdu(&context, &pdu); if (!g_captured_len) { printf("nothing captured\n"); return 1; } printf("PDU size: %zu bytes\n", g_captured_len); printf("initialized: 40 bytes; never written: %zu bytes\n", g_captured_len - 40); size_t nonzero = 0; size_t poisoned = 0; for (size_t i = 40; i < g_captured_len; i++) { if (g_captured[i]) nonzero++; } for (size_t i = 40; i + 8 <= g_captured_len; i += 8) { uint64_t word; memcpy(&word, &g_captured[i], sizeof(word)); if ((word & UINT64_C(0x00ffffffff000000)) == UINT64_C(0x00005555aa000000)) poisoned++; } printf("non-zero padding bytes: %zu / %zu\n", nonzero, g_captured_len - 40); printf("recovered donor words: %zu of %zu\n", poisoned, (g_captured_len - 40) / 8); return poisoned ? 0 : 2; } ```

Why it matters now

Fix Fixed FreeRDP: 3.31.0

SSVC decision points

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

Affected products

VendorProductAffected versionsFixed inStatusSource
—FreeRDP>= 2.0.0, <= 3.30.03.31.0Patch availableGHSA-r7jx-j9h7-j4xj
  • FreeRDP Vendor— Affected >= 2.0.0, <= 3.30.0 Fixed in 3.31.0 Patch available GHSA-r7jx-j9h7-j4xj

Remediation

Upgrade FreeRDP to version 3.31.0, which is the listed fixed version.

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

  • Fix · GHSA-r7jx-j9h7-j4xj FreeRDP Fixed in 3.31.0 Advisory →

Timeline

  1. 2026-11-12 Threatist record created from GHSA-r7jx-j9h7-j4xj

References

Sources

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