CVE-2024-39312
Medium · 5.3CVSS
5.3
EPSS
0.3%
Published
Jul 8, 2024
CISA due date
—
Cloudanix analysis
A cryptography library used to check digital certificates could accept some certificates it should have rejected, potentially letting the wrong systems or people connect securely.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Data Tampering
- Component
- Library
- Class
- Improper Input Validation
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The X.509 name constraint parser accepts certificates containing both permittedSubtrees and excludedSubtrees yet only evaluates the permitted list, allowing a subject name that matches an excluded subtree to pass validation.
Why it matters to the business
Systems relying on Botan for certificate validation may trust certificates that should have been rejected, increasing the chance of unauthorized access or man-in-the-middle connections in TLS-protected services.
How an attack unfolds
An attacker generates an X.509 certificate that includes both a permitted subtree and an excluded subtree for the same name space, ensuring the target identity is covered by the excluded rule. When the certificate is presented to an application using the vulnerable Botan library, the parser skips the excluded-subtree check and accepts the certificate, allowing the attacker to establish a trusted TLS session.
How to fix it
Upgrade Botan to version 3.5.0 or 2.19.5. Rebuild and redeploy all dependent applications after the library update. Until the upgrade is complete, consider additional certificate-policy enforcement layers outside Botan.
How to confirm the fix worked
Confirm the installed Botan version is 3.5.0 or later. Test validation behavior with a certificate that contains both permitted and excluded subtrees covering the same name; the certificate must now be rejected.
Typical attack path
- Locate services that use Botan to validate X.509 certificates
- Craft or obtain a certificate containing both permittedSubtrees and excludedSubtrees with the target identity in the excluded list
- Present the certificate during a TLS handshake or other certificate validation operation
- Obtain acceptance of the certificate and proceed with the intended attack (MITM, impersonation, etc.)
How to detect it
Review application logs for certificate validation events around the time of suspected incidents; look for accepted certificates whose subject names would normally be excluded by name constraints. No reliable post-exploitation IOCs are available because the flaw is a silent acceptance during parsing.
What your security team should do
- Immediately schedule upgrade to Botan 3.5.0 or 2.19.5 across all affected products
- Inventory internal and third-party software that statically or dynamically links Botan
- Add version checks and automated rebuild pipelines to prevent reintroduction of older Botan releases
- Review certificate-validation code paths for any custom name-constraint handling that might mask the issue
The record
Botan is a C++ cryptography library. X.509 certificates can identify elliptic curves using either an object identifier or using explicit encoding of the parameters. A bug in the parsing of name constraint extensions in X.509 certificates meant that if the extension included both permitted subtrees and excluded subtrees, only the permitted subtree would be checked. If a certificate included a name which was permitted by the permitted subtree but also excluded by excluded subtree, it would be accepted. Fixed in versions 3.5.0 and 2.19.5.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Alpine:v3.17 | botan | 0 | 2.19.5-r0 |
| Alpine:v3.18 | botan | 0 | 2.19.5-r0 |
| Alpine:v3.19 | botan | 0 | 2.19.5-r0 |
| Alpine:v3.20 | botan | 0 | 2.19.5-r0 |
| Alpine:v3.21 | botan | 0 | 2.19.5-r0 |
| Alpine:v3.21 | botan3 | 0 | 3.5.0-r0 |
| Alpine:v3.22 | botan3 | 0 | 3.5.0-r0 |
| Debian:11 | botan | 0 | No fix |
| Debian:12 | botan | 0 | No fix |
| Debian:13 | botan | 0 | 2.19.5+dfsg-1 |
| Debian:14 | botan | 0 | 2.19.5+dfsg-1 |
| SUSE:Package Hub 15 SP5 | Botan | 0 | 2.19.5-bp155.2.3.1 |
| Ubuntu:18.04:LTS | botan | 0 | No fix |
| Ubuntu:20.04:LTS | botan | 0 | No fix |
| Ubuntu:22.04:LTS | botan | 0 | No fix |
| Ubuntu:24.04:LTS | botan | 0 | No fix |
| Ubuntu:24.10 | botan | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | botan | 0 | No fix |
| Ubuntu:Pro:20.04:LTS | botan | 0 | No fix |
| Ubuntu:Pro:22.04:LTS | botan | 0 | 2.19.1+dfsg-2ubuntu1+esm1 |
| Ubuntu:Pro:24.04:LTS | botan | 0 | 2.19.3+dfsg-1ubuntu2+esm1 |
| openSUSE:Leap 15.5 | Botan | 0 | 2.19.5-bp155.2.3.1 |
| openSUSE:Tumbleweed | Botan | 0 | 2.19.5-1.1 |
Related vulnerabilities
- CVE-2024-34702 Botan is a C++ cryptography library. Also affects botan
- CVE-2024-34703 Botan is a C++ cryptography library. Also affects botan
- CVE-2024-50382 Botan before 3.6.0, when certain LLVM versions are used, has compiler-induced… Also affects botan
- CVE-2024-50383 Botan before 3.6.0, when certain GCC versions are used, has a compiler-induced… Also affects botan
- CVE-2026-35582 Emissary is a P2P based data-driven workflow engine. Also affects Botan
- CVE-2026-35580 Emissary is a P2P based data-driven workflow engine. Also affects Botan
- CVE-2026-96375 Improper Certificate Validation vulnerability in Drupal Cloud allows Adversary in the… CWE-295
- CVE-2026-87944 Improper Certificate Validation vulnerability in Drupal SAML SSO - Service Provider… CWE-295