Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 7 min read

One Long Key Name, One Double Free: Inside the GPGME Bug That Shook Every App That Verifies Signatures

On Friday, November 20, the GnuPG project published a security advisory with a sentence I have read three times now and still find a little hard to believe. A crafted OpenPGP key with a very long user ID can trigger a do

On Friday, November 20, the GnuPG project published a security advisory with a sentence I have read three times now and still find a little hard to believe. A crafted OpenPGP key with a very long user ID can trigger a double free in GPGME, the library almost every program on your machine uses to talk to GnuPG. That double free, the advisory says, "can be used to exfiltrate data from applications by sending for example signed data." Remote code execution "can't be ruled out."

The bug is CVE-2026-129975. Every GPGME release before 2.3.1 is affected. The fix is out. Most of the software on your computer that verifies a signature probably has not picked it up yet.

I build encrypted messaging software, so I spend a lot of my time thinking about the exact moment a signature gets verified. This bug lives in that moment. Not in the cryptography. Not in the math. In the code that reads the output of the crypto.

What GPGME actually is, and why you probably use it

GPGME is the C library applications link against when they want GnuPG to do something: verify a signature, list a key, decrypt a message. Your mail client uses it. So do a lot of XMPP clients, package managers, and container tools. Samba links it. GitLab imports your GPG keys through it. Gpg4win, the Windows bundle, ships it.

The important thing to understand is that the gpg command-line tool itself is not affected. The flaw is in the library that parses what gpg prints back. GPGME spawns GnuPG, reads its status lines and key listings, and turns that text into structured results your application can use. The bug is in two internal reader functions, read_status() and read_colon_line(), which do that parsing.

Here is the shape of it, as described in the advisory and in the write-ups that followed. Each reader starts with a 1024-byte buffer. When a line is longer than the buffer, it grows the buffer with realloc(). The problem is that the new pointer only gets written back to the engine context on the success path. If the reader returns early after a grow, because a status callback returned an error or a read failed, the context still holds the old pointer. And the old block has already been freed by realloc(). When the context is released later, it frees the same memory a second time.

A double free. In the code that handles untrusted input, because a key listing is untrusted input: anyone can hand you a key. That is the whole point of keys.

How a long user ID becomes an attack

An OpenPGP user ID is the name and email string attached to a key. Nothing in the format stops it from being enormous. A key listing line longer than 1024 bytes is all it takes to push the reader past its initial buffer. The attacker does not need a valid signature, a trusted key, or any special access. They need you, or an application acting on your behalf, to process a key or a signed message that contains one very long field.

GnuPG's own advisory keeps the example simple: signed data sent to an application. That covers a lot of ground. An email with a signature attached. A key someone uploads to a profile. A signed release artifact a tool verifies before installing it. The exact path depends on the application, but the trigger is the same everywhere: untrusted bytes flowing through a library that assumed its input would stay under a kilobyte.

Johan Carlsson found the flaw. GitLab reported it to the GnuPG project on November 12. The disclosure was originally scheduled for November 25, then pulled forward to November 20 because GitLab had to ship its own emergency patch early for the Ruby2Shell bug, and the two disclosures were tied together. That is a small detail, but I like it: two unrelated critical bugs, disclosed on the same day, because one team's emergency moved the other's calendar. Vulnerability disclosure is a human process, and sometimes the schedule is just "today, because today is when the other shoe drops."

There is no public exploit and no reported exploitation in the wild as of November 21. There is also no CVSS score in NVD yet. None of that makes it less urgent. GnuPG calls it a critical security bug, and when the project that maintains the tool calls its own bug critical, I take their word for it.

The update that will not reach everything

The fix is GPGME 2.3.1, released November 19, and 1.24.4 on the legacy 1.x branch. Version 2.3.0 was tagged but never publicly released, so if you see a version number between 2.2.0 and 2.3.1, you are looking at the gap where the fix was supposed to land. On Windows, Gpg4win 5.1.2 bundles the fixed library, and its release notes call the issue severe and say to update as soon as possible. Debian shipped backports for bookworm and trixie the same week. Fedora and Arch were still on 2.2.0 on November 21.

