NULL pointer dereference in FreeRDP smartcard request cleanup
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 through 3.28.0 has a NULL pointer dereference in its smartcard Device Control request cleanup. When decoding the reader states fails, the partially decoded operation is still freed, and the cleanup helpers index the NULL reader-state array without a check, which crashes the process. A local user can trigger it with a malformed smartcard request.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
Description from the GitHub advisory
## Summary I found a locally reproducible NULL pointer dereference in FreeRDP smartcard Device Control request cleanup. Several smartcard request parsers read a remote-controlled `cReaders` value, then can fail while decoding `rgReaderStates`. At that point `rgReaderStates` remains NULL, but the `SMARTCARD_OPERATION` already has its `ioControlCode` and `cReaders` fields set. Real callers clean up the partially decoded operation after the decode error, and `smartcard_operation_free()` calls `free_reader_states_a/w(rgReaderStates, cReaders)`. Those helper functions index `rgReaderStates[x]` without checking whether `rgReaderStates` is NULL, causing a process crash when `cReaders > 0`. This was reproduced locally in Docker against current upstream HEAD `1cc783d4c78bd2f66d3a8582dfe70a663d141444`. The same source shape is also present in the latest release tag I checked, `3.28.0`. Credit: Bin Luo, University of Electronic Science and Technology of China (UESTC), `[email protected]`. ## Affected code Root cleanup helpers: - `libfreerdp/utils/smartcard_operations.c:1497`, `free_reader_states_a()` - `libfreerdp/utils/smartcard_operations.c:1508`, `free_reader_states_w()` Both functions iterate over `cReaders` and access `rgReaderStates[x]` without a NULL check. Cleanup dispatch: - `libfreerdp/utils/smartcard_operations.c:1519`, `smartcard_operation_free()` - `SCARD_IOCTL_LOCATECARDSA/W`: lines `1545-1558` - `SCARD_IOCTL_LOCATECARDSBYATRA/W`: lines `1561-1571` - `SCARD_IOCTL_GETSTATUSCHANGEA/W`: lines `1615-1624` Decode setup: - `libfreerdp/utils/smartcard_operations.c:547`, `smartcard_irp_device_control_decode_request()` - `operation->ioControlCode = ioControlCode` at line `565` Parsers that read `cReaders` before reader-state decoding: - `smartcard_unpack_get_status_change_a_call()`: `libfreerdp/utils/smartcard_pack.c:2779`, `cReaders` line `2799`, reader-state decode line `2811` - `smartcard_unpack_get_status_change_w_call()`: line `2825`, `cReaders` line `2844`, reader-state decode line `2856` - `smartcard_unpack_locate_cards_a_call()`: line `3654`, `cReaders` line `3676`, reader-state decode line `3695` - `smartcard_unpack_locate_cards_w_call()`: line `3703`, `cReaders` line `3725`, reader-state decode line `3744` - `smartcard_unpack_locate_cards_by_atr_a_call()`: line `3512`, `cReaders` line `3535`, reader-state decode line `3563` - `smartcard_unpack_locate_cards_by_atr_w_call()`: line `3841`, `cReaders` line `3865`, reader-state decode line `3893` ## Real call paths FreeRDP client smartcard path: 1. `channels/smartcard/client/smartcard_main.c:353`, `smartcard_process_irp()` 2. Calls `smartcard_irp_device_control_decode_request()` at lines `381-382` 3. If decode fails, calls `smartcard_operation_free(&element->operation, TRUE)` at line `388` 4. A malformed smartcard IRP can therefore reach `free_reader_states_a/w(NULL, cReaders)` FreeRDP proxy smartcard path: 1. `server/proxy/channels/pf_channel_smartcard.c:169`, `pf_channel_smartcard_client_handle()` 2. Calls `smartcard_irp_device_control_decode_request()` at line `217` 3. If decode fails, `goto fail` 4. `fail:` calls `smartcard_operation_free(&e.op, FALSE)` at line `262` ## Reproduced cases The same root cause was reproduced for six IOCTL variants: - `SCARD_IOCTL_GETSTATUSCHANGEA` - `SCARD_IOCTL_GETSTATUSCHANGEW` - `SCARD_IOCTL_LOCATECARDSA` - `SCARD_IOCTL_LOCATECARDSW` - `SCARD_IOCTL_LOCATECARDSBYATRA` - `SCARD_IOCTL_LOCATECARDSBYATRW` All cases use a minimal smartcard Device Control request with `cReaders=1`, a non-NULL NDR pointer for `rgReaderStates`, and a truncated reader-state array body. Decode returns an error, then cleanup crashes. ## Local Docker reproduction I used local Docker only for reproduction. Harness: - `docker_repro/freerdp_smartcard_creaders_harness.c` ASan build directory: - `docker_build_asan` Release build directory: - `docker_build_release` ASan matrix: ```bash docker run --rm \ -v E:/vul-tower/audit_freerdp_20260706:/audit \ -e LD_LIBRARY_PATH=/audit/docker_build_asan/libfreerdp:/audit/docker_build_asan/winpr/libwinpr \ gpac/ubuntu:latest \ bash -lc 'set +e; for cmd in gsc locate atr; do for v in A W; do echo === $cmd $v ===; /audit/docker_repro/freerdp_smartcard_creaders_harness_asan irp $cmd $v short 1; echo exit=$?; done; done' ``` Release matrix: ```bash docker run --rm \ -v E:/vul-tower/audit_freerdp_20260706:/audit \ -e LD_LIBRARY_PATH=/audit/docker_build_release/libfreerdp:/audit/docker_build_release/winpr/libwinpr \ gpac/ubuntu:latest \ bash -lc 'set +e; for cmd in gsc locate atr; do for v in A W; do echo === $cmd $v ===; /audit/docker_repro/freerdp_smartcard_creaders_harness_release irp $cmd $v short 1; echo exit=$?; done; done' ``` ASan result: - All six cases report `AddressSanitizer: SEGV on unknown address 0x000000000000`. - A variants crash at `free_reader_states_a`, `libfreerdp/utils/smartcard_operations.c:1502`. - W variants crash at `free_reader_states_w`, `libfreerdp/utils/smartcard_operations.c:1513`. Representative stack: ```text ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 #0 free_reader_states_a libfreerdp/utils/smartcard_operations.c:1502 #1 smartcard_operation_free libfreerdp/utils/smartcard_operations.c:1618 #2 run_one /audit/docker_repro/freerdp_smartcard_creaders_harness.c:225 SUMMARY: AddressSanitizer: SEGV libfreerdp/utils/smartcard_operations.c:1502 in free_reader_states_a ``` Release result: - All six cases terminate with `Segmentation fault`. - All six cases exit with code `139`. ## Impact The confirmed impact is availability: a malformed smartcard Device Control request can crash the process. Likely scenarios: - A malicious or compromised RDP server could crash a FreeRDP client when smartcard redirection is enabled. - A malicious client could potentially crash FreeRDP proxy smartcard handling when the smartcard proxy/interception path is enabled. I do not claim code execution. The current evidence is a reliable NULL dereference DoS. ## Duplicate check I checked the current public FreeRDP advisory set and public issue search before preparing this report. Related but distinct items: - `GHSA-7g72-39pq-4725` / `CVE-2026-27015`: smartcard NDR alignment padding assertion abort. - `GHSA-rwp3-g84r-6mx9` / `CVE-2026-22855`: `smartcard_unpack_set_attrib_call` heap-buffer-overflow. - `https://github.com/FreeRDP/FreeRDP/issues/9480`: public issue about `smartcard_unpack_locate_cards_*_call` context-ref handling. I did not find a public advisory or issue for this exact root cause: partially decoded reader-state request cleanup calling `free_reader_states_a/w()` with `rgReaderStates == NULL` and `cReaders > 0`. ## Suggested fix direction Possible fixes: - Make `free_reader_states_a/w(NULL, nonzero)` return immediately. - Or clear `cReaders` before returning decode failure when `rgReaderStates` has not been assigned. - Also audit other `smartcard_operation_free()` union cleanup cases for partially decoded state after parser failure.
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++ native project) | <= 3.28.0 | 3.29.0 | Patch available | GHSA-78jj-45vh-jpm5 |
- FreeRDP (c/c++ native project) Vendor— Affected <= 3.28.0 Fixed in 3.29.0 Patch available GHSA-78jj-45vh-jpm5
Remediation
Upgrade FreeRDP to version 3.29.0 or later.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
- Fix · GHSA-78jj-45vh-jpm5 FreeRDP (c/c++ native project) Fixed in 3.29.0 Advisory →
Timeline
- 2026-11-12 Threatist record created from GHSA-78jj-45vh-jpm5
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences