Security & privacy

GPGME patch fixes critical double-free vulnerability in OpenPGP handling

GnuPG released version 2.3.1 to fix CVE-2026-129975, a critical double-free bug in GPGME triggered by crafted long user IDs.

Illustration of a broken security shield with code leaking out
Illustration generated for this article

The GnuPG project has issued an urgent security advisory for GPGME, the library that allows applications to use GnuPG services. Version 2.3.1 addresses a critical memory corruption flaw that could allow attackers to exfiltrate data or potentially execute remote code. The update was accelerated after an unrelated vulnerability forced an earlier disclosure timeline.

What happened

Werner Koch announced the release of GPGME 2.3.1 on November 20, 2026, marking it as a critical security fix for all prior versions. The vulnerability, tracked as CVE-2026-129975 and internal ticket T8557, stems from how the library processes OpenPGP keys with specifically crafted, very long user identifiers. When such a key is processed, the library triggers a double-free error, a type of memory management bug where the same block of memory is freed twice.

The issue was discovered by Johan Carlsson and reported to the GnuPG team by GitLab on November 12, 2026. The original plan involved a coordinated disclosure scheduled for November 25. However, GitLab needed to release updates earlier due to a separate vulnerability known as the Ruby2Shell bug. This shift in timeline compelled the GnuPG maintainers to accelerate their own release and public announcement to ensure users were protected without delay.

This flaw affects any software that relies on GPGME versions older than 2.3.0, whether linked as a shared library, a DLL, or statically compiled into the application binary. Prominent examples include Gpg4win, GnuPG Desktop, GnuPG VS-Desktop, various mail clients, XMPP clients, Samba, and Flatpak. Because GPGME acts as a bridge between these applications and the core GnuPG engine, the vulnerability exposes a wide range of tools that handle encrypted or signed data.

How it works

The root cause lies in two internal functions within GPGME responsible for reading status lines and key listings from the underlying gpg process. When these functions start, they allocate a buffer of 1024 bytes. If the incoming data exceeds this size, the buffer is reallocated to provide more space. During reallocation, the system assigns a pointer to the new, larger buffer for immediate use within the function.

However, the code only updates the pointer stored in the main context object at the very end of the function execution. If the function exits early due to a read error or other interruption, the context object retains the old pointer, which now points to memory that has already been freed. Later, when the context is cleaned up, the system attempts to free this stale pointer again. Since other memory allocations may have occurred in the interim, standard allocator checks might not detect the double free, allowing the corruption to persist.

Attackers can exploit this by sending signed data containing a maliciously crafted key with an excessively long user ID. This triggers the buffer reallocation and subsequent early exit path, leading to the double free. While the primary confirmed impact is data exfiltration, the nature of heap corruption means that remote code execution cannot be ruled out. The instability introduced by freeing memory twice can be manipulated to overwrite critical control structures in the application’s memory space.

Key details

  • Vulnerability ID: CVE-2026-129975 (Internal ID T8557).
  • Affected Versions: All GPGME versions prior to 2.3.0; note that version 2.3.0 was never publicly released.
  • Fixed Version: GPGME 2.3.1, released on November 19, 2026.
  • Trigger Condition: Processing an OpenPGP key with a crafted, very long user ID.
  • Impact Scope: Data exfiltration is confirmed; remote code execution is possible but not definitively proven.
  • Discovery: Reported by Johan Carlsson via GitLab on November 12, 2026.

Why it matters

For developers building systems that integrate PGP encryption, this vulnerability highlights the risks inherent in relying on complex C libraries for memory management. GPGME is a foundational component for many security-sensitive applications, including email clients and package managers like Flatpak. A failure in this layer compromises the integrity of the entire application stack, potentially exposing private keys or decrypted messages to attackers who can inject malformed keys into the system.

The accelerated disclosure timeline also serves as a reminder of the interconnected nature of modern software supply chains. The decision to release early due to the Ruby2Shell bug demonstrates how vulnerabilities in one ecosystem can force hand in another. Teams maintaining software that depends on GPGME must monitor upstream advisories closely, as coordination schedules can change rapidly based on external threats. Ignoring these updates leaves systems open to sophisticated attacks that leverage memory corruption techniques.

What you can do

  • Update your GPGME shared library to version 2.3.1 immediately.
  • If you use Windows, upgrade to Gpg4win version 5.1.2, which includes the fixed GPGME DLL.
  • For statically linked binaries, rebuild your application against GPGME 2.3.1 source code.
  • If an immediate update is not feasible, apply the provided patch to your current GPGME version, as it is compatible with older releases.
  • Verify the integrity of downloaded packages using the provided SHA-1 checksum: 1134a407b50204ee6fb9efaa6e1451c2460e543e.
  • No update is required for GPGMEPP or GPGMEQT, as they are not affected by this specific flaw.
  • #security
  • #gnupg
  • #vulnerability
  • #cve
  • #memory-safety

Tools from the Bytechap store

Keep reading

All stories