GD Library Buffer Overflow

May 20, 2016

The GD Graphics Library (libgd) is an open-source graphics software library for dynamically manipulating images. It can create many formats of image files including GIFs, JPEGs, PNGs, and WBMPs. GD is extensively used with PHP, where a modified version supporting additional features is included by default as of PHP 4.3 and may be used in PHP 5.3 as well.

There is a heap buffer overflow vulnerability has been found in GD Library libgd 2.1.1 and prior. The vulnerability exists when a signed integer was claimed to store the size of chunked data, however, an unsigned integer was used for copying. When a negative integer was set to the size variable, the vulnerable codes will overwrite the heap buffer which may cause denial of service or remote code execution under the current user, which may be web application's privileges.

Dell SonicWALL has researched this vulnerability. The following signature has been created to protect their customers.

  • IPS:11621 GD Library Buffer Overflow

This vulnerability is referred as CVE-2016-3074.