Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 132662 - app-text/pstotext: Filename Shell Command Injection Vulnerability
Summary: app-text/pstotext: Filename Shell Command Injection Vulnerability
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Security
URL: http://bugs.debian.org/cgi-bin/bugrep...
Whiteboard: B2? [noglsa]
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-08 03:57 UTC by Raphael Marichez (Falco) (RETIRED)
Modified: 2006-05-21 10:03 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Raphael Marichez (Falco) (RETIRED) gentoo-dev 2006-05-08 03:57:31 UTC
There's no maintainer for this. We should call for a maintainer, or mask the ebuild.

See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=356988 and SA20012: http://secunia.com/advisories/20012


Software:	pstotext 1.x

Description:
Brian May has reported a vulnerability in pstotext, which potentially can be exploited by malicious people to compromise a vulnerable system.

The vulnerability is caused due to an error in sanitising the filename supplied via the command line. This can be exploited to execute arbitrary commands when pstotext is run with a specially crafted command line that contains shell commands.
Comment 1 Raphael Marichez (Falco) (RETIRED) gentoo-dev 2006-05-08 04:03:46 UTC
Sec team : someone can send an email requesting for a maintainer for app-text/pstotext please ?
Comment 2 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-05-08 09:06:08 UTC
-dev mailed.
Comment 3 Martin Ehmsen (RETIRED) gentoo-dev 2006-05-08 10:41:25 UTC
I have taken the patch from Debian and made a 1.9-r1 revision with that patch (and added text-markup as herd).
As far as I can see the patch from Debian fixes the issue.
Now we only need it marked stable on all archs. There are currently no open bugs open for this package (except this one), so... arch teams, please?
Comment 4 Raphael Marichez (Falco) (RETIRED) gentoo-dev 2006-05-08 10:52:24 UTC
ok; go :)   Little respite for pstotext. Note that amd64 has no stable ebuild and has no need to stabilize 1.9-r1.
Comment 5 Jon Hood (RETIRED) gentoo-dev 2006-05-08 11:41:53 UTC
not going to mark this stable on amd64- it can't accept postscript files from stdin as it advertises on my amd64 systems. It works great if you give it a path to a file, though.
Comment 6 Jon Hood (RETIRED) gentoo-dev 2006-05-08 11:45:42 UTC
btw, something seems odd; these are supposed to be the same:

$ pstotext -
ESP Ghostscript 815.02: Unrecoverable error, exit code 1
ESP Ghostscript 815.02: Unrecoverable error, exit code 1

$ pstotext
ESP Ghostscript 815.02: Unrecoverable error, exit code 1

$ cat /path/to/my.ps | pstotext -
ESP Ghostscript 815.02: Unrecoverable error, exit code 1
ESP Ghostscript 815.02: Unrecoverable error, exit code 1

from the --help text:
"-    read from stdin (default if no files specified)"
Comment 7 Ferris McCormick (RETIRED) gentoo-dev 2006-05-08 11:45:57 UTC
Good on sparc.
Comment 8 Matthias Langer 2006-05-08 13:46:55 UTC
I've done some testing with app-text/pstotext-1.9-r1 on x86 and can conform comment #5 and comment #6 with gostscript-(gnu/esp/afpl).
Comment 9 Matthias Langer 2006-05-08 13:52:26 UTC
by the way: the bugs mentioned in comment #5 do not appear on x86 with the currently stable version of pstotext (that is 1.8g-r1).

Portage 2203-svn (default-linux/x86/2006.0, gcc-3.4.5, glibc-2.3.6-r3, 2.6.16-gentoo-r6 i686)
=================================================================
System uname: 2.6.16-gentoo-r6 i686 AMD Athlon(tm) XP 2400+
Gentoo Base System version 1.6.14
dev-lang/python:     2.3.5-r2, 2.4.2
dev-python/pycrypto: [Not Present]
dev-util/ccache:     [Not Present]
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O2 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/eselect/compiler /etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=athlon-xp -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig collision-protect distlocks sandbox sfperms strict test"
GENTOO_MIRRORS="http://gentoo.inode.at/ "
LANG="en_US.utf8"
LC_ALL="en_US.utf8"
LINGUAS="en de"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://192.168.0.1/gentoo-portage"
USE="x86 3dnow 3dnowext X a52 aac aalib acpi alsa apm audiofile avi berkdb bitmap-fonts bonobo bzip2 cairo cdr cli crypt css cups curl dbus directfb dri dts dvd dvdr dvdread eds emboss encode exif expat fam fbcon ffmpeg firefox flac foomaticdb fortran gd gdbm gif ginac glut gmp gnome gphoto2 gpm gstreamer gtk gtk2 gtkhtml guile hal icq idn imagemagick imlib ipv6 isdnlog java javascript jpeg jpeg2k junit lcms libg++ libwww mad mikmod mime mmx mmxext mng motif mozsvg mp3 mpeg msn nautilus ncurses nls nptl nsplugin nvidia offensive ogg oggvorbis openal opengl pam pcre pdflib perl plotutils png posix pppd python quicktime readline real reflection ruby sdl session slang sockets speex spell spl sqlite sqlite3 sse ssl subtitles svg svga tcltk tcpd tetex theora tiff truetype truetype-fonts type1-fonts udev unicode usb vcd vorbis win32codecs wma xine xml xml2 xmms xorg xv xvid zlib linguas_en linguas_de userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, INSTALL_MASK, LDFLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTAGE_RSYNC_OPTS
Comment 10 Martin Ehmsen (RETIRED) gentoo-dev 2006-05-08 14:02:08 UTC
Okay... I didn't check the stdin input option :-|

