One Key, Two Frees: The GPGME Bug That Turned Trust Infrastructure Into Attack Surface
On November 20, 2026, Werner Koch announced GPGME 2.3.1 on the gnupg-announce mailing list with a sentence no maintainer enjoys writing: the release "fixes a critical security bug found in all prior versions."
The bug is CVE-2026-129975, a double free in GPGME, the library that sits between GnuPG and nearly every application that wants to encrypt, sign, or verify something without reimplementing OpenPGP itself.
The trigger is disarmingly simple. According to the advisory, "by using an OpenPGP key containing a crafted very long user id it is possible to trigger a double free." The same advisory says the double free "can be used to exfiltrate data from applications by sending for example signed data," and that exploiting it for remote code execution "can't be ruled out." That last phrase is the vendor's own, and it is doing a lot of work in this story.
Why this library matters more than most
GPGME, the GnuPG Made Easy library, is not an obscure corner of the ecosystem. The advisory's own list of affected software includes:
- Gpg4win
- GnuPG Desktop
- GnuPG VS-Desktop
- "most mail clients"
- "many XMPP clients"
- Samba
- Flatpak
Any of them linked against GPGME before version 2.3.0 is affected, whether the library arrived as a shared library, a Windows DLL, or was statically linked into the binary.
That last category is the quiet multiplier. When a shared library is patched on a system, every program that loads it picks up the fix the next time it starts. A statically linked copy travels inside the application, invisible to the package manager. The advisory is blunt about it: statically linked binaries must be rebuilt against GPGME 2.3.1. Updating the system library does not reach them.
For Windows users, the project shipped Gpg4win 5.1.2 with the fixed library inside. For anyone stuck on the legacy branch, there is a 1.24.4 release, with the caveat from its notes that the project cannot guarantee that branch will receive every future security patch. GPGMEPP and GPGMEQT, the C++ and Qt bindings, need no update.
The mechanics of the double free
The project's own tracker entry, T8557, lays out the root cause with unusual clarity. Two internal functions, read_status() and read_colon_line() in src/engine-gpg.c, read status lines and key listings coming back from the gpg process.
Both start with a local copy of the engine's buffer pointer, initially 1024 bytes. When more space is needed, the buffer grows with realloc(). Here is the problem, quoted from the ticket's description: realloc() may move the block, freeing the old one. The new pointer is used locally, but it is "only assigned back to the context object at the end of the function."
Between the realloc and that write-back sit several early return paths, for example when a status callback or the colon preprocess callback returns an error. On any of those paths, the engine object keeps pointing at the old block, which realloc already freed. The new block leaks. Later, when the engine context is released, the stale pointer is freed a second time. That is the double free.
The advisory adds one more detail that makes exploitation more plausible than it might sound: "due to other allocations in between the common double free checks of memory allocators may not be triggered." Modern allocators catch the naive case of freeing the same pointer twice in a row. They are far less reliable when the two frees are separated by other allocation activity, which is exactly the pattern this bug produces.
A double free is not automatically code execution. What it gives an attacker is a controlled corruption of the allocator's metadata, and the advisory's data-exfiltration scenario shows the maintainers consider at least one abuse path realistic.
The Hacker News coverage of the release notes the example path the advisory gives: signed data sent to an application. It also flags the honest unknown: which programs pass such material to the library without a manual key import is not something the advisory says. That gap matters, because it is the difference between "import a malicious key by hand" and "receive a signed message and get compromised."
A disclosure timeline that moved
The timeline in the advisory and the tracker reads like a case study in coordinated disclosure under pressure. Johan Carlsson discovered the bug. GitLab informed the GnuPG project on November 12, 2026. The ticket was created on November 13.
The fix was written quickly: the tracker shows the reporter supplied a patch, and the maintainer reviewing it commented that it "works good and is addressed the issue." By November 18, the tarball and patch had been shared with the reporter for distribution to Linux distros, with public announcement planned for November 25.
Then the schedule collapsed. The advisory explains why: "due to the new Ruby2Shell bug GitLab had to update earlier and thus we also disclosed the GPGME bug on 2026-11-20." One vendor's emergency became everyone's earlier disclosure.
The result is a five-day head start for defenders relative to plan, and a reminder that coordinated disclosure dates are only as stable as the most pressured participant. (One small curiosity for version-spotters: GPGME 2.3.0 was never publicly released, so the fix effectively jumps from 2.2.0 to 2.3.1.)
The uncomfortable part
There is no evidence of exploitation in the wild. The Hacker News states plainly that the project "has not reported any attacks exploiting the flaw." That is worth saying before anything else, because stories like this one tend to grow teeth in the retelling.
The discomfort is structural. OpenPGP keys are, by design, data that strangers hand you. They arrive attached to emails, fetched from keyservers, embedded in signatures. The entire point of the web of trust and of keyservers is that you will process keys from people you do not know. A parser bug in the library that handles those keys is therefore not a bug in an edge case; it is a bug on the front door.
The crafted input here is not exotic: it is a user ID field that is simply very long, exercising a buffer-growth path that apparently had not been audited for early returns.
The second structural point is the write-back pattern itself. "Take a local copy, mutate it, commit it back at the end" is a completely ordinary C idiom. It fails silently exactly when the error paths are the interesting ones, the paths that only execute under adversarial input. The functions had early returns for callback errors that nobody had ever traced to the allocator's point of view. This is the class of bug that survives code review because every line looks locally correct.
The third point is the fix distribution problem. GPGME is the kind of dependency that ends up statically linked precisely by the most security-sensitive software, the kind that vendors do not want broken by system library updates. Those are now the copies that will be patched last, each waiting on its own maintainer's release cycle.
The project did the right things: a same-day patch applicable to "very old versions," fixed releases on both current and legacy branches, Debian packages, an updated Windows installer. But the last mile belongs to hundreds of downstream projects, and the advisory offers no workaround for software that cannot update yet.
What to take away
The GnuPG project handled this well by any reasonable standard: report on the 12th, ticket on the 13th, fix and patch distributed privately by the 18th, public release on the 20th, ahead of the planned date when circumstances changed. The advisory is technically honest, including about what is not known.
The lesson for everyone downstream is older than this bug. The components that process trust, the ones that parse keys, certificates, and signatures, are attack surface with a particularly inviting property: their input is supposed to come from strangers. They deserve the same fuzzing, the same early-return audits, and the same suspicion usually reserved for network daemons. And every statically linked copy of a security library is a patch you will have to ship yourself, on a day you do not get to choose.
Sources: GnuPG security advisory for GPGME (gnupg-announce, November 20, 2026), GnuPG tracker entry T8557, The Hacker News (November 21, 2026). Claims about exploitation are the vendor's own wording; no attacks have been reported.
Comments
No comments yet. Start the discussion.