Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 171075 (CVE-2011-4919) - <net-mail/mpack-1.6-r2: Information disclosure (CVE-2011-4919)
Summary: <net-mail/mpack-1.6-r2: Information disclosure (CVE-2011-4919)
Status: RESOLVED FIXED
Alias: CVE-2011-4919
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Gentoo Security
URL:
Whiteboard: B4 [noglsa]
Keywords:
: 396639 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-03-15 19:54 UTC by Marek Chmielewski
Modified: 2012-01-15 23:29 UTC (History)
6 users (show)

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


Attachments
Patch for mpack-1.6 (mpack-1.6.patch,1.63 KB, patch)
2007-05-03 22:54 UTC, Jonas Pedersen
no flags Details | Diff
net-mail/mpack-1.6 bzip'ed patches (mpack-1.6-fixes.patch.bz2,4.03 KB, application/octet-stream)
2007-06-20 03:33 UTC, Tiago Cunha (RETIRED)
no flags Details
net-mail/mpack-1.6 ebuild diff (ebuild-fixes.patch,614 bytes, patch)
2007-06-20 03:34 UTC, Tiago Cunha (RETIRED)
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Chmielewski 2007-03-15 19:54:42 UTC
When I try send mail with attachment mpack give me a message "File exists" and dont send a mail.

$ mpack -s test file mail
File exists

net-mail/mpack-1.5-r1 work fine.


Reproducible: Always
Comment 1 Jonas Pedersen 2007-05-03 22:54:28 UTC
Created attachment 118097 [details, diff]
Patch for mpack-1.6

Apply this patch instead of mpack-1.6-gentoo.patch already in portage. The difference between the two patches is that the change to use mkstemp have been reverted back to use mktemp. This should be safe as the temp file is opened with O_EXCL flag later in the program. When using mkstemp the file is created when mkstemp is called and opening file later with O_EXCL fails. This is reason for program giving "File exists" error. If mktemp should give a filename collision with an other temp file it still gives out an error when it is opened with O_EXCL flag set.
Comment 2 Christian Faulhammer (RETIRED) gentoo-dev 2007-05-24 19:29:21 UTC
Your patch leads to this:

cp unixpk.man mpack.1
xmalloc.c:27: error: conflicting types for 'malloc'
xmalloc.c: In function 'xmalloc':
xmalloc.c:37: warning: incompatible implicit declaration of built-in function 'exit'
xmalloc.c: In function 'xrealloc':
xmalloc.c:50: warning: incompatible implicit declaration of built-in function 'exit'
make: *** [xmalloc.o] Error 1
Comment 3 Jonas Pedersen 2007-05-25 21:41:34 UTC
I have only been able to reproduce the error, you mention, by NOT applying the patch.

I will not take full credit for the patch as the patch I attached is largely based on the one already in portage. I only changed it back to use mktemp instead of mkstemp. 

Are you sure that you actually applied the patch to mpack?
Comment 4 Tiago Cunha (RETIRED) gentoo-dev 2007-06-20 03:28:40 UTC
FreeBSD[1][2] and Debian[3] already have the patches to fix this.

I've download the FreeBSD patches except the patch-uudecode.c because gcc gave warnings (appending -Wall to the CFLAGS in the mpack Makefile) regarding the signedness (they changed char to unsigned char). I also sed'ed the TMPDIR from the FreeBSD default /tmp to /var/tmp (as the existing mpack-1.6-gentoo.patch does).

Executing "mpack -s test file mail" sends file to mail successfully. The error "File exists" ocurred because (as Jonas said) of the use of O_CREAT with O_EXCL, not in mktemp() but on the open() syscall - in the unixos.c file (when O_CREAT and O_EXCL are both specified on open(), open() fails if the file already exists).

The bzip'ed patch (15 patches total but they aren't bigger than 20Kb, but its a lot of patches) and the ebuild diff follows.

[1]. http://www.freebsd.org/cgi/query-pr.cgi?pr=93967
[2]. http://www.freebsd.org/cgi/cvsweb.cgi/ports/converters/mpack/files/
[3]. http://packages.debian.org/changelogs/pool/main/m/mpack/mpack_1.6-4/changelog

