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

CVE-2026-17507: Bouncy Castle for Java MLS DOS Vulnerability

CVE-2026-17507 is a denial of service vulnerability in Bouncy Castle for Java's MLS implementation that allows group members to exhaust heap memory. This article covers technical details, affected versions, and mitigation strategies.

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-17507 Overview

CVE-2026-17507 is a denial-of-service vulnerability in Bouncy Castle for Java versions before 1.86. The flaw resides in the Messaging Layer Security (MLS) implementation under org.bouncycastle.mls. The library stores RFC 9420's uint32leaf_index in a signed Java int, allowing wire values with the top bit set to decode as negative numbers. Signed comparisons against the tree's leaf count then let out-of-range senders bypass membership checks. Any current MLS group member can send a single small message to exhaust the Java Virtual Machine (JVM) heap of every other group member. The issue is tracked under CWE-195: Signed to Unsigned Conversion Error.

Critical Impact

A single crafted MLS message from any group member drives unbounded node-list growth, exhausting JVM heap and denying service to every other member of the group.

Affected Products

  • Bouncy Castle for Java versions prior to 1.86
  • The org.bouncycastle.mls MLS implementation
  • Applications using GroupKeySet.SecretTree.hasLeaf and Group.validateRemove

Discovery Timeline

  • 2026-10-02 - CVE-2026-17507 published to the National Vulnerability Database (NVD)
  • 2026-10-02 - Last updated in NVD database

Technical Details for CVE-2026-17507

Vulnerability Analysis

The vulnerability is a signed-to-unsigned conversion error in the MLS protocol implementation. RFC 9420 defines leaf_index as an unsigned 32-bit integer, but Bouncy Castle stores it in a signed Java int. Wire values with the high bit set decode to negative numbers, which is a legitimate encoding because MLS interop test vectors round-trip the full uint32 range.

Two call sites, GroupKeySet.SecretTree.hasLeaf and Group.validateRemove, compare the decoded leaf_index directly against the positive tree leaf count. Under signed comparison, any negative integer is less than any positive bound, so an out-of-range sender passes the membership check.

In the hasLeaf path, the SenderData of an unprotected PrivateMessage drives LeafIndex.directPath through NodeIndex.parent() arithmetic. The traversal never reaches the tree root and grows the resulting node list without bound. The JVM exhausts its heap, denying service to every member of the MLS group.

Root Cause

The root cause is improper handling of a wire-format unsigned integer in a signed Java type. The membership predicate sender.value() < treeSize.leafCount() performs a signed comparison, allowing negative decoded values to bypass bounds enforcement. This is classified as CWE-195: Signed to Unsigned Conversion Error.

Attack Vector

An attacker who is already a legitimate member of an MLS group crafts a PrivateMessage with a SenderData leaf index whose top bit is set. The message is small and well-formed per the wire protocol. When any other group member processes it, the directPath traversal enters unbounded parent-index arithmetic and consumes all available heap, crashing the receiving JVM.

java
// Patch excerpt from GroupKeySet.java
protected boolean hasLeaf(LeafIndex sender)
{
    // Compare unsigned: a signed leaf_index (uint32 on the wire) with the top bit set would
    // otherwise widen to a negative long and always satisfy this bound.
    return Integer.toUnsignedLong(sender.value()) < treeSize.leafCount();
}

Source: Bouncy Castle commit 1eb8347

Detection Methods for CVE-2026-17507

Indicators of Compromise

  • OutOfMemoryError or JVM heap exhaustion crashes in Java services that process MLS group messages
  • Repeated service restarts of applications linked to org.bouncycastle.mls shortly after receiving a group message
  • Abnormally large allocations in LeafIndex.directPath or NodeIndex.parent() call stacks in heap dumps

Detection Strategies

  • Inventory Java applications using Bouncy Castle and identify any artifact versions below 1.86, especially those importing org.bouncycastle.mls
  • Monitor JVM garbage collection and heap usage metrics on MLS-enabled services for sudden spikes correlated with inbound messages
  • Capture stack traces from OutOfMemoryError events and alert when frames include GroupKeySet$SecretTree.hasLeaf or Group.validateRemove

Monitoring Recommendations

  • Enable JVM heap dump on OutOfMemoryError using -XX:+HeapDumpOnOutOfMemoryError for post-incident analysis
  • Centralize application logs and JVM telemetry into a Security Information and Event Management (SIEM) platform to correlate crash events with message sources
  • Track Bouncy Castle version strings in software bill of materials (SBOM) scans across the fleet

How to Mitigate CVE-2026-17507

Immediate Actions Required

  • Upgrade Bouncy Castle for Java to version 1.86 or later across all affected applications
  • Audit dependency trees for transitive inclusion of vulnerable bcprov or bcmls artifacts
  • Restart affected Java services after dependency replacement to ensure the patched classes are loaded

Patch Information

The fix is included in Bouncy Castle for Java 1.86. Both GroupKeySet.SecretTree.hasLeaf and Group.validateRemove now interpret leaf_index as unsigned via Integer.toUnsignedLong, rejecting out-of-range senders regardless of encoding. Well-formed leaf indices are unaffected. See the GitHub commit and the CVE-2026-17507 wiki entry.

Workarounds

  • Restrict MLS group membership to trusted principals until patching is complete, since exploitation requires an authenticated group member
  • Apply resource limits such as JVM heap caps and container memory limits to contain blast radius of heap exhaustion
  • Where feasible, disable MLS processing paths that invoke GroupKeySet.SecretTree.hasLeaf until the upgrade is deployed
bash
# Maven dependency upgrade example
mvn versions:use-dep-version -Dincludes=org.bouncycastle:bcprov-jdk18on -DdepVersion=1.86 -DforceVersion=true

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.