CVE-2023-33201: Bouncy Castle Bouncy Castle For Java LDAP Vulnerability

MODERATE
Advisory Identifier: GHSA-hr8g-6v94-x4m9
CVSS 5.3
CWE-295
Published
Advisory Summary

CVE-2023-33201 is a MODERATE (CVSS 5.3) bouncy castle for java ldap vulnerability (CWE-295: Improper Certificate Validation) affecting Bouncy Castle libraries in the Maven ecosystem. The issue involves bouncy castle for java ldap injection vulnerability. Remediation is available by upgrading affected packages to version 1.74.

CVE-2023-33201 at a Glance

CVE Identifier CVE-2023-33201
GHSA Identifier GHSA-hr8g-6v94-x4m9
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-295: Improper Certificate Validation
Affected Product Bouncy Castle
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2023-33201

To remediate this vulnerability, upgrade all affected Bouncy Castle dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

org.bouncycastle:bcprov-jdk18on fixed: 1.74
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-jdk18on</artifactId>
    <version>1.74</version>
</dependency>
org.bouncycastle:bcprov-jdk15to18 fixed: 1.74
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-jdk15to18</artifactId>
    <version>1.74</version>
</dependency>
org.bouncycastle:bcprov-jdk14 fixed: 1.74
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-jdk14</artifactId>
    <version>1.74</version>
</dependency>
org.bouncycastle:bcprov-ext-jdk14 fixed: 1.74
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-ext-jdk14</artifactId>
    <version>1.74</version>
</dependency>
org.bouncycastle:bcprov-ext-jdk15to18 fixed: 1.74
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-ext-jdk15to18</artifactId>
    <version>1.74</version>
</dependency>
org.bouncycastle:bcprov-ext-jdk18on fixed: 1.74
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-ext-jdk18on</artifactId>
    <version>1.74</version>
</dependency>
org.bouncycastle:bcprov-debug-jdk14 fixed: 1.74
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-debug-jdk14</artifactId>
    <version>1.74</version>
</dependency>
org.bouncycastle:bcprov-debug-jdk15to18 fixed: 1.74
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-debug-jdk15to18</artifactId>
    <version>1.74</version>
</dependency>
org.bouncycastle:bcprov-debug-jdk18on fixed: 1.74
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-debug-jdk18on</artifactId>
    <version>1.74</version>
</dependency>
org.bouncycastle:bcprov-jdk15on fixed: Latest secure release
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-jdk15on</artifactId>
    <version>Latest secure release</version>
</dependency>
org.bouncycastle:bcprov-ext-jdk15on fixed: Latest secure release
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-ext-jdk15on</artifactId>
    <version>Latest secure release</version>
</dependency>
org.bouncycastle:bcprov-debug-jdk15on fixed: Latest secure release
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-debug-jdk15on</artifactId>
    <version>Latest secure release</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=org.bouncycastle

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2023-33201, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.bouncycastle

Analyze the terminal output to locate any version of Bouncy Castle in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.74), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.bouncycastle command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-295: Improper Certificate Validation, where the product does not validate, or incorrectly validates, a certificate. In Bouncy Castle, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Bouncy Castle provides the `X509LDAPCertStoreSpi.java` class which can be used in conjunction with the CertPath API for validating certificate paths. Pre-1.73 the implementation did not check the X.500 name of any certificate, subject, or issuer being passed in for LDAP wild cards, meaning the presence of a wild car may lead to Information Disclosure. A potential attack would be to generate a self-signed certificate with a subject name that contains special characters, e.g: `CN=Subject*)(objectclass=`. This will be included into the filter and provides the attacker ability to specify additional attributes in the search query. This can be exploited as a blind LDAP injection: an attacker can enumerate valid attribute values using the boolean blind injection technique. The exploitation depends on the structure of the target LDAP directory, as well as what kind of errors are exposed to the user. Changes to the `X509LDAPCertStoreSpi.java` class add the additional checking of any X.500 name used to correctly escape wild card characters.

CVE-2023-33201 Affected Bouncy Castle Versions

12 component(s)
Fixed Versions:
1.74
Product / Package Ecosystem Affected Versions Fixed Version
org.bouncycastle:bcprov-jdk18on
Maven
< 1.74
1.74
org.bouncycastle:bcprov-jdk15to18
Maven
< 1.74
1.74
org.bouncycastle:bcprov-jdk14
Maven
≥ 1.49
< 1.74
1.74
org.bouncycastle:bcprov-ext-jdk14
Maven
≥ 1.49
< 1.74
1.74
org.bouncycastle:bcprov-ext-jdk15to18
Maven
< 1.74
1.74
org.bouncycastle:bcprov-ext-jdk18on
Maven
< 1.74
1.74
org.bouncycastle:bcprov-debug-jdk14
Maven
≥ 1.49
< 1.74
1.74
org.bouncycastle:bcprov-debug-jdk15to18
Maven
< 1.74
1.74
org.bouncycastle:bcprov-debug-jdk18on
Maven
< 1.74
1.74
org.bouncycastle:bcprov-jdk15on
Maven
≥ 1.49
≤ 1.70
org.bouncycastle:bcprov-ext-jdk15on
Maven
≥ 1.49
≤ 1.70
org.bouncycastle:bcprov-debug-jdk15on
Maven
≥ 1.49
≤ 1.70