Portage 2.1.2.7 (default-linux/amd64/2007.0/desktop, gcc-4.1.2, glibc-2.5-r0, 2.6.20-gentoo-r8 x86_64)
=================================================================
System uname: 2.6.20-gentoo-r8 x86_64 Intel(R) Pentium(R) D CPU 3.00GHz
Gentoo Base System release 1.12.9
Timestamp of tree: Tue, 19 Jun 2007 06:20:01 +0000
ccache version 2.4 [enabled]
dev-java/java-config: 1.3.7, 2.0.32
dev-lang/python:     2.4.4-r4
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r7
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.17-r2
ACCEPT_KEYWORDS="amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=nocona -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/init.d /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-O2 -march=nocona -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="-akv"
FEATURES="buildpkg ccache collision-protect distlocks fixpackages metadata-transfer multilib-strict parallel-fetch sandbox sfperms strict test userfetch userpriv usersandbox"
GENTOO_MIRRORS="ftp://mirrors1.netvisao.pt/gentoo http://darkstar.ist.utl.pt/pub/gentoo http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X acl acpi alsa amd64 apache2 arts bash-completion bitmap-fonts cairo cdr cli cracklib crypt dbus dri dts dvd dvdr dvdread eds emboss encode evo fam firefox flac fortran gif gpm hal iconv ipv6 isdnlog jpeg kde kdeenablefinal kdehiddenvisibility libg++ mad midi mikmod mmx mp3 mpeg mudflap musepack musicbrainz mysql ncurses nptl nptlonly offensive ogg opengl openmp pam pcre pdf perl png postgres pppd python qt3 qt3support qt4 quicktime readline reflection sdl session spell spl sse sse2 ssl svg tcpd test tiff truetype truetype-fonts type1-fonts unicode vorbis xcomposite xml xorg xscreensaver xv zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="i810"
Unset:  CTARGET, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 5 Tiago Cunha (RETIRED) gentoo-dev 2007-06-20 03:33:40 UTC
Created attachment 122567 [details]
net-mail/mpack-1.6 bzip'ed patches

