Title: Infinite recursion in CertPathBuilder with multiple root CA certificates · Issue #2291 · bcgit/bc-java · GitHub
Open Graph Title: Infinite recursion in CertPathBuilder with multiple root CA certificates · Issue #2291 · bcgit/bc-java
X Title: Infinite recursion in CertPathBuilder with multiple root CA certificates · Issue #2291 · bcgit/bc-java
Description: While testing the JCA CertPathBuilder provider with my internal company CA topology, I have encountered an infinite recursion leading to a stack overflow. I have created a minimal reproducible test case in the following gist. The same ex...
Open Graph Description: While testing the JCA CertPathBuilder provider with my internal company CA topology, I have encountered an infinite recursion leading to a stack overflow. I have created a minimal reproducible test...
X Description: While testing the JCA CertPathBuilder provider with my internal company CA topology, I have encountered an infinite recursion leading to a stack overflow. I have created a minimal reproducible test...
Opengraph URL: https://github.com/bcgit/bc-java/issues/2291
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Infinite recursion in CertPathBuilder with multiple root CA certificates","articleBody":"While testing the JCA `CertPathBuilder` provider with my internal company CA topology, I have encountered an infinite recursion leading to a stack overflow. I have created a minimal reproducible test case in the following [gist](https://gist.github.com/charlesvdv/8b63e3897ff47c2afd7d3d29f8d1251d). The same example work fine when switching to the `SUN` provider. \n\nFrom my investigation, in order to reproduce the infinite recursion, the following must be true: \n\n- CRL must be used for revocation\n- There must be more than one valid root CA certificate\n\nHere is the stack overflow: \n```\n\tat java.base/java.io.FilterInputStream.read(FilterInputStream.java:71)\n\tat org.bouncycastle.asn1.DefiniteLengthInputStream.read(Unknown Source)\n\tat java.base/java.io.FilterInputStream.read(FilterInputStream.java:71)\n\tat org.bouncycastle.asn1.DefiniteLengthInputStream.read(Unknown Source)\n\tat java.base/java.io.FilterInputStream.read(FilterInputStream.java:71)\n\tat org.bouncycastle.asn1.ASN1InputStream.readObject(Unknown Source)\n\tat org.bouncycastle.asn1.ASN1InputStream.readVector(Unknown Source)\n\tat org.bouncycastle.asn1.ASN1InputStream.readVector(Unknown Source)\n\tat org.bouncycastle.asn1.ASN1InputStream.buildObject(Unknown Source)\n\tat org.bouncycastle.asn1.ASN1InputStream.readObject(Unknown Source)\n\tat org.bouncycastle.asn1.ASN1InputStream.readVector(Unknown Source)\n\tat org.bouncycastle.asn1.ASN1InputStream.readVector(Unknown Source)\n\tat org.bouncycastle.asn1.ASN1InputStream.buildObject(Unknown Source)\n\tat org.bouncycastle.asn1.ASN1InputStream.readObject(Unknown Source)\n\tat org.bouncycastle.asn1.ASN1InputStream.readVector(Unknown Source)\n\tat org.bouncycastle.asn1.ASN1InputStream.readVector(Unknown Source)\n\tat org.bouncycastle.asn1.ASN1InputStream.buildObject(Unknown Source)\n\tat org.bouncycastle.asn1.ASN1InputStream.readObject(Unknown Source)\n\tat org.bouncycastle.asn1.ASN1Primitive.fromByteArray(Unknown Source)\n\tat org.bouncycastle.asn1.ASN1UniversalType.fromByteArray(Unknown Source)\n\tat org.bouncycastle.asn1.ASN1Sequence.getInstance(Unknown Source)\n\tat org.bouncycastle.asn1.x500.X500Name.getInstance(Unknown Source)\n\tat org.bouncycastle.jce.provider.PrincipalUtils.getX500Name(Unknown Source)\n\tat org.bouncycastle.jce.provider.PrincipalUtils.getIssuerPrincipal(Unknown Source)\n\tat org.bouncycastle.jce.provider.CertPathValidatorUtilities.findIssuerCerts(Unknown Source)\n\tat org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi_8.build(Unknown Source)\n\tat org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi_8.engineBuild(Unknown Source)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.processCRLF(Unknown Source)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.checkCRL(Unknown Source)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.checkCRLs(Unknown Source)\n\tat org.bouncycastle.jce.provider.ProvCrlRevocationChecker.check(Unknown Source)\n\tat org.bouncycastle.jce.provider.ProvRevocationChecker.check(Unknown Source)\n\tat java.base/java.security.cert.PKIXCertPathChecker.check(PKIXCertPathChecker.java:176)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.processCertA(Unknown Source)\n\tat org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi_8.engineValidate(Unknown Source)\n\tat org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi_8.build(Unknown Source)\n\tat org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi_8.build(Unknown Source)\n\tat org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi_8.engineBuild(Unknown Source)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.processCRLF(Unknown Source)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.checkCRL(Unknown Source)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.checkCRLs(Unknown Source)\n\tat org.bouncycastle.jce.provider.ProvCrlRevocationChecker.check(Unknown Source)\n\tat org.bouncycastle.jce.provider.ProvRevocationChecker.check(Unknown Source)\n\tat java.base/java.security.cert.PKIXCertPathChecker.check(PKIXCertPathChecker.java:176)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.processCertA(Unknown Source)\n\tat org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi_8.engineValidate(Unknown Source)\n\tat org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi_8.build(Unknown Source)\n\tat org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi_8.build(Unknown Source)\n\tat org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi_8.engineBuild(Unknown Source)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.processCRLF(Unknown Source)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.checkCRL(Unknown Source)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.checkCRLs(Unknown Source)\n\tat org.bouncycastle.jce.provider.ProvCrlRevocationChecker.check(Unknown Source)\n\tat org.bouncycastle.jce.provider.ProvRevocationChecker.check(Unknown Source)\n\tat java.base/java.security.cert.PKIXCertPathChecker.check(PKIXCertPathChecker.java:176)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.processCertA(Unknown Source)\n\tat org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi_8.engineValidate(Unknown Source)\n\tat org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi_8.build(Unknown Source)\n\tat org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi_8.build(Unknown Source)\n\tat org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi_8.engineBuild(Unknown Source)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.processCRLF(Unknown Source)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.checkCRL(Unknown Source)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.checkCRLs(Unknown Source)\n\tat org.bouncycastle.jce.provider.ProvCrlRevocationChecker.check(Unknown Source)\n\tat org.bouncycastle.jce.provider.ProvRevocationChecker.check(Unknown Source)\n\tat java.base/java.security.cert.PKIXCertPathChecker.check(PKIXCertPathChecker.java:176)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.processCertA(Unknown Source)\n\tat org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi_8.engineValidate(Unknown Source)\n\tat org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi_8.build(Unknown Source)\n\tat org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi_8.build(Unknown Source)\n\tat org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi_8.engineBuild(Unknown Source)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.processCRLF(Unknown Source)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.checkCRL(Unknown Source)\n\tat org.bouncycastle.jce.provider.RFC3280CertPathUtilities.checkCRLs(Unknown Source)\n\tat org.bouncycastle.jce.provider.ProvCrlRevocationChecker.check(Unknown Source)\n\tat org.bouncycastle.jce.provider.ProvRevocationChecker.check(Unknown Source)\n\tat java.base/java.security.cert.PKIXCertPathChecker.check(PKIXCertPathChecker.java:176)\n...\n```\n\nThe root cause seems to come from [here](https://github.com/bcgit/bc-java/blob/a46adf354451eb2b1abf80314cbff87ac2c4d466/pkix/src/main/java/org/bouncycastle/pkix/jcajce/RFC3280CertPathUtilities.java#L484). The validation for the CRL re-trigger a validation of the root CA certificate which includes a validation of the CRL, etc. \n\nIn RFC5280 (which obsolete RFC3280), the following security consideration has been added (emphasis mine) which seems similar to the issue described above: \n> When certificates include a cRLDistributionPoints extension with an\n https URI or similar scheme, circular dependencies can be introduced.\n **The relying party is forced to perform an additional path validation\n in order to obtain the CRL required to complete the initial path\n validation!** Circular conditions can also be created with an https\n URI (or similar scheme) in the authorityInfoAccess or\n subjectInfoAccess extensions. At worst, this situation can create\n unresolvable dependencies.\n\nThank you for your support.","author":{"url":"https://github.com/charlesvdv","@type":"Person","name":"charlesvdv"},"datePublished":"2026-05-03T15:07:48Z","url":"https://github.com/bcgit/bc-java/issues/2291"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3bf72e21-d67f-4d35-21f7-4ffb602cbdb9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 93B0:1FB7E7:4FB0D9:6B0767:6AFBEFE3 |
| html-safe-nonce | ca7dbc557891e57935edf8f1f77ba7408ff320ebcee638571b633bf04d033e76 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5M0IwOjFGQjdFNzo0RkIwRDk6NkIwNzY3OjZBRkJFRkUzIiwidmlzaXRvcl9pZCI6IjgyMzczODE1Mjg5OTI4NzAzNzEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8da41f8dd912aaa8bb44f68f08ebd6a12dffc9918c5eb4fa76969f9647ba135b |
| hovercard-subject-tag | issue:4372144387 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/bcgit/bc-java/2291/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a63c8758d7ad90fff8dc63da5633f5c4dbe5031b9288dfb2c98bab51088a51dd/bcgit/bc-java/issues/2291 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a63c8758d7ad90fff8dc63da5633f5c4dbe5031b9288dfb2c98bab51088a51dd/bcgit/bc-java/issues/2291 |
| og:image:alt | While testing the JCA CertPathBuilder provider with my internal company CA topology, I have encountered an infinite recursion leading to a stack overflow. I have created a minimal reproducible test... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | charlesvdv |
| hostname | github.com |
| expected-hostname | github.com |
| None | fa74413a1d84dac536fcca0740780bcbd3207bafec0e51873b73ff8e8cca032f |
| turbo-cache-control | no-preview |
| go-import | github.com/bcgit/bc-java git https://github.com/bcgit/bc-java.git |
| octolytics-dimension-user_id | 4566970 |
| octolytics-dimension-user_login | bcgit |
| octolytics-dimension-repository_id | 10416648 |
| octolytics-dimension-repository_nwo | bcgit/bc-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 10416648 |
| octolytics-dimension-repository_network_root_nwo | bcgit/bc-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b3b5633a74535d9c23385512d534c66c8fde1907 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width