GPGME 2.3.1 fixes a critical double-free bug that may allow code execution
GnuPG released GPGME 2.3.1 on 19 November, a new version of the library[1] that applications use to work with OpenPGP[2] keys and signatures. The release fixes a critical bug present in all versions before 2.3.0. The bug is a double free[3]: a key with a specially crafted, very long user ID can trigger it.
The advisory says the bug can be used to steal data from applications, for example by sending signed data, and that remote code execution cannot be ruled out, so an immediate update is recommended. The cause lies in two internal functions that read status lines and key listings from gpg. A 1024-byte buffer is reallocated when more space is needed, but the new pointer is saved to the context only at the end of the function. If the function returns early, for example after a read error, the context keeps a pointer to memory that was already freed, and that memory is freed a second time.
The bug was found by Johan Carlsson, and GitLab was informed on 12 November. The disclosure was moved up from 25 November to 20 November because GitLab had to update earlier after a separate bug, Ruby2Shell, came to light. Users should update the shared GPGME library to 2.3.1 or take the DLL from the new Gpg4win 5.1.2 installer for Windows[4]. Those who cannot update can apply the attached patch, which the authors say likely applies even to very old versions. Software that uses GPGME includes Gpg4win, GnuPG Desktop, most mail clients, many XMPP clients, Samba and Flatpak.
Repository GnuPG github.com
GnuPG (GNU Privacy Guard) is an open source tool for encrypting data and signing messages with OpenPGP keys.
Read the original lists.gnupg.orgDiscussion
Discussion
Commenters mostly discuss how serious the bug is. Some say it is a double free rather than a full remote code execution chain and ask whether the reports overstate it, while others point out that GitLab is affected because it supports signed commits. One commenter says Red Hat reportedly fixed the issue years ago in its own packages but upstream missed it, and another recommends the sq command-line tool from Sequoia-PGP as more intuitive.
Sources
-
lists.gnupg.org
GnuPG Security Advisory for GPGME
-
KRGeekNews KO
GnuPG의 원격 코드 실행(RCE) 취약점


