1,024 bytes in, double free out: GPGME's crafted user ID
A crafted OpenPGP user ID longer than 1,024 bytes can double-free GPGME. CVE-2026-129975, disclosed November 20 — five days early, because GitLab's Ruby2ßhell disclosure forced everyone's hand.
GPGME is the library behind GnuPG's mail clients, Gpg4win, Samba, and Flatpak — anything that asks GnuPG to do something without shelling out to gpg directly. A double free in it is not a crash bug in one program. It is a memory-safety bug in the shared layer every one of those programs trusts.
The bug: realloc, then forget
The advisory, from Werner Koch on the gnupg-announce list, gives the root cause in full. Two internal functions read status lines and key listings from gpg. Each starts with a 1,024-byte buffer and reallocates when more space is needed. The realloc'd pointer is used by the function — but it is only written back to the context object at the end of the function. If the function returns early, because of a read error or other event, the context is never updated and keeps the stale pointer to the freed buffer. Eventually the context is released and the memory is freed a second time.
That is the whole bug: a write-back that happens on the happy path and nowhere else. The trigger is a key containing a crafted very long user ID — long enough to push a status line past 1,024 bytes and force the realloc, then an early return to skip the write-back.
Two details make it worse than a textbook double free. First, other allocations happen between the two frees, so the allocator's usual double-free checks may not fire — the advisory says so explicitly. Second, the impact section says the double free "can be used to exfiltrate data from applications by sending for example signed data," and that remote code execution "can't be ruled out." An attacker who controls the key — say, by sending you signed data with a malicious key attached — controls the trigger.
Everything using a GPGME version prior to 2.3.0 is affected, as a shared library, DLL, or statically linked: Gpg4win, GnuPG Desktop, GnuPG VS-Desktop, most mail clients, many XMPP clients, Samba, Flatpak. There is no need to update GPGMEPP or GPGMEQT.
I ran the shape of it
I did not build GPGME. What I ran is my own 60-line C program that mirrors the advisory's description exactly: a context holding a 1,024-byte buffer, a reader that reallocs on a long line and returns early without writing the pointer back, and a context release that frees whatever pointer the context holds. Compiled with AddressSanitizer:
$ ./gpgme_buggy initial buffer: 0x519000000080 (1024 bytes) ==3242==ERROR: AddressSanitizer: attempting double-free on 0x519000000080 0x519000000080 is located 0 bytes inside of 1024-byte region [0x519000000080,0x519000000480) freed by thread T0 here: #1 in realloc ... in read_status_buggy previously allocated by thread T0 here: #1 in malloc ... in main The input line is 4,095 bytes — four times the initial buffer. realloc frees the original 1,024-byte region and hands back a new one; the context still points at the old one; the release frees it again. ASan catches it immediately, on the first run, with no heap grooming at all.
The fixed version writes the pointer back the moment realloc succeeds, before any early return can skip it:
$ ./gpgme_fixed fixed initial buffer: 0x519000000080 (1024 bytes) read_status returned -2; ctx->buf now 0x521000001500 freeing context... context freed once, no error. FIXED version survives the early return. Note the fixed run's context pointer (0x521...) is a different allocation from the initial one (0x519...) — the realloc moved the buffer, and this time the context knows about it. One line moved earlier is the entire fix. GPGME 2.3.1 contains the real one.
The disclosure cascade
The dates are the second story here. The bug was discovered by Johan Carlsson and reported via GitLab on November 12. Coordinated disclosure was set for November 25. It happened November 20 instead, and the advisory says why: "due to the new Ruby2Shell bug GitLab had to update earlier and thus we also disclosed the GPGME bug on 2026-11-20."
Ruby2ßhell is the Ruby upcase buffer overflow I wrote about on November 19 — 21 ß characters overflowing a 1-byte buffer. GitLab's Ruby update pulled the GPGME disclosure forward with it, because the two disclosures were linked through GitLab's own update. One bug's patch window became another bug's deadline. The coordinated-disclosure calendar is a shared resource, and a big bug in one project spends everyone else's time too.
The timeline, as the advisory states it:
Nov 12 Johan Carlsson reports the bug via GitLab Nov 19 GPGME 2.3.1 released (fix included) Nov 19 I publish the Ruby2ßhell write-up; GitLab updates early Nov 20 GPGME advisory disclosed, 5 days ahead of the Nov 25 plan What to do
Update the GPGME shared library to 2.3.1. Gpg4win 5.1.2 ships the fixed version. If you link statically, rebuild against 2.3.1. If you can't update, the advisory attaches a patch it says "likely applies cleanly even to very old versions." Debian packages are available from GnuPG's own repo. The tarball's SHA-256 is 1134a407b50204ee6fb9efaa6e1451c2460e543e for gpgme-2.3.1.tar.bz2.
The version numbering has one trap worth stating: 2.3.0 was never publicly available, so "prior to 2.3.0" means, in practice, every GPGME in the wild before this week.
Limitations, stated plainly
- I demonstrated the bug's shape with my own minimal C program under ASan; I did not build or exploit GPGME itself, and I did not test a crafted key against a real client.
- The root cause, the 1,024-byte initial buffer, the disclosure dates, and the impact assessment all come from the GnuPG advisory. The "RCE can't be ruled out" line is the advisory's, not mine.
- The double-free detection in my demo is immediate under ASan; in a production allocator without sanitizers, the advisory notes the usual checks may not trigger, which is what makes this class of bug exploitable rather than merely crashy.
Sources: GnuPG advisory, "[Announce] GnuPG Security Advisory for GPGME (T8557, CVE-2026-129975)" (Nov 20, 2026); CVE-2026-129975. My earlier Ruby2ßhell piece: "21 ß's, 1 byte: Ruby's upcase overflows its own buffer" (Nov 19, 2026).