what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

zgv-55.txt

zgv-55.txt
Posted Oct 28, 2004
Authored by infamous41md

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. There are a total of 11 overflows that are exploitable to execute arbitrary code.

tags | advisory, overflow, arbitrary
SHA-256 | 384321769122fcd48526d6ca52ea357c6591e42351db86b1769e1b9d247e3dd5

zgv-55.txt

Change Mirror Download
++++++++++++++++++++++++++++++++++++++++++++

Subject:

zgv multiple heap overflows

++++++++++++++++++++++++++++++++++++++++++++

Product:

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.

http://www.svgalib.org/rus/zgv/

++++++++++++++++++++++++++++++++++++++++++++

Vulnerable:

I tested latest, zgv-5.5.orig.

++++++++++++++++++++++++++++++++++++++++++++

Summary:

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.

++++++++++++++++++++++++++++++++++++++++++++

Details:

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)

03]readgif.c:606:if((*theimageptr=
(byte *)malloc(ginfo->width*ginfo->height))==NULL)

04]readmrf.c:107: (image=calloc(w64*h64*64*64,1))==NULL)

05]readpcx.c:130:if((*bmap=malloc(w*(h+2)*bytepp))==NULL)

06]readpng.c:225:theimage=(byte *)malloc(pixelsize*width*(height+2));

07]readpnm.c:147:if((*bmap=malloc(w*(h+2)*bytepp))==NULL)

08]readprf.c:205:if((*bmap=work_bmap=malloc(width*(height+2)*planes))==NULL)

09]readtiff.c:89:if((image=*bmap=work_bmap=
malloc(numpix*sizeof(uint32)+width*3*2))==NULL)

10]readxpm.c:183:if((colchars=malloc(ncols*sizeof(struct colchars_tag)))==NULL)

11]readxpm.c:372:if((*bmap=malloc(w*(h+2)*bytepp))==NULL)

++++++++++++++++++++++++++++++++++++++++++++

Exploits:

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.

++++++++++++++++++++++++++++++++++++++++++++

Note:

There was also a hole in:

01]readpcd.c:42:if((*bmap=malloc(w*(h+3-*output_type)*(*output_type)))==NULL)

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.

++++++++++++++++++++++++++++++++++++++++++++

Vendor:

Was not contacted.

++++++++++++++++++++++++++++++++++++++++++++

--
-sean
Login or Register to add favorites

File Archive:

August 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Aug 1st
    15 Files
  • 2
    Aug 2nd
    22 Files
  • 3
    Aug 3rd
    0 Files
  • 4
    Aug 4th
    0 Files
  • 5
    Aug 5th
    15 Files
  • 6
    Aug 6th
    11 Files
  • 7
    Aug 7th
    43 Files
  • 8
    Aug 8th
    42 Files
  • 9
    Aug 9th
    36 Files
  • 10
    Aug 10th
    0 Files
  • 11
    Aug 11th
    0 Files
  • 12
    Aug 12th
    0 Files
  • 13
    Aug 13th
    0 Files
  • 14
    Aug 14th
    0 Files
  • 15
    Aug 15th
    0 Files
  • 16
    Aug 16th
    0 Files
  • 17
    Aug 17th
    0 Files
  • 18
    Aug 18th
    0 Files
  • 19
    Aug 19th
    0 Files
  • 20
    Aug 20th
    0 Files
  • 21
    Aug 21st
    0 Files
  • 22
    Aug 22nd
    0 Files
  • 23
    Aug 23rd
    0 Files
  • 24
    Aug 24th
    0 Files
  • 25
    Aug 25th
    0 Files
  • 26
    Aug 26th
    0 Files
  • 27
    Aug 27th
    0 Files
  • 28
    Aug 28th
    0 Files
  • 29
    Aug 29th
    0 Files
  • 30
    Aug 30th
    0 Files
  • 31
    Aug 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close