Profile
Back to NewsBack
Dev.to 7 min
Reader Mode
How long it actually takes a GPGME fix to reach Ubuntu

How long it actually takes a GPGME fix to reach Ubuntu

8 hours ago

A GPGME advisory went round my feeds on Friday: a double-free in the code that reads status lines back from gpg, triggered by a crafted OpenPGP key with a very long user ID. I'd always filed GPGME under "something mail clients use", which is true as far as it goes, but the advisory's own impact list was wider than that: Samba, most mail clients, and anything statically linked against an old copy. My own boxes don't run any of those directly, but I run plenty of software that does, so I wanted to know one thing before I moved on: was I actually exposed right now, and if so, how far behind was the fix.

I didn't try to reproduce the bug itself. Nothing here involves a crafted key or anything that would double as exploit code. I only checked versions, read what the distro maintainers had already published, and tested that ordinary signing and verification still worked on the affected library.

The advisory

The GnuPG project's announcement (CVE-2026-129975, internal ID T8557) said versions of GPGME before 2.3.0 are affected, fixed in 2.3.1, discovered by Johan Carlsson and disclosed on 20 November 2026. The bug is in two internal functions that read status lines and key listings from gpg: a buffer gets reallocated, the new pointer is only written back to the context at the end of the function, and an early return on a read error leaves the context holding a pointer to memory that's about to be freed a second time.

Before doing anything else, I checked the one claim I could verify without running any code at all: the published checksum of the fix.

$ sha1sum gpgme-2.3.1.tar.bz2
1134a407b50204ee6fb9efaa6e1451c2460e543e  gpgme-2.3.1.tar.bz2

That matches the advisory exactly. Whatever else I found, the actual fix on gnupg.org is the file it claims to be.

What my own distro ships

I ran this inside a plain ubuntu:24.04 container, which is close enough to what's on most of my own boxes:

$ apt-get update -qq && apt-get install -y -qq libgpgme11t64
$ apt-cache policy libgpgme11t64
libgpgme11t64:
  Installed: 1.18.0-4.1ubuntu4
  Candidate: 1.18.0-4.1ubuntu4
  Version table:
 *** 1.18.0-4.1ubuntu4 500
        500 http://archive.ubuntu.com/ubuntu noble/main amd64 Packages

1.18.0 is well short of the 2.3.0 cutoff the advisory gives, so going purely by version number this looked vulnerable. But distro packages don't track upstream version numbers like that; a distro can fix a CVE inside its own point release without ever touching the major version, so a bare number comparison isn't proof of anything either way. I tried the obvious next step:

$ apt-get install -y -qq --only-upgrade libgpgme11t64
$ apt-cache policy libgpgme11t64
libgpgme11t64:
  Installed: 1.18.0-4.1ubuntu4
  Candidate: 1.18.0-4.1ubuntu4

Nothing newer on offer, from either the main or security pocket, with both enabled. That's not proof of exposure on its own, so I went looking for an actual record of what's been published for this source package.

Checking Debian, for comparison

I ran the same version check against debian:bookworm and debian:trixie, since GPGME in Debian and Ubuntu comes from the same upstream source package, gpgme1.0.

$ docker run --rm debian:bookworm bash -c \
  "apt-get update -qq && apt-cache policy libgpgme11"
libgpgme11:
  Candidate: 1.18.0-3+deb12u1
     1.18.0-3+deb12u1 500
        500 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages

$ docker run --rm debian:trixie bash -c \
  "apt-get update -qq && apt-cache policy libgpgme11t64"
libgpgme11t64:
  Candidate: 1.24.2-3+deb13u1
     1.24.2-3+deb13u1 500
        500 http://deb.debian.org/debian-security trixie-security/main amd64 Packages

Both of those point versions turned out to be the fixed ones. The Debian Security Advisory and the LTS advisory were both dated 20 November 2026, the same day the upstream announcement went out:

  • DSA-6646-1 (trixie): gpgme1.0 fixed in 1.24.2-3+deb13u1
  • DLA-4924-1 (bookworm, LTS): gpgme1.0 fixed in 1.18.0-3+deb12u1
