8000 Distrust compromised eMudhra intermediate CAs by tolik518 · Pull Request #54198 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Distrust compromised eMudhra intermediate CAs - #54198

Closed
tolik518 wants to merge 3 commits into
keycloak:mainfrom
tolik518:distrust-emudhra-intermediates
Closed

tolik518 wants to merge 3 commits into
keycloak:mainfrom
tolik518:distrust-emudhra-intermediates

Conversation

@tolik518
@tolik518 tolik518 commented Oct 20, 2026 •
Copy link
Copy Markdown

Closes #54197

Rejects certificates for the eight compromised eMudhra intermediate CAs, including their Sectigo cross-signs. They chain to roots still in the JDK/OS truststores (emSign ECC Root CA - G3 in the UBI image), and outgoing TLS doesn't check revocation by default.

  • New DistrustedCertificates: matches by SPKI SHA-256 and certificate fingerprint.
  • Used by the Apache and Vert.x HTTP clients, the SMTP/LDAP socket factory, and X.509 client certificate path building.
  • TruststoreBuilder skips these certificates if they appear in the truststore paths.
  • Container image: the fingerprints are added to the JDK blocked.certs, which covers the rest of the JVM (e.g. inbound mTLS falling back to the system truststore).
  • Truststore guide and 27.0.0 upgrade guide updated.

Tests: DistrustedCertificatesTest. Also checked with a local TLS server (a chain containing the compromised intermediate is rejected by HttpClientBuilder and the SMTP/LDAP socket factory) and against the official image.

This PR was prepared with an AI agent (Claude Code); I reviewed and verified the changes.

Copilot AI balanced review requested due to automatic review settings October 20, 2026 22:14
@tolik518
tolik518 requested review from a team as code owners October 20, 2026 22:14
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Trust-anchor handling and fallback paths still allow compromised certificate chains to bypass distrust checks.

3 open issues
What changed in this PR

Adds explicit distrust of compromised eMudhra intermediate CAs across Keycloak’s certificate validation and TLS clients, addressing #54197.

Changes:

  • Adds certificate and public-key blocklists with trust-manager and certificate-path checks.
  • Integrates distrust into clients, truststore merging, and the container’s JDK.
  • Adds regression tests, certificate fixtures, and documentation.
File Description
services/​src/​test/​resources/​distrusted-certificates/​emudhra-intermediates.pem Adds compromised intermediate and cross-sign fixtures.
services/​src/​test/​resources/​distrusted-certificates/​emsign-ecc-root-ca-g3.pem Adds the unaffected root fixture.
services/​src/​test/​resources/​distrusted-certificates/​dv-g3b-emudhra-chain.pem Adds a compromised-chain fixture.
services/​src/​test/​java/​org/​keycloak/​truststore/​DistrustedCertificatesTest.java Tests distrust checks and truststore filtering.
services/​src/​main/​java/​org/​keycloak/​truststore/​TruststoreBuilder.java Excludes distrusted certificates during merging.
services/​src/​main/​java/​org/​keycloak/​truststore/​JSSETruststoreConfigurator.java Uses distrust-aware trust managers.
services/​src/​main/​java/​org/​keycloak/​truststore/​DistrustedCertificates.java Implements blocklists and validation wrappers.
services/​src/​main/​java/​org/​keycloak/​services/​x509/​NginxProxySslClientCertificateLookup.java Adds distrust checks during chain reconstruction.
services/​src/​main/​java/​org/​keycloak/​connections/​httpclient/​HttpClientBuilder.java Adds distrust-aware Apache HTTP client validation.
services/​src/​main/​java/​org/​keycloak/​authentication/​authenticators/​x509/​CertificateValidator.java Adds distrust checks during client-certificate revalidation.
quarkus/​runtime/​src/​main/​java/​org/​keycloak/​quarkus/​runtime/​httpclient/​VertxHttpClientFactory.java Wraps configured Vert.x trust managers.
quarkus/​container/​Dockerfile Extends the JDK certificate blocklist.
docs/​guides/​server/​keycloak-truststore.adoc Documents distrust behavior and scope.

