Description
The default BKS keystore use an HMAC that is only 16 bits long, which can allow an attacker to compromise the integrity of a BKS keystore. Bouncy Castle release 1.47 changes the BKS format to a format which uses a 160 bit HMAC instead. This applies to any BKS keystore generated prior to BC 1.47. For situations where people need to create the files for legacy reasons a specific keystore type "BKS-V1" was introduced in 1.49. It should be noted that the use of "BKS-V1" is discouraged by the library authors and should only be used where it is otherwise safe to do so, as in where the use of a 16 bit checksum for the file integrity check is not going to cause a security issue in itself.
Vulnerability type
CWE-354
Improper Validation of Integrity Check Value
The product does not validate or incorrectly validates the integrity check values or checksums of a message.
Impact on systems
| Scope | Impact |
| Integrity, Other |
Modify Application Data, Other Integrity checks usually use a secret key that helps authenticate the data origin. Skipping integrity checking generally opens up the possibility that new data from an invalid source can be injected. |
| Integrity, Other |
Other Data that is parsed and used may be corrupted. |
| Non-Repudiation, Other |
Hide Activities, Other Without a checksum check, it is impossible to determine if any changes have been made to the data after it was sent. |
How to prevent it
Implementation
The protocol specification describes the algorithm used for calculating the checksum. It is then a matter of implementing the calculation and verifying that the calculated checksum and the received checksum match.
All 203 CWE-354 CVEs, with trend and prevention