Back to list
zgv image viewing heap overflows
Oct 26 2004 01:07AM
infamous41md hotpop com
zgv multiple heap overflows
zgv is a picture viewer with a thumbnail-based file selector, for the Linux and
FreeBSD console (it uses svgalib). It's pretty featureful, and is probably the
best svgalib-based viewer. (It can also be built to use SDL if you prefer.) Lots
of people have told me they like it, where "lots" = "oh, it must be at least two
or three", and you can't ask for a more ringing endorsement than that. Well, you
could, but I'm not sure you'd get it. :-)
zgv supports most popular formats, and allows panning and fit-to-screen methods
of viewing, slideshows, scaling, gamma adjustment, etc.
I tested latest, zgv-5.5.orig.
zgv uses malloc() frequently to allocate memory for storing image data. When
calculating how much to allocate, user supplied data from image headers is
multiplied and/or added without any checks for arithmetic overflows. We can
overflow numerous calculations, and cause small buffers to be allocated. Then
we can overflow the buffer, and eventually execute code. There are a total of
11 overflows that are exploitable to execute arbitrary code.
01]readbmp.c:180: if ((work_bmap = *bmap =
calloc (w * (h + 2) * bytepp,1)) == NULL)
02]readgif.c:498: if((im->image=(byte *)malloc(width*height))==NULL)
There is a C file for each hole above. The exploit for the first xpm hole,
#10, demonstrates code execution, the rest just crash zgv. The only one I
couldn't get working is the second gif hole, #3 from above. That is in the
file ximage_other_gif.c. However, all are suitable for code execution with
some work. I just didn't have the time.
There was also a hole in:
I couldn't find the PCD file format anywhere for free on the web, and didn't
pursue this further. I didn't see anything that would make it not exploitable
though, so it looks valid to me.
Was not contacted.
[ reply ]
Re: zgv image viewing heap overflows
Oct 28 2004 03:39AM
Chris Frey (cdfrey netdirect ca)
Copyright 2010, SecurityFocus