VDB
Sign up
HIGH

GHSA-98j2-6v39-78w8

Bouncy Castle: Zeroisation of sensitive key material on garbage collection relies on finalization.

Quick fix

GHSA-98j2-6v39-78w8 — org.bouncycastle:bc-fips: upgrade to the fixed version with the command below.

# pom.xml: bump <version>1.0.2.7</version> for org.bouncycastle:bc-fips

Details

In Bouncy Castle for Java FIPS (BC-FJA) before bc-fips 1.0.2.7 (1.0.X series), 2.0.2 (2.0.X series) and 2.1.3 (2.1.X series), sensitive key material held by the AES and DESede engines, the SP 800-90A DRBGs, SymmetricSecretKey and the PBKD and scrypt parameter classes was zeroised on garbage collection by overriding Object.finalize. Finalization runs at an unspecified time and in an unspecified order and is serviced by a single finalizer thread, so where objects carrying a finalizer are allocated faster than that thread retires them the pending-finalization queue grows without bound: disposal falls arbitrarily far behind, which can contribute to an OutOfMemoryError under load, and the key material those objects hold stays resident in the heap for as long as they are queued, defeating the purpose of the zeroisation. The behaviour was not a problem on Java 8 or Java 11; it is later JVMs, on which finalization has been deprecated and progressively de-emphasised, where it becomes one. Disposal of these classes now runs from a java.lang.ref.Cleaner registered in the multi-release jdk1.9 overlay, so on Java 9 and later it no longer depends on the finalizer being scheduled. Bouncy Castle for Java (bcprov) and Bouncy Castle for Java LTS are not affected, as neither implements the finalizer-based zeroisation scheme.

Are you affected?

Enter the version of the package you're using.

Affected packages

Maven/org.bouncycastle:bc-fips
Introduced in: 0Fixed in: 1.0.2.7
Fix# pom.xml: bump <version>1.0.2.7</version> for org.bouncycastle:bc-fips
Maven/org.bouncycastle:bc-fips
Introduced in: 2.0.0Fixed in: 2.0.2
Fix# pom.xml: bump <version>2.0.2</version> for org.bouncycastle:bc-fips
Maven/org.bouncycastle:bc-fips
Introduced in: 2.1.0Fixed in: 2.1.3
Fix# pom.xml: bump <version>2.1.3</version> for org.bouncycastle:bc-fips

References