CVE-2026-63569: CWE-20 Improper Input Validation in Legion of the Bouncy Castle Inc. bc-csharp
Improper input validation in DHAgreement.CalculateAgreement (MTI/A0 two-pass Diffie-Hellman) in Legion of the Bouncy Castle Inc. bc-csharp before 2.7.0 allows an on-path attacker to make the local party compute an agreed value the attacker already knows, defeating the key authentication MTI/A0 is meant to provide. It also allows a malicious peer to learn the local static private key modulo the small factors of p-1, and to recover it entirely in groups with many such factors. The attack uses a crafted out-of-range or small-order ephemeral value, and works because that value is raised to the static private key without the range and subgroup-membership checks applied to DH public keys. Only applications that call DHAgreement directly are affected.
AI Analysis
Technical Summary
The vulnerability arises from improper input validation in the DHAgreement.CalculateAgreement function of bc-csharp versions prior to 2.7.0. Specifically, the method fails to apply range and subgroup-membership checks to the ephemeral public keys used in the MTI/A0 two-pass Diffie-Hellman protocol. An attacker can send crafted out-of-range or small-order ephemeral values, causing the local party to compute an agreed key value already known to the attacker, thus defeating the intended key authentication. Furthermore, this flaw enables a malicious peer to learn the local static private key modulo small factors of p-1, and potentially recover the entire private key in groups with many such factors. This vulnerability is limited to applications that invoke DHAgreement directly.
Potential Impact
An attacker positioned on the communication path can manipulate the key agreement process to compute a shared secret known to them, effectively breaking the key authentication guarantees of the MTI/A0 Diffie-Hellman protocol. This compromises the confidentiality and integrity of the key exchange. Additionally, the attacker can extract partial or full information about the local static private key, undermining long-term key security. This could lead to further cryptographic attacks or impersonation. The vulnerability does not affect applications that do not call DHAgreement directly.
Mitigation Recommendations
A fixed version 2.7.0 of bc-csharp is available that addresses this vulnerability by properly validating input values in DHAgreement.CalculateAgreement. Users should upgrade to version 2.7.0 or later to remediate this issue. Until upgraded, avoid using DHAgreement directly or implement strict input validation and subgroup membership checks on ephemeral public keys to mitigate the risk.
CVE-2026-63569: CWE-20 Improper Input Validation in Legion of the Bouncy Castle Inc. bc-csharp
Description
Improper input validation in DHAgreement.CalculateAgreement (MTI/A0 two-pass Diffie-Hellman) in Legion of the Bouncy Castle Inc. bc-csharp before 2.7.0 allows an on-path attacker to make the local party compute an agreed value the attacker already knows, defeating the key authentication MTI/A0 is meant to provide. It also allows a malicious peer to learn the local static private key modulo the small factors of p-1, and to recover it entirely in groups with many such factors. The attack uses a crafted out-of-range or small-order ephemeral value, and works because that value is raised to the static private key without the range and subgroup-membership checks applied to DH public keys. Only applications that call DHAgreement directly are affected.
CVSS v4.0
Score 9.1critical
Affected software
Legion of the Bouncy Castle Inc.
bc-csharp
pkg:nuget/BouncyCastle.CryptographyRun on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability arises from improper input validation in the DHAgreement.CalculateAgreement function of bc-csharp versions prior to 2.7.0. Specifically, the method fails to apply range and subgroup-membership checks to the ephemeral public keys used in the MTI/A0 two-pass Diffie-Hellman protocol. An attacker can send crafted out-of-range or small-order ephemeral values, causing the local party to compute an agreed key value already known to the attacker, thus defeating the intended key authentication. Furthermore, this flaw enables a malicious peer to learn the local static private key modulo small factors of p-1, and potentially recover the entire private key in groups with many such factors. This vulnerability is limited to applications that invoke DHAgreement directly.
Potential Impact
An attacker positioned on the communication path can manipulate the key agreement process to compute a shared secret known to them, effectively breaking the key authentication guarantees of the MTI/A0 Diffie-Hellman protocol. This compromises the confidentiality and integrity of the key exchange. Additionally, the attacker can extract partial or full information about the local static private key, undermining long-term key security. This could lead to further cryptographic attacks or impersonation. The vulnerability does not affect applications that do not call DHAgreement directly.
Mitigation Recommendations
A fixed version 2.7.0 of bc-csharp is available that addresses this vulnerability by properly validating input values in DHAgreement.CalculateAgreement. Users should upgrade to version 2.7.0 or later to remediate this issue. Until upgraded, avoid using DHAgreement directly or implement strict input validation and subgroup membership checks on ephemeral public keys to mitigate the risk.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- bcorg
- Date Reserved
- 2026-07-16T23:48:46.076Z
- Cvss Version
- 4.0
- State
- PUBLISHED
Threat ID: 6abfc5e2a43b0b3b89c8de2a
Added to database: 10/02/2026, 14:55:30 UTC
Last enriched: 10/02/2026, 14:57:18 UTC
Last updated: 10/02/2026, 21:45:56 UTC
Views: 7
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.