Skip to content

GHSA-8xfc-gm6g-vgpv CVE-2024-29857

Bouncy Castle certificate parsing issues cause high CPU usage during parameter evaluation.

High MavenNuGet
Severity
5.3 / 10
High · CVSS 3.1
Exploit chance (EPSS)
1.10%
Chance of exploitation in the next 30 days. Higher than 65.68% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-125 Out-of-bounds Read
CWE-400 Uncontrolled Resource Consumption
Fix
Available
9 packages have a fixed version

Description

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.

Affected versions

Maven

NuGet

PackageVulnerableFixed in
BouncyCastle
all versions
No fix yet
BouncyCastle.Cryptography
< 2.3.1
2.3.1

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

org.bouncycastle:bc-fips Maven → 1.0.2.5

maven
<dependency><groupId>org.bouncycastle</groupId><artifactId>bc-fips</artifactId><version>1.0.2.5</version></dependency>
gradle
implementation("org.bouncycastle:bc-fips:1.0.2.5")

org.bouncycastle:bcprov-jdk14 Maven → 1.78

maven
<dependency><groupId>org.bouncycastle</groupId><artifactId>bcprov-jdk14</artifactId><version>1.78</version></dependency>
gradle
implementation("org.bouncycastle:bcprov-jdk14:1.78")

org.bouncycastle:bcprov-jdk15on Maven → 1.78

maven
<dependency><groupId>org.bouncycastle</groupId><artifactId>bcprov-jdk15on</artifactId><version>1.78</version></dependency>
gradle
implementation("org.bouncycastle:bcprov-jdk15on:1.78")

org.bouncycastle:bcprov-jdk15to18 Maven → 1.78

maven
<dependency><groupId>org.bouncycastle</groupId><artifactId>bcprov-jdk15to18</artifactId><version>1.78</version></dependency>
gradle
implementation("org.bouncycastle:bcprov-jdk15to18:1.78")

org.bouncycastle:bcprov-jdk18on Maven → 1.78

maven
<dependency><groupId>org.bouncycastle</groupId><artifactId>bcprov-jdk18on</artifactId><version>1.78</version></dependency>
gradle
implementation("org.bouncycastle:bcprov-jdk18on:1.78")

org.bouncycastle:bctls-jdk14 Maven → 1.78

maven
<dependency><groupId>org.bouncycastle</groupId><artifactId>bctls-jdk14</artifactId><version>1.78</version></dependency>
gradle
implementation("org.bouncycastle:bctls-jdk14:1.78")

org.bouncycastle:bctls-jdk15to18 Maven → 1.78

maven
<dependency><groupId>org.bouncycastle</groupId><artifactId>bctls-jdk15to18</artifactId><version>1.78</version></dependency>
gradle
implementation("org.bouncycastle:bctls-jdk15to18:1.78")

org.bouncycastle:bctls-jdk18on Maven → 1.78

maven
<dependency><groupId>org.bouncycastle</groupId><artifactId>bctls-jdk18on</artifactId><version>1.78</version></dependency>
gradle
implementation("org.bouncycastle:bctls-jdk18on:1.78")

BouncyCastle.Cryptography NuGet → 2.3.1

dotnet
dotnet add package BouncyCastle.Cryptography --version 2.3.1

Severity breakdown

CVSS 3.1 5.3

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
Low

Weakness

CWE-125: Out-of-bounds Read

The product reads data past the end, or before the beginning, of the intended buffer.

How to prevent it
  • Implementation: Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright. To reduce the likelihood of introducing an out-of-bounds read, ensure that you validate and ensure correct calculations for any length argument, buffer size calculation, or offset. Be especially careful of relying on a sentinel (i.e. special character such as NUL) in untrusted inputs.
  • Architecture and Design: Use a language that provides appropriate memory abstractions.

CWE-400: Uncontrolled Resource Consumption

The product does not properly control the allocation and maintenance of a limited resource.

How to prevent it
  • Architecture and Design: Design throttling mechanisms into the system architecture. The best protection is to limit the amount of resources that an unauthorized user can cause to be expended. A strong authentication and access control model will help prevent such attacks from occurring in the first place. The login application should be protected against DoS attacks as much as possible. Limiting the database access, perhaps by caching result sets, can help minimize the resources expended. To further limit the potential for a DoS attack, consider tracking the rate of requests received from users and blocking requests that exceed a defined rate threshold.
  • Architecture and Design: Mitigation of resource exhaustion attacks requires that the target system either: recognizes the attack and denies that user further access for a given amount of time, or uniformly throttles all requests in order to make it more difficult to consume resources more quickly than they can again be freed. The first of these solutions is an issue in itself though, since it may allow attackers to prevent the use of the system by a particular valid user. If the attacker impersonates the valid user, they may be able to prevent the user from accessing the server in question. The second solution is simply difficult to effectively institute -- and even when properly done, it does not provide a full solution. It simply makes the attack require more resources on the part of the attacker.
  • Architecture and Design: Ensure that protocols have specific limits of scale placed on them.
  • Implementation: Ensure that all failures in resource allocation place the system into a safe posture.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-p93r-85wp-75v3
Bouncy Castle Has Covert Timing Channel Vulnerability
High Also affects org.bouncycastle:bcprov-jdk14
GHSA-c3fc-8qff-9hwx
Bouncy Castle has an LDAP injection
Medium Also affects org.bouncycastle:bcprov-jdk14
GHSA-574f-3g2m-x479
Bouncy Castle for Java GOST 28147 CTR mode reuses keystream after 255 blocks
High Also affects org.bouncycastle:bcprov-jdk14
GHSA-67mf-3cr5-8w23
Bouncy Castle for Java on All (API modules) allows Excessive Allocation
Medium Also affects org.bouncycastle:bc-fips
GHSA-m44j-cfrm-g8qc
Bouncy Castle crafted signature and public key can be used to trigger an infinite loop
High Also affects BouncyCastle
GHSA-v435-xc8x-wvr9
Bouncy Castle affected by timing side-channel for RSA key exchange ("The Marvin Attack")
Medium Also affects BouncyCastle
GHSA-4h8f-2wvx-gg5w
Bouncy Castle Java Cryptography API vulnerable to DNS poisoning
High Also affects org.bouncycastle:bcprov-jdk14
GHSA-wjxj-5m7g-mg7q
Bouncy Castle Denial of Service (DoS)
Medium Also affects org.bouncycastle:bcprov-jdk14
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor