Where
-Infinity
0

Vendor Risk Score

See how pgpainless compares to other vendors in security performance

View Risk Score →
Severity
7.5
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Summary An architectural security boundary bypass in inline-detach and MessageInspector allows remote, unauthenticated attackers to force unbounded recursive decompression routines. By supplying a specially crafted OpenPGP message containing deeply nested compressed packet structures, an attacker can completely bypass the library's built-in DoS protections (MAXLAYERDEPTH = 16), leading to resource exhaustion, thread blocking, and potential Out-of-Memory (OOM) application crashes.

Details The pg-painless core processing pipeline implements a defensive threshold constraint to prevent decompression bomb sequences (Zip Bombs) and arbitrary resource consumption:

Enforcement Location: pgpainless-main/pgpainless-core/src/main/kotlin/org/pgpainless/decryptionverification/MessageMetadata.kt

Threshold Constant: MAXLAYERDEPTH = 16

However, a code architecture review revealed two specific packet-walking implementations that unpack and step through PGPCompressedData packets manually, entirely failing to track or increment a layer depth index counter against the static compliance limits:

In InlineDetachImpl.kt (Line ~78-93): The logic loops over data packets via compressedData.dataStream. Because it processes the incoming data block-by-block without leveraging or passing constraints down to the guarded OpenPgpMessageInputStream tracking mechanism, it accepts infinite nesting.

In MessageInspector.kt (Line ~95): The inspector utility descends recursively down nested compressed packet layouts to ascertain inner content classification markers (e.g., determining encryption states) without referencing or respecting maximum layer depth boundaries.

PoC The vulnerability can be verified by constructing an inline-signed binary message wrapped recursively inside multiple layers of compression packets:

Generate a standard, valid OpenPGP public/private keypair.

Sign a plaintext document sample utilizing binary inline-signing configurations (.noArmor()).

Programmatically loop 64 times over the output payload. In each iteration, encapsulate the previous binary output into a new PGPCompressedDataGenerator context configured with CompressionAlgorithmTags.ZIP.

Pass the final 64-layer nested byte array stream directly to the SOP interface via sop.inlineDetach().message(nestedBytes).toByteArrayAndResult().

Observed Result: The library completely parses the highly nested structures, returning a successful outcome without raising any execution constraints. The code fails to throw the expected SOPGPException.BadData, proving that the 16-layer boundary constraint was completely bypassed during the streaming packet loop.

Impact

Who is impacted: Any downstream application, gateway, or mail client (such as FlowCrypt or any framework integrating the library's SOP wrapper interface/MessageInspector modules) that handles untrusted, incoming external user files or signed attachment streams. An attacker can use this behavior to systematically freeze application threads, exhaust target heap allocation metrics, and disrupt backend infrastructure services.

1 / 2
Source: GitHub
First published (updated )
Severity
7.5
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

PGPainless is a simple-to-use OpenPGP API based on Bouncy Castle. Prior to 1.7.8 and from 2.0.0 until 2.0.4, pgpainless-sop/src/main/kotlin/org/pgpainless/sop/InlineDetachImpl.kt InlineDetachImpl and pgpainless-core/src/main/kotlin/org/pgpainless/decryptionverification/MessageInspector.kt MessageInspector manually descend PGPCompressedData packets without incrementing or enforcing MAXLAYERDEPTH. A remote unauthenticated attacker can supply an untrusted OpenPGP message containing deeply nested compressed packet structures to a downstream application using inline-detach or message inspection, bypass the intended 16-layer limit, and force continued decompression and packet processing. The resulting resource consumption can block processing threads, exhaust heap memory, and crash the consuming application. This issue is fixed in versions 1.7.8 and 2.0.4.

First published (updated )

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203