Skip to main content
Vulnerability Database/CVE-2026-63568

CVE-2026-63568: Bouncy Castle bc-csharp DOS Vulnerability

CVE-2026-63568 is a denial of service vulnerability in Bouncy Castle bc-csharp that allows attackers to exhaust CPU resources through excessive hash iterations. This article covers technical details, affected versions, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-63568 Overview

CVE-2026-63568 is a resource allocation flaw [CWE-770] in the Legion of the Bouncy Castle bc-csharp library before version 2.7.0. The vulnerability affects the Certificate Management Protocol (CMP) and Certificate Request Message Format (CRMF) password-based MAC verifier implemented in PKMacBuilder. A remote unauthenticated attacker can trigger CPU exhaustion by sending a CMP message or CRMF certificate request whose PBMParameter structure declares a very large iteration count. The verifier performs up to approximately 2^31 hash iterations before the MAC can be checked, consuming CPU resources on the receiving host.

Critical Impact

Any .NET application that uses bc-csharp to verify incoming CMP or CRMF messages can be forced into prolonged CPU-bound work by an unauthenticated attacker, degrading availability of certificate enrollment services.

Affected Products

  • Legion of the Bouncy Castle bc-csharp versions prior to 2.7.0
  • .NET applications invoking ProtectedPkiMessage.Verify on untrusted CMP messages
  • .NET applications invoking CertificateRequestMessage.IsValidSigningKeyPop on untrusted CRMF requests

Discovery Timeline

  • 2026-10-02 - CVE-2026-63568 published to NVD
  • 2026-10-02 - Last updated in NVD database

Technical Details for CVE-2026-63568

Vulnerability Analysis

The RFC 4211 PKMAC construction derives a symmetric MAC key by iterating a hash function a sender-specified number of times over a shared secret. The iteration count travels inside the PBMParameter structure of an incoming CMP message. Because the parameter is parsed and consumed before the MAC itself is verified, the receiver commits to performing all requested iterations against attacker-controlled input. In bc-csharp before 2.7.0, the PKMacBuilder class only enforced an upper bound on this iteration count when the caller had explicitly supplied a maximum through the PKMacBuilder(IPKMacPrimitivesProvider, int) constructor. Any other construction path left the ceiling unset, so ProtectedPkiMessage.Verify and CertificateRequestMessage.IsValidSigningKeyPop would honor counts up to roughly Int32.MaxValue (~2^31).

Root Cause

The root cause is incomplete input validation inside CheckIterationCountCeiling. The method guarded only the case maxIterations > 0, so default-constructed PKMacBuilder instances bypassed the check entirely. The hash-iteration loop then ran before the MAC authenticated the message, allowing an unauthenticated sender to dictate the computational cost of validation.

Attack Vector

An attacker sends a crafted CMP message or CRMF certificate request to any endpoint that parses PKI protocol messages with bc-csharp. The attacker sets the iterationCount field of PBMParameter to a very large value. The server begins the iterated hash and remains CPU-bound until the loop completes, regardless of whether the MAC ultimately validates. Repeated requests from one or more sources exhaust available CPU and deny service to legitimate certificate enrollment traffic.

csharp
// Patch applied in crypto/src/crmf/PKMacBuilder.cs
// Source: https://github.com/bcgit/bc-csharp/commit/10a9862fad04bb0c832a78b10e71d9818d6d1a63
private void CheckIterationCountCeiling(int iterationCount)
{
    // When no explicit ceiling was configured, fall back to a generous default so that an attacker-supplied
    // PBMParameter from an incoming CMP message cannot drive the iterated hash into a CPU-exhaustion DoS.
    int ceiling = maxIterations > 0
        ? maxIterations
        : Properties.GetInt32(Properties.PKMacMaxIterationCount, 10_000_000);
    if (iterationCount > ceiling)
        throw new ArgumentException("iteration count exceeds limit (" + iterationCount + " > " + ceiling + ")");
}

A follow-up commit tightened the default ceiling further to 1_000_000. See the Bouncy Castle commit lowering the default and the input-validation hardening commit.

Detection Methods for CVE-2026-63568

Indicators of Compromise

  • Sustained high CPU utilization in processes that handle CMP or CRMF traffic, correlated with inbound PKI protocol requests.
  • Repeated inbound CMP or CRMF messages whose PBMParameter.iterationCount field exceeds operational norms (typical values are in the thousands, not millions).
  • Application logs showing slow or stalled ProtectedPkiMessage.Verify or CertificateRequestMessage.IsValidSigningKeyPop calls.

Detection Strategies

  • Inventory .NET services for references to BouncyCastle.Cryptography or BouncyCastle.Crypto assemblies with a version below 2.7.0.
  • Parse captured CMP/CRMF traffic and alert when the iterationCount field inside PBMParameter exceeds a defined threshold (for example, 100,000).
  • Correlate certificate authority or registration authority process CPU spikes with inbound TCP connections on CMP ports (typically 829).

Monitoring Recommendations

  • Enable application performance monitoring on PKI services and alert on sustained single-request processing times beyond baseline.
  • Forward web application firewall and reverse proxy logs for CMP/CRMF endpoints to a centralized data lake for anomaly analysis.
  • Track dependency SBOMs for bc-csharp and raise tickets automatically when a vulnerable version is detected.

How to Mitigate CVE-2026-63568

Immediate Actions Required

  • Upgrade bc-csharp to version 2.7.0 or later across all .NET services that consume CMP or CRMF messages.
  • Restrict network reachability of CMP and CRMF endpoints to trusted registration authorities and known enrollment clients.
  • Place a reverse proxy or WAF in front of PKI endpoints to drop requests with abnormally large PBMParameter.iterationCount values.

Patch Information

The fix is implemented in crypto/src/crmf/PKMacBuilder.cs. The patched CheckIterationCountCeiling method now applies a default ceiling sourced from Properties.PKMacMaxIterationCount whenever the caller does not supply an explicit maximum. The default was initially set to 10_000_000 and later lowered to 1_000_000. A separate hardening change renamed the check to CheckIterationCountValue to avoid leaking ArithmeticException details. See the upstream advisory and the primary fix commit.

Workarounds

  • Construct every PKMacBuilder instance with the PKMacBuilder(IPKMacPrimitivesProvider, int) constructor to supply an explicit maxIterations ceiling.
  • Set the system property Org.BouncyCastle.PKMac.MaxIterationCount to a conservative value before PKI services initialize.
  • Rate-limit inbound CMP and CRMF connections per source address to blunt sustained CPU-exhaustion attempts.
bash
# Set the PKMAC iteration ceiling for a .NET process via environment variable
# consumed by Bouncy Castle Properties lookup
export Org_BouncyCastle_PKMac_MaxIterationCount=100000
dotnet run --project ./PkiService.csproj

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.