Incomplete certificate checks in FreeRDP allow server identity bypass
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- High
- Impact type
- Spoofing
- Confidentiality · integrity · availability
- High · High · None
- Fix status
- Fixed
Attack profile from CVSS 3.1 · GHSA-jq25-3374-4262. Fix status from GitHub. Impact type from CWE-295.
Summary
FreeRDP through 3.32.1 has incomplete certificate identity checks (CWE-295). The client accepts a matching Common Name even when the subject alternative names do not match, and it ignores IP address entries when the target is an IP literal. A remote attacker who can present a certificate chaining to a CA the client already trusts, and who can intercept the RDP connection, can impersonate the server without privileges or user interaction.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
Description from the GitHub advisory
### Summary GHSA-43hh-p3vw-hfx3 (patched_versions: 3.29.0) claims to fix three certificate identity-validation weaknesses in `tls_verify_certificate()`/`tls_match_hostname()`/`x509_utils_get_dns_names()`, but the actual 3.29.0 fix set (commits af7f2280f, c5a7325f1, b7db8d222) only addresses the embedded-NUL-byte truncation case (Case 1); the Common-Name-fallback-despite-non-matching-SAN case (Case 2) and the IP-literal-matched-via-DNS-SAN case (Case 3) are byte-identical in `libfreerdp/crypto/tls.c` from the 3.29.0 tag through current HEAD. Under a trusted-but-misissued or rogue-CA-issued certificate, a man-in-the-middle can still silently pass FreeRDP's client-side TLS identity check for Case 2 and Case 3, exactly as described in the original advisory, with no FreeRDP release since ever actually closing them. ### Details ### Component `libfreerdp/crypto/tls.c` (`tls_verify_certificate()`, `tls_match_hostname()`) and `libfreerdp/crypto/x509_utils.c` (`x509_utils_get_dns_names()`, `x509_utils_get_common_name()`), called from the client TLS handshake path at `tls.c:1093`. ### Threat model Identical to GHSA-43hh-p3vw-hfx3's own stated model: an attacker able to present a certificate that chains to a CA the FreeRDP client already trusts (a misissuing public CA, a compromised or rogue private CA, or any other certificate-trust-chain anomaly), positioned to intercept or redirect the RDP TCP connection. No code execution or credential extraction is claimed; the impact is a silent bypass of server-identity verification in that threat model, enabling full session man-in-the-middle (screen, keystrokes, clipboard, input injection). ### Root cause `tls_verify_certificate()` (current HEAD, `libfreerdp/crypto/tls.c` ~line 1856-1879): ```c if (common_name) { if (tls_match_hostname(common_name, common_name_length, hostname)) hostname_match = TRUE; } if (dns_names) { for (size_t index = 0; index < dns_names_count; index++) { if (tls_match_hostname(dns_names[index], dns_names_lengths[index], hostname)) { hostname_match = TRUE; break; } } } ``` This is an unconditional OR with no RFC 6125 §6.4.4 rule that presence of any `dNSName` SAN entry should make the Common Name irrelevant for identity purposes. A certificate with `CN=<target hostname>` and a SAN list containing only non-matching names still sets `hostname_match = TRUE` through the CN branch alone (Case 2). Separately, `x509_utils_get_dns_names()` (`x509_utils.c:667`, `map_subject_alt_name(xcert, GEN_DNS, extract_string, &list)`) only ever requests `GEN_DNS` entries; `extract_string_generic()`'s switch handles `GEN_URI`/`GEN_DNS`/`GEN_EMAIL` and silently skips everything else (`default: return 1;`), so a true `GEN_IPADD` (`iPAddress`) SAN entry is never read by any code path in the project. When the RDP target is an IP literal, FreeRDP falls back to matching it as a plain string against CN/DNS-SAN entries via the same `tls_match_hostname()`, so a certificate whose CN or DNS-SAN happens to equal the IP-literal string (with no real `iPAddress` SAN at all) is accepted (Case 3). None of the three commits that shipped in 3.29.0 for this GHSA touch this OR-logic block or add any `GEN_IPADD` handling: - `af7f2280f` only tightens wildcard (`*.`) subdomain-depth matching (an unrelated sibling advisory, GHSA-5wr6-8m8j-3h7f). - `c5a7325f1` only restricts accepted X.509 purposes to `X509_PURPOSE_SSL_SERVER` (another unrelated sibling advisory, GHSA-89c6-jjrw-96h4). - `b7db8d222` adds `check_string_is_host_or_ip()` (length-aware string extraction), which genuinely fixes Case 1 only. ### Already-known check Searched FreeRDP's open/closed issues and all currently published security advisories (100 fetched via the GitHub API) for certificate/hostname/CN/SAN-fallback keywords. No open issue or advisory other than GHSA-43hh-p3vw-hfx3 itself describes this residual gap, and GHSA-43hh-p3vw-hfx3's own `vulnerabilities[].patched_versions` field states `3.29.0`, which this report shows to be inaccurate for 2 of its 3 documented cases. ### Suggested fix Case 2: only consult the Common Name when the certificate has zero `dNSName` SAN entries at all (RFC 6125 §6.4.4); if any SAN entries are present, ignore CN entirely regardless of match/mismatch. Case 3: add a `GEN_IPADD`-aware extraction path (`x509_utils_get_ip_addresses()` or similar) and, when the connection target parses as an IP literal, match exclusively against `iPAddress` SAN entries (binary comparison, not string formatting) — never fall back to CN/DNS-SAN string matching for IP-literal targets. Both are exactly the behaviors OpenSSL's own `X509_check_host()`/`X509_check_ip_asc()` already implement; the original advisory's own stated remediation direction ("delegating identity validation to OpenSSL APIs") would resolve both if actually adopted instead of hand-rolled string matching. ### AI Use Disclosure AI (Claude) was used as a tool under my direction for code review, build automation, and reproduction-harness development. I reviewed and verified the AI-generated results — including independently re-checking the cited commit hashes and file:line references against the actual repository — before submission. ### Proof of concept ### Versions tested Built from source at current HEAD `9ae75235a` (2026-10-02). Source also read statically at the `3.29.0` tag (first release claiming the fix) and confirmed byte-identical for the relevant logic. ### Reproduction Built `libfreerdp3.so` from the real, unmodified FreeRDP source (one 10-line pass-through wrapper added only to export the otherwise-internal-linkage `tls_verify_certificate()` symbol for direct testing — no logic changed). Loaded real X.509 certificates via FreeRDP's own `freerdp_certificate_new_from_file()`/`x509_utils_from_pem()`, verified chain trust via FreeRDP's own `freerdp_certificate_verify()` (real OpenSSL `X509_verify_cert()` against a locally-trusted test CA installed via the standard `X509_LOOKUP_hash_dir` layout FreeRDP itself uses), then called the real `tls_verify_certificate()` with settings matching the original advisory's own stated repro config (`AutoAcceptCertificate=FALSE`, `AutoDenyCertificate=TRUE`, `AuthenticationLevel=2`). **Case 2 (CN-fallback).** Leaf cert: `CN=victim.test`, SAN=`DNS:attacker.test` (non-matching), signed by the trusted test CA. Target hostname: `victim.test`. - Result: `certificate_status=1` (chain trusted), `tls_verify_certificate() → verification_status=1` — silent accept, no deny-path log, despite the only SAN entry not matching. **Case 3 (IP-literal).** Leaf cert: `CN=ignored-cn.test`, SAN=`DNS:127.0.0.1` (a plain DNS-type SAN string, not a real `iPAddress` SAN). Target: `127.0.0.1`. - Result: `certificate_status=1`, `verification_status=1` — silent accept. **Supplementary.** A cert with a genuine `IP:127.0.0.1` `iPAddress` SAN entry (no DNS SAN) returned `x509_utils_get_dns_names() → count=0` — confirming at runtime, not just by reading the switch statement, that FreeRDP's extraction code cannot see true `iPAddress` SAN entries at all. Controls (same mechanism, flip only the value the suspected logic consumes): Case 2 control — identical SAN structure (`DNS:attacker.test`, non-matching), but `CN=something-else.test` (also non-matching) → `verification_status=-1`, real deny-path log `[tls_verify_certificate]: No certificate stored, automatically denying.` fired. Case 3 control — `SAN=DNS:10.10.10.10` instead of the target IP → `verification_status=-1`. Both controls confirm the positive results are caused specifically by the CN/SAN fallback logic, not by chain-trust or some unrelated acceptance path. ### Stack / environment reach Verification level: called FreeRDP's real, unmodified `tls_verify_certificate()` directly with certificates loaded and chain-verified through FreeRDP's own loader and OpenSSL verification code — the same objects the function receives after a genuine client TLS handshake (confirmed by reading the real call site at `tls.c:1093`). A full network handshake through an actual TCP proxy / `xfreerdp` CLI invocation was not performed, since the vulnerable logic operates purely on an already-parsed certificate object and a hostname string, independent of the transport layer. ### Verification level Reproduced by calling FreeRDP's real verification function directly on real, OpenSSL-chain-verified X.509 certificates, with isolating control groups for both cases (not merely observed in source, and not a full end-to-end network handshake). ### Impact A man-in-the-middle able to present a certificate that chains to a CA the FreeRDP client already trusts can silently bypass FreeRDP's server-identity verification for RDP connections, enabling full confidentiality and integrity compromise of the session (screen content, clipboard, keystrokes, and the ability to inject input) with no client-side prompt or warning — `AutoDenyCertificate=TRUE` is never consulted because `hostname_match` is wrongly TRUE. This reproduces, unchanged, the exact two of three cases the original advisory (GHSA-43hh-p3vw-hfx3) already documented and whose metadata states were fixed in 3.29.0. Precondition: the attacker must hold a certificate trusted via the target's existing trust-chain configuration (misissuance, a compromised/rogue CA, or a private-CA environment) — this is not a no-precondition bypass of a validly-issued, correctly-scoped certificate. Happy to follow whatever coordinated-disclosure timeline works for the team, and to verify against a candidate patch.
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.32.1 | 3.32.2 | Patch available | GHSA-jq25-3374-4262 |
- FreeRDP (c) Vendor— Affected <= 3.32.1 Fixed in 3.32.2 Patch available GHSA-jq25-3374-4262
Remediation
Upgrade FreeRDP to version 3.32.2, which is the fixed version listed for FreeRDP.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
- Fix · GHSA-jq25-3374-4262 FreeRDP (c) Fixed in 3.32.2 Advisory →
Timeline
- 2026-11-12 Threatist record created from GHSA-jq25-3374-4262
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences