By using an OpenPGP key containing a crafted very long user id it
is possible to trigger a double free. This double free can be used
exfiltrate data from applications by sending for example signed
data. Exploiting this bug to mount an Remote Code Execution attack
(RCE) can't be ruled out.
The root cause for this bug are two GPGME internal functions to
read the status lines and key listings from gpg. Initially a buffer
of 1024 bytes is allocated which is reallocated if more space is
required. When reallocating the pointer to the new buffer, it is used
by the function, but it is only assigned back to the context object
at the end of the function. Thus if the function returns early due
to a read error or other events, the context is not updated and
keeps the stale pointer to the freed memory. Eventually, the context
is released and the memory is freed a second time. Due to other
allocations in between the common double free checks of memory
allocators may not be triggered.