A security researcher with the pseudonym Awakened discovered a vulnerability in the popular WhatsApp messenger that could allow attackers to access files and messages of a victim using a malicious GIF image.The problem is the double-free memory vulnerability — an anomaly in memory corruption that could cause an application to crash or, even worse, provide an attacker with a “loophole” to the contents of the device.
All that is needed to carry out the attack is to create a malicious GIF-file, send it to the victim and wait until she opens it in the WhatsApp gallery.
“Attacker sends GIF file to user via any channels. One of them could be as Document via WhatsApp (i.e. pressing the Paper Clip button and choose Document to send the corrupted GIF). If the attacker is in the contact list of the user (i.e. a friend), the corrupted GIF is downloaded automatically without any user interaction”, — writes Awakened.
As the researcher explained, the vulnerability affects the implementation of the gallery, namely the mechanism for creating previews for images, videos and gifs.
When you open the WhatsApp gallery, the modified GIF file causes a double free error in the rasterBits buffer with sizeof size (GifInfo). Interestingly, in the WhatsApp gallery, the GIF file is parsed twice. When the specified GIF file is parsed again (as some frames are resized in the specially created GIF file), another GifInfo object is created.
Due to the double behavior in Android, the GifInfo info object and info->rasterBits will point to the same address. Then DDGifSlurp () decodes the first frame into the info-> rasterBits buffer, thus overwriting the information and its rewindFunction () function, which is called right at the end of the DDGifSlurp () function.
Presented by the researcher exploit works mainly on devices running versions of Android 8.1 and 9.0 and does not work on Android 8.0 and earlier. According to Awakened, on older devices, the vulnerability can also be exploited, but only to crash the application.
Awakened notified Facebook of the problem and the company released a fix.
“I informed this to Facebook. Facebook acknowledged and patched it officially in WhatsApp version 2.19.244. Facebook helped to reserve CVE-2019-11932 for this issue”, — reported Awakened.
In order to avoid attacks with exploitation of this vulnerability, WhatsApp users are strongly recommended to update their applications to version 2.19.244 or later.