-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CVE‐2026‐59649
Title: OpenPGP user-attribute subpacket length bounded only by JVM max memory.
Issue affecting: BC before 1.85, BC-LTS before 2.73.12, BC-FJA before bcpg-fips 1.0.13, 2.0.13 and 2.1.13.
Fixed versions: BC 1.85, BC-LTS 2.73.12, BC-FJA bcpg-fips 1.0.13, 2.0.13 and 2.1.13.
Platform affected: Java 8 and later.
UserAttributeSubpacketInputStream.readPacket() reads an attacker-controlled 5-octet subpacket length (up to Integer.MAX_VALUE) and allocates new byte[bodyLen-1] after checking only against 'limit'. Because UserAttributePacket constructs the stream with the single-arg constructor, 'limit' is computed by StreamUtil.findLimit(in), which for the wrapped BCPGInputStream/BufferedInputStream/PartialInputStream falls through to Runtime.getRuntime().maxMemory(). The actual enclosing packet body length known to PartialInputStream is never consulted. An attacker who can get a victim to import a public key (keyserver, WKD, attachment) can therefore force allocation of a byte array near the JVM heap size from a few dozen bytes of input, throwing OutOfMemoryError before readFully notices the short stream.
The fix was introduced in commit a43c40dc12c3.