GPGME 2.3.1 fixes a double free triggered by crafted OpenPGP keys
On 20 November 2026 GnuPG disclosed CVE-2026-129975, a double free in GPGME triggered by an OpenPGP key with a very long user ID. All versions before 2.3.1 are affected, including statically linked builds. The advisory warns of data exfiltration and says remote code execution can't be ruled out. Update to GPGME 2.3.1 or apply the patch.
GnuPG disclosed CVE-2026-129975 on 20 November 2026, a double free in GPGME, the library many applications use to drive gpg instead of calling it directly. It can be triggered by an OpenPGP key with a crafted, very long user ID. Every GPGME release before 2.3.1 is affected, the fix shipped on 19 November, and the advisory says "an immediate update is highly suggested". The catch for engineers is reach: GPGME sits inside mail clients, XMPP clients, Samba and Flatpak, and in anything that links it statically, so finding every copy matters more than updating one package.
What the bug is
The advisory, tracked internally as T8557, describes the root cause plainly. Two internal GPGME functions read status lines and key listings from the gpg process into a buffer that starts at 1024 bytes and is reallocated when a line is longer. The new pointer is only saved back to the context at the end of the function. If the function returns early, for example on a read error, the context keeps a stale pointer to memory that has already been freed, and that memory is freed a second time later.
A user ID long enough to force a reallocation is the trigger. That means the input an attacker controls is a public key, which is exactly the kind of data applications import from mail, keyservers, package metadata or user uploads without much suspicion.
On impact, the advisory says the bug allows data exfiltration from applications, giving "sending signed data" as an example, and that "Exploiting this bug to mount an Remote Code Execution attack (RCE) can't be ruled out." It does not list further preconditions or describe a working exploit.
The bug was found by Johan Carlsson. GitLab informed the GnuPG team on 12 November, and the planned disclosure date of 25 November was brought forward.
What is affected
From the advisory:
| Component | Status |
|---|---|
| GPGME before 2.3.1 (shared library, DLL, static builds) | Affected |
| GPGME 2.3.1 | Fixed, released 19 November 2026 |
| GPGME 2.3.0 | Never publicly released |
| GPGMEPP and GPGMEQT | No update needed |
| Gpg4win | Fixed in 5.1.2 |
| GnuPG Desktop, GnuPG VS-Desktop | Updated releases available |
The advisory names "most mail clients, many XMPP clients, Samba, and Flatpak" as examples of software that uses GPGME. It does not mention gpg, gpgsm or libgcrypt as affected; this is a bug in the GPGME wrapper library, not in GnuPG's own tools.
For server and CI teams, the cases to think about are:
- Services that import or verify keys through a language binding built on GPGME, such as Python's
gpgmodule or the C library used directly. Signature verification of uploaded artifacts, release tooling and mail processing all fit. - Container images that pull GPGME in as a dependency of something else. Flatpak and Samba are common examples.
- Static builds. Anything that links GPGME statically keeps the vulnerable code until it is rebuilt, regardless of what the host's package manager says.
- Developer laptops, where mail clients and Gpg4win on Windows are the usual consumers.
What to do
1. Find GPGME
Start with the package manager on hosts and in images. These commands cover Debian and Ubuntu, RHEL and Fedora, and Alpine, and the loop lists installed binaries that link GPGME dynamically:
dpkg -l | grep -i gpgme
rpm -qa | grep -i gpgme
apk info -v | grep -i gpgme
for f in /usr/bin/* /usr/sbin/*; do ldd "$f" 2>/dev/null | grep -q libgpgme && echo "$f"; doneFor your own containers, run the same commands inside each image, or check your SBOM or image scanner output for gpgme. Static linking won't show up in ldd, so check build files for it too:
grep -rnE 'gpgme' --include='Dockerfile*' --include='CMakeLists.txt' --include='*.pc' --include='meson.build' --include='Makefile*' .As with most library CVEs, distributions often backport the fix into an older version number. Check your distribution's security tracker for CVE-2026-129975 rather than looking only for 2.3.1.
2. Update or patch, then restart
Update to GPGME 2.3.1 from your distribution or the GnuPG release. The advisory publishes the source tarball checksum, SHA-1 1134a407b50204ee6fb9efaa6e1451c2460e543e for gpgme-2.3.1.tar.bz2, so verify it if you build from source.
If you can't move to 2.3.1, the advisory attaches a patch and says it "likley applies cleanly even to very old versions". That is the route for long-lived distributions and vendored copies.
Shared library updates only take effect in processes started after the update, so restart long-running services that use GPGME. Rebuild anything linked statically. On Windows, take the DLL from Gpg4win 5.1.2.
3. Treat imported keys as untrusted input
Until everything is patched, be careful with paths that import keys from outside: keyserver refreshes, keys attached to email, keys uploaded by users, and keys fetched during builds. If a service imports keys automatically, consider pausing that or limiting it to a known set of fingerprints.
4. Track the change in code
Most of the work here is mechanical: bumping base images, rebuilding static binaries and redeploying. Teams that already route dependency alerts into their tracker can treat each affected image as a ticket. If you use CodeBeast, Automations can turn a scanner alert into a board task through a webhook, and the resulting change still goes through review and test before you merge it.
Open questions
- The advisory gives no CVSS score and no proof of concept. Exploitability will depend on how each application handles the error path, which the advisory doesn't analyse.
- Language bindings and applications that vendor GPGME will ship fixes on their own schedule. Check the ones you depend on.
- The advisory doesn't say whether any public keyservers have seen keys crafted to trigger this. Keys with absurdly long user IDs are unusual, which may help with detection.
Sources
FAQ
Which GPGME version fixes CVE-2026-129975?
GPGME 2.3.1, released on 19 November 2026. Every earlier version is affected, including statically linked builds; 2.3.0 was never publicly released. On Windows, Gpg4win 5.1.2 ships the fixed DLL.
Is gpg itself vulnerable?
The advisory is about GPGME, the library applications use to drive gpg, and does not list gpg, gpgsm or libgcrypt as affected. You are exposed if software on your systems uses GPGME, which includes many mail and XMPP clients, Samba and Flatpak.
Can this lead to remote code execution?
The advisory says the double free allows data exfiltration from applications and that remote code execution "can't be ruled out". There is no public exploit described. Treat it as a memory-safety bug in code that parses attacker-supplied keys and patch promptly.
What if I can't upgrade to GPGME 2.3.1?
Apply the patch attached to the advisory, which the GnuPG team expects to apply cleanly to very old versions, then rebuild. Restart services that load the library, and rebuild any static binaries.
Written by the CodeBeast Team with AI assistance. Spotted a mistake? Email support@codebeast.ai.