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

CVE-2026-63567: Bouncy Castle bc-csharp RCE Vulnerability

CVE-2026-63567 is a padding oracle remote code execution flaw in Bouncy Castle bc-csharp affecting IesEngine.DecryptBlock. Attackers can recover plaintext from captured IES or ECIES ciphertexts. This post explains its impact, affected versions, and mitigation steps.

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

CVE-2026-63567 is an observable discrepancy vulnerability [CWE-203] in the IesEngine.DecryptBlock function of Legion of the Bouncy Castle bc-csharp before version 2.7.0. The flaw enables a CBC padding-oracle attack against Integrated Encryption Scheme (IES) and Elliptic Curve Integrated Encryption Scheme (ECIES) ciphertexts. The engine decrypts the ciphertext and strips its padding before verifying the Message Authentication Code (MAC). A padding failure produces a distinct error path and skips MAC computation, giving attackers an observable side channel. Only applications that construct IesEngine directly with a padded block cipher, such as Advanced Encryption Standard (AES) in Cipher Block Chaining (CBC) mode with Public-Key Cryptography Standards #7 (PKCS#7) padding, are affected. Stream-mode IES is not vulnerable.

Critical Impact

A remote attacker who captures an IES or ECIES ciphertext and submits modified ciphertexts for decryption under the same key pair can recover the original plaintext.

Affected Products

  • Legion of the Bouncy Castle Inc. bc-csharp versions prior to 2.7.0
  • Applications instantiating IesEngine directly with AES-CBC and PKCS#7 padding
  • ECIES and IES implementations built on the vulnerable block-cipher mode

Discovery Timeline

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

Technical Details for CVE-2026-63567

Vulnerability Analysis

The vulnerability is a classic padding-oracle issue in the IesEngine.DecryptBlock routine. When operating in block-cipher mode, the engine performs operations in the wrong order: it decrypts the ciphertext and removes PKCS#7 padding before verifying the MAC. A malformed padding produces a different exception path, and the MAC check is bypassed entirely when padding fails. An attacker who submits modified ciphertexts can distinguish padding-valid responses from padding-invalid responses by observing error messages or response timing. This oracle allows recovery of plaintext bytes one at a time, following standard CBC padding-oracle methodology such as the Vaudenay attack. Because IES and ECIES are frequently used for hybrid public-key encryption, a successful attack compromises the confidentiality of sensitive data protected by these schemes.

Root Cause

The root cause is an ordering flaw that violates the Encrypt-then-MAC construction. The correct sequence requires MAC verification first using constant-time comparison, followed by decryption and padding removal only after authentication succeeds. The vulnerable code reversed this: it decrypted, unpadded, and then checked the MAC. Padding failures reported through a different error path leak information about intermediate plaintext state.

Attack Vector

The attack is network-reachable and requires no authentication. The adversary must capture a valid IES or ECIES ciphertext and have the ability to submit arbitrary modified ciphertexts to a decryption oracle operating under the same key pair. Each submission reveals one bit of information about padding validity, which the attacker iterates to recover full plaintext blocks.

text
             byte[] M, K, K1, K2;
             int len = 0;
             int macKeySize = m_parameters.MacKeySize;
+            int macSize = m_mac.GetMacSize();
 
             // Ensure that the length of the input is greater than the MAC in bytes
-            if (inLen < m_V.Length + m_mac.GetMacSize())
+            if (inLen < m_V.Length + macSize)
                 throw new InvalidCipherTextException("Length of input must be greater than the MAC and V combined");
 
             // note order is important: set up keys, do simple encryptions, check mac, do final encryption.
             if (m_cipher == null)
             {
                 // Streaming mode.
-                K1 = new byte[inLen - m_V.Length - m_mac.GetMacSize()];
+                K1 = new byte[inLen - m_V.Length - macSize];
                 K2 = new byte[macKeySize / 8];
                 K = new byte[K1.Length + K2.Length];

Source: GitHub Commit eaa42e1. The patch restructures IesEngine so that MAC verification precedes padding processing, eliminating the observable discrepancy between padding failures and MAC failures.

Stop Remote Code Execution Before It Runs

Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.

Stop Exploit Attempts

Detection Methods for CVE-2026-63567

Indicators of Compromise

  • Unusually high volume of decryption requests from a single client against an IES or ECIES endpoint, indicating oracle probing
  • Repeated InvalidCipherTextException entries in application logs tied to the same key pair
  • Sequential ciphertext submissions that differ by single-byte modifications in trailing blocks

Detection Strategies

  • Perform dependency inventory to identify applications referencing BouncyCastle.Cryptography or bc-csharp assemblies below version 2.7.0
  • Static analysis to flag direct instantiation of IesEngine with block ciphers configured for CBC and PKCS#7 padding
  • Review network and application telemetry for burst patterns of decryption failures against public-key endpoints

Monitoring Recommendations

  • Alert on application exception rates exceeding baseline for cryptographic error types
  • Rate-limit decryption endpoints that accept attacker-controlled ciphertexts
  • Correlate decryption failures with source IP and session identifiers to surface oracle-style enumeration

How to Mitigate CVE-2026-63567

Immediate Actions Required

  • Upgrade bc-csharp to version 2.7.0 or later across all applications and build pipelines
  • Audit code for direct IesEngine usage with padded block ciphers and replace with stream-mode IES where feasible
  • Rotate IES and ECIES key pairs that may have been exposed to an untrusted decryption oracle

Patch Information

The fix is delivered in bc-csharp 2.7.0. Relevant commits are GitHub Commit eaa42e1 and GitHub Commit f881400. Additional detail is available in the GitHub CVE-2026-63567 Wiki.

Workarounds

  • Switch IES configurations to stream-cipher mode, which is not affected by this flaw
  • Avoid returning distinguishable error messages for padding versus MAC failures to external clients
  • Enforce strict rate limiting and anomaly detection on decryption endpoints until patching is complete
bash
# Update bc-csharp via NuGet to the patched release
dotnet add package BouncyCastle.Cryptography --version 2.7.0

# Verify installed version
dotnet list package | grep -i BouncyCastle

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.