So I see to options:
1. Make a 1.8g-r2 with the patch and mark that stable.
2. Remove the package, since equivalent functionality is provided by ps2ascii from ghostscript (valid point raised by genstef on -dev)

I tend to vote in favor of option 2, but I'm not 100% sure it dosen't have additional functionality over ps2ascii (I just became familiar with the package this evening).

Comments?
Comment 11 Jon Hood (RETIRED) gentoo-dev 2006-05-08 15:08:56 UTC
My vote is for option 2; HOWEVER it is important to note that this problem is caused because of the pstotext-1.9-quote-chars-fix.patch. If you remove the patch, everything works fine in 1.9. Take a look at the patch. If it's going to be a hastle to fix, I say remove the package. If it will be easy to fix, I look forward to 1.9-r1 soon.
Comment 12 Alexandre Buisse (RETIRED) gentoo-dev 2006-05-09 00:13:46 UTC
We should tell debian about the stdin problems with this patch.

Even if I don't like nuking packages, I suggest p.mask'ing it, which would give us some time to find a better solution or destroy it completely.
Comment 13 Thierry Carrez (RETIRED) gentoo-dev 2006-05-09 09:34:24 UTC
Also this vulnerability is a latent one, meaning it needs a cooperative application (webapp) that acts quite weirdly on untrusted input. So I wouldn't get overexcited on it and call a vote when it comes to GLSA or glsamask it.

For patching/masking, I leave the decision to the maintainers.
Comment 14 Mark Loeser (RETIRED) gentoo-dev 2006-05-14 08:15:55 UTC
text-markup: so....what are we doing? :)
Comment 15 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-05-14 08:50:07 UTC
Back to ebuild and unccing arches.
Comment 16 Mark Loeser (RETIRED) gentoo-dev 2006-05-14 11:10:46 UTC
You forgot to remove us :)
Comment 17 Martin Ehmsen (RETIRED) gentoo-dev 2006-05-19 03:15:51 UTC
Sorry for the long wait (real life caught up with me this last week)
I have fixed the patch so it now works with stdin and commited it to a 1.9-r2 ebuild.
Hopefully pstotext-1.9-r2 can go stable?

sparc: When you mark it stable can you please remove the 1.9-r1 ebuild? It is only there because it is the lastest stable sparc.
Comment 18 Raphael Marichez (Falco) (RETIRED) gentoo-dev 2006-05-19 03:54:20 UTC
Dear arches,

please (try to) stabilize 1.9-r2. Report if any problems.

Dear SPARC,

please remove 1.9-r1 ebuild as soon as 1.9-r2 is SPARC'ed :)
Comment 19 Martin Ehmsen (RETIRED) gentoo-dev 2006-05-19 04:16:50 UTC
(In reply to comment #18)
> Dear arches,
>
> please (try to) stabilize 1.9-r2. Report if any problems.
> 
> Dear SPARC,
> 
> please remove 1.9-r1 ebuild as soon as 1.9-r2 is SPARC'ed :)

Dammit!
I had the archs marked, just forgot to press that "Add Archs" button. :-)
Comment 20 Ferris McCormick (RETIRED) gentoo-dev 2006-05-19 05:42:05 UTC
Sparc stable.  And -r1.ebuild removed from repository.  In two steps.  Because I am a slow reader, and missed the second part of your request the first time.
Comment 21 Jon Hood (RETIRED) gentoo-dev 2006-05-19 08:04:38 UTC
amd64 stable; I also assume that the updated patch has been sent to our Debian friends?
Comment 22 Stefan Cornelius (RETIRED) gentoo-dev 2006-05-19 08:09:55 UTC
(In reply to comment #21)
> amd64 stable; I also assume that the updated patch has been sent to our Debian
> friends?
> 

Sorry, no clue. Unfortunately, I don't have a lot of debian friends :( Feel free to send it or tell me where to send it to and I'll do it.
Comment 23 Jon Hood (RETIRED) gentoo-dev 2006-05-19 08:39:30 UTC
Martin submitted it :)
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=356988
Comment 24 Markus Rothe (RETIRED) gentoo-dev 2006-05-19 11:15:25 UTC
stable on ppc64
Comment 25 Tobias Scherbaum (RETIRED) gentoo-dev 2006-05-19 12:02:15 UTC
ppc stable
Comment 26 Mark Loeser (RETIRED) gentoo-dev 2006-05-20 21:31:43 UTC
x86 done
Comment 27 Raphael Marichez (Falco) (RETIRED) gentoo-dev 2006-05-21 05:05:14 UTC
Calling for a vote on a GLSA


i would vote a half-no. pstotext isn't often used and other distribs don't seem to have considered this issue as being worthy of an advisory.
Comment 28 Stefan Cornelius (RETIRED) gentoo-dev 2006-05-21 07:18:39 UTC
another weak no
Comment 29 Thierry Carrez (RETIRED) gentoo-dev 2006-05-21 10:03:33 UTC
Voting no and closing.