Smartcard Logon with YubiKey fails to consider PIV Key Management certificate (slot 9d / PKCS#11 ID 03)
Summary
Smart Card Logon only evaluates the PIV Authentication certificate (slot 9a / PKCS#11 ID 01) and does not evaluate a second certificate present on the same YubiKey in the PIV Key Management slot (9d / PKCS#11 ID 03), even though the latter contains a valid Smart Card Logon EKU and a UPN matching the requested user.
As a result, Smart Card Logon fails with:
no suitable smartcard certificates were foundbecause FreeRDP rejects the certificate in slot 9a and never evaluates the certificate in slot 9d.
Environment
- FreeRDP: 3.32.0
- OS: Ubuntu 24.04
- Smart Card: YubiKey 5 (PIV)
- PKCS#11 Module: p11-kit-proxy.so
- Security: NLA (/sec:nla)
- Key Type: RSA 2048
- Smart Card Logon: /smartcard-logon
YubiKey Configuration
PIV Authentication (9a / ID 01)
Label: Certificate for PIV Authentication
ID: 01
UPN: [email protected]
Extended Key Usage: Microsoft Smartcard Login TLS Web Client Authentication
PIV Key Management (9d / ID 03)
Label: Certificate for Key Management
ID: 03
Subject: CN=privileged-user
UPN: [email protected]
Extended Key Usage: Microsoft Smartcard Login TLS Web Client Authentication
Both certificates:
- are RSA
- contain the Microsoft Smartcard Login EKU
- are visible through PKCS#11
- have associated private keys on the token
PKCS#11 Enumeration
OpenSC correctly enumerates both certificates:
pkcs11-tool --module p11-kit-proxy.so -ORelevant output:
Certificate for PIV Authentication
ID: 01
Certificate for Key Management
ID: 03The certificate in ID 03 can also be exported and inspected successfully:
pkcs11-tool \
--module p11-kit-proxy.so \
--read-object \
--type cert \
--id 03 \
| openssl x509 -inform DER -text -nooutCertificate contents confirm:
X509v3 Extended Key Usage:
Microsoft Smartcard Login
TLS Web Client Authentication
X509v3 Subject Alternative Name:
othername: UPN:[email protected]Reproduction
Commands:
xfreerdp3 \
/smartcard-logon \
/sec:nla \
/u:privileged-user \
/v:rdp-server.example.localActual Behavior
Debug output shows:
exploring CSP 'Microsoft Smart Card Key Storage Provider'
opening key \1100000000000000\01
discarding non matching cert by user
[email protected]
no suitable smartcard certificates were foundFreeRDP only opens:
\1100000000000000\01and never attempts:
\1100000000000000\03which corresponds to the certificate whose UPN is:
and matches the requested account.
Expected Behavior
FreeRDP should enumerate and evaluate all Smart Card Logon-capable certificates present on the token before deciding that no matching certificate exists.
In this configuration I would expect FreeRDP to evaluate both:
\1100000000000000\01
\1100000000000000\03and select the certificate whose UPN matches:
privileged-useror
Additional Notes
Tested using YubiKey 5 NFC F/W 5.4.3 and YubiKey 5 NFC FIPS F/W 5.4.3 seperately. Both configured the same for slots 9a and 9d.
Strangely, if --both-- YubiKeys are slotted, the reader detects 2 certificates, in particular the [email protected] UPN in 9d !!
$ /usr/bin/xfreerdp3 /list:smartcard
smartcard reader detected, listing 2 certificates:
0: OU = Users, OU = StandardAccounts, CN = primary-user
* CSP: Microsoft Smart Card Key Storage Provider
* reader: Yubico YubiKey OTP+FIDO+CCID 00 00
* slotId: 17
* pkinitArgs: PKCS11:module_name=p11-kit-proxy.so:slotid=17:certid=01
* containerName: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx01
* UPN: [email protected]
1: OU = Users, OU = PrivilegedAccounts, CN = privileged-user
* CSP: Microsoft Smart Card Key Storage Provider
* reader: Yubico YubiKey OTP+FIDO+CCID 00 00
* slotId: 17
* pkinitArgs: PKCS11:module_name=p11-kit-proxy.so:slotid=17:certid=03
* containerName: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx03
* UPN: [email protected]Question
Is FreeRDP intentionally restricted to the PIV Authentication container (9a / ID 01) during Smart Card Logon, or is this a bug in PKCS#11 certificate enumeration/filtering?
Based on the observed behavior, the certificate stored in:
PIV slot 9d
PKCS#11 ID 03
UPN: [email protected]
EKU: Microsoft Smartcard Loginis never evaluated despite being discoverable via PKCS#11 and appearing valid for Smart Card Logon.
A little extra info
I had been previously using the exact configuration for about two weeks (3.32.0) without issue, no apt updates performed between working and not working statuses. I hesitate to log this as a bug or a question because it must be a problem between the chair and the keyboard.
Thanks for the indulgence.
Source: FreeRDP/FreeRDP