CVE
CVE-2026-129975
CWE
CWE-415, CWE-416
Affected Surface
- GPGME (`libgpgme`) before 2.3.0, whether loaded as a shared library, a Windows DLL or linked statically; fixed in 2.3.1 and in the legacy 1.24.4 release (2.3.0 was tagged but never published)
- Gpg4win before 5.1.2, GnuPG Desktop and GnuPG VS-Desktop
- RubyGems `gpgme` 2.0.26 and earlier when installed the default way, which builds a vendored GPGME 2.0.0; no fixed gem was released by 21 November
- Self-managed GitLab CE/EE before 19.4.10, 19.5 before 19.5.8 and 19.6 before 19.6.1, which import and list user-supplied GPG keys through the `gpgme` gem
- Other GPGME consumers named by GnuPG or confirmed in source: most mail clients, many XMPP clients, Samba, Flatpak, OSTree, pacman (`libalpm`) and Go `containers/image` (Podman, Skopeo, Buildah) unless built with the `containers_image_openpgp` tag
- Distribution packages on 21 November: Debian bookworm and trixie fixed (DLA-4924-1, DSA-6646-1), forky vulnerable; Arch Linux and Fedora 46 still on 2.2.0
TL;DR
GPGME is the library that mail clients, package managers, container tools and web apps link when they want GnuPG to verify a signature or list a key. Two of its internal readers, read_status() and read_colon_line(), grow their line buffer with realloc() but only write the new pointer back to the engine context on the success path. If the reader returns early after a grow, the context still holds the old, freed block, and releasing the context frees it a second time. An OpenPGP key with a very long user ID is enough to push a key listing past the initial 1024-byte buffer.
GnuPG calls it critical. Its advisory says the double free “can be used exfiltrate data from applications by sending for example signed data” and that remote code execution “can’t be ruled out”. Johan Carlsson found it, and GitLab reported it to GnuPG on 12 November. Disclosure was planned for 25 November. GitLab had to ship its Ruby2Shell patch early, so both went out on 20 November.
There’s no CVSS score in NVD and no EPSS score yet, no public exploit, and nobody has reported exploitation.
What to do now:
- Update the system library to GPGME 2.3.1, or 1.24.4 if you’re on the legacy branch. On Debian take DLA-4924-1 (bookworm) or DSA-6646-1 (trixie). On Windows install Gpg4win 5.1.2.
- Find copies the system update won’t touch. The Ruby
gpgmegem builds its own vendored GPGME 2.0.0 unless you install it with--use-system-libraries. Statically linked binaries need a rebuild too. - 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.
- If you maintain a GPGME fork or cherry-picked the fix from master, take
b283b2901ff8as well. The refactor that landed alongside the fix lefterruninitialised until that commit.
Affected packages and projects
| Ecosystem | Package | Affected versions | Fixed or safe version |
|---|---|---|---|
| GnuPG | gpgme (libgpgme) | All releases before 2.3.0 | 2.3.1; legacy 1.24.4; or the advisory patch |
| Windows | Gpg4win | Before 5.1.2 | 5.1.2 (20 November 2026) |
| Debian | gpgme1.0 | bookworm 1.18.0-3, trixie 1.24.2-3, forky 2.2.0-2 | bookworm 1.18.0-3+deb12u1, trixie 1.24.2-3+deb13u1, sid 2.3.1-1; forky unfixed |
| Arch Linux | gpgme | 2.2.0-1 | Not yet on 21 November |
| Fedora | gpgme | 2.2.0-1.fc46 | Not yet on 21 November |
| RubyGems | gpgme | All versions through 2.0.26 built with the vendored library (the default) | No fixed gem; rebuild with --use-system-libraries against a fixed libgpgme |
| GitLab CE/EE | Omnibus, Helm, source | Before 19.4.10, 19.5 before 19.5.8, 19.6 before 19.6.1 | 19.4.10, 19.5.8, 19.6.1 |
GPGMEPP and QGpgME (the C++ and Qt wrappers) don’t need their own update. They pick up the fix from libgpgme.
RHEL 9 is a special case. Todd Zullinger pointed out on gnupg-devel that Red Hat had already patched this exact code in 2021 after a Coverity scan, and never sent the change upstream or to Fedora. The CentOS Stream 9 file gpgme-1.15.1-covscan.patch moves the same two assignments, with the comment “Update buffer and bufsize here to prevent memory leaks.” RHEL 8 and RHEL 10 don’t carry that patch.
Technical analysis
The bug
Both readers start from a 1024-byte buffer stored on the engine object. Before each read they check for at least 256 free bytes and grow the buffer by 1024 if there isn’t room. This is read_status() in src/engine-gpg.c as it shipped through 2.2.0. read_colon_line() is identical apart from using gpg->colon:
static gpgme_error_t
read_status (engine_gpg_t gpg)
{
char *p;
int nread;
size_t bufsize = gpg->status.bufsize;
char *buffer = gpg->status.buffer; /* local copy of the pointer */
size_t readpos = gpg->status.readpos;
gpgme_error_t err;
assert (buffer);
if (bufsize - readpos < 256)
{
/* Need more room for the read. */
bufsize += 1024;
buffer = realloc (buffer, bufsize); /* may move the block and free the old one */
if (!buffer)
return gpg_error_from_syserror ();
}
nread = _gpgme_io_read (gpg->status.fd[0],
buffer + readpos, bufsize-readpos);
if (nread == -1)
return gpg_error_from_syserror (); /* early return #1 */
/* ... parse lines; callbacks may fail ... */
if (err)
return err; /* early return #2, #3, ... */
/* ... */
/* Update the gpg object. */
gpg->status.bufsize = bufsize; /* only reached on success */
gpg->status.buffer = buffer;
gpg->status.readpos = readpos;
return 0;
}
Line by line:
bufferis a local copy ofgpg->status.buffer.realloc()can move the block. When it does, the old block is freed, and only the localbufferknows the new address.- Between the
realloc()and the write-back at the bottom there are severalreturnstatements: a failed_gpgme_io_read(), a status or monitor callback (gpg->status.fnc,mon_cb) returning an error, a failedstrdup()of the command keyword. Inread_colon_line(), the colon preprocessor (gpg->colon.preprocess_fnc) can fail too. - On any of those paths
gpg->status.bufferstill points at the freed block, and the new block leaks. - When the engine is released,
gpg_release()freesgpg->status.buffer(andgpg->colon.buffer) again. That’s the double free.
The advisory explains why allocators don’t always catch it: “Due to other allocations in between the common double free checks of memory allocators may not be triggered.” If something else has reused the freed block by then, the second free() releases memory that now belongs to another object.
The fix commit says the bug dates to f12433c1e476, about 24 years ago.
Where the long user ID comes in
Key listings come back from gpg --with-colons one line per record, and uid records carry the user ID string. A line longer than roughly 768 bytes leaves less than 256 bytes free in the 1024-byte buffer, so the reader grows it. Once the buffer has moved, any error in the rest of that call leaves the stale pointer behind. Status lines carry user IDs too (GOODSIG, BADSIG and USERID_HINT include them), so verifying signed data from a key with a long user ID also sends long lines through read_status(). That fits the advisory’s “sending for example signed data” example, though GnuPG hasn’t published the exact path.
GnuPG hasn’t said which consumers reach an early-return path with attacker input and no manual key import. The T8557 report lists the callback and preprocessor failures above as the triggers. Whether a given program hits one depends on its callbacks.
Who parses keys they didn’t create
The worst exposure is in programs that take OpenPGP keys or signed data from strangers and pass them to GPGME:
- GitLab lets any user upload a GPG key to their profile for commit signature verification.
lib/gitlab/gpg.rbpasses that key toGPGME::Key.import, then lists it withGPGME::Key.findto read fingerprints and user IDs. The listing goes throughread_colon_line(). The 19.6.1, 19.5.8 and 19.4.10 releases add a “Validate OpenPGP input before passing it to GPGME” change (security MRs 7264, 7204 and 7206). On 21 November,omnibus-gitlabmaster still built GPGME 2.2.0, so GitLab is relying on that validation for now. The patch release notes only list the Ruby CVE, but the changelog has the GPGME entry for all three versions. - The Ruby
gpgmegem (59.6 million downloads, latest 2.0.26 from February 2026) shipsports/archives/gpgme-2.0.0.tar.bz2and builds it withmini_portile2unless--use-system-librariesorRUBY_GPGME_USE_SYSTEM_LIBRARIESis set. A Rails app that verifies signatures or imports keys with this gem keeps the vulnerable copy afterapt upgrade. - Package and image verification. pacman’s
libalpm/signing.c, OSTree’sostree-gpg-verifier.cand Gocontainers/image(signature/mechanism_gpgme.go, built unless thecontainers_image_openpgptag is set) all use GPGME to verify signatures. GnuPG also names Flatpak, Samba, mail clients and XMPP clients. Keys in these tools usually come from a trusted keyring, so the attacker would need a key there first, but signature status lines still pass throughread_status().
The fix
Commit 14499348b966 by Werner Koch, credited to Johan Carlsson, writes the new pointer back as soon as realloc() succeeds:
@@ -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;
}
read_colon_line() gets the same change. After this, every early return leaves the context pointing at the live block, so release frees it exactly once.
Two more commits shipped with it. 4254af7dafdb replaced the early returns in both readers and in start() with goto leave, but on the success path it returned err without initialising it. b283b2901ff8 on 19 November fixed that (gpgme_error_t err = 0;, with the commit message “next time remmber not to hack when suffering from flu”). That’s why the 2.3.0 tag from 18 November was never published. If you backport from master, take all three, or just the first one on its own. The standalone patch GnuPG gave distributions is the first one.
IOCs
There are none to publish. Nobody has reported exploitation, and no exploit or malicious key has been released.
A hunting heuristic you can run on keyrings that hold third-party keys: flag any user ID long enough to force a buffer grow. A colon-format uid line longer than about 768 bytes will do it, and ordinary “Name (comment)
gpg --with-colons --list-keys 2>/dev/null \
| awk -F: '$1=="uid" && length($0) > 700 { print length($0), $8 }'
On GitLab, review recently uploaded GPG keys for oversized user IDs and check Puma and Sidekiq logs for glibc aborts such as free(): double free detected or corrupted size vs. prev_size.
Detection and remediation
Find the library versions on a host:
# System library
pkg-config --modversion gpgme 2>/dev/null || gpgme-config --version 2>/dev/null
dpkg -l 'libgpgme*' 2>/dev/null | awk '/^ii/ {print $2, $3}'
rpm -q gpgme 2>/dev/null
pacman -Q gpgme 2>/dev/null
# Debian/Ubuntu changelog check for the fix
apt changelog gpgme1.0 2>/dev/null | grep -m3 -E 'CVE-2026-129975|double free'
Find copies that don’t use the system library:
# Ruby gem: does the extension link libgpgme dynamically? No output means it uses the vendored static copy.
ldd "$(gem contents gpgme | grep -m1 'gpgme_n.so$')" | grep libgpgme
# Lockfiles across a monorepo or CI cache
rg -n '^\s+gpgme \(' --glob 'Gemfile.lock'
# Binaries that may have GPGME linked in statically (string from the library's copyright blurb)
grep -rlas 'The GnuPG Made Easy library' /usr/local/bin /opt 2>/dev/null
# Podman/Skopeo/Buildah: dynamic link means the GPGME mechanism is compiled in
for b in podman skopeo buildah; do command -v $b >/dev/null && ldd "$(command -v $b)" | grep -q libgpgme && echo "$b links libgpgme"; done
Fix the Ruby gem by rebuilding it against a patched system library:
sudo apt-get install --only-upgrade libgpgme-dev # or your distro's fixed gpgme-devel
bundle config set --local build.gpgme --use-system-libraries
bundle pristine gpgme
# or, without Bundler
gem pristine gpgme -- --use-system-libraries
Containers that gem install gpgme or bundle install during the build need the same build flag in the Dockerfile and then a rebuild. Pulling a new base image doesn’t fix the copy inside the gem.
For GitLab, upgrade to 19.6.1, 19.5.8 or 19.4.10. Self-compiled installations also have to rebuild Ruby (3.3.14 or 3.4.13) for the Ruby2Shell part of the same release.
Credentials to rotate: none by default. If you process untrusted keys or signed data with a vulnerable build and see the crash signatures above, treat secrets in that process’s memory (session keys, API tokens, decrypted message content) as exposed, since the advisory names data exfiltration as the impact.
Timeline
- About 2002: Commit
f12433c1e476introduces the deferred write-back inengine-gpg.c. - 2021: Red Hat adds
gpgme-1.15.1-covscan.patchto RHEL 9 with the same fix, labelled as a memory-leak fix. It doesn’t go upstream or to Fedora. - 2026-11-12: GitLab informs GnuPG of Johan Carlsson’s report.
- 2026-11-13: GnuPG opens T8557.
- 2026-11-15: Fix
14499348b966and refactor4254af7dafdbland in the publicgpgmerepository. - 2026-11-17 to 18: GitLab Dedicated runs internal-only releases 19.5.7 and 19.4.9 with interim mitigations. GPGME 2.3.0 is tagged but not published. GnuPG sends the 2.3.1 tarball and a patch to the reporter for distributions and sets 25 November for disclosure. Ruby2Shell is disclosed on 18 November.
- 2026-11-19:
b283b2901ff8fixes the uninitialisederrregression and GPGME 2.3.1 is tagged. - 2026-11-20: GitLab releases 19.6.1, 19.5.8 and 19.4.10. GnuPG publishes the advisory (18:01 UTC), GPGME 2.3.1, legacy 1.24.4 and Gpg4win 5.1.2. Alan Coopersmith forwards it to oss-security.
- By 2026-11-21: Debian ships DLA-4924-1 (bookworm) and DSA-6646-1 (trixie). Sid has
2.3.1-1, and forky, Arch and Fedora are still on 2.2.0. Ubuntu has no CVE page yet. On oss-security, Sam James forwards Todd Zullinger’s note that RHEL 9 already had the fix. No fixed Rubygpgmegem exists.
From research to remediation
Check whether this pattern exists in your codebase
Turn this research into a remediation workflow. Scan dependencies and package manifests for similar supply-chain risk, then prioritize fixes with reachability context.
References
- GnuPG Security Advisory for GPGME (T8557, CVE-2026-129975), gnupg-announce, 20 November 2026
- GnuPG tracker T8557: Double free in GPGME read_status/read_colon_line (src/engine-gpg.c)
- Fix commit gpg/gpgme@14499348b966: Fix a double free in the status line read code
- Follow-up commit gpg/gpgme@b283b2901ff8: Fix a stupid regression (uninitialised err)
- oss-security: Fwd: GnuPG Security Advisory for GPGME (CVE-2026-129975)
- oss-security: RHEL 9 carried the same fix as a Coverity patch since 2021 (Sam James forwarding Todd Zullinger)
- CentOS Stream 9 gpgme-1.15.1-covscan.patch
- GitLab Critical Patch Release 19.6.1, 19.5.8, 19.4.10
- GitLab CHANGELOG: Validate OpenPGP input before passing it to GPGME
- Debian security tracker: CVE-2026-129975
- Gpg4win 5.1.2 security update
- ueno/ruby-gpgme extconf.rb (vendored GPGME build)
- The Hacker News: GnuPG warns critical GPGME flaw could expose app data via malicious OpenPGP keys