/

CVE-2026-63573

Severity:

HIGH RISK

(7.5)

Padding Oracle (CWE-203) in Bouncy Castle C# CMS RSA

CVE-2026-63573

Analyzed

Vulnerability type

Category:

Observable Response Discrepancy

CWE:

CWE-203

Impact:

Content Decryption and Confidentiality Loss

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A response-discrepancy vulnerability in Bouncy Castle's CMS RSA PKCS#1 v1.5 key-transport unwrapping can expose whether submitted ciphertext has valid padding. If an attacker has a captured CMS EnvelopedData message and can send many modified messages to a decryption service that reveals distinguishable failures, they may recover the content-encryption key and decrypt the captured content.

A response-discrepancy vulnerability in Bouncy Castle's CMS RSA PKCS#1 v1.5 key-transport unwrapping can expose whether submitted ciphertext has valid padding. If an attacker has a captured CMS EnvelopedData message and can send many modified messages to a decryption service that reveals distinguishable failures, they may recover the content-encryption key and decrypt the captured content.

Affected context

The issue affects applications using the Bouncy Castle C# CMS implementation for RSA PKCS#1 v1.5 key transport, particularly when the application decrypts attacker-influenced CMS messages with a recipient's RSA private key. Risk increases when decryption failures expose distinct exception messages, response behaviors, timing differences, or other observable signals, and when captured encrypted messages remain available for analysis.

The issue affects applications using the Bouncy Castle C# CMS implementation for RSA PKCS#1 v1.5 key transport, particularly when the application decrypts attacker-influenced CMS messages with a recipient's RSA private key. Risk increases when decryption failures expose distinct exception messages, response behaviors, timing differences, or other observable signals, and when captured encrypted messages remain available for analysis.

Exploit preconditions

  • Attack surface: An application endpoint or service that accepts CMS EnvelopedData for RSA-based decryption
  • Required access: Ability to submit many modified ciphertexts and observe the resulting decryption behavior
  • Additional requirement: Access to a captured CMS message encrypted for the target recipient
  • Trigger point: RSA PKCS#1 v1.5 key-transport unwrapping followed by content decryption
  • Why exploitation is possible: Invalid padding produces a distinguishable failure during key unwrapping, while correctly padded values proceed to a later decryption stage, creating an adaptive padding oracle
  • Attack surface: An application endpoint or service that accepts CMS EnvelopedData for RSA-based decryption
  • Required access: Ability to submit many modified ciphertexts and observe the resulting decryption behavior
  • Additional requirement: Access to a captured CMS message encrypted for the target recipient
  • Trigger point: RSA PKCS#1 v1.5 key-transport unwrapping followed by content decryption
  • Why exploitation is possible: Invalid padding produces a distinguishable failure during key unwrapping, while correctly padded values proceed to a later decryption stage, creating an adaptive padding oracle

Why this happens

The implementation preserves an observable distinction between invalid PKCS#1 v1.5 padding and ciphertexts that pass padding checks. Specifically, invalid padding causes a distinct CMS exception during key unwrapping instead of causing decryption to continue with a uniformly generated replacement key and a consistent external failure response.

This behavior maps to CWE-203: Observable Discrepancy, because security-relevant processing outcomes can be distinguished by an attacker. In an adaptive chosen-ciphertext attack, that discrepancy can function as a Bleichenbacher-style padding oracle.

The implementation preserves an observable distinction between invalid PKCS#1 v1.5 padding and ciphertexts that pass padding checks. Specifically, invalid padding causes a distinct CMS exception during key unwrapping instead of causing decryption to continue with a uniformly generated replacement key and a consistent external failure response.

This behavior maps to CWE-203: Observable Discrepancy, because security-relevant processing outcomes can be distinguished by an attacker. In an adaptive chosen-ciphertext attack, that discrepancy can function as a Bleichenbacher-style padding oracle.

Potential impact

  • An attacker may recover the content-encryption key for a captured CMS message
  • Encrypted CMS content could be decrypted without directly obtaining the recipient's RSA private key
  • Confidential business data, credentials, or documents may be exposed
  • Repeated probing could increase load on the decryption service
  • Applications may suffer broader confidentiality loss if the same recipient key protects multiple messages
  • An attacker may recover the content-encryption key for a captured CMS message
  • Encrypted CMS content could be decrypted without directly obtaining the recipient's RSA private key
  • Confidential business data, credentials, or documents may be exposed
  • Repeated probing could increase load on the decryption service
  • Applications may suffer broader confidentiality loss if the same recipient key protects multiple messages

