CVE-2025-14813 Overview
CVE-2025-14813 is a critical cryptographic vulnerability affecting Legion of the Bouncy Castle Inc's BC-JAVA library (bcprov) across all core modules. The vulnerability is classified as "Use of a Broken or Risky Cryptographic Algorithm" (CWE-327) and resides in the G3413CTRBlockCipher program files where the GOST CTR implementation fails to correctly process more than 255 blocks of data.
This flaw enables attackers to potentially compromise the confidentiality and integrity of encrypted data when the GOST cipher in CTR mode is used for encrypting data larger than 255 blocks (approximately 4KB for 128-bit block ciphers), leading to cryptographic failures that could expose sensitive information.
Critical Impact
The GOST CTR cipher implementation incorrectly handles block processing beyond 255 blocks, potentially leading to data exposure and integrity violations for encrypted payloads exceeding the threshold.
Affected Products
- BC-JAVA bcprov versions 1.59 through 1.83
- All core modules using the G3413CTRBlockCipher implementation
- Applications implementing GOST CTR encryption via Bouncy Castle
Discovery Timeline
- April 15, 2026 - CVE-2025-14813 published to NVD
- April 15, 2026 - Last updated in NVD database
Technical Details for CVE-2025-14813
Vulnerability Analysis
The vulnerability stems from a fundamental implementation error in the GOST CTR (Counter) mode block cipher within the Bouncy Castle cryptographic library. The GOST cipher family is a set of Russian cryptographic standards, and CTR mode is a block cipher mode of operation that converts a block cipher into a stream cipher. The G3413CTRBlockCipher class is responsible for implementing GOST R 34.13-2015 CTR mode encryption.
The critical flaw lies in how the implementation handles the internal block counter. When processing data that exceeds 255 blocks, the counter mechanism fails to properly increment, likely due to an 8-bit counter overflow issue. This results in the cryptographic keystream repeating after the 255th block, which fundamentally breaks the security guarantees of CTR mode encryption.
When the same keystream is reused for different plaintext blocks, an attacker who obtains the ciphertext can XOR together the repeated ciphertext blocks to derive information about the plaintext—a classic cryptographic failure known as keystream reuse.
Root Cause
The root cause is an incorrect implementation of the block counter within G3413CTRBlockCipher. The counter variable appears to be implemented as an 8-bit value (or equivalent), which wraps around to zero after reaching 255. In CTR mode, each block must be encrypted with a unique counter value; when the counter repeats, the same keystream is generated for different plaintext blocks.
This violates the fundamental security requirement of CTR mode: that each counter value must be used exactly once with a given key. The issue likely exists in the counter increment logic where the carry propagation fails to extend beyond the least significant byte.
Attack Vector
The attack requires local access to the affected system where the vulnerable Bouncy Castle library processes cryptographic operations. An attacker can exploit this vulnerability by:
- Observing or capturing ciphertext produced by applications using GOST CTR mode with the vulnerable library
- Waiting for or inducing encryption of data larger than 255 blocks (approximately 4KB)
- Exploiting the keystream repetition to recover plaintext information through XOR analysis of repeated ciphertext blocks
The vulnerability is particularly dangerous for applications that encrypt large files, stream data, or handle bulk cryptographic operations using the affected GOST CTR implementation. Since the attack can compromise both confidentiality and integrity of encrypted data, it represents a significant risk for systems relying on this cipher mode for data protection.
Detection Methods for CVE-2025-14813
Indicators of Compromise
- Applications using BC-JAVA versions 1.59 through 1.83 with GOST CTR encryption
- Cryptographic operations involving G3413CTRBlockCipher class
- Encrypted data outputs larger than 255 cipher blocks showing unexpected patterns
- Evidence of keystream reuse in encrypted communications or stored data
Detection Strategies
- Scan dependencies for BC-JAVA bcprov library versions between 1.59 and 1.83
- Monitor for usage of G3413CTRBlockCipher in application code
- Implement cryptographic testing that specifically validates large-block encryption behavior
- Use software composition analysis (SCA) tools to identify vulnerable library versions
Monitoring Recommendations
- Establish continuous dependency monitoring for Bouncy Castle libraries
- Review cryptographic implementations using GOST cipher modes for data size handling
- Audit applications processing encrypted data larger than 4KB using GOST CTR
- Implement automated alerts for known vulnerable library versions in CI/CD pipelines
How to Mitigate CVE-2025-14813
Immediate Actions Required
- Upgrade BC-JAVA bcprov to version 1.84 or later immediately
- Inventory all applications and services using Bouncy Castle cryptographic libraries
- Prioritize patching for systems handling sensitive data with GOST CTR encryption
- Consider temporary workarounds for systems that cannot be immediately patched
Patch Information
Legion of the Bouncy Castle has released version 1.84 to address this vulnerability. The fix corrects the block counter implementation in G3413CTRBlockCipher to properly handle encryption of data exceeding 255 blocks.
Security patches are available through the following commits:
For additional details, consult the official CVE wiki entry.
Workarounds
- Avoid using GOST CTR mode for data larger than 255 blocks until patching is complete
- Consider switching to alternative cipher modes (e.g., GCM) that are not affected
- Implement application-level chunking to ensure no single encryption operation exceeds 255 blocks
- Deploy compensating controls to detect and prevent exploitation attempts
# Update Maven dependency to patched version
# In pom.xml, update bcprov-jdk18on dependency:
# <version>1.84</version>
# Then run:
mvn dependency:resolve -U
mvn clean install
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