FreeBSD/Debian patches with the signedness modifications in the patch-uudecode.c FreeBSD patch file - i.e. don't change char to unsigned char.
Comment 6 Tiago Cunha (RETIRED) gentoo-dev 2007-06-20 03:34:37 UTC
Created attachment 122568 [details, diff]
net-mail/mpack-1.6 ebuild diff
Comment 7 Christian Faulhammer (RETIRED) gentoo-dev 2007-06-21 09:31:39 UTC
(In reply to comment #4)
> FreeBSD[1][2] and Debian[3] already have the patches to fix this.

 Is upstream aware of them?
Comment 8 Tiago Cunha (RETIRED) gentoo-dev 2007-06-23 08:36:26 UTC
(In reply to comment #7)
>  Is upstream aware of them?

I've mailed <mpack-bugs@andrew.cmu.edu> and heard nothing back.
Comment 9 meyerm 2007-10-05 14:30:41 UTC
Anything new about it? Just stumpled again over this bug after an update.
Comment 10 Tiago Cunha (RETIRED) gentoo-dev 2007-10-06 20:36:36 UTC
(In reply to comment #9)
> Anything new about it? Just stumpled again over this bug after an update.

I heard nothing back from <mpack-bugs@andrew.cmu.edu>.

Comment 11 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2008-12-08 01:57:18 UTC
@net-mail team: I have removed the ~amd64 kw from 1.6. Please add us back to CC if you decide to patch mpack (or create a new bug) to test. (However, IMHO, this is a candidate for treecleaners)
Comment 12 Sebastian Pipping gentoo-dev 2011-12-07 23:45:00 UTC
Here's a quick summary:

 - error "File exist" should be fixed in 1.6-r1, now

 - both 1.6 and 1.6-r1 seem vulnerable to a TOCTTOU attack to me

 - neither Debian [1] nor FreeBSD [2] seem to have proper patches for this, yet:
   Debian uses mktemp, FreeBSD uses "close(mkstemp(fnamebuf))", which looks
   vulnerable to me.


+*mpack-1.6-r1 (07 Dec 2011)
+
+  07 Dec 2011; Sebastian Pipping <sping@gentoo.org> +mpack-1.6-r1.ebuild,
+  +files/mpack-1.6-compile.patch, +files/mpack-1.6-paths.patch:
+  The s/mktemp/mkstemp/ from <mpack-1.6-gentoo.patch> is broken: it does not
+  fully fix the TOCTTOU vulnerability but breaks sending of e-mails (bug
+  #171075). So I extracted the parts of (1) missing include, (2) wrong
+  prototypes and (3) system path corrections from that patch, made dedicated
+  files and added missing bits to each of these, and ripped the
+  s/mktemp/mkstemp/ part out. A proper TOCTTOU fix is left todo. It's not
+  trivial to do.
+


[1] http://ftp.de.debian.org/debian/pool/main/m/mpack/mpack_1.6-7.debian.tar.bz2
[2] http://www.freebsd.org/cgi/cvsweb.cgi/ports/converters/mpack/files/patch-unixpk.c?rev=1.1
Comment 13 Sebastian Pipping gentoo-dev 2011-12-07 23:50:23 UTC
PS: Upstream may be dead:

 - mpack-bugs (a) andrew.cmu.edu
   --> no reply yet

 - John G. Myers <jgm (a) cmu.edu>
   --> error

 - Christopher J. Newman <chrisn (a) cmu.edu>
   --> error
Comment 14 Sebastian Pipping gentoo-dev 2011-12-31 22:48:05 UTC
I have done a bit more research now, just received a CVE number and applied a patch.


+*mpack-1.6-r2 (31 Dec 2011)
+
+  31 Dec 2011; Sebastian Pipping <sping@gentoo.org> +mpack-1.6-r2.ebuild,
+  +files/mpack-1.6-cve-2011-4919.patch:
+  Apply patch for CVE-2011-4919 (information disclosure) (bug #171075)
+
Comment 15 Michael Harrison 2011-12-31 22:53:25 UTC
*** Bug 396639 has been marked as a duplicate of this bug. ***
Comment 16 Sebastian Pipping gentoo-dev 2012-01-01 16:32:41 UTC
Just checked: the latest stable version in Gentoo (1.5-r1) is affected, too.

Please stabilize 1.6-r2.
Comment 17 Tim Sammut (RETIRED) gentoo-dev 2012-01-01 17:43:14 UTC
Arches, please test and mark stable:
=net-mail/mpack-1.6-r2
Target keywords : "amd64 sparc x86"
Comment 18 Agostino Sarubbo gentoo-dev 2012-01-02 00:15:00 UTC
amd64 stable
Comment 19 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2012-01-04 18:00:52 UTC
x86 stable
Comment 20 Raúl Porcel (RETIRED) gentoo-dev 2012-01-14 18:44:39 UTC
sparc keyword dropped
Comment 21 Sebastian Pipping gentoo-dev 2012-01-14 18:52:34 UTC
(In reply to comment #20)
> sparc keyword dropped

Please excuse that I add you back to CC so you see this reply for sure.  I would be interested to hear about the rationale with dropping sparc.  No objections, just curiosity.  Thanks!
Comment 22 Raúl Porcel (RETIRED) gentoo-dev 2012-01-14 19:31:05 UTC
(In reply to comment #21)
> (In reply to comment #20)
> > sparc keyword dropped
> 
> Please excuse that I add you back to CC so you see this reply for sure.  I
> would be interested to hear about the rationale with dropping sparc.  No
> objections, just curiosity.  Thanks!

sparc doesn't need this package, if any user that uses sparc still uses it he'll complain. Otherwise this just puts load on the sparc team(which is just me) and on the other hand the security team or the maintainer can go ahead with their procedures without waiting for sparc in the future.
Comment 23 Tim Sammut (RETIRED) gentoo-dev 2012-01-15 22:54:03 UTC
Thanks, everyone. GLSA vote: no.
Comment 24 Sean Amoss (RETIRED) gentoo-dev Security 2012-01-15 23:29:36 UTC
NO, too. Closing noglsa.