But here is the part that matters most, and the part that will quietly stay broken the longest: updating the system library does not fix the copies that are not the system library.

GPGME can be linked as a shared library, a Windows DLL, or statically into a program. A statically linked copy lives inside the application binary. Your package manager updating libgpgme11 does nothing for it. The application has to be rebuilt and re-released. The Ruby gpgme gem, installed the default way, builds its own vendored GPGME 2.0.0. Self-managed GitLab instances before 19.4.10, 19.5.8, and 19.6.1 import and list user-supplied GPG keys through that gem, which is exactly how this bug was found in the first place.

So the honest checklist is longer than "run your package manager":

  1. Update the system library to GPGME 2.3.1, or 1.24.4 if you are on the legacy branch. On Windows, install Gpg4win 5.1.2. Then restart every service that loads the library.
  2. Find the copies the system update will not touch. Check for vendored and statically linked builds, especially the Ruby gpgme gem and anything that bundles GPGME inside its own installer.
  3. If you run self-managed GitLab, upgrade to 19.6.1, 19.5.8, or 19.4.10. Those releases validate OpenPGP input before it reaches GPGME, and they also carry the Ruby2Shell fix.
  4. If you maintain software that links GPGME, rebuild it against 2.3.1 and ship the new binary. A library update your users install is not the same as a library update your binary contains.

There is no interim workaround in the advisory. No configuration change removes the bug. Restricting which keys and signed messages an application processes lowers exposure, but it is not a fix.

The quiet post-quantum footnote

There is one more thing in the GPGME 2.3.1 release notes that caught my eye, and it is the reason this story landed on my desk rather than just in my feed reader.

The release adds new constants: GPGME_PK_MLKEM, GPGME_PK_MLDSA, and GPGME_PK_DLTHM. Mappings for the algorithms used by backends. ML-KEM and ML-DSA are the NIST-standardized post-quantum algorithms, the same ones I use in my own messenger, and they are now first-class citizens in the library that verifies signatures for half the open-source world.

That is worth pausing on. The same release that fixes a critical memory bug in thirty-year-old parsing code also wires in the algorithms meant to survive the next thirty years of cryptography. The old world and the new world ship in the same tarball. The post-quantum migration is not a separate project you do later; it is happening inside the routine security updates, one constant at a time, in the libraries you already depend on.

It also means the stakes of getting the plumbing right are going up, not down. As ML-KEM and ML-DSA keys start flowing through GPGME, through key listings and status lines and signed data, the parser that just broke on a long user ID will be handling larger keys, larger signatures, and more unfamiliar input than ever. The bug class here is not exotic. A buffer that grows, a pointer that does not get written back, a free that happens twice. It is the kind of bug that has existed in C programs for decades, and it will keep existing in the code that wraps new cryptography until someone looks at the wrapping as carefully as the math.

What I actually take away from this

I have a habit, when a bug like this lands, of asking one question: where in my own code does untrusted input meet a parser I did not write? In my messenger, the answer is mostly the places where keys and signed bundles arrive from the network. I did not write the JSON parser, the transport framing, or the base64 decoder, and each of them has its own version of the 1024-byte buffer. The cryptography in my protocol gets reviewed, argued about, and tested. The parsers around it get trusted by default, because they feel like plumbing.

CVE-2026-129975 is a reminder that the plumbing is the attack surface. The signature scheme can be perfect and the verification can still be broken by the code that reads the output. GnuPG's advisory is honest about that in a way I respect: it says what the bug can do, it says what it cannot rule out, and it says plainly that there is no workaround. Update, rebuild, restart.

So update GPGME. Then go look at the other libraries your application links that parse untrusted input, and ask when they were last updated. The answer is usually longer ago than you think.

Sources: GnuPG security advisory, November 20, 2026 Β· The Hacker News Β· Corgea research Β· Ostorlab

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.