CVE-2024-29857: Bouncy Castle Bouncy Castle Certificate Parsing Issues Vulnerability

MODERATE
Advisory Identifier: GHSA-8xfc-gm6g-vgpv
CVSS 5.3
CWE-125 CWE-400
Published
Advisory Summary

CVE-2024-29857 is a MODERATE (CVSS 5.3) bouncy castle certificate parsing issues vulnerability (CWE-125: Out-of-bounds Read) affecting Bouncy Castle libraries in the Maven ecosystem. The issue involves bouncy castle certificate parsing issues cause high cpu usage during parameter evaluation.. Remediation is available by upgrading affected packages to version 1.78, 1.0.2.5, 2.3.1.

CVE-2024-29857 at a Glance

CVE Identifier CVE-2024-29857
GHSA Identifier GHSA-8xfc-gm6g-vgpv
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-125: Out-of-bounds Read
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:N/I:N/A:L).

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 None (C:N)
Integrity None (I:N)
Availability Low (A:L)

How to Fix CVE-2024-29857

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.78
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-jdk18on</artifactId>
    <version>1.78</version>
</dependency>
org.bouncycastle:bcprov-jdk15on fixed: 1.78
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-jdk15on</artifactId>
    <version>1.78</version>
</dependency>
org.bouncycastle:bcprov-jdk15to18 fixed: 1.78
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-jdk15to18</artifactId>
    <version>1.78</version>
</dependency>
org.bouncycastle:bcprov-jdk14 fixed: 1.78
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcprov-jdk14</artifactId>
    <version>1.78</version>
</dependency>
org.bouncycastle:bctls-jdk18on fixed: 1.78
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bctls-jdk18on</artifactId>
    <version>1.78</version>
</dependency>
org.bouncycastle:bctls-jdk14 fixed: 1.78
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bctls-jdk14</artifactId>
    <version>1.78</version>
</dependency>
org.bouncycastle:bctls-jdk15to18 fixed: 1.78
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bctls-jdk15to18</artifactId>
    <version>1.78</version>
</dependency>
org.bouncycastle:bc-fips fixed: 1.0.2.5
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bc-fips</artifactId>
    <version>1.0.2.5</version>
</dependency>
BouncyCastle fixed: Latest secure release
Upgrade BouncyCastle to Latest secure release
BouncyCastle.Cryptography fixed: 2.3.1
Upgrade BouncyCastle.Cryptography to 2.3.1
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-2024-29857, 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.78), 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-125: Out-of-bounds Read, where the product reads data past the end, or before the beginning, of the intended buffer. 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

An issue was discovered in ECCurve.java and ECCurve.cs in Bouncy Castle Java (BC Java) before 1.78, BC Java LTS before 2.73.6, BC-FJA before 1.0.2.5, and BC C# .Net before 2.3.1. Importing an EC certificate with crafted F2m parameters can lead to excessive CPU consumption during the evaluation of the curve parameters.

CVE-2024-29857 Affected Bouncy Castle Versions

10 component(s)
Fixed Versions:
1.781.0.2.52.3.1
Product / Package Ecosystem Affected Versions Fixed Version
org.bouncycastle:bcprov-jdk18on
Maven
< 1.78
1.78
org.bouncycastle:bcprov-jdk15on
Maven
< 1.78
1.78
org.bouncycastle:bcprov-jdk15to18
Maven
< 1.78
1.78
org.bouncycastle:bcprov-jdk14
Maven
< 1.78
1.78
org.bouncycastle:bctls-jdk18on
Maven
< 1.78
1.78
org.bouncycastle:bctls-jdk14
Maven
< 1.78
1.78
org.bouncycastle:bctls-jdk15to18
Maven
< 1.78
1.78
org.bouncycastle:bc-fips
Maven
< 1.0.2.5
1.0.2.5
BouncyCastle
NuGet
BouncyCastle.Cryptography
NuGet
< 2.3.1
2.3.1

References

Frequently Asked Questions

What is CVE-2024-29857?
CVE-2024-29857 is a security vulnerability in Bouncy Castle involving Bouncy Castle certificate parsing issues cause high CPU usage during parameter evaluation. under CWE-125: Out-of-bounds Read.
Which Bouncy Castle versions are affected?
Affected versions include releases prior to 1.78, 1.0.2.5, 2.3.1 across affected packages: org.bouncycastle:bcprov-jdk18on, org.bouncycastle:bcprov-jdk15on, org.bouncycastle:bcprov-jdk15to18, org.bouncycastle:bcprov-jdk14, org.bouncycastle:bctls-jdk18on, org.bouncycastle:bctls-jdk14, org.bouncycastle:bctls-jdk15to18, org.bouncycastle:bc-fips, BouncyCastle, BouncyCastle.Cryptography.
What version fixes CVE-2024-29857?
Upgrading to 1.78, 1.0.2.5, 2.3.1 (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.78. Upgrade your dependency to 1.78 or later.
Is bcprov-jdk15on affected?
Yes, org.bouncycastle:bcprov-jdk15on is affected in releases prior to 1.78. Upgrade your dependency to 1.78 or later.
What is the CVSS score of CVE-2024-29857?
CVE-2024-29857 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:N/I:N/A:L.
What CWE is associated with CVE-2024-29857?
CVE-2024-29857 is classified under CWE-125: Out-of-bounds Read (The product reads data past the end, or before the beginning, of the intended buffer.).
How can I check Maven dependencies for CVE-2024-29857?
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-8xfc-gm6g-vgpv",
  "modified" : "2024-12-06T15:31:20Z",
  "published" : "2024-05-14T15:32:54Z",
  "aliases" : [ "CVE-2024-29857" ],
  "summary" : "Bouncy Castle certificate parsing issues cause high CPU usage during parameter evaluation.",
  "details" : "An issue was discovered in ECCurve.java and ECCurve.cs in Bouncy Castle Java (BC Java) before 1.78, BC Java LTS before 2.73.6, BC-FJA before 1.0.2.5, and BC C# .Net before 2.3.1. Importing an EC certificate with crafted F2m parameters can lead to excessive CPU consumption during the evaluation of the curve parameters.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bcprov-jdk18on"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.78"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bcprov-jdk15on"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.78"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bcprov-jdk15to18"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.78"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bcprov-jdk14"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.78"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bctls-jdk18on"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.78"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bctls-jdk14"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.78"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bctls-jdk15to18"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.78"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.bouncycastle:bc-fips"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.0.2.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "BouncyCastle"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 2.3.1"
    }
  }, {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "BouncyCastle.Cryptography"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.3.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-29857"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/bcgit/bc-csharp/commit/56daa6eac526f165416d17f661422d60de0dfd63"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/bcgit/bc-java/commit/efc498ca4caa340ac2fe11f2efee06c1a294501f"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/bcgit/bc-java/commit/fee80dd230e7fba132d03a34f1dd1d6aae0d0281"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/bcgit/bc-csharp/wiki/CVE%E2%80%902024%E2%80%9029857"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/bcgit/bc-java/wiki/CVE%E2%80%902024%E2%80%9029857"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20241206-0008"
  }, {
    "type" : "WEB",
    "url" : "https://www.bouncycastle.org/latest_releases.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-125", "CWE-400" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-05-14T20:22:01Z",
    "nvd_published_at" : "2024-05-14T15:17:02Z"
  }
}