Double free in GPGME read_status/read_colon_line (src/engine-gpg.c)
Closed, ResolvedPublic

Assigned To
Authored By
• gniibe
Fri, Nov 13, 3:17 AM

Description

Quote from the report:

Affected code

src/engine-gpg.c, functions read_status() and read_colon_line(). Confirmed present up to current master (also in 1.18.0 and later releases shipped in distributions).

Root cause

Both functions take a local copy of the engine's status/colon buffer pointer, grow it with realloc(), and only write the new pointer back to the engine object at the very end of the function:

char  *buffer  = gpg->status.buffer;   /* local copy */
...
buffer = realloc (buffer, bufsize);    /* may move + free old block */
if (!buffer)
  return gpg_error_from_syserror ();
...
gpg->status.buffer = buffer;           /* write-back only on success */

realloc() may move the block, freeing the old one. Between the realloc and that final write-back there are several early return paths, for example when a status callback (gpg->status.fnc / mon_cb) or the colon preprocess callback returns an error. On those paths the engine's buffer field is left pointing at the already-freed old block; the newly reallocated block leaks, and the stale pointer is freed a second time when the engine is released. That is the double free.


CVE-id: CVE-2026-129975

Event Timeline

The reporter gave us the patch, if I manually applied, like:

In my opinion, adding comments is not needed. It works good and is addressed the issue.

• gniibe mentioned this in Unknown Object (Maniphest Task).Mon, Nov 16, 2:50 AM
• werner changed the task status from Open to Testing.Mon, Nov 16, 5:42 PM

We have fixed this with gpgme 2.3.1 (T8427) and provided the tarball and a patch to the reporter for further distribution to Linux distros. The announcement is planned for the 25th.

• werner claimed this task.
• werner shifted this object from the Restricted Space space to the S1 Public space.
• werner changed the visibility from "g10code (Project)" to "All Users".
• werner changed the edit policy from "Custom Policy" to "Contributor (Project)".
• werner changed the visibility from "All Users" to "Public (No Login Required)".Fri, Nov 20, 8:01 PM
• werner set External Link to https://lists.gnupg.org/pipermail/gnupg-announce/2026q4/000517.html.Fri, Nov 20, 8:05 PM