CVE-2018-5382: Improper Validation of Integrity Check Value in Bouncy Castle

Summary

13/05/2022
Yes i
Moderate
4.4

CVE-2018-5382: Improper Validation of Integrity Check Value in Bouncy Castle. Affects org.bouncycastle:bcprov-jdk15on versions < 1.50. Fixed in 1.50. How to fix ↓

Also tracked for

The same CVE-2018-5382 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The Bouncy Castle library is a popular open-source cryptographic library for Java. It provides a wide range of cryptographic algorithms and functions, including support for various keystore formats. One of the keystore formats used by Bouncy Castle is the BKS keystore, which is a binary keystore format. The BKS keystore uses an HMAC (Hash-based Message Authentication Code) to ensure the integrity of the keystore file. However, prior to version 1.47 of Bouncy Castle, the default BKS keystore used an HMAC that was only 16 bits long, which could allow an attacker to compromise the integrity of the keystore. This vulnerability, identified as CVE-2018-5382, poses a moderate risk to applications using Bouncy Castle versions prior to 1.50.

Vulnerability Detail

The vulnerability arises from the use of a weak HMAC in the BKS keystore format. The 16-bit HMAC used in earlier versions of Bouncy Castle is susceptible to brute-force attacks, where an attacker can modify the keystore file without detection. This could lead to various security issues, such as unauthorized access to sensitive information or the injection of malicious code into the keystore. Bouncy Castle release 1.47 addressed this vulnerability by introducing a new BKS format that uses a 160-bit HMAC instead. However, the use of the legacy keystore type "BKS-V1" is discouraged, as it still relies on the weak 16-bit HMAC. It is recommended to upgrade to Bouncy Castle version 1.50 or later to mitigate this vulnerability.

How To Fix

Minimum fixed version

1.50

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading to Bouncy Castle version 1.50 or later is not feasible, a workaround is to manually convert the existing BKS keystores to the new format using the provided tools or APIs. This can be done by creating a new BKS keystore of type "BKS-V1" and importing the entries from the old keystore. However, it should be noted that this workaround is not recommended by the library authors and should only be used in situations where it is safe to do so.

Conclusion

The vulnerability in Bouncy Castle's BKS keystore format, identified as CVE-2018-5382, can compromise the integrity of the keystore and lead to various security risks. It is recommended to update applications to use Bouncy Castle version 1.50 or later to mitigate this vulnerability. If upgrading is not feasible, manual conversion of existing BKS keystores to the new format can be done as a workaround. For further support on vulnerability remediation, contact DevNack.com.

See every vulnerability recorded for org.bouncycastle:bcprov-jdk15on →

Share this vulnerability

FAQ

The vulnerability allows an attacker to compromise the integrity of BKS keystores, potentially leading to unauthorized access to sensitive information or the injection of malicious code.

You can use Vulert's playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities, using just the pom.xml file of your application.

Yes, the vulnerability has been fixed in Bouncy Castle version 1.50. It is recommended to update your application to use this version or later to mitigate the vulnerability.

The use of the legacy keystore type "BKS-V1" is discouraged by the library authors and should only be used where it is otherwise safe to do so. It is recommended to migrate to the new BKS format with a 160-bit HMAC for improved security.

There are no known exploits for this vulnerability at the time of this advisory. However, it is important to address the vulnerability to prevent potential security issues.

Related vulnerabilities

Recent vulnerabilities recorded for org.bouncycastle:bcprov-jdk15on.

How To Fix

Minimum fixed version

1.50

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback