GPGME critical security bug allows data exfiltration via crafted OpenPGP keys
A double-free vulnerability in the GnuPG Made Easy (GPGME) library allows attackers to exfiltrate data or potentially execute remote code using specially crafted user IDs.
Summary
A critical security vulnerability has been identified in the GnuPG Made Easy (GPGME) library, affecting all previous releases. The flaw is triggered by an OpenPGP key containing an excessively long user ID, which causes a double-free memory error.
This vulnerability impacts a wide range of software that relies on GPGME for cryptographic operations, including most email clients, XMPP clients, Samba, and the Flatpak ecosystem. While the primary confirmed risk is the exfiltration of application data through signed data, the developer warned that remote code execution (RCE) cannot be ruled out. Users are urged to update to GPGME version 2.3.1 immediately.
Technical breakdown of the GPGME double-free
- Root Cause: Two internal GPGME functions responsible for reading status lines and key listings incorrectly handle buffer reallocation when encountering read errors.
- Memory Corruption: The library initially allocates a 1024-byte buffer and attempts to reallocate it if more space is needed; however, the new pointer is only assigned to the context object at the end of the function.
- Double-Free Mechanism: If a function returns early due to an error, the context object retains a stale pointer to the original memory that has already been freed, leading to a second free operation when the context is eventually released.
- Exploitation Vector: An attacker can use a crafted, very long user ID within an OpenPGP key to trigger this state, potentially bypassing standard memory allocator checks due to intervening allocations.
Why it matters
Because GPGME is used as a shared library, DLL, or statically linked component across diverse software, the blast radius includes critical desktop infrastructure like Flatpak and communication tools like email and XMPP clients. System administrators and distribution maintainers must prioritize patching GPGME to prevent data exfiltration or potential RCE in user-facing applications.
What to do
- Update GPGME to version 2.3.1 immediately.
- Users of software relying on GPGME, such as email clients, XMPP clients, Samba, and Flatpak, should ensure they are using the fixed version.
Original reference: www.phoronix.com →