Verify the connector server certificate against the host over the legacy SSL connection - #122
Open
vharseko wants to merge 1 commit into
Conversation
…acy SSL connection RemoteFrameworkConnection wrapped the socket in an SSLSocket, which does not check the server certificate against the host it connects to, so anyone with a certificate the client trusts could sit in the middle and read the connector server key. Enable JSSE "HTTPS" endpoint identification for the handshake (CodeQL java/unsafe-cert-trust, alert OpenIdentityPlatform#24). The check can be switched off with -Dorg.identityconnectors.framework.remote.hostnameVerification=false; the client then still compares the certificate names with the host and logs a warning naming the certificate's subject and subjectAltName entries, so the certificate can be fixed and the check re-enabled.
This was referenced Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves CodeQL alert https://github.com/OpenIdentityPlatform/OpenICF/security/code-scanning/24 (
java/unsafe-cert-trust, critical).Problem
RemoteFrameworkConnection(the legacy binary-protocol client for the connector server, port 8759) wraps the socket in anSSLSocketwhenuseSSLis on.SSLSocketvalidates the certificate chain but never checks the certificate against the host it connects to, so anyone holding a certificate the client trusts could sit in the middle of the connection. The connector server key is written to that connection as aGuardedStringencrypted with the framework's fixed default key, i.e. readable by such an attacker, and all connector operation data flows through it as well.With the typical setup (no custom
trustManagers, the server's self-signed certificate imported into the JVM truststore next to the public CAs) any publicly trusted certificate was enough.Change
RemoteFrameworkConnection: enable JSSE "HTTPS" endpoint identification (SSLParameters.setEndpointIdentificationAlgorithm) before the handshake. The certificate must now name the configured host as a subjectAltName dNSName/iPAddress entry, or as CN when it has no subjectAltName (RFC 6125 rules, asHttpsURLConnectiondoes). The check happens inside the handshake, before the key is sent, and applies to custom trust managers too — including plainX509TrustManagerimplementations, which JSSE wraps.-Dorg.identityconnectors.framework.remote.hostnameVerification=false. Only the literalfalsedisables the check, so a typo cannot weaken it. With the check off the client still compares the certificate names with the host and logs a WARN once per server naming the certificate's subject and subjectAltName entries, so the certificate can be fixed and the check re-enabled.CertificateHostnameMatcher(package-private): the RFC 6125-style matcher behind that diagnostic — iPAddress entries for IP literals, dNSName entries with a wildcard standing for exactly one leftmost label, CN only when no dNSName is present.RemoteFrameworkConnectionInfojavadoc foruseSSLdocuments the requirement and the property.Tests
RemoteFrameworkConnectionSSLTests: a CN-only certificate is rejected when connecting by IP (with aTrustManagerFactorytrust manager and with a plainX509TrustManager), a SAN certificate is accepted, CN fallback works when there is no SAN, the property disables the check,offdoes not.CertificateHostnameMatcherTests: SAN/CN/wildcard/IP matching rules.RemoteConnectorInfoManagerSSLTestsnow usesKeyStore-san.jks(SANlocalhost,127.0.0.1,::1); with the old CN-onlyKeyStore.jksit fails as expected, since it connects to127.0.0.1.KeyStore.jksstays for the negative tests.Compatibility
Deployments whose connector server certificate does not name the host used in the client configuration (self-signed certificates with an unrelated CN, connections by IP without an iPAddress SAN) will fail the handshake with
SSLHandshakeException: No subject alternative names present/No name matching <host> found. The fix is a certificate that names the host; the system property above is the temporary escape hatch. Worth a release-notes entry.Not covered here: the Grizzly WebSocket client (
connector-framework-serverConnectionManager) has the same class of problem outside the CodeQL model; separate PR.