Unbounded RDPEI PDU length causes memory allocation in FreeRDP server
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 versions up to and including 3.28.0 accept an RDPEI PDU with a declared length that is not checked against any maximum, and the server allocates memory for the declared body before the body arrives. A remote RDP client can send only a small header with a large declared length, which makes the server grow its RDPEI stream buffer and exhaust resources. The flaw is in rdpei_server_handle_messages() and is an availability issue on the server side.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
Description from the GitHub advisory
## Summary `channels/rdpei/server/rdpei_main.c:rdpei_server_handle_messages()` reads a peer-controlled 32-bit RDPEI `pduLen`, checks only that it is at least `RDPINPUT_HEADER_LENGTH`, then calculates: ```c priv->expectedBytes = pduLen - RDPINPUT_HEADER_LENGTH; ``` If `expectedBytes` is non-zero, the function calls: ```c Stream_EnsureCapacity(s, priv->expectedBytes) ``` before the declared PDU body has been received. A malicious or compromised RDP client can therefore send only a small RDPEI header with a large declared `pduLen` and force the FreeRDP server-side RDPEI stream to grow to the declared body size. I am reporting this conservatively as server-side availability/resource exhaustion only. ## Affected code Affected function: ```text channels/rdpei/server/rdpei_main.c:rdpei_server_handle_messages() ``` Relevant code shape in `3.28.0`: ```c Stream_Read_UINT16(s, priv->currentMsgType); Stream_Read_UINT32(s, pduLen); if (pduLen < RDPINPUT_HEADER_LENGTH) return ERROR_INVALID_DATA; priv->expectedBytes = pduLen - RDPINPUT_HEADER_LENGTH; priv->waitingHeaders = FALSE; Stream_ResetPosition(s); if (priv->expectedBytes) { if (!Stream_EnsureCapacity(s, priv->expectedBytes)) return CHANNEL_RC_NO_MEMORY; return CHANNEL_RC_OK; } ``` There is a lower-bound validation for malformed short headers, but no maximum accepted RDPEI PDU/body length before `Stream_EnsureCapacity()` is reached. This is also different from the earlier upstream fix around reading the RDPEI length as a 32-bit value. That fix made the width match the protocol field; it did not add an upper bound on accepted declared body size. ## Reproduction I reproduced this locally in Docker against FreeRDP `3.28.0`. Harness: ```text E:\vul-tower\audit_freerdp_20260706\docker_repro\freerdp_rdpei_pdu_length_harness.c ``` Fresh logs: ```text E:\vul-tower\audit_freerdp_20260706\docker_repro\rdpei_pdu_length_asan_run_fresh_20260707.txt E:\vul-tower\audit_freerdp_20260706\docker_repro\rdpei_pdu_length_release_run_fresh_20260707.txt ``` The harness includes the original upstream `channels/rdpei/server/rdpei_main.c` and `channels/rdpei/rdpei_common.c`, stubs only the virtual-channel read side, and feeds a header-only RDPEI message. It then calls the real `rdpei_server_handle_messages()` path. Observed output: ```text case normal-header-only: pduLen=22 before_cap=256 case normal-header-only: rc=0 expectedBytes=16 waitingHeaders=0 after_cap=256 input_pos=0 case 64MiB-plus: pduLen=67112966 before_cap=256 case 64MiB-plus: rc=0 expectedBytes=67112960 waitingHeaders=0 after_cap=67113088 input_pos=0 case 128MiB: pduLen=134217734 before_cap=256 case 128MiB: rc=0 expectedBytes=134217728 waitingHeaders=0 after_cap=134217856 input_pos=0 ``` Both ASan and release builds show the same behavior. The function returns `CHANNEL_RC_OK`, sets `waitingHeaders=FALSE`, waits for the declared body, and the stream capacity has already grown from `256` bytes to approximately the peer-declared body length. ## Observed behavior A header-only RDPEI input can cause the server-side stream to be expanded to `64 MiB+` or `128 MiB` before the body bytes are provided or validated. ## Expected behavior The server should reject oversized RDPEI `pduLen` values before growing the stream. A malformed or excessive declared body length should fail cleanly without large allocation. ## Impact and threat model - Attacker position: malicious or compromised RDP client. - Affected side: FreeRDP server/proxy/shadow deployment where RDPEI is reachable. - Confirmed impact: server-side memory/resource consumption from a peer-declared 32-bit RDPEI PDU length. - Not claimed: RCE, memory corruption, information disclosure. ## Suggested fix direction Introduce a maximum accepted RDPEI PDU/body length before `Stream_EnsureCapacity()` is called. If `pduLen - RDPINPUT_HEADER_LENGTH` exceeds that cap, reject the PDU or close the channel. The cap should be protocol-appropriate and should be enforced before changing `waitingHeaders`/stream capacity. ## Reported by Bin Luo University of Electronic Science and Technology of China (UESTC)
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/c++ application) | <= 3.28.0 | 3.29.0 | Patch available | GHSA-jm8r-22j6-4m4v |
- FreeRDP (c/c++ application) Vendor— Affected <= 3.28.0 Fixed in 3.29.0 Patch available GHSA-jm8r-22j6-4m4v
Remediation
Upgrade FreeRDP to version 3.29.0, which fixes the issue. The sources list no fixed version for other FreeRDP branches.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
- Fix · GHSA-jm8r-22j6-4m4v FreeRDP (c/c++ application) Fixed in 3.29.0 Advisory →
Timeline
- 2026-11-12 Threatist record created from GHSA-jm8r-22j6-4m4v
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences