ImageMagick is "a suite of image manipulation tools (animate, composite, conjure, convert, display, identify, import, mogrify and montage) that are sometimes used by other applications for processing image files". Remote exploitation of an off-by-one vulnerability in ImageMagick, as included in various vendors' operating system distributions, allows attackers to execute arbitrary code.
The variable "string" is a character array of length "MaxTextExtent". An off-by-one buffer overflow will occur on line 3123 when "i" is exactly "MaxTextExtent". This function is called from several image file processing routines. Most of the buffers involved are stack based, although some are on the heap.
Analysis:
Exploitation of this vulnerability allows an attacker to execute arbitrary code in the context of the user.
One way of exploiting this vulnerability is to persuade a targeted user to open a malicious image file with a program that utilizes the ImageMagick library.
As the tools that are part of ImageMagick are sometimes used as helper tools by other applications, this user may be the same as the web server user. This scenario is somewhat more severe than the previously described attack vector since the image processing can occur automatically.
Exploitation in stack-based scenarios depends on the stack layout, which depends on the compiler and compiler options used to build the library.