Distro Package build Status Advisory Date
Debian 12 (bookworm) 1.18.0-3+deb12u1 fixed DLA-4924-1 20 Nov 2026
Debian 13 (trixie) 1.24.2-3+deb13u1 fixed DSA-6646-1 20 Nov 2026
Ubuntu 24.04 (noble) 1.18.0-4.1ubuntu4 still vulnerable none published yet —

Debian, old-stable and current stable both, had this out on the day it was disclosed. That's the one I didn't expect going in; I'd assumed an LTS release would lag behind current stable, not match it.

Ubuntu is the odd one out, and I wanted to be sure the gap wasn't just something stale about the Docker image's mirror snapshot. Launchpad's own publishing history for gpgme1.0 in noble settled that:

$ curl -s "https://api.launchpad.net/1.0/ubuntu/+archive/primary?ws.op=getPublishedSources&source_name=gpgme1.0&distro_series=https://api.launchpad.net/1.0/ubuntu/noble" \
  | python3 -c "import json,sys; d=json.load(sys.stdin); print(d['entries'][0]['display_name'], d['entries'][0]['date_published'])"
gpgme1.0 1.18.0-4.1ubuntu4 in noble 2024-04-04T02:14:57.175555+00:00

The most recent publish to noble's archive is from April 2024, well before this bug existed. As of this run, nobody has uploaded a fixed gpgme1.0 for 24.04. If you're on Ubuntu and relying on apt upgrade to catch this one, there's currently nothing for it to catch.

What still works

The bug only fires on a specific, malformed input, so I checked that ordinary use of the vulnerable library was unaffected, using the actual installed GPGME through its Python binding rather than the bare gpg CLI (which doesn't go through GPGME at all):

import gpg, time

ctx = gpg.Context()
key = next(ctx.keylist())
ctx.signers = [key]
msg = b"a normal message, nothing crafted about it"

t0 = time.perf_counter()
signed, _ = ctx.sign(msg, mode=gpg.constants.sig.mode.DETACH)
t1 = time.perf_counter()

vctx = gpg.Context()
vctx.verify(msg, signed)
t2 = time.perf_counter()

Five runs, same container, same key:

Run Sign (ms) Verify (ms)
1 8.62 7.78
2 7.72 7.82
3 8.07 7.52
4 8.29 7.76
5 7.54 7.31

Every verification came back with status 0, meaning a good signature, every time. So the vulnerable version of the library on my test box signs and verifies a normal message in under 9ms either way, correctly, and the double-free path simply never gets exercised by any of that. The risk here is specific to whatever parses untrusted key listings, not to day-to-day signing.

What I got wrong on the way

My original plan was to measure the actual cost of fixing this by hand, rather than waiting on Ubuntu: download the 2.3.1 source, build it, and time the whole thing, since that's a real option for anyone who can't wait for a distro upload. I got as far as downloading the tarball and verifying its checksum before I hit a wall: the build box I run these tests in won't compile or execute anything straight from a tarball pulled off the internet, full stop, no exceptions for a security fix. So I don't have a build-time number, and I'm not going to invent one.

That turned out fine. The more useful number wasn't how long a manual build takes, it was how long each distro's own channel took, and that's the one I ended up with real data for.

Run it yourself

# check what you're actually running
apt-cache policy libgpgme11t64 2>/dev/null || apt-cache policy libgpgme11

# check for an update specifically
sudo apt-get update && sudo apt-get install --only-upgrade libgpgme11t64

# verify the official fix, if you're building it yourself
curl -O https://gnupg.org/ftp/gcrypt/gpgme/gpgme-2.3.1.tar.bz2
sha1sum gpgme-2.3.1.tar.bz2
# should read: 1134a407b50204ee6fb9efaa6e1451c2460e543e

Where I've landed

I'm treating this as: check apt-cache policy on anything running GPGME, today, not next week. If you're on Debian, the fix is almost certainly already sitting in your mirror. If you're on Ubuntu 24.04, as of this week it isn't, and apt upgrade won't tell you that, it'll just silently report nothing to do, which looks exactly like "you're fine" from the outside. I don't think that's a reason to panic about day-to-day signing, since the bug needs a specific malformed key to trigger, but anything that parses key listings from a source you don't control, a keyserver, a mail attachment, a downloaded release key, is worth treating as exposed until Ubuntu actually ships something. I'd rather check a version number by hand once than trust a package manager that's reporting "up to date" against a vulnerability it doesn't know about yet.

Chat with me