General mitigation guidance

Mitigation generally focuses on removing decryption oracles and making failure behavior indistinguishable.

Common defensive patterns include:

  • Use a maintained cryptographic implementation with protections against RSA PKCS#1 v1.5 padding-oracle attacks
  • Prefer authenticated encryption and modern key-establishment schemes where protocol compatibility permits
  • Normalize errors so padding, key-unwrapping, and content-decryption failures produce the same external result
  • Avoid returning detailed cryptographic exception types, messages, or status codes to untrusted callers
  • Apply consistent processing and response behavior to reduce timing and side-channel differences
  • Limit repeated decryption attempts and enforce authorization, auditing, and rate controls
  • Protect RSA private keys and use least-privilege isolation for decryption services

Mitigation generally focuses on removing decryption oracles and making failure behavior indistinguishable.

Common defensive patterns include:

  • Use a maintained cryptographic implementation with protections against RSA PKCS#1 v1.5 padding-oracle attacks
  • Prefer authenticated encryption and modern key-establishment schemes where protocol compatibility permits
  • Normalize errors so padding, key-unwrapping, and content-decryption failures produce the same external result
  • Avoid returning detailed cryptographic exception types, messages, or status codes to untrusted callers
  • Apply consistent processing and response behavior to reduce timing and side-channel differences
  • Limit repeated decryption attempts and enforce authorization, auditing, and rate controls
  • Protect RSA private keys and use least-privilege isolation for decryption services

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis and dependency review targeting RSA PKCS#1 v1.5 decryption and CMS key-transport paths
  • Code review checks for externally visible distinctions between padding, key-unwrapping, and content-decryption failures
  • Tests that submit malformed and correctly padded ciphertexts and compare status codes, response bodies, exception handling, and timing distributions
  • Monitoring for repeated CMS decryption attempts involving related or systematically modified ciphertexts
  • API policy enforcement that restricts who can submit encrypted messages and limits repeated failures
  • Automated security review tools configured to flag padding-oracle patterns and detailed cryptographic error disclosure

Organizations can look for this class of issue through:

  • Static analysis and dependency review targeting RSA PKCS#1 v1.5 decryption and CMS key-transport paths
  • Code review checks for externally visible distinctions between padding, key-unwrapping, and content-decryption failures
  • Tests that submit malformed and correctly padded ciphertexts and compare status codes, response bodies, exception handling, and timing distributions
  • Monitoring for repeated CMS decryption attempts involving related or systematically modified ciphertexts
  • API policy enforcement that restricts who can submit encrypted messages and limits repeated failures
  • Automated security review tools configured to flag padding-oracle patterns and detailed cryptographic error disclosure

Sources

SourceLink
github.comgithub.com/bcgit/bc-csharp/commit/85679cc7023adf4e2a0650b88a1f4f98679c7463
github.comgithub.com/bcgit/bc-csharp/commit/c38b4790e2aef68f116a551f73b94ea05cb5590c
github.comgithub.com/bcgit/bc-csharp/wiki/CVE-2026-63573

Frequently asked

questions

It can be remotely exploitable when an application exposes a CMS decryption operation to an attacker and reveals distinguishable outcomes for submitted messages.

The attacker generally needs a captured CMS EnvelopedData message, the ability to submit many modified ciphertexts, and an observable difference between padding rejection and later decryption failure.

Use cryptographic processing that prevents padding-oracle behavior, normalize all decryption failures, and avoid exposing detailed error information or timing differences.

Prefer modern authenticated encryption where feasible, review legacy RSA decryption paths specifically for oracle behavior, restrict decryption endpoints, and continuously test error uniformity and abuse controls.

It can be remotely exploitable when an application exposes a CMS decryption operation to an attacker and reveals distinguishable outcomes for submitted messages.

The attacker generally needs a captured CMS EnvelopedData message, the ability to submit many modified ciphertexts, and an observable difference between padding rejection and later decryption failure.

Use cryptographic processing that prevents padding-oracle behavior, normalize all decryption failures, and avoid exposing detailed error information or timing differences.

Prefer modern authenticated encryption where feasible, review legacy RSA decryption paths specifically for oracle behavior, restrict decryption endpoints, and continuously test error uniformity and abuse controls.

Find out what's already
exploitable in your codebase.