Read the docs

Use after free in FreeRDP RDPEAR NDR parsing

Priority MEDIUM 48Published · Updated

Key facts

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

Attack profile from CVSS 3.1 · GHSA-j9q5-7g8m-jc9v. Fix status from GitHub.

Summary

FreeRDP / libfreerdp client RDPEAR up to and including 3.25.0 accepts one NDR pointer reference ID for several pointer fields, so the same heap object is freed more than once. A malicious RDP server can trigger a use-after-free and double free in the client when a user connects, leading to client-side memory corruption.

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

Description from the GitHub advisory

# FreeRDP RDPEAR GHSA Form ## Title FreeRDP RDPEAR NDR ref-id aliasing causes client-side UAF/double-free and type confusion ## Affected Products Ecosystem: Other Package name: FreeRDP / libfreerdp client RDPEAR Affected versions: ```text Current master at c2636c6cd1c492522ea43f42b3ed382216421fe4. Likely any version containing the same RDPEAR NDR refPointers implementation in channels/rdpear/common/ndr.c. Exact released-version range not yet determined. ``` Patched versions: ```text None known. ``` ## Severity Severity: High Vector string: ```text CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H ``` Rationale: ```text Network-delivered malicious RDP server data can trigger client-side memory corruption when the FreeRDP client uses RDPEAR / Remote Credential Guard. User interaction is modeled because a user/application must connect to a malicious or compromised RDP server. Attack complexity is set to High conservatively because RDPEAR must be active and the full encrypted channel path depends on the Remote Credential Guard context. ``` ## Weaknesses ```text CWE-416: Use After Free CWE-415: Double Free CWE-843: Access of Resource Using Incompatible Type ('Type Confusion') CWE-125: Out-of-bounds Read ``` ## Description ### Summary FreeRDP's RDPEAR NDR parser accepts one non-null NDR pointer ref-id for multiple logical pointer fields without tracking the pointed object's expected NDR type or ownership. When the same ref-id is reused across two pointer fields, the parser assigns the same heap object to both output fields. The generic destructor later walks each field independently and destroys/frees both pointers. This causes a malicious-server-triggerable heap use-after-free / double-free in the FreeRDP client's RDPEAR authentication-redirection path. I also confirmed a same-root-cause cross-type alias case where the parser reuses a `KERB_ASN1_DATA` allocation as a `KERB_RPC_ENCRYPTION_KEY`, producing a production-equivalent heap out-of-bounds read / type confusion. I am not claiming a reliable full RCE exploit. The demonstrated impact is client-side memory corruption reachable from malicious RDPEAR NDR data. ### Details The parser caches only `ptrId -> pointer`: ```text channels/rdpear/common/ndr.c:903 BOOL ndr_read_pointedMessageEx(...) channels/rdpear/common/ndr.c:915 void* ret = HashTable_GetItemValue(context->refPointers, (void*)(UINT_PTR)ptrId); channels/rdpear/common/ndr.c:921 ret = calloc(itemCount, descr->itemSize); channels/rdpear/common/ndr.c:925-926 descr->readFn(...) HashTable_Insert(context->refPointers, (void*)(UINT_PTR)ptrId, ret) ``` There is no check that a reused `ptrId` is being reused for the same `NdrMessageType`, nor is there reference-counted/shared ownership. The generic destructor frees every pointer field independently: ```text channels/rdpear/common/ndr.c:822 void ndr_struct_destroy(...) channels/rdpear/common/ndr.c:843-850 if (field->pointerType != NDR_NOT_POINTER) ptr = *(void**)ptr; if (ptr && field->typeDescr->destroyFn) field->typeDescr->destroyFn(context, hints, ptr); if (field->pointerType != NDR_NOT_POINTER) free(ptr); ``` One clean affected request is `PackApReplyReq`, which has two same-type non-null pointer fields: ```text channels/rdpear/common/rdpear-common/rdpear_common.h:224-229 typedef struct { KERB_ASN1_DATA* Reply; KERB_ASN1_DATA* ReplyBody; KERB_RPC_ENCRYPTION_KEY* SessionKey; } PackApReplyReq; channels/rdpear/common/rdpear_common.c:544-550 PackApReplyReq_fields[] ``` The live RDPEAR client path reads and later destroys this request: ```text channels/rdpear/client/rdpear_main.c:723-757 rdpear_kerb_PackApReply() ndr_read_PackApReplyReq(...) ndr_treat_deferred_read(...) ndr_destroy_PackApReplyReq(...) channels/rdpear/client/rdpear_main.c:880-885 RemoteCallKerbPackApReply dispatch channels/rdpear/client/rdpear_main.c:940-999 rdpear_on_data_received() decrypts server channel data and dispatches payload ``` The same design also allows cross-type aliasing. For example, in `ComputeTgsChecksumReq`, the first field can be parsed as `KERB_ASN1_DATA*`, and a later field can reuse the same ref-id as `KERB_RPC_ENCRYPTION_KEY*`. Because `KERB_ASN1_DATA` is 16 bytes and `KERB_RPC_ENCRYPTION_KEY` is 24 bytes, subsequent key handling can read beyond the original object. ### PoC Tested against: ```text FreeRDP commit: c2636c6cd1c492522ea43f42b3ed382216421fe4 Local source: /tmp/FreeRDP-upstream ASAN/UBSAN build: /tmp/freerdp-fuzz-asan-core ``` PoC files: ```text repro/freerdp_rdpear_ndr_alias_uaf/rdpear_ndr_alias_uaf_probe.c repro/freerdp_rdpear_ndr_alias_uaf/rdpear_ndr_alias_type_confusion_probe.c ``` Build UAF/double-free probe: ```bash mkdir -p generated out/freerdp-rdpear-ndr-alias-uaf clang -std=gnu2x -fsanitize=address,undefined -fno-omit-frame-pointer -g -O1 \ -I/tmp/freerdp-fuzz-asan-core/include \ -I/tmp/FreeRDP-upstream/include \ -I/tmp/freerdp-fuzz-asan-core/winpr/include \ -I/tmp/FreeRDP-upstream/winpr/include \ -I/tmp/FreeRDP-upstream/channels/rdpear/common \ -I/tmp/FreeRDP-upstream/channels/rdpear/common/rdpear-common \ repro/freerdp_rdpear_ndr_alias_uaf/rdpear_ndr_alias_uaf_probe.c \ /tmp/FreeRDP-upstream/channels/rdpear/common/ndr.c \ /tmp/FreeRDP-upstream/channels/rdpear/common/rdpear_common.c \ -L/tmp/freerdp-fuzz-asan-core/winpr/libwinpr -lwinpr3 \ -Wl,-rpath,/tmp/freerdp-fuzz-asan-core/winpr/libwinpr \ -o generated/freerdp_rdpear_ndr_alias_uaf_probe ``` Run: ```bash ASAN_OPTIONS='detect_leaks=0:symbolize=1' \ UBSAN_OPTIONS='halt_on_error=1:print_stacktrace=1' \ ./generated/freerdp_rdpear_ndr_alias_uaf_probe \ > out/freerdp-rdpear-ndr-alias-uaf/probe-rerun.out \ 2> out/freerdp-rdpear-ndr-alias-uaf/probe-rerun.err ``` Observed output: ```text RESULT_ENCODED length=56 RESULT_ALIAS Reply=0x6020000000d0 ReplyBody=0x6020000000d0 SessionKey=0x6030000002b0 same_reply=1 ``` ASAN result: ```text ERROR: AddressSanitizer: heap-use-after-free READ of size 8 #0 ndr_struct_destroy /tmp/FreeRDP-upstream/channels/rdpear/common/ndr.c:844 #1 ndr_descr_destroy_KERB_ASN1_DATA /tmp/FreeRDP-upstream/channels/rdpear/common/rdpear_common.c:174 #2 ndr_struct_destroy /tmp/FreeRDP-upstream/channels/rdpear/common/ndr.c:847 #3 ndr_destroy_PackApReplyReq /tmp/FreeRDP-upstream/channels/rdpear/common/rdpear_common.c:557 #4 main repro/freerdp_rdpear_ndr_alias_uaf/rdpear_ndr_alias_uaf_probe.c:70 freed by: #1 ndr_struct_destroy /tmp/FreeRDP-upstream/channels/rdpear/common/ndr.c:850 allocated by: #1 ndr_read_pointedMessageEx /tmp/FreeRDP-upstream/channels/rdpear/common/ndr.c:921 #2 ndr_treat_deferred_read /tmp/FreeRDP-upstream/channels/rdpear/common/ndr.c:971 ``` Build type-confusion probe: ```bash clang -std=gnu2x -fsanitize=address,undefined -fno-omit-frame-pointer -g -O1 \ -I/tmp/freerdp-fuzz-asan-core/include \ -I/tmp/FreeRDP-upstream/include \ -I/tmp/freerdp-fuzz-asan-core/winpr/include \ -I/tmp/FreeRDP-upstream/winpr/include \ -I/tmp/FreeRDP-upstream/channels/rdpear/common \ -I/tmp/FreeRDP-upstream/channels/rdpear/common/rdpear-common \ repro/freerdp_rdpear_ndr_alias_uaf/rdpear_ndr_alias_type_confusion_probe.c \ /tmp/FreeRDP-upstream/channels/rdpear/common/ndr.c \ /tmp/FreeRDP-upstream/channels/rdpear/common/rdpear_common.c \ -L/tmp/freerdp-fuzz-asan-core/winpr/libwinpr -lwinpr3 \ -Wl,-rpath,/tmp/freerdp-fuzz-asan-core/winpr/libwinpr \ -o generated/freerdp_rdpear_ndr_alias_type_confusion_probe ``` Run: ```bash ASAN_OPTIONS='detect_leaks=0:symbolize=1' \ UBSAN_OPTIONS='halt_on_error=1:print_stacktrace=1' \ ./generated/freerdp_rdpear_ndr_alias_type_confusion_probe \ > out/freerdp-rdpear-ndr-alias-uaf/type-confusion.out \ 2> out/freerdp-rdpear-ndr-alias-uaf/type-confusion.err ``` Observed output: ```text RESULT_ENCODED length=32 RESULT_TYPE_ALIAS requestBody=0x6020000000d0 Key=0x6020000000d0 same=1 ``` ASAN result: ```text ERROR: AddressSanitizer: heap-buffer-overflow READ of size 8 #0 main repro/freerdp_rdpear_ndr_alias_uaf/rdpear_ndr_alias_type_confusion_probe.c:71 0x6020000000e0 is located 0 bytes to the right of 16-byte region allocated by: #1 ndr_read_pointedMessageEx /tmp/FreeRDP-upstream/channels/rdpear/common/ndr.c:921 ``` ### Impact A malicious or compromised RDP server can provide crafted RDPEAR NDR data to a FreeRDP client using RDPEAR / Remote Credential Guard and trigger client-side memory corruption. Confirmed impact: ```text malicious-server-controlled NDR ref-id aliasing same heap object assigned to multiple owning fields heap use-after-free during request cleanup double-free class behavior in non-ASAN builds cross-type aliasing / type confusion production-equivalent heap out-of-bounds read when a KERB_ASN1_DATA object is reused as KERB_RPC_ENCRYPTION_KEY ``` Not claimed: ```text reliable full RCE clean arbitrary address read/write primitive server-observable memory disclosure from this RDPEAR path default reachability without RDPEAR / Remote Credential Guard ``` Suggested fix direction: ```text Do not store only ptrId -> raw pointer for incoming NDR pointers. Track metadata such as ptrId -> NdrMessageType and ownership/refcount. Reject reused ref-ids when the requested descriptor differs from the original descriptor. For same-type aliases, either reject aliases unless explicitly allowed by the protocol or implement safe shared ownership so the destructor cannot double-free. Add destructor-side alias hardening as defense-in-depth, but parsing should enforce type/ownership invariants before object use. ``` [freerdp-rdpear-ndr-alias-uaf-package-2026-05-05.zip](https://github.com/user-attachments/files/27394183/freerdp-rdpear-ndr-alias-uaf-package-2026-05-05.zip)

Why it matters now

Fix Fixed FreeRDP / libfreerdp client RDPEAR: 3.26.0

SSVC decision points

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

Affected products

VendorProductAffected versionsFixed inStatusSource
—FreeRDP / libfreerdp client RDPEAR<= 3.25.03.26.0Patch availableGHSA-j9q5-7g8m-jc9v
  • FreeRDP / libfreerdp client RDPEAR Vendor— Affected <= 3.25.0 Fixed in 3.26.0 Patch available GHSA-j9q5-7g8m-jc9v

Remediation

Upgrade FreeRDP / libfreerdp to version 3.26.0, which fixes the flaw.

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

  • Fix · GHSA-j9q5-7g8m-jc9v FreeRDP / libfreerdp client RDPEAR Fixed in 3.26.0 Advisory →

Timeline

  1. 2026-11-12 Threatist record created from GHSA-j9q5-7g8m-jc9v

References

Sources

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