Improper Verification of Cryptographic Signature Affecting org.bouncycastle:bcprov-jdk18on package, versions [,1.85)


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.17% (8th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JAVA-ORGBOUNCYCASTLE-18518014
  • published4 Aug 2026
  • disclosed3 Aug 2026
  • creditUnknown

Introduced: 3 Aug 2026

NewCVE-2026-12860  (opens in a new tab)
CWE-347  (opens in a new tab)

How to fix?

Upgrade org.bouncycastle:bcprov-jdk18on to version 1.85 or higher.

Overview

Affected versions of this package are vulnerable to Improper Verification of Cryptographic Signature in the verifySignature() method of RSADigestSigner, whose legacy NULL-omitted DigestInfo path computes comparison offsets as length - hash.length - 2, so its two comparison loops jointly cover only bytes [0..sig.length-2) and leave the final two hash bytes unverified. An attacker can forge an RSA PKCS#1 signature by producing a message whose digest matches the signed digest in every byte except the last two, reducing the second-preimage work factor by 2^16. The flawed path is reachable by default only for signatures using NULL-less DigestInfo encoding, across BC-lightweight TLS rsa_pkcs1_*, PKIX/CMS, and OpenPGP RSA verification, and only when org.bouncycastle.pkcs1.strict_digestinfo is not set.

Workaround

This vulnerability can be avoided by setting the system property org.bouncycastle.pkcs1.strict_digestinfo, which enforces strict DigestInfo parsing and rejects the NULL-omitted encoding that reaches the flawed path.

CVSS Base Scores

version 4.0
version 3.1