References

Frequently Asked Questions

What is CVE-2023-33201?
CVE-2023-33201 is a security vulnerability in Bouncy Castle involving Bouncy Castle For Java LDAP injection vulnerability under CWE-295: Improper Certificate Validation.
Which Bouncy Castle versions are affected?
Affected versions include releases prior to 1.74 across affected packages: org.bouncycastle:bcprov-jdk18on, org.bouncycastle:bcprov-jdk15to18, org.bouncycastle:bcprov-jdk14, org.bouncycastle:bcprov-ext-jdk14, org.bouncycastle:bcprov-ext-jdk15to18, org.bouncycastle:bcprov-ext-jdk18on, org.bouncycastle:bcprov-debug-jdk14, org.bouncycastle:bcprov-debug-jdk15to18, org.bouncycastle:bcprov-debug-jdk18on, org.bouncycastle:bcprov-jdk15on, org.bouncycastle:bcprov-ext-jdk15on, org.bouncycastle:bcprov-debug-jdk15on.
What version fixes CVE-2023-33201?
Upgrading to 1.74 (or the latest patched release for your respective branch) resolves the vulnerability.
Is bcprov-jdk18on affected?
Yes, org.bouncycastle:bcprov-jdk18on is affected in releases prior to 1.74. Upgrade your dependency to 1.74 or later.
Is bcprov-jdk15to18 affected?
Yes, org.bouncycastle:bcprov-jdk15to18 is affected in releases prior to 1.74. Upgrade your dependency to 1.74 or later.
What is the CVSS score of CVE-2023-33201?
CVE-2023-33201 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2023-33201?
CVE-2023-33201 is classified under CWE-295: Improper Certificate Validation (The product does not validate, or incorrectly validates, a certificate.).
How can I check Maven dependencies for CVE-2023-33201?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.bouncycastle'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-hr8g-6v94-x4m9",
  "modified" : "2023-09-05T16:57:42Z",
  "published" : "2023-07-05T03:30:23Z",
  "aliases" : [ "CVE-2023-33201" ],
  "summary" : "Bouncy Castle For Java LDAP injection vulnerability",
  "details" : "Bouncy Castle provides the `X509LDAPCertStoreSpi.java` class which can be used in conjunction with the CertPath API for validating certificate paths. Pre-1.73 the implementation did not check the X.500 name of any certificate, subject, or issuer being passed in for LDAP wild cards, meaning the presence of a wild car may lead to Information Disclosure.\n\nA potential attack would be to generate a self-signed certificate with a subject name that contains special characters, e.g: `CN=Subject*)(objectclass=`. This will be included into the filter and provides the attacker ability to specify additional attributes in the search query. This can be exploited as a blind LDAP injection: an attacker can enumerate valid attribute values using the boolean blind injection technique. The exploitation depends on the structure of the target LDAP directory, as well as what kind of errors are exposed to the user.\n\nChanges to the `X509LDAPCertStoreSpi.java` class add the additional checking of any X.500 name used to correctly escape wild card characters.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bcprov-jdk18on"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.74"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bcprov-jdk15to18"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.74"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bcprov-jdk14"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.49"
      }, {
        "fixed" : "1.74"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bcprov-ext-jdk14"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.49"
      }, {
        "fixed" : "1.74"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bcprov-ext-jdk15to18"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.74"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bcprov-ext-jdk18on"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.74"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bcprov-debug-jdk14"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.49"
      }, {
        "fixed" : "1.74"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bcprov-debug-jdk15to18"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.74"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bcprov-debug-jdk18on"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.74"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bcprov-jdk15on"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.49"
      }, {
        "last_affected" : "1.70"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bcprov-ext-jdk15on"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.49"
      }, {
        "last_affected" : "1.70"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bcprov-debug-jdk15on"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.49"
      }, {
        "last_affected" : "1.70"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-33201"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/bcgit/bc-java/commit/ccf93ca736b89250ff4ce079a5aa56f5cbf0ebbd"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/bcgit/bc-java/commit/e8c409a8389c815ea3fda5e8b94c92fdfe583bcc"
  }, {
    "type" : "WEB",
    "url" : "https://bouncycastle.org"
  }, {
    "type" : "WEB",
    "url" : "https://bouncycastle.org/releasenotes.html#r1rv74"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/bcgit/bc-java"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/bcgit/bc-java/commits/main/prov/src/main/java/org/bouncycastle/jce/provider/X509LDAPCertStoreSpi.java"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/bcgit/bc-java/wiki/CVE-2023-33201"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2023/08/msg00000.html"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20230824-0008"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-295" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-07-06T15:40:29Z",
    "nvd_published_at" : "2023-07-05T03:15:09Z"
  }
}