Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 79762
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Gentoo Security <security@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Tavis Ormandy (RETIRED) <taviso@gentoo.org>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:
Flags: Requestee:
 
 
  ()

Filename Description Type Creator Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 79762 depends on: Show dependency tree
Bug 79762 blocks:

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2005-01-27 11:48 0000
xli and xloadimage use insufficient validation when parsing images, there is
almost certainly a security issue waiting to be found in there somewhere that
could be exploited by getting a user to display an image with one of these
utilities (via gpg key photos, for example).

examples of insufficient validation:

ppm images are simple pixmap files, you can read about the format here:

http://netpbm.sourceforge.net/doc/ppm.html

values arent verified very well, so setting illegal values can cause crazy
behaviour, for example:

P6
1 1
# max_value can't be > 255 in a P6 (raw) ppm, this is illegal.
# however, this will kill xli
256
FOOBAR

P3
1 1
# will SIGFPE xli
0e1
FOOBAR

P3
# this causes odd behaviour in xli and xloadimage, and calls malloc(0)
0 0
1
FOOBAR

P3
# allocating huge amounts of memory seems to cause some sort of race 
# condition in xli.
9999 9999
1
FOOBAR

I've also noticed return codes from libpng are sometimes ignored, I'm not sure
if that's such a good idea, it will happily try to display illegal png files,
I've seen it segfault after this, although i no longer have the png file that
caused it or a core file...if it happens again i'll try to track it down.

------- Comment #1 From Tavis Ormandy (RETIRED) 2005-02-08 06:56:29 0000 -------
Look at these two examples I just tried:

P3
1073741825 4
16
FOOBAR

P3
65536 65536
16
FOOBAR

both overflow the value passed to malloc, and then die trying to copy the image data past the allocated buffer. I'm confident this could lead to an attack, I've emailed the author for his opinion.

------- Comment #2 From rob holland (RETIRED) 2005-02-18 12:18:12 0000 -------
xli suffers from a bug fixed in xloadimage in 2001:

details here: http://archives.neohapsis.com/archives/bugtraq/2001-07/0160.html

rob@leet ~/projects/test/xli-1.17.0 $ xli ./foo.faces 
./foo.faces is a  32x32 8-bit grayscale Faces Project image
xli: stack smashing attack in function facesLoad()
Aborted

------- Comment #3 From Tavis Ormandy (RETIRED) 2005-02-18 12:53:39 0000 -------
There's also a quoting problem in xli's zio.c

sprintf(buf, "gunzip -c %s", name);

If a user were to use xli via ~/.mailcap or similar, someone could send a file with Content-Type set to image/jpeg and a filename like ';id 1>&2;: .Z', they could potentially execute arbitrary shell commands.

example:

$ touch ';id 1>&2;: .Z'
$ xli ';id 1>&2;: .Z'
gunzip: compressed data not read from a terminal. Use -f to force
decompression.
For help, type: gunzip -h
uid=1000(taviso) gid=100(users)
groups=5(tty),10(wheel),16(cron),19(cdrom),35(games),100(users),250(portage)
;id 1>&2;: .Z: unknown or unsupported image type

This also seems to affect xloadimage.

------- Comment #4 From Tavis Ormandy (RETIRED) 2005-02-18 12:53:59 0000 -------
upstreamn informed.

------- Comment #5 From Matthias Geerdsen 2005-02-23 12:45:53 0000 -------
any news yet?

CC'ing desktop-misc herd for xloadimage, xli is no-herd

------- Comment #6 From Tavis Ormandy (RETIRED) 2005-02-23 12:52:59 0000 -------
xli author responded that he's planning a new release to fix these two issues
by next week.

------- Comment #7 From Tavis Ormandy (RETIRED) 2005-02-28 00:40:13 0000 -------
A new upstream version is available that fixes these problems:

http://pantransit.reptiles.org/prog/xli/xli-2005-02-27.tar.gz

------- Comment #8 From Thierry Carrez (RETIRED) 2005-02-28 02:56:58 0000 -------
This is somewhat noherd, we've got lu_zero (from graphics herd) approval to fix
them.

------- Comment #9 From Tavis Ormandy (RETIRED) 2005-02-28 04:10:04 0000 -------
xli-1.17.0-r1 contains the fixes

------- Comment #10 From Thierry Carrez (RETIRED) 2005-02-28 05:36:05 0000 -------
Waiting for xloadimage to get backported fix too...

------- Comment #11 From Tavis Ormandy (RETIRED) 2005-02-28 07:47:08 0000 -------
media-gfx/xloadimage-4.1-r2 contains the shell meta-char escaping from xli.

------- Comment #12 From Thierry Carrez (RETIRED) 2005-02-28 11:37:36 0000 -------
Arches, please test and mark stable :
media-gfx/xli-1.17.0-r1: x86 ppc hppa
media-gfx/xloadimage-4.1-r2: alpha amd64 arm hppa ia64 mips ppc ppc64 sparc x86 ppc-macos

------- Comment #13 From Markus Rothe 2005-02-28 11:53:45 0000 -------
stable on ppc64

------- Comment #14 From Jan Brinkmann (RETIRED) 2005-02-28 12:08:36 0000 -------
stable on amd64

------- Comment #15 From Olivier Crete 2005-02-28 12:57:19 0000 -------
x86 there

------- Comment #16 From Gustavo Zacarias (RETIRED) 2005-02-28 13:05:28 0000 -------
sparc stable.

------- Comment #17 From Michael Hanselmann (hansmi) (RETIRED) 2005-02-28 14:10:10 0000 -------
Stable on ppc.

------- Comment #18 From Aron Griffis (RETIRED) 2005-02-28 15:47:31 0000 -------
all set on ia64

------- Comment #19 From Lina Pezzella (RETIRED) 2005-02-28 21:04:07 0000 -------
Stable ppc-macos.

------- Comment #20 From Hardave Riar (RETIRED) 2005-03-01 10:01:09 0000 -------
xloadimage stable on mips.

------- Comment #21 From Bryan Østergaard (RETIRED) 2005-03-01 11:01:31 0000 -------
Alpha stable.

------- Comment #22 From Thierry Carrez (RETIRED) 2005-03-02 11:06:08 0000 -------
GLSA 200503-05

------- Comment #23 From René Nussbaumer 2005-06-26 05:50:46 0000 -------
Already stable on hppa.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug