Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 129151 - gnome-base/gdm possible local issue (CVE-2006-1057)
Summary: gnome-base/gdm possible local issue (CVE-2006-1057)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo Security
URL: https://bugzilla.redhat.com/bugzilla/...
Whiteboard: [noglsa] jaervosz
Keywords:
: 130715 132971 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-04-07 10:19 UTC by Sune Kloppenborg Jeppesen (RETIRED)
Modified: 2019-12-22 11:57 UTC (History)
4 users (show)

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


Attachments
Proposed upstream patch (gdmdiff.out,1.21 KB, patch)
2006-04-07 21:50 UTC, Sune Kloppenborg Jeppesen (RETIRED)
no flags Details | Diff
gdm-CVE-2006-1057.patch (gdm-CVE-2006-1057.patch,1.77 KB, patch)
2006-04-10 07:48 UTC, Leonardo Boshell (RETIRED)
no flags Details | Diff
gdm-2.8.0.7-user-must-own-iceauthority.patch (gdm-2.8.0.7-user-must-own-iceauthority.patch,2.92 KB, patch)
2006-04-10 16:21 UTC, Sune Kloppenborg Jeppesen (RETIRED)
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-04-07 10:19:27 UTC
I just found this gem in GDM, in daemon/slave.c:

                if (seteuid (pwent->pw_uid) == 0 &&
                    access (".ICEauthority", F_OK) == 0) {
                        /* sanitize .ICEauthority to be of the correct
                         * permissions, if it exists */
                        struct stat s;
                        if (stat (home_dir, &s) == 0 &&
                            s.st_uid == pwent->pw_uid &&
                            stat (".ICEauthority", &s) &&
                            S_ISREG (s.st_mode) &&
                            (s.st_uid != pwent->pw_uid ||
                             s.st_gid != pwent->pw_gid ||
                             (s.st_mode & (S_IRWXG|S_IRWXO)))) {
                                /* This may not work on NFS, but oh well, there
                                 * this is beyond our help, but it's unlikely
                                 * that it got screwed up when NFS was used
                                 * in the first place */
                                seteuid (0);
                                /* only if we own the current directory */
                                chown (".ICEauthority",
                                       pwent->pw_uid,
                                       pwent->pw_gid);
                                chmod (".ICEauthority", S_IRUSR | S_IWUSR);

which is of course racy and buggy (between access() and stat()) and can lead
to local privilege escalation (just symlink to a cron script or similar).

Online link:
        http://cvs.gnome.org/viewcvs/gdm2/daemon/slave.c?rev=1.320&view=markup

It was introduced by this patch:
        http://cvs.gnome.org/viewcvs/gdm2/daemon/slave.c?r1=1.260&r2=1.261
for GDM version 2.6.0.8.


The correct way would be to open(), fstat(), compare with lstat() result,
then fchown() / fchmod() (I think).

Or why not just unlink(".ICEauthority") if it is fishy in any way and 
let the next program using it set it up again?
Comment 1 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-04-07 10:20:22 UTC
Above reported by Marcus Meissner from SUSE.
Comment 2 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-04-07 21:50:58 UTC
Created attachment 84189 [details, diff]
Proposed upstream patch
Comment 3 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-04-07 21:55:27 UTC
Saleem please be prepared to provide a quick update on this one or CC another from the gnome team.

The attached patch is not final so you might want to wait some hours before doing anything. So just consider this as a notification.

Also note that unless the code is present in upstream CVS it cannot yet be committed to Portage. Instead attach any ebuild changes to this bug.
Comment 4 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-04-10 02:45:28 UTC
g_stat (".ICEauthority", &s) &&

should be

(g_stat (".ICEauthority", &s) == 0) &&

CCing Leonardo since Saleem didn't respond.
Comment 5 Leonardo Boshell (RETIRED) gentoo-dev 2006-04-10 07:48:03 UTC
Created attachment 84367 [details, diff]
gdm-CVE-2006-1057.patch

Patch from CVS + suggestion from comment #4, which seems to be right as far as I can tell
Comment 6 Leonardo Boshell (RETIRED) gentoo-dev 2006-04-10 07:52:21 UTC
Ebuild changes:

----

--- gdm-2.14.0.ebuild   2006-03-17 18:43:37.000000000 -0500
+++ gdm-2.14.0-r1.ebuild        2006-04-10 09:36:11.000000000 -0500
@@ -96,6 +96,9 @@

        # Fix missing intllib
        epatch ${FILESDIR}/${PN}-2.13.0.7-gdm-dmx-intllibs.patch
+
+       # Unlink ~/.ICEauthority instead of trying to chown/chmod it (bug #129151)
+       epatch ${FILESDIR}/${PN}-CVE-2006-1057.patch

        gnome2_omf_fix docs/*/Makefile.in docs/Makefile.in
 }

----

Let us know if it's OK to commit and unmask (it's in p.mask along with the rest of GNOME 2.14, but I think gdm could be removed without hassle since it doesn't depend on other masked ebuilds). Thanks.
Comment 7 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-04-10 16:21:30 UTC
Created attachment 84407 [details, diff]
gdm-2.8.0.7-user-must-own-iceauthority.patch

New upstream patch that also fixes:

https://bugzilla.novell.com/show_bug.cgi?id=162952

Which I'm not able to see.
Comment 8 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-04-10 16:22:54 UTC
A fixed 2.14.1 tarball should be released any minute now. When it does you're free to commit and call arches.

If it is not available by tomorrow morning I'll call Arch Security Liaisons to test this patched version.
Comment 9 Leonardo Boshell (RETIRED) gentoo-dev 2006-04-11 11:38:34 UTC
gdm-2.8.0.7-r1.ebuild and gdm-2.14.1.ebuild have been commited, both including the fix from upstream.

gdm-2.8.0.7-r1 is the version to be marked stable by the arch teams; gdm-2.14.1 is still hardmasked along with the rest of GNOME 2.14.

Thanks.
Comment 10 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-04-11 22:34:09 UTC
There seems to be some discussion wether this is exploitable or not. To be on the safe side I'm calling arches now.
Comment 11 Markus Rothe (RETIRED) gentoo-dev 2006-04-11 23:25:20 UTC
stable on ppc64
Comment 12 Thomas Cort (RETIRED) gentoo-dev 2006-04-12 09:40:44 UTC
stable on alpha.
Comment 13 Daniel Gryniewicz (RETIRED) gentoo-dev 2006-04-12 16:20:10 UTC
amd64 done
Comment 14 Jason Wever (RETIRED) gentoo-dev 2006-04-12 19:16:35 UTC
This SPARC ebuild SPARC has SPARC been SPARC marked SPARC stable SPARC on SPARC SPARC.  Please SPARC drive SPARC through SPARC.  Thank SPARC you.
Comment 15 Matthias Langer 2006-04-13 05:10:15 UTC
gdm-2.8.0.7-r1 [-debug +ipv6 +pam (-selinux) +tcpd -xinerama] seems to work fine on x86. For testing i've done a few logins and configuration changes.

Portage 2.0.54 (default-linux/x86/2006.0, gcc-3.4.5, glibc-2.3.5-r3, 2.6.15-gentoo-r5 i686)
=================================================================
System uname: 2.6.15-gentoo-r5 i686 AMD Athlon(tm) XP 2400+
Gentoo Base System version 1.6.14
dev-lang/python:     2.3.5-r2, 2.4.2
sys-apps/sandbox:    1.2.12
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="-O2 -march=athlon-xp -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="-O2 -march=athlon-xp -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig collision-protect distlocks sandbox sfperms strict"
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 aalib alsa apm audiofile avi berkdb bitmap-fonts bonobo bzip2 bzlib cairo cdr cli crypt css ctype cups curl dba dbus divx4linux dri dts dv dvd dvdr dvdread emboss encode evo exif expat fam fame fastbuild ffmpeg firefox flac foomaticdb force-cgi-redirect fortran ftp gd gdbm gif glut gmp gnome gphoto2 gpm gstreamer gtk gtk2 gtkhtml guile hal idn imagemagick imlib ipv6 isdnlog java jpeg junit lcms libg++ libwww mad memlimit mhash mikmod mmx mmxext mng motif mp3 mpeg nautilus ncurses nls nptl nsplugin nvidia ogg oggvorbis openal opengl pam pcre pdflib perl plotutils png posix pppd python quicktime readline real ruby sdl session simplexml slang soap sockets speex spell spl sqlite sse ssl subtitles svga tcltk tcpd tetex theora tiff tokenizer truetype truetype-fonts type1-fonts udev unicode usb vcd video_cards_nvidia vorbis win32codecs wma xine xml xml2 xmms xsl xv xvid zlib linguas_en linguas_de userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, INSTALL_MASK, LDFLAGS
Comment 16 Chris Gianelloni (RETIRED) gentoo-dev 2006-04-13 06:16:53 UTC
x86 is done
Comment 17 René Nussbaumer (RETIRED) gentoo-dev 2006-04-14 07:06:50 UTC
stable on hppa
Comment 18 Stephen Becker (RETIRED) gentoo-dev 2006-04-14 18:12:13 UTC
stable on mips
Comment 19 Thierry Carrez (RETIRED) gentoo-dev 2006-04-15 05:59:00 UTC
PPC please test and mark stable
security: we must make our minds if this is really exploitable or not : should we issue a GLSA ?
Comment 20 Tobias Scherbaum (RETIRED) gentoo-dev 2006-04-15 08:16:34 UTC
ppc stable
Comment 21 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-04-20 09:15:58 UTC
I tend to vote NO, unless someone determines that is indeed exploitable.
Comment 22 Thierry Carrez (RETIRED) gentoo-dev 2006-04-21 08:31:13 UTC
*** Bug 130715 has been marked as a duplicate of this bug. ***
Comment 23 Thierry Carrez (RETIRED) gentoo-dev 2006-04-21 08:46:55 UTC
See Impact=Low at URL.
I tend to vote no, especially since nobody else released something here.
Comment 24 Raphael Marichez (Falco) (RETIRED) gentoo-dev 2006-04-21 14:13:47 UTC
as for http://www.securityfocus.com/bid/17635 , it seems not really dangerous.

i vote No.
Comment 25 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-04-21 22:38:23 UTC
Voting full NO and closing. Feel free to reopen if you disagree.
Comment 26 Raphael Marichez (Falco) (RETIRED) gentoo-dev 2006-05-02 07:58:19 UTC
i suggest to reopen it because of a regression : http://bugzilla.gnome.org/show_bug.cgi?id=340347 , thanks to jaervosz for the link.

The patch below has just been applied to 2.14 and cvs head branches

diff -u -p -r1.325 slave.c
--- daemon/slave.c	14 Apr 2006 17:53:51 -0000	1.325
+++ daemon/slave.c	1 May 2006 21:13:13 -0000
@@ -3543,6 +3543,7 @@ session_child_run (struct passwd *pwent,
                         close (iceauth_fd);
         }
 
+	NEVER_FAILS_setegid (pwent->pw_gid);
 #ifdef HAVE_LOGINCAP
 	if (setusercontext (NULL, pwent, pwent->pw_uid,
 			    LOGIN_SETLOGIN | LOGIN_SETPATH |


Leonardo or another, please can you repair this, thanks.
Comment 27 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-05-02 08:06:55 UTC
Leonardo please advise and patch as necessary.
Comment 28 Thierry Carrez (RETIRED) gentoo-dev 2006-05-02 09:20:30 UTC
Note: this isn't a vulnerability per se, just an impact booster (if there is a vuln in gdm it will potentially have bigger impact) so no GLSA over the fix.

Moving to default configs.
Comment 29 Leonardo Boshell (RETIRED) gentoo-dev 2006-05-02 19:43:03 UTC
I've added gdm-2.14.5 to the tree. Note however that this problem only affected gdm-2.14.4, which was never in the tree, so we haven't been affected by this.
Comment 30 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-05-02 21:46:45 UTC
Thx Leonardo.

I'll just reclose this one.
Comment 31 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-05-11 00:22:43 UTC
*** Bug 132971 has been marked as a duplicate of this bug. ***