GPGME Double Free: Data Theft, Possible RCE (CVE-2026-129975)
A crafted OpenPGP key triggers a double free in GPGME before 2.3.1, or before 1.24.4 on 1.x, risking data theft and possible RCE.
TL;DR
- A crafted OpenPGP key with a very long user ID makes GPGME reallocate a status buffer and then free it twice. GnuPG calls the flaw a critical security bug.
- Every GPGME release before 2.3.1 is affected, and so is every legacy release before 1.24.4. Most mail clients and many XMPP clients use it. It also ships inside Gpg4win and Samba, and inside Flatpak.
- No exploitation is known and the CVE is not in CISA KEV as of 2026-11-21. No public proof-of-concept code is published.
- Upgrade to GPGME 2.3.1, or to 1.24.4 on the legacy branch. Debian has already shipped backports.
Am I affected?
All of these must hold:
- A program on the host uses GPGME before 2.3.1 on the 2.x branch, or before 1.24.4 on the 1.x branch.
- That program processes OpenPGP keys or signed data that an attacker can supply, such as an email or a downloaded key.
- The attacker can make
gpgemit a status line or a key-listing line longer than the initial 1024-byte buffer, for example with a very long user ID. - An early return happens before GPGME writes the new buffer pointer back, because a status callback returns an error or a read fails.
GPGME is the C library that applications use to call GnuPG. The gpg command itself is not affected. The flaw is in the library that parses gpg output, and a program can link GPGME dynamically or bundle it statically. Gpg4win, GnuPG Desktop and GnuPG VS-Desktop bundle it.
To see whether a running program loads the library, inspect its dynamic dependencies. A statically linked program will not list it.
| Branch | Affected versions | Fixed version |
|---|---|---|
| 2.x | 2.0.0 through 2.2.0 | 2.3.1 |
| 1.x legacy | 1.0.0 through 1.24.3 | 1.24.4 |
GPGME 2.3.0 was never released. The advisory says every release before these fixed versions is affected, including the 0.x line. Only the 2.x and 1.x legacy branches have fixed releases.
Check the installed library:
# Debian and Ubuntu
dpkg-query -W -f='${Package} ${Version}\n' | grep -i gpgme
# Fedora, RHEL and SUSE
rpm -qa | grep -i gpgme
# Alpine
apk info -v | grep -i gpgme
# macOS with Homebrew
brew list --versions gpgme
# development files, when installed
pkg-config --modversion gpgme 2>/dev/null || gpgme-config --version
A version earlier than 2.3.1 on the 2.x branch is affected. So is a version earlier than 1.24.4 on the 1.x branch. A statically linked application may not appear in the package list, so check its build manifest or its vendor version. On Windows, Gpg4win 5.1.2 carries the fix.
How do I fix it?
Upgrade GPGME to 2.3.1, or to 1.24.4 if you stay on the legacy 1.x branch, then restart every service that loads the library.
- Debian and Ubuntu: run
sudo apt update && sudo apt install --only-upgrade libgpgme11. Debian published DSA-6646-1 for trixie (1.24.2-3+deb13u1) and DLA-4924-1 for bookworm (1.18.0-3+deb12u1). A system that already ships GPGME 2.x needs its distribution's 2.x package instead. - Fedora and RHEL: run
sudo dnf upgrade gpgme. On SUSE, runsudo zypper update gpgme. - Alpine: run
sudo apk upgrade gpgme. - macOS with Homebrew: run
brew upgrade gpgme. - Windows: install Gpg4win 5.1.2 or later.
- If you build the library yourself or bundle it statically, build against 2.3.1 or 1.24.4 and rebuild every application that links it. Updating a shared system library does not fix a statically linked copy.
There is no configuration change that removes the bug. The advisory attaches a patch that applies cleanly to older versions, according to GnuPG. Distributions and vendors that cannot move to 2.3.1 or 1.24.4 can backport that patch. Restricting which keys and signed messages an application processes lowers exposure, but it is not a fix.
What is the root cause?
GPGME reads gpg status lines and key listings through two functions in src/engine-gpg.c: read_status() and read_colon_line(). Each function starts with a 1024-byte heap buffer, allocated when the engine starts. When fewer than 256 bytes remain before the read position, the function adds 1024 bytes to the buffer size and calls realloc().
The vulnerable code in GPGME 1.24.3 keeps a local copy of the buffer pointer. It writes the new pointer back only at the end of the function.
/* src/engine-gpg.c:1452-1464, 1576-1579, GPGME 1.24.3 */
size_t bufsize = gpg->status.bufsize;
char *buffer = gpg->status.buffer;
size_t readpos = gpg->status.readpos;
if (bufsize - readpos < 256)
{
bufsize += 1024;
buffer = realloc (buffer, bufsize);
if (!buffer)
return gpg_error_from_syserror ();
}
/* ... read, parse and dispatch status lines ... */
/* Update the gpg object. */
gpg->status.bufsize = bufsize;
gpg->status.buffer = buffer;
gpg->status.readpos = readpos;
realloc() can move the buffer and free the old block. The new pointer lives in the local buffer until the final assignment. Several paths return before that assignment. A read can fail. The monitor callback or the status callback can return an error. A strdup() of a status keyword can fail. On any of those paths, gpg->status.buffer still points to the block that realloc() freed.
The new block leaks, and the stale pointer is freed a second time when the engine is released. engine_release() frees both the status buffer and the colon buffer:
/* src/engine-gpg.c:571-574, GPGME 1.24.3 */
if (gpg->status.buffer)
free (gpg->status.buffer);
if (gpg->colon.buffer)
free (gpg->colon.buffer);
read_colon_line() has the same pattern for the machine-readable key listing, with the same early returns. The vendor says the bug was introduced 24 years ago by commit f12433c1e476.
How is it exploited?
- An attacker sends a signed message, a key or a key update to an application that uses GPGME.
- The OpenPGP key carries a user ID long enough that the status or colon output exceeds the 1024-byte buffer.
read_status()orread_colon_line()callsrealloc()and moves the buffer.- Before the function writes the new pointer back, an early return occurs. The advisory names a callback error and a read error; the callback is application code.
- The engine keeps the pointer to the freed block. When the application releases the context, the library frees that pointer again.
- GnuPG says the double free can be used to exfiltrate data from the application by sending signed data. The vendor cannot rule out remote code execution.
No public exploit code has been released. The advisory gives the mechanism and the patch, not a working payload.
How does the attack flow?
A long user ID forces a buffer move. An early return then leaves the old pointer in place, and releasing the context frees that pointer a second time.
OpenPGP key or signed data"] --> B["gpg emits a status line
longer than 1024 bytes"] B --> C["read_status or read_colon_line
reallocates the buffer"] C --> D["Early return before
the pointer is written back"] D --> E["Context keeps the pointer
to the freed block"] E --> F["gpgme_release frees
the same pointer again"] F --> G["Data theft, possible
code execution"]
What can an attacker do?
A successful attacker can leak data from the application and possibly run code in its process. GnuPG states that data exfiltration is possible by sending signed data. The vendor cannot rule out remote code execution.
Every condition has to hold:
- The application uses an affected GPGME version.
- It processes OpenPGP data the attacker can influence.
- The crafted data produces a line longer than the current buffer.
- The status or colon-line path reaches an early return, through a callback error or a failed read.
The attacker does not need a signature from the victim. The crafted key only has to carry a long user ID. A program that never parses untrusted OpenPGP data is not exposed to the trigger, even when it links an affected library.
Why does the fix work?
The patch writes the new pointer into the context immediately after realloc() succeeds, so no early return can leave a stale pointer behind.
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -1494,7 +1494,9 @@ read_status (engine_gpg_t gpg)
buffer = realloc (buffer, bufsize);
if (!buffer)
return gpg_error_from_syserror ();
- }
+ gpg->status.bufsize = bufsize;
+ gpg->status.buffer = buffer;
+ }
nread = _gpgme_io_read (gpg->status.fd[0],
buffer + readpos, bufsize-readpos);
@@ -1606,8 +1608,6 @@ read_status (engine_gpg_t gpg)
}
/* Update the gpg object. */
- gpg->status.bufsize = bufsize;
- gpg->status.buffer = buffer;
gpg->status.readpos = readpos;
return 0;
}
@@ -1647,6 +1647,8 @@ read_colon_line (engine_gpg_t gpg)
buffer = realloc (buffer, bufsize);
if (!buffer)
return gpg_error_from_syserror ();
+ gpg->colon.bufsize = bufsize;
+ gpg->colon.buffer = buffer;
}
nread = _gpgme_io_read (gpg->colon.fd[0], buffer+readpos, bufsize-readpos);
@@ -1726,8 +1728,6 @@ read_colon_line (engine_gpg_t gpg)
}
/* Update the gpg object. */
- gpg->colon.bufsize = bufsize;
- gpg->colon.buffer = buffer;
gpg->colon.readpos = readpos;
return 0;
}
After the change, an early return leaves the context pointing at the live block. The block that realloc() freed is no longer referenced, and release frees the current buffer once. The patch covers both functions that read gpg output, so it closes the two paths the advisory describes.
How do I check if I was compromised?
No indicators of compromise are published. The double free can abort the process with an allocator message such as double free or corruption or free(): invalid pointer. Check the logs of applications that process untrusted keys or signed mail:
grep -Ei 'double free|free\(\): invalid pointer' /var/log/syslog /var/log/messages 2>/dev/null
journalctl --since "2026-11-01" | grep -Ei 'double free|invalid pointer'
A crash is a lead, not proof of exploitation. The same bug can abort a process without an attacker. A failed attempt may also leave no trace. A service manager may restart the process automatically, so check for repeated restarts as well. No network indicator or file path is published for this flaw.
Timeline
- 2026-11-12: GitLab informs GnuPG of the flaw, after Johan Carlsson's report.
- 2026-11-13: GnuPG opens T8557 to track the double free.
- 2026-11-14: Werner Koch authors the fix patch.
- 2026-11-19: GPGME 2.3.1 is released with the fix.
- 2026-11-20: GPGME 1.24.4 is released on the legacy branch, and GnuPG publishes the advisory.
FAQ
Is the gpg command itself affected?
No. The flaw is in GPGME, the library applications use to call gpg. A system that only runs the gpg command-line tool without a GPGME-based application is not exposed through this bug.
Do I need to replace my OpenPGP keys?
No. The bug is in how GPGME parses gpg output. Your own key material is not the problem, and rotating it does not remove the vulnerability.
Can an email client be exploited by opening a message?
Only if the client uses an affected GPGME version and processes the crafted key or signed data in a way that reaches the early return. GnuPG says data exfiltration is possible. It cannot rule out RCE. No public exploit has been released.
My distribution has not shipped 2.3.1. What can I do?
Apply the patch from the advisory to the version you ship, or build 2.3.1 or 1.24.4 from source. Debian has fixed both the trixie and bookworm packages through DSA-6646-1 and DLA-4924-1.
Does a statically linked application need a different fix?
Yes. A statically linked application carries its own copy of GPGME, so updating the system library does not change it. Rebuild the application against 2.3.1 or 1.24.4 and ship the new build.
Is there a CVSS score?
No CVSS score was published when this article was written. GnuPG describes the bug as a critical security bug and recommends an immediate update. The CVE record had not appeared in the public CVE database at that point.
References
- GnuPG security advisory for GPGME, CVE-2026-129975: https://lists.gnupg.org/pipermail/gnupg-announce/2026q4/000517.html (checked November 21, 2026)
- GnuPG T8557, the public issue with the root cause and fix commits: https://static.dev.gnupg.org/T8557 (checked November 21, 2026)
- GnuPG T8427, release of GPGME 2.3.1: https://static.dev.gnupg.org/T8427 (checked November 21, 2026)
- GnuPG T7659, release of GPGME 1.24.4 on the legacy branch: https://static.dev.gnupg.org/T7659 (checked November 21, 2026)
- GPGME source tarball 1.24.3, used for the vulnerable code: https://gnupg.org/ftp/gcrypt/gpgme/gpgme-1.24.3.tar.bz2 (checked November 21, 2026)
- The fix patch as posted to oss-security: https://www.openwall.com/lists/oss-security/2026/11/20/13/1 (checked November 21, 2026)
- GnuPG download page, with GPGME 2.3.1 and legacy 1.24.4: https://gnupg.org/download/index.html (checked November 21, 2026)
- Gpg4win, version 5.1.2: https://gpg4win.org/ (checked November 21, 2026)
- Debian security tracker for CVE-2026-129975, with DSA-6646-1 and DLA-4924-1: https://security-tracker.debian.org/tracker/CVE-2026-129975 (checked November 21, 2026)
- Repology entry for gpgme, 336 package entries: https://repology.org/project/gpgme/versions (checked November 21, 2026)
- CVE-2026-129975 record, not yet published when checked: https://www.cve.org/CVERecord?id=CVE-2026-129975 (checked November 21, 2026)