GHSA-5FMP-48FF-RX9P
PGPainless 2.0.3 security-control and verified-metadata consistency findings
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-5FMP-48FF-RX9P divulgada | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Consolidated private report: PGPainless 2.0.3 security-control and metadata-consistency audit
FlowCrypt asked me to report PGPainless findings directly upstream first and return to FlowCrypt only after maintainer validation. This private report bundles the remaining local/synthetic PGPainless 2.0.3 findings so maintainers can triage them by root-cause area rather than receiving a flood of separate reports.
This is a single combined audit package covering related local/synthetic findings against `org.pgpainless:pgpainless-core:2.0.3`. I have grouped them so you can triage by root-cause area rather than receiving a flood of separate emails. I am not presenting these as 22 equal-severity issues; several are narrow policy-boundary or metadata-consistency cases, and I have placed weaker edge cases in a secondary/deferred section.
All testing used local JVM harnesses with synthetic OpenPGP keys, messages, certificates, passphrases, and policies. I did not test live FlowCrypt/Gmail accounts, production services, real user keys/messages, customer data, or public issue trackers.
Tested package and source context:
- Maven package: `org.pgpainless:pgpainless-core:2.0.3`
- Source JAR SHA-256 recorded in the individual packets: `a8d1679fefa030b4c30c12b4587513dd45223439949634111f0e17fab2b58d8f`
- Tag evidence recorded in the individual packets: `2.0.3` / `cb3a76ce0da0a95770319fd3a796566489ad9b58`
I can send the individual PoC Java/Kotlin files and raw JSON outputs in whatever private format you prefer. The summaries below are intentionally compact; each item has a local reproducer and saved raw proof output, but some items may be best treated as hardening/consistency bugs rather than CVE-level vulnerabilities.
Policy enforcement / policy isolation
1. Per-instance signature policy can be weakened by a later lenient API instance
PGPainless advertises per-instance configuration, but default instances share Bouncy Castle's singleton `OpenPGPImplementation`. Each constructor mutates that shared implementation with `implementation.setPolicy(PolicyAdapter(algorithmPolicy))`, while signature verification later reads `api.implementation.policy()` during metadata finalization. A strict verifier can reject a SHA1 document signature, then accept the same SHA1 signature after unrelated code in the same JVM constructs a lenient `PGPainless(Policy.wildcardPolicy())`, then reject it again after another strict instance resets the shared implementation policy.
Impact: verifier-side policy isolation bypass. A weak-hash document signature can appear as positively verified metadata under a verifier that the caller configured or expected to remain strict. I am not claiming live product impact without a downstream integration that uses multiple policy profiles in one JVM.
2. Strict per-instance key-parameter validation can be ignored during secret-key unlock
`Policy.enableKeyParameterValidation` can be enabled on a non-singleton PGPainless instance, but several secret-key unlock paths default to `PGPainless.getInstance().algorithmPolicy` or provide no policy parameter. In a local proof, explicit strict-policy unlock rejected tampered RSA secret-key material, while high-level signing through a strict API instance accepted the forged `OpenPGPSecretKey` component and emitted a signed message.
Impact: a caller-enabled key-overwriting/KOpenPGP-style mitigation can be bypassed by policy propagation gaps. This is not evidence of private-key extraction or account compromise.
3. RFC4880-only encryption policy can still emit SEIPDv2/AEAD
When configured with RFC4880-only encryption mechanism policy, PGPainless generated a decryptable SEIPDv2/AEAD encrypted message for a synthetic recipient certificate advertising `MODIFICATION_DETECTION_2`. `EncryptionResult.encryptionMechanism` was not accepted by the configured policy.
Impact: a caller intending to emit only RFC4880/SEIPDv1 encrypted data can produce SEIPDv2/AEAD output.
4. RFC4880-only decryption policy still decrypts SEIPDv2/AEAD
When configured with `Policy.MessageEncryptionMechanismPolicy.rfc4880(...)`, PGPainless decrypted and returned plaintext from an SEIPDv2/AEAD message. The configured policy rejected the observed mechanism, but the fail-closed gate checked only the session key's symmetric algorithm.
Impact: a caller's message encryption mechanism policy can be bypassed during decryption.
5. Restrictive compression policy is ignored while consuming compressed signed messages
A verifier configured with a compression policy accepting only `UNCOMPRESSED` still consumed a ZLIB-compressed inline-signed message and returned matching plaintext with positive signature metadata. The active policy rejected ZLIB in the proof.
Impact: caller-configured compression restrictions are not enforced on the decryption/verification path.
6. Subkey-binding certification signatures use document-signature hash policy
`SecretKeyRingEditor.addSubKey(...)` negotiates a hash using `HashAlgorithmNegotiator.negotiateSignatureHashAlgorithm(api.algorithmPolicy)`, which reads the document/data signature hash policy rather than the certification signature hash policy. A mixed-policy proof generated a `SUBKEY_BINDING` certification signature with SHA1 even though the active certification-signature policy rejected SHA1.
Impact: generated key certifications can violate the caller's certification-signature hash policy.
7. Revocation signatures use document hash policy
Revocation signature generation defaults through `AbstractSignatureBuilder.negotiateHashAlgorithm(...)`, which uses the document/data signature hash policy instead of `revocationSignatureHashAlgorithmPolicy`. A proof configured document signatures to allow only SHA1 and revocations to allow only SHA512; high-level revocation APIs generated SHA1 revocation signatures.
Impact: generated revocation signatures can violate the caller's revocation-signature hash policy.
8. Caller-configured S2K hash settings are ignored for secret-key protection
`KeyRingProtectionSettings.hashAlgorithm` is exposed as caller-controlled key-protection settings, but secret-key encryptor construction omits that configured hash. Proofs configured SHA-512 for key generation and SHA3-512 for passphrase re-protection; resulting secret-key packets used SHA-256 S2K while honoring the caller's cipher and S2K count.
Impact: applications can believe private-key protection is emitted with a configured S2K hash while PGPainless emits SHA-256. This is a narrow configuration-consistency issue, not evidence of password recovery or private-key extraction.
Signature / verified metadata semantics
9. Expired OpenPGP document signatures are exposed as verified
Synthetic one-second document signatures were verified after expiration through detached, inline one-pass, and cleartext signature paths. PGPainless returned positive verified metadata and zero rejected signatures after the hashed `Signature Expiration Time` had elapsed.
Impact: a cryptographically correct but expired document signature can be exposed as acceptable through `MessageMetadata.getVerifiedSignatures()`, helper predicates, and related metadata APIs.
10. Non-document OpenPGP signature packets are exposed as verified detached/document metadata
Detached signature verification wraps raw `PGPSignature` packets as `OpenPGPDocumentSignature` and records them as verified metadata when cryptographic verification succeeds, without enforcing document signature types. A local proof showed positive verified metadata for `STANDALONE`, `TIMESTAMP`, `DIRECT_KEY`, and `GENERIC_CERTIFICATION` signatures over non-empty synthetic message bytes. Wrong-message controls rejected, so this is a signature-type semantic boundary issue, not unconditional acceptance.
Impact: APIs such as `verifiedDetachedSignatures`, `verifiedSignatures`, `isVerifiedDetachedSignedBy(...)`, and `hasSignature()` can represent non-document signatures as document/message signatures.
11. Intended Recipient Fingerprint is ignored in verified metadata
An inline document signature carrying an Intended Recipient Fingerprint for recipient A was encrypted to and decrypted by recipient B. PGPainless still exposed the signature as positively verified message metadata for recipient B. A critical-subpacket mismatch produced the same positive verified metadata.
Impact: recipient-context signature validity is not bound to the recipient key that actually decrypted the encrypted message context.
12. Malformed dash-escaped cleartext signed content can produce positive signature metadata
PGPainless verifies cleartext signed messages over a normalized/dearmored text stream. A proof signed cleartext line `payload`, changed only the raw armored cleartext line to `-Xpayload`, and PGPainless still returned normalized output `payload\n` with one verified signature, zero rejected signatures, and no exception. The negative control `Xpayload` failed verification.
Impact: raw cleartext syntax that should be rejected or warned on can be normalized away before positive verified metadata is exposed. This is not a general signature forgery claim.
13. Positive verified-signature metadata can be exposed after MDC/integrity failure is consumed by a second close
For a tampered SEIPDv1/MDC-protected signed+encrypted message, the first finalization raises `ModificationDetectionException`, but `IntegrityProtectedInputStream.close()` has already marked the inner stream closed before `encryptedData.verify()` succeeds. A later close on the same `DecryptionStream` can return without rethrowing and allow `getMetadata()` to report the tampered message as encrypted with one verified inline signature and zero rejected signatures.
Impact: integrity failure can be followed by positive verified metadata on the same stream object. The proof is for SEIPDv1/MDC; I am not claiming an AEAD variant without separate evidence.
Recipient, key-use, and preference binding
14. Detached signing accepts an encryption-only subkey
Whole-key signing and caller-selected inline signing enforce signing-key capability, but the caller-selected detached-signature overload accepted an encryption-only subkey. The proof showed the subkey was not in `KeyRingInfo.signingSubkeys`, inline signing rejected it, detached signing accepted it, and the resulting detached signature verified with the encryption-only public subkey.
Impact: caller-selected detached signing can use key material outside the signing-capability boundary.
15. Missing-key-flags fallback bypasses caller encryption subkey selector
`EncryptionOptions.addRecipient(cert, EncryptionKeySelector)` lets callers decide which recipient encryption subkeys to use, but when `setAllowEncryptionWithMissingKeyFlags()` is enabled and the selector returns an empty list for normal flagged subkeys, PGPainless replaces that list with all valid encryption-capable no-key-flag subkeys without applying the caller selector. A proof registered two no-key-flag subkeys even though the selector always returned empty.
Impact: caller key-selection policy can be bypassed by the missing-key-flags fallback.
16. Hidden-recipient decryption bypasses the missing-key-flags gate
The default consumer rejects an explicit-recipient message encrypted to a subkey whose binding signature has no encryption key flags, unless `setAllowDecryptionWithMissingKeyFlags()` is enabled. The hidden-recipient/wildcard PKESK branch does not apply the same gate and decrypted the same missing-key-flags subkey under default options.
Impact: hidden-recipient decryption can cross a key-flags policy boundary enforced for explicit recipients.
17. Passphrase-decrypted mixed SKESK/PKESK messages report injected public-key recipients
After passphrase/SKESK decryption succeeds, `OpenPgpMessageInputStream.decryptSKESKAndStream(...)` records visible PKESK key identifiers into metadata. A mixed ESK message with `PKESK(victim, session A)`, `SKESK(passphrase, session B)`, and `SEIPD(session B)` decrypted through the passphrase path, while victim private-key-only control could not decrypt it. `MessageInspector`, `MessageMetadata.recipientKeyIdentifiers`, and `MessageMetadata.isEncryptedFor(victimCert)` still reported the victim identifier.
Impact: recipient metadata can indicate public-key recipients that did not decrypt the accepted payload.
18. CA-authenticated recipient user-ID preferences are discarded
`EncryptionOptions.addAuthenticatableRecipients(...)` authenticates a specific user-ID/certificate binding through `CertificateAuthority`, then discards the returned `CertificateAuthenticity.userId` and calls `addRecipient(it.certificate)`. The no-user-ID path can use direct-key/key-level preferences rather than the authenticated user-ID binding. A proof showed explicit user-ID encryption selecting SEIPDv1/MDC while the CA-authenticated convenience path selected SEIPDv2/AEAD for the same synthetic certificate.
Impact: sender-side preference negotiation can cross the authenticated user-ID boundary. I consider this secondary because downstream use of `CertificateAuthority` in public FlowCrypt code was not demonstrated.
19. Multi-recipient preference intersection bypass
PGPainless can generate a multi-recipient encrypted message whose symmetric algorithm or SEIPDv2 AEAD ciphersuite is not in one recipient's advertised user-ID preference set. The negotiation path gathers each recipient's preference sets and chooses a policy-preferred/popular item without checking that the selected mechanism is present in every recipient's set.
Impact: multi-recipient messages can violate one recipient's advertised preferences rather than using a true intersection or standards fallback. I consider this secondary because recipient preference handling can be product/context dependent.
Parser / stream hardening / availability
20. ASCII-armored OpenPGP input can be misclassified as raw non-OpenPGP data after a short first bulk read
`OpenPGPAnimalSnifferInputStream` samples the stream with a single bulk read. If the first bulk read returns a short prefix, such as one byte, the ASCII armor header comparison fails and the high-level `processMessage()` API can return the original armored ciphertext unchanged with `metadata.isEncrypted() == false` and zero verified signatures. The same bytes decrypt and verify normally from an eager `ByteArrayInputStream` control.
Impact: applications that rely on PGPainless to enforce OpenPGP handling can mis-route or accept protected data as raw data when using streams that legitimately return short initial reads.
21. Public-key encrypted messages bypass maximum nesting depth guard
`MessageMetadata.Layer.MAX_LAYER_DEPTH` is 16, but the public-key encrypted decryption path constructs the next encrypted metadata layer with the current depth instead of `depth + 1`. A proof decrypted 17 and 32 nested public-key encrypted layers and returned plaintext, while metadata reported 17/32 encryption layers.
Impact: the configured structural nesting depth guard is ineffective for public-key encrypted nesting. I am not claiming a proven production DoS without a downstream resource-exhaustion demonstration.
Deferred / lowest-confidence appendix
22. Hidden-recipient interactive passphrase flow throws unchecked NPE
For a valid anonymous/wildcard-recipient public-key encrypted message where the secret key is passphrase-protected and the caller uses the default interactive passphrase callback flow, PGPainless throws an unchecked `NullPointerException` before invoking the callback. The same hidden-recipient ciphertext decrypts when the passphrase is supplied up front, and an explicit-recipient ciphertext exercises the callback normally.
Impact: valid hidden-recipient messages can abort before the passphrase callback, creating a robustness/availability problem for applications using interactive unlocking. I would treat this as a low-confidence hardening issue unless you want all edge cases included.
Bounds and non-claims
I am not claiming private-key extraction, signature forgery, account takeover, live FlowCrypt product compromise, production service access, plaintext recovery from real users, broad CVE count, or exploitation against any real mailbox/account. The strongest common issue is that several PGPainless high-level APIs expose caller-configurable security policy and verified metadata, but selected code paths do not consistently bind those policies or metadata semantics to the operation being performed.
Suggested handling
I am submitting this through GitHub's private vulnerability reporting flow rather than opening public issues or sending 22 separate emails. Please split, close, downgrade, or ask for narrower follow-up reports as appropriate.
I can provide a follow-up archive containing individual PoC source files, raw JSON/text outputs, and source-code reference notes for any subset you want to validate first.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Versiones afectadas
2.0.3Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Mavenorg.pgpainless:pgpainless-core |
Sin parche | — | — | — |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/pgpainless/pgpainless/security/advisories/GHSA-5fmp-48ff-rx9pLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