Review effort: Balanced

The private keys of eight eMudhra intermediate CAs were compromised
(https://emudhra.we-have-a-problem.com/). They chain to emSign ECC Root
CA - G3 and AAA Certificate Services, which are still in the JDK and OS
truststores, and revocation is not checked for outgoing TLS connections
by default.

Reject certificates with the compromised keys, including their Sectigo
cross-signs, in the outgoing HTTP clients, the SMTP and LDAP socket
factory, the X.509 client certificate path building and the merged
truststore. Also add them to the JDK blocked.certs in the container
image to cover the remaining TLS connections of the JVM.

Closes keycloak#54197

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: tolik518 <function@returnnull.de>
Copilot AI balanced review requested due to automatic review settings October 20, 2026 22:33
@tolik518
tolik518 force-pushed the distrust-emudhra-intermediates branch from 6e092e9 to a44150f Compare October 20, 2026 22:33
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread quarkus/container/Dockerfile Resolved
Reject chains with a certificate whose issuer is one of the compromised
CAs and whose signature verifies with its key. This covers chains where
the compromised intermediate is not presented: it is a trust anchor, it
is fetched from the AIA extension, or the nginx and RFC 9440 lookups
only have the leaf.

The JDK blocked.certs list in the container image only matches
fingerprints, so also add the copies of the ECDSA-signed certificates
with the signature value s replaced by n - s.

Closes keycloak#54197

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: tolik518 <function@returnnull.de>
8000
Copilot AI balanced review requested due to automatic review settings October 20, 2026 22:52
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@vmuzikar vmuzikar left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tolik518 Thank you for the PR. I appreciate the impact of the compromised CA. However, I disagree Keycloak should manage on its own the untrusted certs – the trusted certs are fully in control of the admin with the fallback to OS/JDK certs.

We should instead consider introducing a supported option for providing CRL file to the truststores, and/or enabling CRL-DP.

WDYT @keycloak/cloud-native?

@michalvavrik
Copy link
Copy Markdown
Member

We should instead consider introducing a supported option for providing CRL file to the truststores, and/or enabling CRL-DP.

I think such an option alone has little value. Only problem it solves is that it can revoke some certs from the default java truststore. You can do the same today by specifying truststore path and declare trust anchors explicitly. Personally I don't find it easier to have CRL than truststore and the latter is arguably safer as it is explicit. CRLs/CRL-DP only makes sense when you have truststore reload ( #52520 ), or am I missing some scenario?

@michalvavrik
michalvavrik commented Oct 21, 2026 •
Copy link
Copy Markdown
Member

Maybe if you tend to trust wide range of certificates, once-read CRL makes sense as you revoke only one issued cert, I'd still go with own truststore path instead of relying on JDK/OS truststores.

@michalvavrik
Copy link
Copy Markdown
Member

Just to be clear, I think CRL as feature makes sense, I was just referring in relation to what this PR is trying to solve.

@vmuzikar
Copy link
Copy Markdown
Contributor

IMHO, CRL would make sense exactly in the scenario this PR is trying to solve: you want to keep leveraging the default OS/JDK truststore but you need an escape hatch to temporarily exclude a single cert (before the default truststore is updated) to avoid (re-)building your own for whatever reason.

@michalvavrik
Copy link
Copy Markdown
Member

As you wish.

Copilot AI balanced review requested due to automatic review settings October 21, 2026 13:34
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@rtau-cca
Copy link
Copy Markdown

I just came across this website, which suggested adding the SHA-256 fingerprints of the compromised certs into $JAVA_HOME/lib/security/blocked.certs is sufficient to block that. Will that be simpler than this PR?

@vmuzikar
Copy link
Copy Markdown
Contributor

@rtau-cca Yes, that's actually suggested by OpenJDK.

@vmuzikar
Copy link
Copy Markdown
Contributor

I'm going to close this PR as that's not an approach we want to take. @tolik518 Feel free to open an RFE for supporting CRL and/or CRL-DP. Thanks.

@vmuzikar vmuzikar closed this Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compromised eMudhra intermediate CAs are still trusted

5 participants

0